Algernon Software

org.algernon.app.j2p
Class J2PFrame

java.lang.Object
  extended byjavax.swing.tree.DefaultMutableTreeNode
      extended byorg.algernon.app.j2p.J2PFrame
All Implemented Interfaces:
Cloneable, MutableTreeNode, Serializable, TreeNode
Direct Known Subclasses:
J2PClass, J2PSlot

public abstract class J2PFrame
extends DefaultMutableTreeNode
implements TreeNode

J2PFrame is an abstract base class for Java2Protege classes and slots.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.tree.DefaultMutableTreeNode
 
Field Summary
protected  String CHILD_ERROR_COLOR
           
protected  String ERROR_COLOR
           
private  J2PError f_error
           
private  boolean f_isIgnored
           
private  String f_name
           
private  String f_originalName
           
protected  int MAX_NAME_LENGTH
           
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
J2PFrame(String name, String originalName)
           
 
Method Summary
 boolean childHasError()
           
abstract  Enumeration children()
          Creates and returns a forward-order enumeration of this node's children.
 boolean getAllowsChildren()
          Returns true if this node is allowed to have children.
 TreeNode getChildAt(int index)
          Returns the child at the specified index in this node's child array.
 int getChildCount()
          Returns the number of children of this node.
 J2PError getError()
          Returns the error.
 int getIndex(TreeNode aChild)
          Returns the index of the specified child in this node's child array.
 String getName()
          Returns the name
 String getOriginalName()
           
 TreeNode getParent()
          Returns this node's parent or null if this node has no parent.
 boolean hasError()
          gets the hasError flag.
 boolean isIgnored()
          returns true if the user doesn't want to export this one.
 boolean isLeaf()
          Returns true if this node has no children.
 void setError(J2PError error)
          sets the hasError flag.
 void setIsIgnored(boolean newValue)
          Sets the isIgnored flag.
 void setName(String newName)
          Sets the name of this class.
 void setOriginalName(String originalName)
           
 String toString()
           
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, clone, depthFirstEnumeration, getChildAfter, getChildBefore, getDepth, getFirstChild, getFirstLeaf, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

f_name

private String f_name

f_originalName

private String f_originalName

f_error

private J2PError f_error

f_isIgnored

private boolean f_isIgnored

ERROR_COLOR

protected String ERROR_COLOR

CHILD_ERROR_COLOR

protected String CHILD_ERROR_COLOR

MAX_NAME_LENGTH

protected int MAX_NAME_LENGTH
Constructor Detail

J2PFrame

public J2PFrame(String name,
                String originalName)
Method Detail

setName

public void setName(String newName)
Sets the name of this class.


getName

public String getName()
Returns the name


toString

public String toString()

setError

public void setError(J2PError error)
sets the hasError flag.


getError

public J2PError getError()
Returns the error. Null if no error.


hasError

public boolean hasError()
gets the hasError flag.


childHasError

public boolean childHasError()

isIgnored

public boolean isIgnored()
returns true if the user doesn't want to export this one.


setIsIgnored

public void setIsIgnored(boolean newValue)
Sets the isIgnored flag.


getOriginalName

public String getOriginalName()

setOriginalName

public void setOriginalName(String originalName)

children

public abstract Enumeration children()
Creates and returns a forward-order enumeration of this node's children. Modifying this node's child array invalidates any child enumerations created before the modification.

Specified by:
children in interface TreeNode
Returns:
an Enumeration of this node's children

getAllowsChildren

public boolean getAllowsChildren()
Returns true if this node is allowed to have children.

Specified by:
getAllowsChildren in interface TreeNode
Returns:
true if this node allows children, else false

getChildAt

public TreeNode getChildAt(int index)
Returns the child at the specified index in this node's child array.

Specified by:
getChildAt in interface TreeNode
Parameters:
index - an index into this node's child array
Returns:
the TreeNode in this node's child array at the specified index
Throws:
ArrayIndexOutOfBoundsException - if index is out of bounds

getChildCount

public int getChildCount()
Returns the number of children of this node.

Specified by:
getChildCount in interface TreeNode
Returns:
an int giving the number of children of this node

getIndex

public int getIndex(TreeNode aChild)
Returns the index of the specified child in this node's child array. If the specified node is not a child of this node, returns -1. This method performs a linear search and is O(n) where n is the number of children.

Specified by:
getIndex in interface TreeNode
Parameters:
aChild - the TreeNode to search for among this node's children
Returns:
an int giving the index of the node in this node's child array, or -1 if the specified node is a not a child of this node
Throws:
IllegalArgumentException - if aChild is null

isLeaf

public boolean isLeaf()
Returns true if this node has no children. To distinguish between nodes that have no children and nodes that cannot have children (e.g. to distinguish files from empty directories), use this method in conjunction with getAllowsChildren

Specified by:
isLeaf in interface TreeNode
Returns:
true if this node has no children
See Also:
getAllowsChildren()

getParent

public TreeNode getParent()
Returns this node's parent or null if this node has no parent.

Specified by:
getParent in interface TreeNode
Returns:
this node's parent TreeNode, or null if this node has no parent

Algernon Software