Package mgui.interfaces.trees
Class InterfaceTreeNode
java.lang.Object
javax.swing.tree.DefaultMutableTreeNode
mgui.interfaces.trees.InterfaceTreeNode
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,javax.swing.tree.MutableTreeNode
,javax.swing.tree.TreeNode
,InterfaceObjectListener
,PopupMenuObject
- Direct Known Subclasses:
AttributeTreeNode
,DataFieldTreeNode
,InterfaceNetworkTreeNode
,InterfaceNeuroTreeNode
,ShapeModel3DTreeNode
,ShapeTreeNode
,TaskTreeNode
public class InterfaceTreeNode extends javax.swing.tree.DefaultMutableTreeNode implements java.lang.Cloneable, InterfaceObjectListener, PopupMenuObject
Base class for tree nodes representing ModelGUI objects (instances of InterfaceObject).
- Author:
- Andrew Ried
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description boolean
isDestroyed
boolean
isMouseOverSelect
boolean
isSelectable
protected java.util.ArrayList<TreeListener>
listeners
protected javax.swing.JTree
parent_tree
protected PopupMenuObject
popup_handler
protected InterfacePopupMenu
popup_menu
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
-
Constructor Summary
Constructors Constructor Description InterfaceTreeNode()
InterfaceTreeNode(java.lang.String nodeStr)
InterfaceTreeNode(InterfaceObject thisObj)
InterfaceTreeNode(InterfaceObject thisObj, javax.swing.JTree parent)
-
Method Summary
Modifier and Type Method Description void
addChild(InterfaceTreeNode node)
Adds a child to anInterfaceTreeNode
and sets its listeners.void
addListener(TreeListener l)
java.lang.Object
clone()
boolean
containsObject(java.lang.Object o)
void
destroy()
void
destroy(boolean fire)
void
destroyAllChildren()
protected void
fireTreeListeners(TreeEvent e)
java.util.ArrayList<javax.swing.tree.TreeNode>
getChildren()
javax.swing.JTree
getParentTree()
InterfacePopupMenu
getPopupMenu()
Produces and returns a popup menu for this object.InterfacePopupMenu
getPopupMenu(java.util.List<java.lang.Object> selection)
Produces and returns a popup menu for this object.void
handleMouseEvent(java.awt.event.MouseEvent e, InterfaceTree tree)
void
handlePopupEvent(java.awt.event.ActionEvent e)
Handles an event on this object's popup menu.void
init()
void
insertChild(InterfaceTreeNode node, int pos)
boolean
isDestroyed()
boolean
isSelectable()
void
moveChild(InterfaceTreeNode node, int pos)
void
objectChanged()
void
objectChanged(InterfaceObject object)
void
removeChild(InterfaceTreeNode node)
void
removeListener(TreeListener l)
void
setParentTree(javax.swing.JTree tree)
void
setPopupMenu(InterfacePopupMenu menu)
void
setSelectable(boolean s)
void
setUserObject(InterfaceObject thisObj)
void
showPopupMenu(java.awt.event.MouseEvent e)
Shows a popup menu at the point of the givenMouseEvent
.Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
listeners
-
isDestroyed
public boolean isDestroyed -
isSelectable
public boolean isSelectable -
isMouseOverSelect
public boolean isMouseOverSelect -
popup_handler
-
parent_tree
protected javax.swing.JTree parent_tree
-
-
Constructor Details
-
InterfaceTreeNode
public InterfaceTreeNode() -
InterfaceTreeNode
-
InterfaceTreeNode
-
InterfaceTreeNode
public InterfaceTreeNode(java.lang.String nodeStr)
-
-
Method Details
-
getChildren
public java.util.ArrayList<javax.swing.tree.TreeNode> getChildren() -
setParentTree
public void setParentTree(javax.swing.JTree tree) -
getParentTree
public javax.swing.JTree getParentTree() -
insertChild
-
moveChild
-
addChild
Adds a child to anInterfaceTreeNode
and sets its listeners. Use instead ofadd
to ensure proper tree behaviour forInterfaceObject
s.- Parameters:
node
-
-
removeChild
-
destroyAllChildren
public void destroyAllChildren() -
isSelectable
public boolean isSelectable() -
setSelectable
public void setSelectable(boolean s) -
containsObject
public boolean containsObject(java.lang.Object o) -
setUserObject
-
isDestroyed
public boolean isDestroyed() -
destroy
public void destroy() -
destroy
public void destroy(boolean fire) -
init
public void init() -
objectChanged
public void objectChanged() -
objectChanged
- Specified by:
objectChanged
in interfaceInterfaceObjectListener
-
clone
public java.lang.Object clone()- Overrides:
clone
in classjavax.swing.tree.DefaultMutableTreeNode
-
addListener
-
removeListener
-
fireTreeListeners
-
getPopupMenu
Description copied from interface:PopupMenuObject
Produces and returns a popup menu for this object.- Specified by:
getPopupMenu
in interfacePopupMenuObject
- Returns:
-
getPopupMenu
Description copied from interface:PopupMenuObject
Produces and returns a popup menu for this object. Allows an associated list of objects to be passed as an argument.- Specified by:
getPopupMenu
in interfacePopupMenuObject
- Returns:
-
handlePopupEvent
public void handlePopupEvent(java.awt.event.ActionEvent e)Description copied from interface:PopupMenuObject
Handles an event on this object's popup menu.- Specified by:
handlePopupEvent
in interfacePopupMenuObject
-
handleMouseEvent
-
showPopupMenu
public void showPopupMenu(java.awt.event.MouseEvent e)Description copied from interface:PopupMenuObject
Shows a popup menu at the point of the givenMouseEvent
.- Specified by:
showPopupMenu
in interfacePopupMenuObject
-