com.ca.directory.jxplorer.viewer
Class TableAttributeEditor

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

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

This class displays attributes in a table (currently string attributes only). The user can modify the table values, and submit the results, which are passed to the registered DataSource (obtained from the registered DataSource)...

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
 DataSource dataSource
           
 
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
TableAttributeEditor(javax.swing.JFrame MyOwner)
          Constructor initialises the table and a popup tool, as well as initialising the required GUI elements.
 
Method Summary
 boolean canCreateEntry()
          Indicates whether the editor can create a new entry, given a unique name.
 void changeClass()
          Opens the change class dialog.
 void displayEntry(DXEntry entry, DataSource ds)
          Displays data that can be modified by the user in a table.
 void displayOperationalAttributes()
          Opens a dialog that displays the operational attributes of the current entry.
 void doSubmit()
          Kicks off the entry modify/update & checks for manditory attributes.
 void doVirtualEntryDisplay()
          Opens a dialog that asks the user if they want to make a virtual entry a non virtual entry.
 java.lang.String[] getAttributeValuesAsStringArray(javax.naming.directory.Attribute a)
           
 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()
          Return the thingumy that should be printed.
 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.
 boolean isUnique()
          This editor is happy to be used in conjunction with other editors...
 boolean objectClassesChanged(DXAttributes a, DXAttributes b)
          Test whether the (unordered) object class lists of two attributes contain the same
 void processVirtualEntry()
          Normally called by the 'Yes' button listener of the virtual entry dialog.
 boolean promptForSave(boolean reset)
           
 void registerClassLoader(java.lang.ClassLoader loader)
          Optionally register a new class loader for atribute value viewers to use.
 void registerComponents(javax.swing.JMenuBar menu, javax.swing.JToolBar buttons, javax.swing.JTree tree, javax.swing.JPopupMenu treeMenu, javax.swing.JFrame jx)
          Registers Swing components that the pluggable editor may manipulate.
 void setVisible(boolean state)
           
 void shutVirtualEntryDialog()
          Disposes of the virtual entry dialog that is opened as a prompt when the user may want to edit a virtual entry.
 void unload()
          This method is called when the editor is being unloaded by the browser, and allows for any required clean up activity.
 void writeTableData()
          Writes the data currently in the table editor to the directory.
 
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, 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
 

Field Detail

dataSource

public DataSource dataSource
Constructor Detail

TableAttributeEditor

public TableAttributeEditor(javax.swing.JFrame MyOwner)
Constructor initialises the table and a popup tool, as well as initialising the required GUI elements. It adds action listeners for the three main buttons, which include basic user input validation checking.

Method Detail

changeClass

public void changeClass()
Opens the change class dialog.


doSubmit

public void doSubmit()
Kicks off the entry modify/update & checks for manditory attributes.


displayOperationalAttributes

public void displayOperationalAttributes()
Opens a dialog that displays the operational attributes of the current entry.


promptForSave

public boolean promptForSave(boolean reset)

doVirtualEntryDisplay

public void doVirtualEntryDisplay()
Opens a dialog that asks the user if they want to make a virtual entry a non virtual entry. If the user clicks 'Yes' the 'change class' dialog opens.


processVirtualEntry

public void processVirtualEntry()
Normally called by the 'Yes' button listener of the virtual entry dialog. This method opens the New Entry dialog in simple mode (or Change Classes dialog). If the user selects one or more object classes they are added to the entry and displayed in the table editor.


shutVirtualEntryDialog

public void shutVirtualEntryDialog()
Disposes of the virtual entry dialog that is opened as a prompt when the user may want to edit a virtual entry.


displayEntry

public void displayEntry(DXEntry entry,
                         DataSource ds)

Displays data that can be modified by the user in a table.

Specified by:
displayEntry in interface DataSink
Parameters:
entry - the entry to be displayed by all the editors
ds - the datasource the editors may use for more info

getDisplayComponent

public javax.swing.JComponent getDisplayComponent()
Description copied from interface: PluggableEditor
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.

getAttributeValuesAsStringArray

public java.lang.String[] getAttributeValuesAsStringArray(javax.naming.directory.Attribute a)
                                                   throws javax.naming.NamingException
javax.naming.NamingException

objectClassesChanged

public boolean objectClassesChanged(DXAttributes a,
                                    DXAttributes b)
Test whether the (unordered) object class lists of two attributes contain the same


writeTableData

public void writeTableData()
Writes the data currently in the table editor to the directory.


getPrintComponent

public java.awt.Component getPrintComponent()
Return the thingumy that should be printed.

Specified by:
getPrintComponent in interface PluggableEditor
Returns:
the component being used to print the node data.

isUnique

public boolean isUnique()
This editor is happy to be used in conjunction with other editors...

Specified by:
isUnique in interface PluggableEditor

getName

public java.lang.String getName()
Description copied from interface: PluggableEditor
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()
Description copied from interface: PluggableEditor
Returns the icon of the editor. (This might be displayed on a tab or similar).

Specified by:
getIcon in interface PluggableEditor

getToolTip

public java.lang.String getToolTip()
Description copied from interface: PluggableEditor
Returns the Tool Tip of the editor. (This might be displayed on a tab or similar).

Specified by:
getToolTip in interface PluggableEditor

getDataSink

public DataSink getDataSink()
Description copied from interface: PluggableEditor
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.

canCreateEntry

public boolean canCreateEntry()
Description copied from interface: DataSink
Indicates whether the editor can create a new entry, given a unique name.

Specified by:
canCreateEntry in interface DataSink

registerComponents

public void registerComponents(javax.swing.JMenuBar menu,
                               javax.swing.JToolBar buttons,
                               javax.swing.JTree tree,
                               javax.swing.JPopupMenu treeMenu,
                               javax.swing.JFrame jx)
Description copied from interface: PluggableEditor
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
jx - 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()
Description copied from interface: PluggableEditor
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.

Specified by:
unload in interface PluggableEditor

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').

registerClassLoader

public void registerClassLoader(java.lang.ClassLoader loader)
Optionally register a new class loader for atribute value viewers to use.


setVisible

public void setVisible(boolean state)
Overrides:
setVisible in class javax.swing.JComponent