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;
   }
 }
コード例 #3
0
 /**
  * Set the domain model for this editor.
  *
  * @param model the model
  */
 public void setModel(final DomainObject model, InfiniteProgressPanel progressPanel) {
   super.setModel(model, progressPanel);
   IndexItems indexItem = (IndexItems) super.getModel();
   reference.setModel(new DefaultComboBoxModel(ResourceUtils.getReferencesArray()));
   int selectedIndex = ResourceUtils.getIndexById(indexItem.getReference());
   if (selectedIndex >= 0) {
     // add 1 to account for the blank at the top of the list
     reference.setSelectedIndex(selectedIndex + 1);
   }
 }
コード例 #4
0
  /**
   * Sets the model for this editor.
   *
   * @param model the model to be used
   */
  public final void setModel(final DomainObject model, InfiniteProgressPanel progressPanel) {
    super.setModel(model, progressPanel);

    Names namesModel = (Names) model;
    resourcesTable.updateCollection(namesModel.getResources());
    accessionsTable.updateCollection(namesModel.getAccessions());
    digitalObjectsTable.updateCollection(namesModel.getDigitalObjects());
    nameContactNotesTable.updateCollection(namesModel.getRelatedCollection(NameContactNotes.class));
    nonPreferredNamesTable.updateCollection(
        namesModel.getRelatedCollection(NonPreferredNames.class));

    setPluginModel(); // update any plugins with this new domain object
  }