|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.argouml.uml.diagram.static_structure.layout.ClassdiagramLayouter
This class implements a layout algoritms for class diagrams.
Field Summary | |
private int |
_hGap
The horizontal gap between nodes. |
private java.util.Vector |
_layoutedClassNodes
_layoutedClassNodes is a convenience which holds a subset of _layoutedObjects (only ClassNodes) |
private java.util.Vector |
_layoutedObjects
Attribute _layoutedObjects holds the objects to layout. |
private int |
_maxPackageRank
|
private int |
_vGap
The vertical gap between nodes. |
private int |
_vMax
The maximum of elements in a particular row |
static org.apache.log4j.Logger |
cat
Logger for logging events |
private UMLDiagram |
diagram
stores the current diagram * |
(package private) java.util.Collection |
nodes
stores all the nodes which will be layouted |
private int |
xPos
internal |
private int |
yPos
internal |
Constructor Summary | |
ClassdiagramLayouter(UMLDiagram theDiagram)
This constructor is mainly for convenience, so we don't have add every node manually to the layouter. |
Method Summary | |
void |
add(ClassdiagramNode obj)
Add a ClassdiagramNode to layout. |
void |
add(LayoutedObject obj)
Add a object to layout. |
private void |
centerPlacedRows()
center the rows according to the biggest/widest row. |
ClassdiagramNode |
getClassdiagramNode(int index)
Get a ClassdiagramNode from the layouted objects. |
private ClassdiagramNode |
getClassdiagramNode4owner(java.lang.Object m)
Search the nodes in this classdiagram for a node with a given owner. |
private java.util.Vector |
getClassdiagramNodes()
extract the ClassdiagramNodes from all layouted objects |
private int |
getColumns(int row)
Get the number of elements in a given row |
protected int |
getHGap()
Get the horizontal gap between nodes. |
java.awt.Dimension |
getMinimumDiagramSize()
Operation getMinimumDiagramSize returns the minimum diagram size after the layout process. |
LayoutedObject |
getObject(int index)
Operation getObject returns a object with a given index from the layouter. |
LayoutedObject[] |
getObjects()
Operation getObjects returns all the objects currently participating in the layout process. |
private ClassdiagramNode[] |
getObjectsInRow(int row)
Operation getObject InRow returns all the objects for a given row. |
private int |
getRowHeight(int row)
calculate the height of the row |
private int |
getRows()
Get the number of rows in this diagram. |
private int |
getRowWidth(int row)
calculate the width of the row |
protected int |
getVGap()
Get the vertical gap between nodes. |
void |
layout()
Operation layout implements the actual layout algorithm |
(package private) void |
layoutPackages()
position the packages of the diagram |
private void |
rankPackagesAndMoveClassesBelow()
|
void |
remove(LayoutedObject obj)
Remove a object from the layout process. |
private void |
weightAndPlaceClasses()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final org.apache.log4j.Logger cat
private UMLDiagram diagram
java.util.Collection nodes
private java.util.Vector _layoutedObjects
private java.util.Vector _layoutedClassNodes
private int _maxPackageRank
private int _hGap
private int _vGap
private int _vMax
private int xPos
private int yPos
Constructor Detail |
public ClassdiagramLayouter(UMLDiagram theDiagram)
Method Detail |
public void add(LayoutedObject obj)
add
in interface Layouter
obj
- represents the object to layout.public void add(ClassdiagramNode obj)
obj
- represents the object to layout.public void remove(LayoutedObject obj)
remove
in interface Layouter
obj
- represents the object to remove.public LayoutedObject[] getObjects()
getObjects
in interface Layouter
public LayoutedObject getObject(int index)
getObject
in interface Layouter
index
- represents the index of this object in the layouter.
public ClassdiagramNode getClassdiagramNode(int index)
index
- represents the index of this ClassdiagramNode.
private java.util.Vector getClassdiagramNodes()
public void layout()
layout
in interface Layouter
private void rankPackagesAndMoveClassesBelow()
private void weightAndPlaceClasses()
private void centerPlacedRows()
ABC DEFGH Iplace them like this:
ABC DEFGH I
void layoutPackages()
private ClassdiagramNode getClassdiagramNode4owner(java.lang.Object m)
public java.awt.Dimension getMinimumDiagramSize()
getMinimumDiagramSize
in interface Layouter
private int getRows()
private int getRowHeight(int row)
row
- the row to calculate
private int getRowWidth(int row)
row
- the row to calculate
private int getColumns(int row)
row
- The row to check.
private ClassdiagramNode[] getObjectsInRow(int row)
row
- represents the row of the returned objects.protected int getVGap()
protected int getHGap()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2004 (20040316) | ArgoUML Homepage | ArgoUML Developers' page | ArgoUML Cookbook |