com.ca.directory.jxplorer.viewer
Class BasicPluggableEditor

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.ca.directory.jxplorer.viewer.BasicPluggableEditor
All Implemented Interfaces:
javax.accessibility.Accessible, DataSink, java.awt.image.ImageObserver, java.awt.MenuContainer, PluggableEditor, java.io.Serializable

public class BasicPluggableEditor
extends javax.swing.JPanel
implements DataSink, PluggableEditor

This is a Basic 'PluggableEditor' that it may be useful to inherit from. It is no more than a read-only text display of an entry, with no-op methods for for most of the PluggableEditor and DataSink interface methods.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
BasicPluggableEditor()
          A Simple constructor that creates the JEditorPane.
 
Method Summary
 void addHelpSet(java.lang.String name)
          Optionally adds the name of a custom help set to JXplorer's default help set.
 void addLanguageBundle(java.lang.String name)
          If you want to include language translation files in your plugin, simply zip 'em up, and use this method to register the base name of the translation files.
 boolean canCreateEntry()
          Whether this editor can handle a partially created new entry.
 void displayEntry(DXEntry entry, DataSource ds)
          Displays the data in an entry as a plain text list.
 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)
          Use the default popupmenu.
 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)
          Use the default tree icon system based on naming value or object class.
 boolean hideSubEntries(java.lang.String rdn)
          Don't hide sub entries.
protected  void initDefaultEditor(java.lang.String bloop)
           
 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.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicPluggableEditor

public BasicPluggableEditor()
A Simple constructor that creates the JEditorPane.

Method Detail

initDefaultEditor

protected void initDefaultEditor(java.lang.String bloop)

displayEntry

public void displayEntry(DXEntry entry,
                         DataSource ds)
Displays the data in an entry as a plain text list.

Specified by:
displayEntry in interface DataSink
Parameters:
entry - the directory entry to display. If null, indicates that a blank or 'empty' entry should be displayed.
ds - the datasource used for data modification/schema access etc. May be null, in which case no schema checking/prompting will be done, and no editing will be possible.

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.

Specified by:
getDisplayComponent in interface PluggableEditor
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).

The default implementation simply returns getDisplayComponent().

Specified by:
getPrintComponent in interface PluggableEditor
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.

Specified by:
getDataSink in interface PluggableEditor
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.

Specified by:
isUnique in interface PluggableEditor

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.

Specified by:
getName in interface PluggableEditor
Overrides:
getName in class java.awt.Component

getIcon

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

Specified by:
getIcon in interface PluggableEditor

getToolTip

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

Specified by:
getToolTip in interface PluggableEditor

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.

Specified by:
registerComponents in interface PluggableEditor
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.

Specified by:
unload in interface PluggableEditor

canCreateEntry

public boolean canCreateEntry()
Whether this editor can handle a partially created new entry.

Specified by:
canCreateEntry in interface DataSink

getTreeIcon

public javax.swing.ImageIcon getTreeIcon(java.lang.String rdn)
Use the default tree icon system based on naming value or object class.

Specified by:
getTreeIcon in interface PluggableEditor
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)
Use the default popupmenu.

Specified by:
getPopupMenu in interface PluggableEditor
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)
Don't hide sub entries.

Specified by:
hideSubEntries in interface PluggableEditor
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').

addLanguageBundle

public void addLanguageBundle(java.lang.String name)

If you want to include language translation files in your plugin, simply zip 'em up, and use this method to register the base name of the translation files.

For example, if your translation files are 'myPlugin.properties', 'myPlugin_ja.properties', and 'myPlugin_fr_CA.properties', you can just zip them up in the same zip file as the rest of the plugins, and call this method with the string 'myPlugin' to have these language files appended to the base JX language file set.)

Parameters:
name - the base name of all the different language files.

addHelpSet

public void addHelpSet(java.lang.String name)

Optionally adds the name of a custom help set to JXplorer's default help set. The help set will be loaded from the plugin's zip file (or equivalently the top level of the /plugins directory.

This method should return null if no help set needs to be registered.

Parameters:
name - the base name (without any localisation extensions) of the help set to append.