private void dateTableMouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { try { DomainEditor domainEditor = new DomainEditor( ArchDescriptionDates.class, editorField.getParentEditor(), "Dates", new ArchDescriptionDatesFields()); domainEditor.setCallingTable(dateTable); domainEditor.setNavigationButtonListeners(domainEditor); editRelatedRecord(dateTable, ArchDescriptionDates.class, true, domainEditor); } catch (UnsupportedTableModelException e1) { new ErrorDialog("Error creating editor for Dates", e1).showDialog(); } } }
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; } }