/** * Method to load a custom plugin domain editor for viewing the record. Usefull if someone want to * implemment an editor that is more suited for their workflow or to load a read only viewer for * the record. * * @param domainObject The record to edit * @return Whether any plugin editors where found */ protected boolean usePluginDomainEditor( boolean newInstance, DomainObject domainObject, DomainSortableTable callingTable) { ATPlugin plugin = ATPluginFactory.getInstance().getEditorPlugin(domainObject); if (plugin == null) { // just return false and so that the built in domain object can be used return false; } // set the calling table and editor plugin.setEditorField(this); plugin.setCallingTable(callingTable); if (!newInstance) { // this means that it is a record being edited, so may have to do something // special plugin.setModel(domainObject, null); } else { // its a new record to just set the model plugin.setModel(domainObject, null); } // set the main program application frame and display it plugin.setApplicationFrame(ApplicationFrame.getInstance()); plugin.showPlugin(getParentEditor()); return true; }
/** Method that initializes any embedded plugins that would add an editor */ private void initPlugins() { plugins = ATPluginFactory.getInstance().getEmbeddedNameEditorPlugins(); if (plugins != null) { for (ATPlugin plugin : plugins) { plugin.setEditorField(this); HashMap pluginPanels = plugin.getEmbeddedPanels(); for (Object key : pluginPanels.keySet()) { String panelName = (String) key; JPanel pluginPanel = (JPanel) pluginPanels.get(key); tabbedPane.addTab(panelName, pluginPanel); } } } }