/** 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"); }
public void remove(int index) { if (activeEditors.size() == 0) return; // it can get a bit excitable about removing element 0 ... PluggableEditor ed = (PluggableEditor) activeEditors.remove(index); ed.unload(); super.remove(index); }
public void removeAll() { int size = activeEditors.size(); for (int i = size - 1; i >= 0; i--) remove(i); super.removeAll(); // XXX this really shouldn't be necessary. }