de.uni_paderborn.fujaba.layout.classdiag
Class ClassdiagramNode

java.lang.Object
  extended byde.uni_paderborn.fujaba.layout.classdiag.ClassdiagramNode
All Implemented Interfaces:
LayoutedNode, LayoutedObject

class ClassdiagramNode
extends java.lang.Object
implements LayoutedNode

This class represents a node in the classdiagram (a class, interface or package). The class has been taken from Argo UML source code.

Version:
$Revision: 1.1 $ $Date: 2005/01/24 12:30:48 $
Author:
$Author: joerg $

Field Summary
private  int column
          Attribute _column represents the current column of this node.
private  java.util.Vector downlinks
          Attribute _downlinks represents the links I consider as an 'downlink'.
private  FSAPanel figure
          Attribute _figure represents the figure, that this ClassdiagramNode represents during the layout process.
private  boolean movable
          a Node is movable when it has associations and no up- or downlinks.
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.
private  int placementHint
          No comment provided by developer, please add a comment to improve documentation.
private  int rank
          Attribute _rank represents the current rank of this node.
private  java.util.Vector uplinks
          Attribute _uplinks represents the links I consider as an 'uplink'.
private  float weight
          This attributes stores the 'weight' of this node.
 
Constructor Summary
ClassdiagramNode(FSAPanel f)
          Operation ClassdiagramNode creates a new ClassdiagramNode.
 
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.
 int getColumn()
          Operation getColumn returns the value of the attribute _column.
 ClassdiagramNode getDownlink(int i)
          Get the downlink for a given index.
 java.util.Vector getDownlinks()
          Operation getDownlinks returns the value of the attribute _downlinks.
 FSAPanel getFigure()
          Operation getFigure returns the value of the attribute _figure.
 java.awt.Point getLocation()
          Operation getLocation returns the location of the associated figure in the diagram.
 int getPlacementHint()
          get the current placementhint.
 int getRank()
          Compute or just return the rank of this node.
 int getRealRank()
          Get the realRank attribute of the ClassdiagramNode object
 java.awt.Dimension getSize()
          Operation getSize returns the size of the figure associated with this layout node.
 ClassdiagramNode getUplink(int i)
          Get the uplink for a given index.
 java.util.Vector getUplinks()
          Operation getUplinks returns the value of the attribute _uplinks.
 float getWeight()
          Return the weight of this node.
 boolean isMovable()
          a node is movable when it hasn't got any up- or downlinks.
(package private)  boolean isPackage()
          Check if this node is associated with a package.
 void setColumn(int newColumn)
          Operation setColumn changes the value of the attribute _column.
 void setFigure(FSAPanel newFigure)
          Operation setFigure changes the value of the attribute _figure.
 void setLocation(java.awt.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 a new weight for this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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

rank

private int rank
Attribute _rank represents the current rank of this node.


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

column

private int column
Attribute _column represents the current column of this node.


uplinks

private java.util.Vector uplinks
Attribute _uplinks represents the links I consider as an 'uplink'. An uplink is a link going to a superclass or a interface that this class implements. Figures that are usually placed above this figure.


downlinks

private java.util.Vector downlinks
Attribute _downlinks represents the links I consider as an 'downlink'. The opposite of an uplink. See explanation above.


figure

private FSAPanel figure
Attribute _figure represents the figure, that this ClassdiagramNode represents during the layout process.


weight

private float weight
This attributes stores the 'weight' of this node. This is a computed attribute that is used during the horizontal placement process. It's based on the position of the 'uplinked' objects. The actual purpose is to minimize the number of link crossings in the diagram. Since we don't compute the actual number of link crossings, we look where our uplinked objects are, and then try to place our object in a way, that we can expect to have a minimal number of crossings.


movable

private boolean movable
a Node is movable when it has associations and no up- or downlinks. The logic behind this is, that we would like to move nodes which were skipped during the rankking process to a position where they are as close as possible to the respective(s) nodes they share an association to


placementHint

private int placementHint
No comment provided by developer, please add a comment to improve documentation.

Constructor Detail

ClassdiagramNode

public ClassdiagramNode(FSAPanel f)
Operation ClassdiagramNode creates a new ClassdiagramNode.

Parameters:
f - represents the figure in the diagram, that peers this layout node.
Method Detail

getSize

public java.awt.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.

getLocation

public java.awt.Point getLocation()
Operation getLocation returns the location of the associated figure in the diagram.

Specified by:
getLocation in interface LayoutedNode
Returns:
The location of the associated figure.

setLocation

public void setLocation(java.awt.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.

isPackage

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

Returns:
true, if this node is associated with a package, false otherwise.

getRealRank

public int getRealRank()
Get the realRank attribute of the ClassdiagramNode object

Returns:
The realRank value

getRank

public int getRank()
Compute or just return the rank of this node.

Returns:
The rank for this node.

setRank

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

Parameters:
newRank - represents the new value of _rank.

addRank

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

Parameters:
n - The value to add.

getColumn

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

Returns:
The value of the attribute _column.

setColumn

public void setColumn(int newColumn)
Operation setColumn changes the value of the attribute _column.

Parameters:
newColumn - represents the new value of _column.

getUplinks

public java.util.Vector getUplinks()
Operation getUplinks returns the value of the attribute _uplinks.

Returns:
The value of the attribute _uplinks.

getUplink

public ClassdiagramNode getUplink(int i)
Get the uplink for a given index.

Parameters:
i - The index of this uplink.
Returns:
The ClassdiagramNode for this uplink.

addUplink

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

Parameters:
newUplink - represents the new uplinks.

getDownlinks

public java.util.Vector getDownlinks()
Operation getDownlinks returns the value of the attribute _downlinks.

Returns:
The value of the attribute _downlinks.

getDownlink

public ClassdiagramNode getDownlink(int i)
Get the downlink for a given index.

Parameters:
i - The index of this downlink.
Returns:
The ClassdiagramNode of this downlink.

addDownlink

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

Parameters:
newDownlink - Represents the new value of _downlinks.

getFigure

public FSAPanel getFigure()
Operation getFigure returns the value of the attribute _figure.

Returns:
The value of the attribute _figure.

setFigure

public void setFigure(FSAPanel newFigure)
Operation setFigure changes the value of the attribute _figure.

Parameters:
newFigure - represents the new value of _figure.

getWeight

public float getWeight()
Return the weight of this node.

Returns:
The weight of this node.

setWeight

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

Parameters:
w - The new weight of this node.

isMovable

public boolean isMovable()
a node is movable when it hasn't got any up- or downlinks.

Returns:
whether the node is movable

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

getPlacementHint

public int getPlacementHint()
get the current placementhint.

Returns:
The placementHint value