wt.clients.widgets
Class DefaultTreeNodeSelector

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bywt.clients.widgets.BaseSelector
                      extended bywt.clients.widgets.DefaultTreeNodeSelector
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, SelectorInterface, Serializable
Direct Known Subclasses:
AttributeDefinitionSelector, AttributeDefTypeIDSelector, ClassificationNodeSelector, NavigationNodeSelector, TypeSelector

public abstract class DefaultTreeNodeSelector
extends BaseSelector

------------------------------------------------------------

See Also:
Serialized Form

Nested Class Summary
(package private)  class DefaultTreeNodeSelector.IBATreeSelectionListener
          Class for selection listener.
(package private)  class DefaultTreeNodeSelector.IBATreeWillExpandListener
          The listener that's notified when a tree expands or collapses a node
 
Nested classes inherited from class wt.clients.widgets.BaseSelector
BaseSelector.SelectCancelPanel
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  DefaultLiteTreeNode cache
           
protected  StatusMessage copyMessage
           
protected  boolean cut
           
protected  StatusMessage cutMessage
           
protected  StatusMessage pasteCopyMessage
           
protected  StatusMessage pasteCutMessage
           
static int PRE_FETCH_LEVEL
           
protected  TreeSelectionListener selectionListener
           
protected  JIBATree tree
           
protected  TreeWillExpandListener treeWillExpandListener
           
 
Fields inherited from class wt.clients.widgets.BaseSelector
BASE_RESOURCE, baseSelectorTitle, canceled, editorDialog, errorDialogTitle, id, modelDialogFlag, multiSelection, resource, selected, selectorListenerManager, statusBarHost, warningDialogTitle
 
Fields inherited from class javax.swing.JPanel
 
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.Container
 
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
DefaultTreeNodeSelector()
           
 
Method Summary
 void addValue(Object obj)
          Method to create(add) an object to the tree
private  boolean checkAllNodes(AbstractLiteObject obj)
           
private  DefaultLiteTreeNode checkAllNodesForParent(AbstractLiteObject obj)
          This method will check all the nodes stored inside the hashtable and see if we can find the parent of this object.
private  void checkChildrenIfExist(DefaultLiteTreeNode parent, AbstractLiteObject object)
          This method will check whether the object exists under the parent node.
protected abstract  boolean checkObjectIsParentOf(AbstractLiteObject parent, AbstractLiteObject node)
           
protected abstract  boolean checkObjectIsRoot(AbstractLiteObject object)
           
 void clearAllStatusMessages()
           
 void copy()
          Method for copy
protected abstract  DefaultLiteTreeNode createRootNode()
           
protected abstract  DefaultTreeCellRenderer createTreeCellRenderer()
           
protected abstract  DefaultLiteTreeNode createTreeNode(AbstractLiteObject obj, boolean hasDummyChildren)
           
protected  TreeSelectionListener createTreeSelectionListener()
           
 void cut()
          Method for cut
 void expandNodeAndChildren(DefaultLiteTreeNode node)
           
 Object getFirstSelected()
          Get the first selected value of the only selected value
protected  void getNodeChildren(DefaultLiteTreeNode parent, int level)
          Get the children of this parent node, and get # levels down from this parent.
protected abstract  String getParentObjectID(AbstractLiteObject node)
           
protected abstract  AbstractLiteObject[] getRootNodes()
           
 TreePath[] getSelectedPaths()
          Get selected paths in a array format.
 Vector getSelectedValues()
          Get selected value in a vector format.
protected abstract  AbstractLiteObject[] getThisNodeChildren(DefaultLiteTreeNode parent)
           
 boolean isEquivalent(Object obj1, Object obj2)
          Comparing two user object if they are equivalent.
 boolean isMultiSelect()
          Get the selection mode of the tree
abstract  void paste()
           
protected  void populateRoots()
          Method to populate the roots of the tree
protected abstract  void populateSelectedValue(Object obj)
           
protected  void pushMessage(String name)
           
protected  void pushPasteMessage(String name)
           
 void removeValue(Object obj)
          Method to delete an object from the tree.
 void setMultiSelect(boolean multi)
          Set the selection mode of the tree
 void setSelectedValue(Object obj)
          Set selected value by passing an object
 void setSelectedValues(Vector obj)
          Set selected value by passing a vector of objects
private  void updateCache()
          Method for update the cache for cut and copy.
 
Methods inherited from class wt.clients.widgets.BaseSelector
addSelectorListener, fireSelectionChangedEvent, getContext, initResource, isModalDialog, removeSelectorListener, setBusy, setStatusBarHost, showAsModalSelectorDialog, showAsModalSelectorDialog, showAsModalSelectorDialog
 
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, getName, 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

PRE_FETCH_LEVEL

public static final int PRE_FETCH_LEVEL
See Also:
Constant Field Values

tree

protected JIBATree tree

selectionListener

protected TreeSelectionListener selectionListener

treeWillExpandListener

protected TreeWillExpandListener treeWillExpandListener

cache

protected DefaultLiteTreeNode cache

copyMessage

protected StatusMessage copyMessage

cutMessage

protected StatusMessage cutMessage

pasteCopyMessage

protected StatusMessage pasteCopyMessage

pasteCutMessage

protected StatusMessage pasteCutMessage

cut

protected boolean cut
Constructor Detail

DefaultTreeNodeSelector

public DefaultTreeNodeSelector()
Method Detail

createTreeCellRenderer

protected abstract DefaultTreeCellRenderer createTreeCellRenderer()

createTreeNode

protected abstract DefaultLiteTreeNode createTreeNode(AbstractLiteObject obj,
                                                      boolean hasDummyChildren)

createRootNode

protected abstract DefaultLiteTreeNode createRootNode()

getRootNodes

protected abstract AbstractLiteObject[] getRootNodes()

getThisNodeChildren

protected abstract AbstractLiteObject[] getThisNodeChildren(DefaultLiteTreeNode parent)

populateSelectedValue

protected abstract void populateSelectedValue(Object obj)

checkObjectIsRoot

protected abstract boolean checkObjectIsRoot(AbstractLiteObject object)

checkObjectIsParentOf

protected abstract boolean checkObjectIsParentOf(AbstractLiteObject parent,
                                                 AbstractLiteObject node)

getParentObjectID

protected abstract String getParentObjectID(AbstractLiteObject node)

paste

public abstract void paste()

createTreeSelectionListener

protected TreeSelectionListener createTreeSelectionListener()

setMultiSelect

public void setMultiSelect(boolean multi)
Set the selection mode of the tree

Specified by:
setMultiSelect in interface SelectorInterface
Specified by:
setMultiSelect in class BaseSelector
Parameters:
multi - Set the selection mode

isMultiSelect

public boolean isMultiSelect()
Get the selection mode of the tree

Specified by:
isMultiSelect in interface SelectorInterface
Overrides:
isMultiSelect in class BaseSelector
Returns:
the selection mode of the tree

isEquivalent

public boolean isEquivalent(Object obj1,
                            Object obj2)
Comparing two user object if they are equivalent. If the user updates the object, the two object will not be the same; however, they should have the same objectID. Using the isPersistedObjectEqual method can check whether the two objects are actually the same object on the database.


setSelectedValue

public void setSelectedValue(Object obj)
Set selected value by passing an object

Specified by:
setSelectedValue in interface SelectorInterface
Specified by:
setSelectedValue in class BaseSelector
Parameters:
obj - Object that the node will be contained.

setSelectedValues

public void setSelectedValues(Vector obj)
Set selected value by passing a vector of objects

Specified by:
setSelectedValues in interface SelectorInterface
Specified by:
setSelectedValues in class BaseSelector
Parameters:
obj - Vector of objects that the nodes will be contained.

getSelectedValues

public Vector getSelectedValues()
Get selected value in a vector format.

Specified by:
getSelectedValues in interface SelectorInterface
Specified by:
getSelectedValues in class BaseSelector
Returns:
vector containing the selected objects. The object should be instance of ClassificationNodeNodeView

getSelectedPaths

public TreePath[] getSelectedPaths()
Get selected paths in a array format.

Returns:
TreePath array containing the selected paths.

getFirstSelected

public Object getFirstSelected()
Get the first selected value of the only selected value

Specified by:
getFirstSelected in interface SelectorInterface
Specified by:
getFirstSelected in class BaseSelector
Returns:
Object containing the selected objects. The object should be instance of ClassificationNodeNodeView

populateRoots

protected void populateRoots()
Method to populate the roots of the tree


getNodeChildren

protected void getNodeChildren(DefaultLiteTreeNode parent,
                               int level)
Get the children of this parent node, and get # levels down from this parent.

Parameters:
level - # of levels for the children to get

addValue

public void addValue(Object obj)
Method to create(add) an object to the tree

Specified by:
addValue in interface SelectorInterface
Specified by:
addValue in class BaseSelector

checkChildrenIfExist

private void checkChildrenIfExist(DefaultLiteTreeNode parent,
                                  AbstractLiteObject object)
This method will check whether the object exists under the parent node.

Parameters:
parent - Parent node which will be checked
object - object to be checked whether it's already under the parent node.

checkAllNodes

private boolean checkAllNodes(AbstractLiteObject obj)

checkAllNodesForParent

private DefaultLiteTreeNode checkAllNodesForParent(AbstractLiteObject obj)
This method will check all the nodes stored inside the hashtable and see if we can find the parent of this object.

Parameters:
obj - The object which we want to find whether the parent exists.
Returns:
the AttributeDefinition node which is the parent of this object.

expandNodeAndChildren

public void expandNodeAndChildren(DefaultLiteTreeNode node)

removeValue

public void removeValue(Object obj)
Method to delete an object from the tree.

Specified by:
removeValue in interface SelectorInterface
Specified by:
removeValue in class BaseSelector

copy

public void copy()
Method for copy


cut

public void cut()
Method for cut


updateCache

private void updateCache()
Method for update the cache for cut and copy. It's the same for the two functions.


clearAllStatusMessages

public void clearAllStatusMessages()
Overrides:
clearAllStatusMessages in class BaseSelector

pushMessage

protected void pushMessage(String name)

pushPasteMessage

protected void pushPasteMessage(String name)