Synergy Home Page

au.edu.swin.synergy.plugin.packager
Class BPackageModelElement

java.lang.Object
  |
  +--au.edu.swin.synergy.plugin.packager.BPackageModelElement

public class BPackageModelElement
extends Object
implements MutableTreeNode, Serializable

This will contain a MetaElement and allow a means of editting the way this looks as well as displaying it as a hierarchy in a tree.

Author:
Tristan Austin
See Also:
Serialized Form

Field Summary
static int kPackageArc
          Indicates that this is a package arc
static int kPackageNode
          Indicates that this is a package node
static int kPackageTerminator
          Indicates that this is a package terminator
 
Constructor Summary
BPackageModelElement(BMetaElement metaElement, int nodeType)
          Creates a new BPackageModelElement based on the given meta element.
 
Method Summary
 Enumeration children()
          Returns the children of the reciever as an Enumeration.
 boolean getAllowsChildren()
          Returns true if the receiver allows children.
 BDrawable getBDrawable()
          This will return the BGroup that represents this BMetaElement in this package.
 TreeNode getChildAt(int childIndex)
          Returns the child TreeNode at index childIndex.
 int getChildCount()
          Returns the number of children TreeNodes the receiver contains.
 int getIndex(TreeNode node)
          Returns the index of node in the receivers children.
 int getNodeType()
          This will indicate the type of node this node represents.
 TreeNode getParent()
          Returns the parent TreeNode of the receiver.
 Object getUserObject()
          Provides a reference to the meta element that this node represents.
 void insert(MutableTreeNode newNode, int index)
          This will insert the given MutableTreeNode into the element at the specified index.
 boolean isLeaf()
          Returns true if the receiver is a leaf.
 void remove(int targetNodeIndex)
          Removes the given node from the list of children of this node.
 void remove(MutableTreeNode targetNode)
          Removes the given node from the list of children of this node.
 void removeFromParent()
          This will remove this node from its parent node by calling the remove method on the parent object and passing this as the paramater to the call.
 void setParent(MutableTreeNode parentTreeNode)
          Sets the parent node of this node to the given tree node.
 void setUserObject(Object metaElementObject)
          This allows the user to
 String toString()
          This will get the name of the meta element as the graphical representation on the screen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kPackageNode

public static final int kPackageNode
Indicates that this is a package node

kPackageArc

public static final int kPackageArc
Indicates that this is a package arc

kPackageTerminator

public static final int kPackageTerminator
Indicates that this is a package terminator
Constructor Detail

BPackageModelElement

public BPackageModelElement(BMetaElement metaElement,
                            int nodeType)
Creates a new BPackageModelElement based on the given meta element.
Parameters:
metaElement - The element to base this on
nodeType - The type of node creating, BPackageArc, BPackageNode, BPackageTerminator
Method Detail

getChildAt

public TreeNode getChildAt(int childIndex)
Returns the child TreeNode at index childIndex.

getChildCount

public int getChildCount()
Returns the number of children TreeNodes the receiver contains.
Returns:
The number of children of this node

getParent

public TreeNode getParent()
Returns the parent TreeNode of the receiver.
Returns:
The parent tree node of this tree node

getIndex

public int getIndex(TreeNode node)
Returns the index of node in the receivers children. If the receiver does not contain node, -1 will be returned.

getAllowsChildren

public boolean getAllowsChildren()
Returns true if the receiver allows children. This will always return true because this class only represents an element with properties.
Returns:
True always

isLeaf

public boolean isLeaf()
Returns true if the receiver is a leaf. This will return true when it has no children
Returns:
True if there are no children, false otherwise

children

public Enumeration children()
Returns the children of the reciever as an Enumeration.

toString

public String toString()
This will get the name of the meta element as the graphical representation on the screen
Returns:
The name of the element
Overrides:
toString in class Object

getUserObject

public Object getUserObject()
Provides a reference to the meta element that this node represents.
Returns:
The meta element this node represents

setUserObject

public void setUserObject(Object metaElementObject)
This allows the user to
Specified by:
setUserObject in interface MutableTreeNode

setParent

public void setParent(MutableTreeNode parentTreeNode)
Sets the parent node of this node to the given tree node.
Specified by:
setParent in interface MutableTreeNode
Parameters:
parentTreeNode - The new parent of this node

removeFromParent

public void removeFromParent()
This will remove this node from its parent node by calling the remove method on the parent object and passing this as the paramater to the call.
Specified by:
removeFromParent in interface MutableTreeNode
Pre Condition:
This node has a parent
Post Condition:
This node no longer has a parent

remove

public void remove(MutableTreeNode targetNode)
Removes the given node from the list of children of this node. This probably won't be used as the hierarchy of the package modeller is fairly static.
Specified by:
remove in interface MutableTreeNode
Parameters:
targetNode - The node to remove

remove

public void remove(int targetNodeIndex)
Removes the given node from the list of children of this node. This probably won't be used as the hierarchy of the package modeller is fairly static.
Specified by:
remove in interface MutableTreeNode
Parameters:
targetNode - The node to remove

insert

public void insert(MutableTreeNode newNode,
                   int index)
This will insert the given MutableTreeNode into the element at the specified index.
Specified by:
insert in interface MutableTreeNode
Parameters:
newNode - The node to insert
index - The index to insert the new node

getBDrawable

public BDrawable getBDrawable()
This will return the BGroup that represents this BMetaElement in this package.
Returns:
The BGroup representing this meta element

getNodeType

public int getNodeType()
This will indicate the type of node this node represents.
Returns:
kPackageArc, kPackageNode, kPackageTerminator

Synergy Home Page