com.horstmann.violet
Class NoteNode

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

public class NoteNode
extends RectangularNode

A note node in a UML diagram.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.horstmann.violet.framework.AbstractNode
SHADOW_GAP
 
Constructor Summary
NoteNode()
          Construct a note node with a default size and color
 
Method Summary
 boolean addEdge(Edge e, java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
          Adds an edge that originates at this node.
 java.lang.Object clone()
           
 void draw(java.awt.Graphics2D g2)
          Draw the node.
 java.awt.Color getColor()
          Gets the value of the color property.
 java.awt.Shape getShape()
           
 MultiLineString getText()
          Gets the value of the text property.
 void layout(Graph g, java.awt.Graphics2D g2, Grid grid)
          Lays out the node and its children.
 void removeEdge(Graph g, Edge e)
          Notifies this node that an edge is being removed.
 void setColor(java.awt.Color newValue)
          Sets the value of the color property.
 void setText(MultiLineString newValue)
          Sets the value of the text property.
 
Methods inherited from class com.horstmann.violet.framework.RectangularNode
contains, getBounds, getConnectionPoint, setBounds, translate
 
Methods inherited from class com.horstmann.violet.framework.AbstractNode
addChild, addChild, addNode, getChildren, getParent, removeChild, removeNode, setParent, setPersistenceDelegate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NoteNode

public NoteNode()
Construct a note node with a default size and color

Method Detail

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

removeEdge

public void removeEdge(Graph g,
                       Edge e)
Description copied from interface: Node
Notifies this node that an edge is being removed.

Specified by:
removeEdge in interface Node
Overrides:
removeEdge in class AbstractNode
Parameters:
g - the ambient graph
e - the edge to be removed

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

getText

public MultiLineString getText()
Gets the value of the text property.

Returns:
the text inside the note

setText

public void setText(MultiLineString newValue)
Sets the value of the text property.

Parameters:
newValue - the text inside the note

getColor

public java.awt.Color getColor()
Gets the value of the color property.

Returns:
the background color of the note

setColor

public void setColor(java.awt.Color newValue)
Sets the value of the color property.

Parameters:
newValue - the background color of the note

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

getShape

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

clone

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