public void displayEntry(DXEntry dxentry, DataBrokerQueryInterface ds) { // Set the local data variables. dataSource = ds; entry = dxentry; // check that the default editors have been initialised. if (tableDisplay == null) initTableEditor(); if (templateDisplay == null) initHTMLEditor(); // check for a 'no data' display - if there is no data, revert // to the default html 'no data' template. if (entry == null) // || entry.size() == 0) //TE: This is commented out to allow virtual nodes to be // edited. { if (oldOCSig != null) { clearPluggableEditors(); if (activeEditors.size() == 0) { addEditor(templateDisplay); } oldOCSig = null; } refreshEditors(null, ds); } else { dataSource = ds; // may be null... Vector ocs = entry.getOrderedOCs(); // try to create a unique 'signature' for a group of object classes // This relies on them being delivered in the same order though. (Less // efficient if they aren't, but otherwise shouldn't be a big problem). String newOCSig = new String(); if (ocs != null) for (int i = 0; i < ocs.size(); i++) { Object ocSig = ocs.get(i); if (ocSig != null) newOCSig += ocSig.toString(); } // Check if signiture hasn't changed. If it *has* changed, // reset the editors using 'setEditors', and update // the 'old object class signiture' variable. if (newOCSig.equals(oldOCSig) == false) { setEditors(entry, ds, ocs); oldOCSig = newOCSig; } // Some quick sanity checks... if (entry.getStatus() == DXEntry.NEW) // check for new entries (but *not* NEW_WRITTEN)... { // don't allow editors to appear that can't edit a new entry trimNonNewEntryEditors(); suggestPluggableEditor(); } else { // make sure that the html template display is around... // XXX (a bit of a hack - this should really check that *all* // XXX editor that can't handle new entries have been added back... // XXX (maybe set flag?) // TE: added '&& !currentEditor.isUnique()' b/c this code always made sure the HTML // TE: editor is visible, whereas with a unique plugin we only want that one visible... // TE: unless of course I am totally confused! See bug 674. if (activeEditors.contains(templateDisplay) == false && !currentEditor.isUnique()) { add((PluggableEditor) templateDisplay, 0); if (currentEditor != null) // XXX hack hack. setCurrentEditor(currentEditor); } } if (activeEditors.contains(currentEditor) == false) { suggestPluggableEditor(); } // now that the editor set we're using has been sorted out, // actually go and update the editors! (Nb. this triggers an usaved changes check) refreshEditors(entry, ds); } }