/** Fügt einen neuen Eintrag hinzu. */ private void add() { JDialog parent = (JDialog) getTopLevelAncestor(); KeyValueProperty p = new KeyValueProperty(null); KeyValuePropertyEditorPanel content = new KeyValuePropertyEditorPanel(); content.setProperty(p); StandardDetailsDialog dialog = new StandardDetailsDialog(parent, true, content); dialog.setLocationRelativeTo(parent); dialog.setVisible(true); if (dialog.getReturnStatus() == StandardDetailsDialog.RET_OK) { setItem(p.getKey(), p.getValue()); sortItems(); selectItem(p.getKey()); updateView(); } }
@Override public void setProperty(Property property) { fProperty = (KeyValueSetProperty) property; DefaultTableModel model = (DefaultTableModel) itemsTable.getModel(); for (int i = model.getRowCount() - 1; i >= 0; i--) { model.removeRow(i); } Iterator<KeyValueProperty> e = fProperty.getItems().iterator(); while (e.hasNext()) { KeyValueProperty p = e.next(); String[] row = new String[2]; row[0] = p.getKey(); row[1] = p.getValue(); model.addRow(row); } sortItems(); updateView(); }