private void readdbfNextRecord(Region region) throws JDBFException { Object[] data = dbfReader.nextRecord(); for (int fieldIndex = 0; fieldIndex < dbfReader.getFieldCount(); fieldIndex++) { String fieldName = dbfReader.getField(fieldIndex).getName(); region.setInfo(fieldName, data[fieldIndex].toString()); } }
private void doDBFEinlesen() { String datei; String nummer = tf1[0].getText().trim(); if (nummer.equals("")) { JOptionPane.showMessageDialog(null, "Bitte Reha-Nummer eingeben"); return; } datei = ("L:/projekte/rta/dbf/eterm/" + "RH" + nummer + ".dbf").toLowerCase(); File f = new File(datei); if (!f.exists()) { JOptionPane.showMessageDialog(null, "Rehanummer --> RH" + nummer + " <-- existiert nicht"); return; } DBFReader dbfreader; try { dbfreader = new DBFReader(datei); //// System.out.println("Öffne Datei "+datei); String ganzerString = ""; String datum; DateFormat df = DateFormat.getDateInstance(); vec.clear(); combobox1.setDataVector((Vector) vec.clone()); for (int i = 0; dbfreader.hasNextRecord(); i++) { dummyvec.clear(); Object aobj[] = dbfreader.nextRecord(); for (int j = 0; j < aobj.length; j++) { if (j == 0) { try { datum = df.format(aobj[j]); } catch (Exception ex) { datum = DatFunk.sHeute(); } // dummyvec.add(datum); // dummyvec.add(DatFunk.sDatInSQL(datum)); vec.add((String) datum); //// System.out.println("Feld "+j+" "+(aobj[j])); } } //// System.out.print("\n"); } dbfreader.close(); combobox1.setDataVector((Vector<String>) vec.clone()); combobox1.setMaximumRowCount(25); combobox1.validate(); // System.out.println("Vectorlänge = "+vec.size()); } catch (JDBFException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
private void getdbfInfos(Region region) throws JDBFException { if (dbfReader != null) { if (dbfReader.hasNextRecord()) { readdbfNextRecord(region); } else { LoggerManager.getInstance() .getLogger() .log(Level.WARNING, "Missing data in the DataBase File (.dbf)"); } } }