gov.nih.nci.cagrid.graph.uml.classdiagram
Class ClassdiagramLayouter

java.lang.Object
  extended by gov.nih.nci.cagrid.graph.uml.classdiagram.ClassdiagramLayouter
All Implemented Interfaces:
Layouter

public class ClassdiagramLayouter
extends java.lang.Object
implements Layouter

This class implements a layout algorithm for class diagrams.

The layout process is performed in a row by row way. The position of the nodes in a row are set using the sequence given by the natural order of the nodes.

The resulting layout sequence:

  1. Standalone (i.e. without links) nodes first, followed by linked nodes
  2. Ordered by node-typ: package, interface, class, other
  3. Increasing level in link-hierarchy - root elements first
  4. Decreasing amount of weighted links
  5. Ascending name of model object

See Also:
ClassdiagramNode.compareTo(java.lang.Object)

Constructor Summary
ClassdiagramLayouter()
          Constructor for the layouter.
 
Method Summary
 void add(LayoutedObject obj)
          Add an object to layout.
 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.
 void layout()
          Operation layout implements the actual layout algorithm.
 void remove(LayoutedObject obj)
          Remove an object from the layout process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassdiagramLayouter

public ClassdiagramLayouter()
Constructor for the layouter. Takes a diagram as input to extract all LayoutedObjects, which will be layouted.

Parameters:
theDiagram - The diagram to layout.
Method Detail

add

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

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

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.

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.

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.

layout

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

Specified by:
layout in interface Layouter

remove

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

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