easik.sketch.vertex
Class EntityNode

java.lang.Object
  extended by easik.sketch.vertex.SketchVertex
      extended by easik.sketch.vertex.EntityNode

public class EntityNode
extends SketchVertex

An entity node represents a table in a database. It has a name, attributes, and unique keys. This class keeps track of all these elements.

Version:
2006-06-21 Kevin Green
Author:
Rob Fletcher 2005, Kevin Green 2006

Field Summary
private  java.util.ArrayList<EntityAttribute> _entityAttributes
          List of all attributes for this entity
private  javax.swing.tree.DefaultMutableTreeNode _entityNode
          Node representing this entity for the information tree
private  javax.swing.tree.DefaultMutableTreeNode _keyNode
          Node representing the key for the information tree
private  java.util.ArrayList<UniqueKey> _uniqueKeys
          List of all unique keys for this entity
 
Fields inherited from class easik.sketch.vertex.SketchVertex
_marked, _name, _posX, _posY
 
Constructor Summary
EntityNode(java.lang.String nodeName)
          Creates a new entity node with the name provided.
EntityNode(java.lang.String nodeName, int x, int y)
          Creates a new enity node with the name provided.
 
Method Summary
 void addAttribute(EntityAttribute inAtt)
          Creates a new EntityAttribute and add its to the list of attributes
 void addAttribute(java.lang.String inName, DataType inAttributeType)
          Creates a new EntityAttribute and add its to the list of attributes
 void addUniqueKey(java.util.ArrayList inAtts, java.lang.String inName)
          Adds a unique key to the list
 void addUniqueKey(UniqueKey inKey)
          Adds a unique key to the list
 java.util.ArrayList getAttributes()
          Returns the list of EntityAttributes
 javax.swing.tree.DefaultMutableTreeNode getKeyNode()
          Returns the tree node used to display unique keys
 javax.swing.tree.DefaultMutableTreeNode getNode()
          Returns the tree node used to display entity
 java.util.ArrayList getUniqueKeys()
          Returns an ArrayList of the unique keys
 void removeAttribute(EntityAttribute inAttribute)
          Removes an attribute from the list
 void removeUniqueKey(UniqueKey inKey)
          Removes a unique key from the list
 void setKeyNode(javax.swing.tree.DefaultMutableTreeNode inNode)
          Sets the tree node used to display unique keys
 void setNode(javax.swing.tree.DefaultMutableTreeNode inNode)
          Sets the tree node used to display entity
 void testKeysNode()
          Test to see if the keys tree node should be visible or not
 
Methods inherited from class easik.sketch.vertex.SketchVertex
getMarked, getName, getX, getY, setMarked, setName, setX, setY, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_entityAttributes

private java.util.ArrayList<EntityAttribute> _entityAttributes
List of all attributes for this entity


_uniqueKeys

private java.util.ArrayList<UniqueKey> _uniqueKeys
List of all unique keys for this entity


_entityNode

private javax.swing.tree.DefaultMutableTreeNode _entityNode
Node representing this entity for the information tree


_keyNode

private javax.swing.tree.DefaultMutableTreeNode _keyNode
Node representing the key for the information tree

Constructor Detail

EntityNode

public EntityNode(java.lang.String nodeName)
Creates a new entity node with the name provided.

Parameters:
nodeName - The name of the new node

EntityNode

public EntityNode(java.lang.String nodeName,
                  int x,
                  int y)
Creates a new enity node with the name provided. Stores visual representation information.

Parameters:
nodeName - Name of the new node
x - X Coordinate of the new node
y - Y Coordinate of the new node
Method Detail

addAttribute

public void addAttribute(java.lang.String inName,
                         DataType inAttributeType)
Creates a new EntityAttribute and add its to the list of attributes

Parameters:
inName - Name of attribute
inAttributeType - SQL Type of the attribute

addAttribute

public void addAttribute(EntityAttribute inAtt)
Creates a new EntityAttribute and add its to the list of attributes

Parameters:
inAtt - The EntityAttribute to add to this EntityNode.

getAttributes

public java.util.ArrayList getAttributes()
Returns the list of EntityAttributes

Returns:
List of EntityAttributes

removeAttribute

public void removeAttribute(EntityAttribute inAttribute)
Removes an attribute from the list

Parameters:
inAttribute - The attribute to be removed

addUniqueKey

public void addUniqueKey(java.util.ArrayList inAtts,
                         java.lang.String inName)
Adds a unique key to the list

Parameters:
inAtts - The attributes used in the key
inName - The name of the unique key

addUniqueKey

public void addUniqueKey(UniqueKey inKey)
Adds a unique key to the list

Parameters:
inKey - The key to be added

removeUniqueKey

public void removeUniqueKey(UniqueKey inKey)
Removes a unique key from the list

Parameters:
inKey - The unique key to be removed

getUniqueKeys

public java.util.ArrayList getUniqueKeys()
Returns an ArrayList of the unique keys

Returns:
An ArrayList of the unique keys

setNode

public void setNode(javax.swing.tree.DefaultMutableTreeNode inNode)
Sets the tree node used to display entity

Parameters:
inNode - The tree node used to display entity

getNode

public javax.swing.tree.DefaultMutableTreeNode getNode()
Returns the tree node used to display entity

Returns:
The tree node used to display entity

setKeyNode

public void setKeyNode(javax.swing.tree.DefaultMutableTreeNode inNode)
Sets the tree node used to display unique keys

Parameters:
inNode - The tree node used to display unique keys

getKeyNode

public javax.swing.tree.DefaultMutableTreeNode getKeyNode()
Returns the tree node used to display unique keys

Returns:
The tree node used to display unique keys

testKeysNode

public void testKeysNode()
Test to see if the keys tree node should be visible or not