de.uni_paderborn.fujaba.layout.classdiag
Class ClassdiagramLayouter

java.lang.Object
  extended byde.uni_paderborn.fujaba.layout.AbstractLayouter
      extended byde.uni_paderborn.fujaba.layout.classdiag.ClassdiagramLayouter
All Implemented Interfaces:
Layouter

public class ClassdiagramLayouter
extends AbstractLayouter
implements Layouter

This class implements a layout algoritms for class diagrams. 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 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 static org.apache.log4j.Logger LOG
          Logger for logging events.
private  int maxPackageRank
          No comment provided by developer, please add a comment to improve documentation.
static ClassdiagramLayouter theInstance
          Make this class a Singleton.
private  int vGap
          The vertical gap between nodes.
private  int vMax
          The maximum of elements in a particular row
private  int xPos
          internal
private  int yPos
          internal
 
Fields inherited from class de.uni_paderborn.fujaba.layout.AbstractLayouter
 
Constructor Summary
private ClassdiagramLayouter()
          Constructor for class ClassdiagramLayouter
 
Method Summary
 void add(ClassdiagramNode obj)
          Add a ClassdiagramNode to layout.
 void add(LayoutedObject obj)
          Add a object to layout.
static ClassdiagramLayouter get()
          No comment provided by developer, please add a comment to improve documentation.
 ClassdiagramNode getClassdiagramNode(int index)
          Get a ClassdiagramNode from the layouted objects.
private  ClassdiagramNode getClassdiagramNode4owner(UMLIncrement 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.
protected  int getVGap()
          Get the vertical gap between nodes.
private  void init(UMLDiagram curDiagram, int hGap, int vGap)
          This init method is mainly for convenience, so we don't have add every node manually to the layouter.
 void layout()
          Operation layout implements the actual layout algorithm.
(package private)  void layoutPackages()
          position the packages of the diagram
private  void rankPackagesAndMoveClassesBelow(java.util.HashMap maptoAssocClasses)
          No comment provided by developer, please add a comment to improve documentation.
 void reLayout(FSAContainer currentCanvas)
          No comment provided by developer, please add a comment to improve documentation.
 void remove(LayoutedObject obj)
          Remove a object from the layout process.
private  void weightAndPlaceClasses()
          No comment provided by developer, please add a comment to improve documentation.
 
Methods inherited from class de.uni_paderborn.fujaba.layout.AbstractLayouter
checkVisited, getChild, getFrame, getFromToFrame, getHorizDist, getLeft, getPreferredLen, getPresetAdjustment, getRevMyLayouter, getVertDist, innerLayout, isLastCondition, refreshOptions, removeYou, searchStart, setHorizDist, setLastCondition, setLeft, setPresetAdjustment, setRevMyLayouter, setVertDist
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theInstance

public static ClassdiagramLayouter theInstance
Make this class a Singleton.


LOG

private static final org.apache.log4j.Logger LOG
Logger for logging events.


layoutedObjects

private java.util.Vector layoutedObjects
Attribute _layoutedObjects holds the objects to layout.


layoutedClassNodes

private java.util.Vector layoutedClassNodes
_layoutedClassNodes is a convenience which holds a subset of _layoutedObjects (only ClassNodes)


maxPackageRank

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


hGap

private int hGap
The horizontal gap between nodes.


vGap

private int vGap
The vertical gap between nodes.


vMax

private int vMax
The maximum of elements in a particular row


xPos

private int xPos
internal


yPos

private int yPos
internal

Constructor Detail

ClassdiagramLayouter

private ClassdiagramLayouter()
Constructor for class ClassdiagramLayouter

Method Detail

get

public static ClassdiagramLayouter get()
No comment provided by developer, please add a comment to improve documentation.

Returns:
No description provided

init

private void init(UMLDiagram curDiagram,
                  int hGap,
                  int vGap)
This init method is mainly for convenience, so we don't have add every node manually to the layouter.

Parameters:
curDiagram - No description provided
hGap - No description provided
vGap - No description provided

add

public void add(LayoutedObject obj)
Add a object to layout.

Specified by:
add in interface Layouter
Parameters:
obj - represents the object to layout.

add

public void add(ClassdiagramNode obj)
Add a ClassdiagramNode to layout.

Parameters:
obj - represents the object to layout.

remove

public void remove(LayoutedObject obj)
Remove a object from the layout process.

Specified by:
remove in interface Layouter
Parameters:
obj - represents the object to remove.

getObjects

public LayoutedObject[] getObjects()
Operation getObjects returns all the objects currently participating in the layout process.

Specified by:
getObjects in interface Layouter
Returns:
An array holding all the object in the layouter.

getObject

public LayoutedObject getObject(int index)
Operation getObject returns a object with a given index from the layouter.

Specified by:
getObject in interface Layouter
Parameters:
index - represents the index of this object in the layouter.
Returns:
The LayoutedObject for the given index.

getClassdiagramNode

public ClassdiagramNode getClassdiagramNode(int index)
Get a ClassdiagramNode from the layouted objects.

Parameters:
index - represents the index of this ClassdiagramNode.
Returns:
The ClassdiagramNode for this index.

getClassdiagramNodes

private java.util.Vector getClassdiagramNodes()
extract the ClassdiagramNodes from all layouted objects

Returns:
The classdiagramNodes value

layout

public void layout()
Operation layout implements the actual layout algorithm.

Specified by:
layout in interface Layouter

rankPackagesAndMoveClassesBelow

private void rankPackagesAndMoveClassesBelow(java.util.HashMap maptoAssocClasses)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
maptoAssocClasses - No description provided

weightAndPlaceClasses

private void weightAndPlaceClasses()
No comment provided by developer, please add a comment to improve documentation.


layoutPackages

void layoutPackages()
position the packages of the diagram


getClassdiagramNode4owner

private ClassdiagramNode getClassdiagramNode4owner(UMLIncrement m)
Search the nodes in this classdiagram for a node with a given owner.

Parameters:
m - No description provided
Returns:
The classdiagram node for this owner, if it's in this diagram, or null if not.

getMinimumDiagramSize

public java.awt.Dimension getMinimumDiagramSize()
Operation getMinimumDiagramSize returns the minimum diagram size after the layout process.

Specified by:
getMinimumDiagramSize in interface Layouter
Returns:
The minimum diagram size after the layout process.

getRows

private int getRows()
Get the number of rows in this diagram.

Returns:
The number of rows in this layout.

getRowHeight

private int getRowHeight(int row)
calculate the height of the row

Parameters:
row - the row to calculate
Returns:
the height

getColumns

private int getColumns(int row)
Get the number of elements in a given row

Parameters:
row - The row to check.
Returns:
The number of elements in the given row.

getObjectsInRow

private ClassdiagramNode[] getObjectsInRow(int row)
Operation getObject InRow returns all the objects for a given row.

Parameters:
row - represents the row of the returned objects.
Returns:
The objectsInRow value

getVGap

protected int getVGap()
Get the vertical gap between nodes.

Returns:
The vertical gap between nodes.

getHGap

protected int getHGap()
Get the horizontal gap between nodes.

Returns:
The horizontal gap between nodes.

reLayout

public void reLayout(FSAContainer currentCanvas)
              throws java.lang.InterruptedException
No comment provided by developer, please add a comment to improve documentation.

Specified by:
reLayout in class AbstractLayouter
Parameters:
currentCanvas - No description provided
Throws:
java.lang.InterruptedException - Exception description not provided