org.argouml.uml.diagram.static_structure.layout
Class ClassdiagramNote

java.lang.Object
  extended byorg.argouml.uml.diagram.static_structure.layout.ClassdiagramNode
      extended byorg.argouml.uml.diagram.static_structure.layout.ClassdiagramNote
All Implemented Interfaces:
Comparable, LayoutedNode, LayoutedObject

public class ClassdiagramNote
extends ClassdiagramNode

This class overrides some of the aspects of ClassdiagramNodes to simplify the positioning of notes nearby the commented nodes.


Field Summary
static int NOCOLUMN
          Constant to be used as an initializer when this node is not placed at an column.
static int NORANK
          Constant to be used as an initializer when this node has no rank assigned yet.
static int NOWEIGHT
          Constant to be used as an initializer when this node has no weight.
 
Constructor Summary
ClassdiagramNote(org.tigris.gef.presentation.FigNode f)
           
 
Method Summary
 void addDownlink(ClassdiagramNode newDownlink)
          Operation setDownlinks changes the value of the attribute _downlinks.
 void addRank(int n)
          Add a constant to the rank of this node.
 void addUplink(ClassdiagramNode newUplink)
          Add an uplink to this node.
 float calculateWeight()
          Calculate the weight of this node.
 int compareTo(Object arg0)
          The "natural order" for ClassdiagramNodes is defined by: First standalone, then linked nodes First Packages, then Interfaces/Classes/Notes increasing rank (rownumber) decreasing weight name of model object increasing hashcode (for uniqueness)
private  ClassdiagramNode first()
          Return the first node to which this note is attached to.
 int getColumn()
          Operation getColumn returns the value of the attribute _column.
 Vector getDownlinks()
          Get the downlinks of this node.
 int getEdgeOffset()
          Get the offset which shall be used for edges with this node as parent.
 org.tigris.gef.presentation.FigNode getFigure()
          Get the underlying figure of this node
 int getLevel()
          Get the level in the inheritance hierarchy for this node.
 Point getLocation()
          Get the location of the underlying figure in the diagram.
 int getPlacementHint()
          Get the current placementhint.
 int getRank()
          Get the rank of this node.
 Dimension getSize()
          Operation getSize returns the size of the figure associated with this layout node.
 float getSubtreeWeight()
          Get the weight of the subtree defined by this node.
 int getTypeOrderNumer()
          Get the type order number of this node.
 Vector getUplinks()
          Get the uplinks of this node.
 float getWeight()
          Return the weight of this node, which is used for positioning in a row.
 boolean isComment()
          Check if this node is associated with a note.
 boolean isPackage()
          Check if this node is associated with a package.
 boolean isStandalone()
          Test whether this node has no connection to other nodes.
 void setColumn(int newColumn)
          Set the column of this node.
 void setEdgeOffset(int newOffset)
          Set the offset for edges to this node.
 void setFigure(org.tigris.gef.presentation.FigNode newFigure)
          Operation setFigure changes the value of the attribute _figure.
 void setLocation(Point newLocation)
          Operation setLocation set the new location of the associated figure in the diagram.
 void setPlacementHint(int hint)
          A placementhint gives an indication where it might be feasible to place this node.
 void setRank(int newRank)
          Operation setRank changes the value of the attribute _rank.
 void setWeight(float w)
          Set the weight for this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOCOLUMN

public static final int NOCOLUMN
Constant to be used as an initializer when this node is not placed at an column.

See Also:
Constant Field Values

NORANK

public static final int NORANK
Constant to be used as an initializer when this node has no rank assigned yet.

See Also:
Constant Field Values

NOWEIGHT

public static final int NOWEIGHT
Constant to be used as an initializer when this node has no weight.

See Also:
Constant Field Values
Constructor Detail

ClassdiagramNote

public ClassdiagramNote(org.tigris.gef.presentation.FigNode f)
Parameters:
f - the fig
Method Detail

getTypeOrderNumer

public int getTypeOrderNumer()
Description copied from class: ClassdiagramNode
Get the type order number of this node. This number may be used to influence the sort order of ClassdiagramNodes.

Overrides:
getTypeOrderNumer in class ClassdiagramNode
Returns:
Type order number
See Also:
ClassdiagramNode.getTypeOrderNumer()

calculateWeight

public float calculateWeight()
Description copied from class: ClassdiagramNode
Calculate the weight of this node. The function distinguishes between note-nodes and standard-nodes, because a note shall be positioned to the right of its first related node, if it exists. Therefor the weight is a function of the weight of the related node. For standard-nodes the weight is a function of up-/downlinks, column and uplink factor.

Overrides:
calculateWeight in class ClassdiagramNode
Returns:
The weigth of this node
See Also:
ClassdiagramNode.calculateWeight()

getRank

public int getRank()
Description copied from class: ClassdiagramNode
Get the rank of this node.

Overrides:
getRank in class ClassdiagramNode
Returns:
The rank for this node.
See Also:
ClassdiagramNode.getRank()

getWeight

public float getWeight()
Description copied from class: ClassdiagramNode
Return the weight of this node, which is used for positioning in a row.

Overrides:
getWeight in class ClassdiagramNode
Returns:
The weight of this node.
See Also:
ClassdiagramNode.getWeight()

isStandalone

public boolean isStandalone()
Description copied from class: ClassdiagramNode
Test whether this node has no connection to other nodes. Return true, if node has no connections, false otherwise

Overrides:
isStandalone in class ClassdiagramNode
Returns:
Result of test
See Also:
ClassdiagramNode.isStandalone()

first

private ClassdiagramNode first()
Return the first node to which this note is attached to.

Returns:

addDownlink

public void addDownlink(ClassdiagramNode newDownlink)
Operation setDownlinks changes the value of the attribute _downlinks.

Parameters:
newDownlink - Represents the new value of _downlinks.

addRank

public void addRank(int n)
Add a constant to the rank of this node.

Parameters:
n - The value to add.

addUplink

public void addUplink(ClassdiagramNode newUplink)
Add an uplink to this node.

Parameters:
newUplink - represents the new uplinks.

compareTo

public int compareTo(Object arg0)
The "natural order" for ClassdiagramNodes is defined by:

Specified by:
compareTo in interface Comparable
See Also:
Comparable.compareTo(java.lang.Object)

getColumn

public int getColumn()
Operation getColumn returns the value of the attribute _column.

Returns:
The value of the attribute _column.

getDownlinks

public Vector getDownlinks()
Get the downlinks of this node.

Returns:
The downlinks of this node.

getEdgeOffset

public int getEdgeOffset()
Get the offset which shall be used for edges with this node as parent.

Returns:
The offset

getFigure

public org.tigris.gef.presentation.FigNode getFigure()
Get the underlying figure of this node

Returns:
The figure

getLevel

public int getLevel()
Get the level in the inheritance hierarchy for this node.

Returns:
The level

getLocation

public Point getLocation()
Get the location of the underlying figure in the diagram.

Specified by:
getLocation in interface LayoutedNode
Returns:
The location

getPlacementHint

public int getPlacementHint()
Get the current placementhint.

Returns:
The placementhint for this node

getSize

public Dimension getSize()
Operation getSize returns the size of the figure associated with this layout node.

Specified by:
getSize in interface LayoutedNode
Returns:
The size of the associated figure.

getSubtreeWeight

public float getSubtreeWeight()
Get the weight of the subtree defined by this node. Impact on weight is decreasing with increasing hierarchical distance

Returns:
The weight of the subtree

getUplinks

public Vector getUplinks()
Get the uplinks of this node.

Returns:
The uplinks of this node.

isComment

public boolean isComment()
Check if this node is associated with a note.

Returns:
Result of test

isPackage

public boolean isPackage()
Check if this node is associated with a package.

Returns:
Result of test

setColumn

public void setColumn(int newColumn)
Set the column of this node. A re-calculation of the weight is performed, because the column is an input parameter for the weight.


setEdgeOffset

public void setEdgeOffset(int newOffset)
Set the offset for edges to this node.


setFigure

public void setFigure(org.tigris.gef.presentation.FigNode newFigure)
Operation setFigure changes the value of the attribute _figure.

Parameters:
newFigure - represents the new value of _figure.

setLocation

public void setLocation(Point newLocation)
Operation setLocation set the new location of the associated figure in the diagram.

Specified by:
setLocation in interface LayoutedNode
Parameters:
newLocation - represents the new location for this figure.

setPlacementHint

public void setPlacementHint(int hint)
A placementhint gives an indication where it might be feasible to place this node. It is used by the layouter, and there is no guarantee that it will be used.

Parameters:
hint - x coordinate of the desired placement

setRank

public void setRank(int newRank)
Operation setRank changes the value of the attribute _rank.

Parameters:
newRank - represents the new value of _rank.

setWeight

public void setWeight(float w)
Set the weight for this node.



ArgoUML © 1996-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook