net.sourceforge.nite.nstyle.handler
Class TreeHandler

java.lang.Object
  extended by net.sourceforge.nite.nstyle.handler.NDisplayObjectHandler
      extended by net.sourceforge.nite.nstyle.handler.JComponentHandler
          extended by net.sourceforge.nite.nstyle.handler.TreeHandler
All Implemented Interfaces:
InputComponent, OutputComponent

public class TreeHandler
extends JComponentHandler
implements InputComponent, OutputComponent

Author:
judyr

Constructor Summary
TreeHandler()
           
 
Method Summary
 void addChild(NDisplayObjectHandler child)
          The children of a Tree must be TreeNodes.
 javax.swing.JComponent displayElement(ObjectModelElement e, boolean selected)
          Display this element on the user interface
 java.util.Set getSelectedObjectModelElements()
          Returns a list of object model elements which corresponds to the input currently selected or entered in this JComponentHandler's component.
 void initializeTree(NTreeNode rootnode)
           
 void insertDisplayElement(ObjectModelElement newElement, ObjectModelElement parent, int position)
          Find the tree nodes which represent the specified parent.
 void redisplayElement(ObjectModelElement e)
          Find the tree nodes which display this object model element and redraw them given the data in the specified element
 void registerAction(java.lang.String binding, NiteAction a)
          This is used to register an action listener for the action.
 void removeDisplayComponent(ObjectModelElement e)
          Find the nodes which represent this element and delete them (and their children) from the tree.
 
Methods inherited from class net.sourceforge.nite.nstyle.handler.JComponentHandler
addActionReference, getImage, getJComponent, setImage, setUpBackgroundColour, setUpFont, setUpForegroundColour, setUpImage, setUpToolTip
 
Methods inherited from class net.sourceforge.nite.nstyle.handler.NDisplayObjectHandler
addActionReference, getActionReferences, getChildren, getClock, getElement, getEndTime, getID, getParent, getSourceID, getStartTime, init, setChildren, setClock, setElement, setEndTime, setID, setParent, setSourceID, setStartTime, setUpTimes
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeHandler

public TreeHandler()
Method Detail

initializeTree

public void initializeTree(NTreeNode rootnode)

addChild

public void addChild(NDisplayObjectHandler child)
The children of a Tree must be TreeNodes.

Overrides:
addChild in class JComponentHandler
Parameters:
child - The child to add.
See Also:
net.sourceforge.net.sourceforge.nite.nstyle.handler.NDisplayObjectHandler#addChild(net.sourceforge.net.sourceforge.nite.nstyle.handler.NDisplayObjectHandler)

getSelectedObjectModelElements

public java.util.Set getSelectedObjectModelElements()
Description copied from interface: InputComponent
Returns a list of object model elements which corresponds to the input currently selected or entered in this JComponentHandler's component.

Specified by:
getSelectedObjectModelElements in interface InputComponent

redisplayElement

public void redisplayElement(ObjectModelElement e)
Find the tree nodes which display this object model element and redraw them given the data in the specified element

Specified by:
redisplayElement in interface OutputComponent
Parameters:
e - The element which should have its representation refreshed.
See Also:
OutputComponent.redisplayElement(net.sourceforge.nite.nxt.ObjectModelElement)

removeDisplayComponent

public void removeDisplayComponent(ObjectModelElement e)
Find the nodes which represent this element and delete them (and their children) from the tree.

Specified by:
removeDisplayComponent in interface OutputComponent
See Also:
OutputComponent.removeDisplayComponent(net.sourceforge.nite.nxt.ObjectModelElement)

insertDisplayElement

public void insertDisplayElement(ObjectModelElement newElement,
                                 ObjectModelElement parent,
                                 int position)
Find the tree nodes which represent the specified parent. Find which node represents the positionth child of them and add a new tree node to represent the specified node there

Specified by:
insertDisplayElement in interface OutputComponent
Parameters:
newElement - The element which is to be inserted
parent - The parent of the element to be added
position - The index into the list of children belonging to the parent
See Also:
OutputComponent.insertDisplayElement(net.sourceforge.nite.nxt.ObjectModelElement, net.sourceforge.nite.nxt.ObjectModelElement, int)

displayElement

public javax.swing.JComponent displayElement(ObjectModelElement e,
                                             boolean selected)
Description copied from interface: OutputComponent
Display this element on the user interface

Specified by:
displayElement in interface OutputComponent
See Also:
net.sourceforge.nite.gui.actions.OutputComponent#displayElement(net.sourceforge.nite.nxt.ObjectModelElement)

registerAction

public void registerAction(java.lang.String binding,
                           NiteAction a)
This is used to register an action listener for the action.

Overrides:
registerAction in class JComponentHandler