protected void addIdentifierActionPerformed( DomainSortableTable identifierTable, ResourcesComponents model) { ArchDescComponentIdentifiers newArchDescComponentIdentifier; DomainEditor dialog = new DomainEditor( ArchDescComponentIdentifiers.class, editorField.getParentEditor(), "Add Identifier", new ArchDescComponentIdentifiersFields()); dialog.setNavigationButtonListeners((ActionListener) editorField.getParentEditor()); dialog.setNewRecord(true); boolean done = false; int returnStatus; while (!done) { newArchDescComponentIdentifier = new ArchDescComponentIdentifiers(model); dialog.setModel(newArchDescComponentIdentifier, null); returnStatus = dialog.showDialog(); if (returnStatus == JOptionPane.OK_OPTION) { model.addArchDescComponentIdentifier(newArchDescComponentIdentifier); identifierTable.updateCollection(model.getArchDescComponentIdentifiers()); done = true; } else if (returnStatus == StandardEditor.OK_AND_ANOTHER_OPTION) { model.addArchDescComponentIdentifier(newArchDescComponentIdentifier); identifierTable.updateCollection(model.getArchDescComponentIdentifiers()); } else { done = true; } } }
protected int editRelatedRecord( DomainGlazedListTable table, Class clazz, Boolean buffered, DomainEditor domainEditor) { int selectedRow = table.getSelectedRow(); if (selectedRow != -1) { DomainObject domainObject = table.getSortedList().get(selectedRow); if (domainEditor == null) { try { domainEditor = DomainEditorFactory.getInstance() .createDomainEditorWithParent(clazz, editorField.getParentEditor(), false); domainEditor.setCallingTable(table); } catch (UnsupportedTableModelException e1) { new ErrorDialog( editorField.getParentEditor(), "Error creating editor for " + clazz.getSimpleName(), e1) .showDialog(); } catch (DomainEditorCreationException e) { new ErrorDialog( editorField.getParentEditor(), "Error creating editor for " + clazz.getSimpleName(), e) .showDialog(); } } domainEditor.setBuffered(buffered); domainEditor.setSelectedRow(selectedRow); domainEditor.setNavigationButtons(); domainEditor.setModel(domainObject, null); int returnValue = domainEditor.showDialog(); if (domainEditor.getBuffered()) { if (returnValue == JOptionPane.CANCEL_OPTION) { domainEditor.editorFields.cancelEdit(); } else { domainEditor.editorFields.acceptEdit(); ApplicationFrame.getInstance() .setRecordDirty(); // ok an edit was made, so set the record dirty } } return returnValue; } else { return JOptionPane.CANCEL_OPTION; } }