com.ca.directory.jxplorer.viewer
Interface PluggableEditor

All Known Implementing Classes:
BasicPluggableEditor, HTMLTemplateDisplay, TableAttributeEditor

public interface PluggableEditor

PluggableEditor defines the interface used by 'pluggable' objects that display data to the user in JXPlorer. Objects that implement this interface, are placed in the package com.ca.directory.jxplorer.viewer, and are given the class name of a particular schema object class will be dynamically loaded when the JXPlorer user attempts to view that object class.

For example, a class implementing this interface, called 'person.class', and placed in the com/cai/od/jxplorer/viewer directory, would be automatically loaded whenever the user accessed a 'person' entry, or a 'person' derived entry, in the directory.

Note that the class should be given the completely lower case name of the object class being modelled, and be aware that this breaks the java class naming convention. (E.g. use 'organizationalunit.java' rather than either 'OrganizatonalUnit.java' or 'organizationalUnit.java').


Method Summary
 DataSink getDataSink()
          Returns the data sink that will be used to slurp data.
 javax.swing.JComponent getDisplayComponent()
          This returns the swing component being used to display the data, so that another component can set its visibility.
 javax.swing.ImageIcon getIcon()
          Returns the icon of the editor.
 java.lang.String getName()
          Returns the title of the editor.
 javax.swing.JPopupMenu getPopupMenu(java.lang.String rdn)
          If a UNIQUE pluggable editor exists for an entry, the display tree will call this method to see if a special pull down menu ('right click menu') is desired.
 java.awt.Component getPrintComponent()
          This returns the component that should be used to print the data (e.g. a full table of data that spans several pages).
 java.lang.String getToolTip()
          Returns the Tool Tip of the editor.
 javax.swing.ImageIcon getTreeIcon(java.lang.String rdn)
          If a UNIQUE pluggable editor exists for an entry, the display tree will call this method to see if a special icon is desired.
 boolean hideSubEntries(java.lang.String rdn)
          If a UNIQUE pluggable editor exists for an entry, the display tree will call this method to see if it should hide the subtree below this entry because the pluggable editor is directly handling this data.
 boolean isUnique()
          This sets whether the component expects to be the only editor used for its object class, or whether it will co-exist with any other applicable editors, and the default (html/table) editor.
 void registerComponents(javax.swing.JMenuBar menu, javax.swing.JToolBar buttons, javax.swing.JTree tree, javax.swing.JPopupMenu treeMenu, javax.swing.JFrame jxplorer)
          Registers Swing components that the pluggable editor may manipulate.
 void unload()
          This method is called when the editor is being unloaded by the browser, and allows for any required clean up activity.
 

Method Detail

getDisplayComponent

public javax.swing.JComponent getDisplayComponent()
This returns the swing component being used to display the data, so that another component can set its visibility.

In many cases this may be the editor itself.

Returns:
the java.swing component being used to display the node data.

getPrintComponent

public java.awt.Component getPrintComponent()
This returns the component that should be used to print the data (e.g. a full table of data that spans several pages).

A minimal implementation can simply return getDisplayComponent().

Returns:
the component being used to print the node data.

getDataSink

public DataSink getDataSink()
Returns the data sink that will be used to slurp data.

In many cases this may be the editor itself.

Returns:
a data sink to display or process data.

isUnique

public boolean isUnique()
This sets whether the component expects to be the only editor used for its object class, or whether it will co-exist with any other applicable editors, and the default (html/table) editor.


getName

public java.lang.String getName()
Returns the title of the editor. (This might be displayed on a tab or similar). If null, the object class name will be used instead.


getIcon

public javax.swing.ImageIcon getIcon()
Returns the icon of the editor. (This might be displayed on a tab or similar).


getToolTip

public java.lang.String getToolTip()
Returns the Tool Tip of the editor. (This might be displayed on a tab or similar).


registerComponents

public void registerComponents(javax.swing.JMenuBar menu,
                               javax.swing.JToolBar buttons,
                               javax.swing.JTree tree,
                               javax.swing.JPopupMenu treeMenu,
                               javax.swing.JFrame jxplorer)
Registers Swing components that the pluggable editor may manipulate. Any or all of these may be null if the editor is not permitted to manipulate the objects.

Any changes made by the editor should be removed when the editor is unloaded.

Parameters:
menu - the main menu that appears on the top of JXplorer
buttons - the JXplorer button bar
tree - the JXplorer tree
treeMenu - the popup menu that JXplorer uses for tree items
jxplorer - the root JXplorer object, from which the entire GUI tree descends. (You need this for look & feel updates, and possibly for paintology)

unload

public void unload()
This method is called when the editor is being unloaded by the browser, and allows for any required clean up activity. Note that this is not necessarily called when JXplorer shuts down.


getTreeIcon

public javax.swing.ImageIcon getTreeIcon(java.lang.String rdn)
If a UNIQUE pluggable editor exists for an entry, the display tree will call this method to see if a special icon is desired. At this stage it is quite likely that the entry will not have been fully read, so that all that is known will be the entry name and object classes.

Most pluggable editors will not bother implementing this class and will just return null. Only pluggable editors with very special needs should consider implementing this: otherwise the normal naming attribute or object class based icons should be sufficient.

Parameters:
rdn - the name of the tree node being displayed (i.e. the rdn of the entry)
Returns:
an image icon to display - usually 'null' to revert to default behaviour.

getPopupMenu

public javax.swing.JPopupMenu getPopupMenu(java.lang.String rdn)
If a UNIQUE pluggable editor exists for an entry, the display tree will call this method to see if a special pull down menu ('right click menu') is desired. Most pluggable editors will use the default behaviour and will simply return null.

Parameters:
rdn - the name of the tree node being displayed (i.e. the rdn of the entry)
Returns:
a popup menu to use for this type of entry - usually 'null' to revert to default behaviour.

hideSubEntries

public boolean hideSubEntries(java.lang.String rdn)
If a UNIQUE pluggable editor exists for an entry, the display tree will call this method to see if it should hide the subtree below this entry because the pluggable editor is directly handling this data.

Most pluggable editors will use the default behaviour and return 'false' to allow user browsing of sub entries.

Parameters:
rdn - the name of the tree node being displayed (i.e. the rdn of the entry)
Returns:
whether to truncate the subtree (normally 'false').