com.horstmann.violet
Class FieldNode

java.lang.Object
  extended by com.horstmann.violet.framework.AbstractNode
      extended by com.horstmann.violet.framework.RectangularNode
          extended by com.horstmann.violet.FieldNode
All Implemented Interfaces:
Node, java.io.Serializable, java.lang.Cloneable

public class FieldNode
extends RectangularNode

A field node in an object diagram.

See Also:
Serialized Form

Field Summary
static int DEFAULT_HEIGHT
           
static int DEFAULT_WIDTH
           
 
Fields inherited from class com.horstmann.violet.framework.AbstractNode
SHADOW_GAP
 
Constructor Summary
FieldNode()
           
 
Method Summary
 boolean addEdge(Edge e, java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
          Adds an edge that originates at this node.
 boolean addNode(Node n, java.awt.geom.Point2D p)
          Adds a node as a child node to this node.
 java.lang.Object clone()
           
 void draw(java.awt.Graphics2D g2)
          Draw the node.
 double getAxisX()
          Gets the x-offset of the axis (the location of the = sign) from the left corner of the bounding rectangle.
 java.awt.geom.Point2D getConnectionPoint(Direction d)
          Get the best connection point to connect this node with another node.
 MultiLineString getName()
          Gets the name property value.
 java.awt.Shape getShape()
           
 MultiLineString getValue()
          Gets the value property value.
 boolean isBoxedValue()
          Gets the boxedValue property value.
 void layout(Graph g, java.awt.Graphics2D g2, Grid grid)
          Lays out the node and its children.
 void setBoxedValue(boolean newValue)
          Sets the boxedValue property value.
 void setBoxWidth(double newValue)
          Sets the box width.
 void setName(MultiLineString newValue)
          Sets the name property value.
 void setValue(MultiLineString newValue)
          Sets the value property value.
 
Methods inherited from class com.horstmann.violet.framework.RectangularNode
contains, getBounds, setBounds, translate
 
Methods inherited from class com.horstmann.violet.framework.AbstractNode
addChild, addChild, getChildren, getParent, removeChild, removeEdge, removeNode, setParent, setPersistenceDelegate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WIDTH

public static int DEFAULT_WIDTH

DEFAULT_HEIGHT

public static int DEFAULT_HEIGHT
Constructor Detail

FieldNode

public FieldNode()
Method Detail

draw

public void draw(java.awt.Graphics2D g2)
Description copied from interface: Node
Draw the node.

Specified by:
draw in interface Node
Overrides:
draw in class AbstractNode
Parameters:
g2 - the graphics context

addEdge

public boolean addEdge(Edge e,
                       java.awt.geom.Point2D p1,
                       java.awt.geom.Point2D p2)
Description copied from interface: Node
Adds an edge that originates at this node.

Specified by:
addEdge in interface Node
Overrides:
addEdge in class AbstractNode
Parameters:
e - the edge to add
Returns:
true if the edge was added

addNode

public boolean addNode(Node n,
                       java.awt.geom.Point2D p)
Description copied from interface: Node
Adds a node as a child node to this node.

Specified by:
addNode in interface Node
Overrides:
addNode in class AbstractNode
Parameters:
n - the child node
p - the point at which the node is being added
Returns:
true if this node accepts the given node as a child

getConnectionPoint

public java.awt.geom.Point2D getConnectionPoint(Direction d)
Description copied from interface: Node
Get the best connection point to connect this node with another node. This should be a point on the boundary of the shape of this node.

Specified by:
getConnectionPoint in interface Node
Overrides:
getConnectionPoint in class RectangularNode
Parameters:
d - the direction from the center of the bounding rectangle towards the boundary
Returns:
the recommended connection point

layout

public void layout(Graph g,
                   java.awt.Graphics2D g2,
                   Grid grid)
Description copied from interface: Node
Lays out the node and its children.

Specified by:
layout in interface Node
Overrides:
layout in class RectangularNode
Parameters:
g - the ambient graph
g2 - the graphics context
grid - the grid to snap to

setName

public void setName(MultiLineString newValue)
Sets the name property value.

Parameters:
newValue - the field name

getName

public MultiLineString getName()
Gets the name property value.

Returns:
the field name

setValue

public void setValue(MultiLineString newValue)
Sets the value property value.

Parameters:
newValue - the field value

getValue

public MultiLineString getValue()
Gets the value property value.

Returns:
the field value

setBoxWidth

public void setBoxWidth(double newValue)
Sets the box width.

Parameters:
newValue - the new box width

setBoxedValue

public void setBoxedValue(boolean newValue)
Sets the boxedValue property value.

Parameters:
newValue - the new property value

isBoxedValue

public boolean isBoxedValue()
Gets the boxedValue property value.

Returns:
the property value

clone

public java.lang.Object clone()
Specified by:
clone in interface Node
Overrides:
clone in class RectangularNode

getAxisX

public double getAxisX()
Gets the x-offset of the axis (the location of the = sign) from the left corner of the bounding rectangle.

Returns:
the x-offset of the axis

getShape

public java.awt.Shape getShape()
Overrides:
getShape in class RectangularNode
Returns:
the shape to be used for computing the drop shadow