private void addNonPreferredNameButtonActionPerformed() { Names namesModel = (Names) this.getModel(); NonPreferredNames newNonPreferredName; DomainEditor dialogNonPreferredNames = null; try { dialogNonPreferredNames = DomainEditorFactory.getInstance() .createDomainEditorWithParent(NonPreferredNames.class, this.getParentEditor(), false); } catch (DomainEditorCreationException e) { new ErrorDialog(getParentEditor(), "Error creating editor for NonPreferredNames", e) .showDialog(); } dialogNonPreferredNames.setNewRecord(true); int returnStatus; Boolean done = false; while (!done) { newNonPreferredName = new NonPreferredNames(namesModel); newNonPreferredName.setNameType(namesModel.getNameType()); dialogNonPreferredNames.setModel(newNonPreferredName, null); returnStatus = dialogNonPreferredNames.showDialog(); if (returnStatus == JOptionPane.OK_OPTION) { namesModel.addNonPreferredName(newNonPreferredName); nonPreferredNamesTable.getEventList().add(newNonPreferredName); done = true; } else if (returnStatus == StandardEditor.OK_AND_ANOTHER_OPTION) { namesModel.addNonPreferredName(newNonPreferredName); nonPreferredNamesTable.getEventList().add(newNonPreferredName); } else { done = true; } } }
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(); } } }
private void addNote(String whereString) { Names namesModel = (Names) super.getModel(); NameContactNotes newNote; DomainEditor dialog = null; try { dialog = DomainEditorFactory.getInstance() .createDomainEditorWithParent(NameContactNotes.class, this.getParentEditor(), false); } catch (DomainEditorCreationException e) { new ErrorDialog(getParentEditor(), "Error creating editor for NameContactNotes", e) .showDialog(); } dialog.setNewRecord(true); Boolean done = false; int sequenceNumber = 0; Boolean first = true; int returnStatus; while (!done) { newNote = new NameContactNotes(namesModel); if (first) { sequenceNumber = SequencedObjectsUtils.determineSequenceOfNewItem(whereString, nameContactNotesTable); first = false; } else { sequenceNumber++; } newNote.setSequenceNumber(sequenceNumber); dialog.setModel(newNote, null); returnStatus = dialog.showDialog(); if (returnStatus == javax.swing.JOptionPane.OK_OPTION) { namesModel.addNameContactNote(newNote); nameContactNotesTable.getEventList().add(newNote); done = true; } else if (returnStatus == StandardEditor.OK_AND_ANOTHER_OPTION) { namesModel.addNameContactNote(newNote); nameContactNotesTable.getEventList().add(newNote); } else { done = true; } } dialog.setNewRecord(false); }