private void referenceActionPerformed(ActionEvent e) { IndexItems indexItem = (IndexItems) super.getModel(); if (reference.getSelectedIndex() == 0) { indexItem.setReference(""); } else { ResourceUtils.PersistentId persistentID = (ResourceUtils.PersistentId) reference.getSelectedItem(); indexItem.setReference(persistentID.getPersistentId()); } }
/** * 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); } }