/** Refreshes the currently visible editor with new info. */ public void refreshEditors(DXEntry entry, DataBrokerQueryInterface ds) { if (currentEditor != null) { this.entry = entry; // TE: make sure everything is in sink. dataSource = ds; currentEditor.getDataSink().displayEntry(entry, ds); // checks for unsaved changes... // check that the editor hasn't changed display component JComponent display = currentEditor.getDisplayComponent(); // XXX hack alert - some editor writers change their display component // XXX mid-flight, and expect JX to magically notice, and change the // XXX the display. This code attempts to do this. if (indexOfComponent(display) == -1) // we have a problem - the display component has changed { String title = currentEditor.getName(); ImageIcon icon = currentEditor.getIcon(); String toolTip = currentEditor.getToolTip(); int index = getSelectedIndex(); // find the index of the editor (XXX - this relies on the // activeEditor vector tracking the inherent tab pane order) super.remove(index); super.insertTab(title, icon, display, toolTip, index); super.setSelectedIndex(index); } } else log.warning("internal error - no editor available in AttributeDisplay"); }
/** * Sets the current editor to the specified editor, loads the current entry, and makes sure that * it is visible to the user. * * @param makeCurrent the editor to select. */ protected void setCurrentEditor(PluggableEditor makeCurrent) { currentEditor = makeCurrent; if (currentEditor != null && currentEditor.getDataSink() != null) currentEditor.getDataSink().displayEntry(entry, dataSource); int index = activeEditors.indexOf(makeCurrent); if (index == -1) { clearPluggableEditors(); addEditor(makeCurrent); setSelectedIndex(activeEditors.indexOf(makeCurrent)); } else if (index != getSelectedIndex()) { setSelectedIndex(index); } }