medi.swing.tree
Class MediTreeNode

java.lang.Object
  |
  +--javax.swing.tree.DefaultMutableTreeNode
        |
        +--javatools.swing.tree.IndexedTypedTreeNode
              |
              +--medi.swing.tree.MediTreeNode
All Implemented Interfaces:
Clippable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, java.io.Serializable, javax.swing.tree.TreeNode

public class MediTreeNode
extends IndexedTypedTreeNode

It's a tree node specifically designed for Medi.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javatools.swing.tree.IndexedTypedTreeNode
beingCut, deleteWhenCut, dupWhenClipped, expanded, ID, tree, type
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
MediTreeNode()
          Creates new MediTreeNode
MediTreeNode(javax.swing.JTree pTree, java.lang.Object userObject)
          Creates a new node with the given object.
MediTreeNode(javax.swing.JTree pTree, java.lang.Object userObject, boolean allowsChildren)
          Creates a new node with the given object.
MediTreeNode(java.lang.Object userObject)
          Creates a new node with the given object.
MediTreeNode(java.lang.Object userObject, boolean allowsChildren)
          Creates a new node with the given object.
 
Method Summary
 void attach(Clippable newSon)
          Attaches an object to this one.
 boolean canBeAttached(Clippable newSon)
          Checks whether an object can be attached to this one.
 boolean canBeCopied()
          Checks whether this object can be copied or not.
 boolean canBeCut()
          Checks whether this object can be cut or not.
 Clippable copy()
          Copies this object into the clipboard.
 Clippable cut()
          Cuts this object into the clipboard.
 Clippable duplicate()
          Duplicates (clones) this object.
 java.lang.Object[] getID()
          Returns the ID.
 java.lang.String getType()
          Returns the type of the node.
 java.lang.Object getValue()
          Returns the value of this object.
static void init()
          Initializes some generic lists.
 void paste(Clippable newFather)
          Pastes this object into another.
 void setID(java.lang.Object[] pID)
          Sets the ID for the node.
 void setType(java.lang.String pType)
          Sets the type of node.
 void unclip()
          Resets the status of this object.
 
Methods inherited from class javatools.swing.tree.IndexedTypedTreeNode
add, conditionalSetPlace, expand, getDeleteWhenCut, getDuplicateWhenClipped, getPlace, insert, isExpanded, reload, remove, remove, removeAllChildren, removeFromParent, setDeleteWhenCut, setDuplicateWhenClipped, setExpanded, setPlace, setPlaceForChildren
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, 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, setAllowsChildren, setParent, setUserObject, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MediTreeNode

public MediTreeNode()
Creates new MediTreeNode


MediTreeNode

public MediTreeNode(java.lang.Object userObject)
Creates a new node with the given object.

Parameters:
userObject - The object.

MediTreeNode

public MediTreeNode(java.lang.Object userObject,
                    boolean allowsChildren)
Creates a new node with the given object.

Parameters:
userObject - The object to use.
allowsChildren - true: it allows children; false: it DOES NOT allow children.

MediTreeNode

public MediTreeNode(javax.swing.JTree pTree,
                    java.lang.Object userObject)
Creates a new node with the given object.

Parameters:
pTree - The tree that contains this node.
userObject - The object.

MediTreeNode

public MediTreeNode(javax.swing.JTree pTree,
                    java.lang.Object userObject,
                    boolean allowsChildren)
Creates a new node with the given object.

Parameters:
pTree - The tree that contains this node.
userObject - The object.
allowsChildren - true: it allows children; false: it DOES NOT allow children.
Method Detail

init

public static void init()
Initializes some generic lists. It must be called at the start of the program.


setID

public void setID(java.lang.Object[] pID)
Sets the ID for the node.

Overrides:
setID in class IndexedTypedTreeNode
Parameters:
pID - An array of object representing the ID.

getID

public java.lang.Object[] getID()
Returns the ID.

Overrides:
getID in class IndexedTypedTreeNode
Returns:
An array of objects representing the ID.

setType

public void setType(java.lang.String pType)
Sets the type of node.

Overrides:
setType in class IndexedTypedTreeNode
Parameters:
pType - The type.

getType

public java.lang.String getType()
Returns the type of the node.

Specified by:
getType in interface Clippable
Overrides:
getType in class IndexedTypedTreeNode
Returns:
The type.

attach

public void attach(Clippable newSon)
Attaches an object to this one.

Specified by:
attach in interface Clippable
Overrides:
attach in class IndexedTypedTreeNode
Parameters:
newSon - The object to be attached. It must be MediTreeNode.

copy

public Clippable copy()
Copies this object into the clipboard.

Specified by:
copy in interface Clippable
Overrides:
copy in class IndexedTypedTreeNode
Returns:
The object to be copied.

cut

public Clippable cut()
Cuts this object into the clipboard.

Specified by:
cut in interface Clippable
Overrides:
cut in class IndexedTypedTreeNode
Returns:
The object to be cut.

getValue

public java.lang.Object getValue()
Returns the value of this object.

Specified by:
getValue in interface Clippable
Overrides:
getValue in class IndexedTypedTreeNode
Returns:
The value of this object (i.e. the printed string).

paste

public void paste(Clippable newFather)
Pastes this object into another.

Specified by:
paste in interface Clippable
Overrides:
paste in class IndexedTypedTreeNode
Parameters:
newFather - The object to paste this object into. It must be MediTreeNode to really work.

canBeAttached

public boolean canBeAttached(Clippable newSon)
Checks whether an object can be attached to this one.

Specified by:
canBeAttached in interface Clippable
Overrides:
canBeAttached in class IndexedTypedTreeNode
Parameters:
newSon - The object that is going to be attached to this one.
Returns:
true: the object can be attached; false: otherwise.

duplicate

public Clippable duplicate()
Duplicates (clones) this object.

Specified by:
duplicate in interface Clippable
Overrides:
duplicate in class IndexedTypedTreeNode
Returns:
The newly created object.

unclip

public void unclip()
Resets the status of this object.

Specified by:
unclip in interface Clippable
Overrides:
unclip in class IndexedTypedTreeNode

canBeCut

public boolean canBeCut()
Checks whether this object can be cut or not.

Specified by:
canBeCut in interface Clippable
Overrides:
canBeCut in class IndexedTypedTreeNode
Returns:
true: the object can be cut; false: otherwise.

canBeCopied

public boolean canBeCopied()
Checks whether this object can be copied or not.

Specified by:
canBeCopied in interface Clippable
Overrides:
canBeCopied in class IndexedTypedTreeNode
Returns:
true: the object can be copied; false: otherwise.