Modelers

org.topcased.modeler.tools
Class AutoLayout

java.lang.Object
  extended by org.topcased.modeler.tools.AutoLayout

public class AutoLayout
extends java.lang.Object

This class computes the command that autolayouts a list of GraphNodes.
creation : 4 mai 2005


Constructor Summary
AutoLayout(org.eclipse.gef.GraphicalEditPart container, boolean fail)
          Creates an autolayout algorithm for the given diagram.
 
Method Summary
protected  org.eclipse.gef.commands.Command getCommand(org.eclipse.draw2d.graph.DirectedGraph g)
          Creates the list of commands for the given DirectedGraph
 org.eclipse.gef.commands.Command getCommand(java.util.List elements)
          Returns the autolayout command
 void setMargin(int margin)
          Define a margin in the autolayout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutoLayout

public AutoLayout(org.eclipse.gef.GraphicalEditPart container,
                  boolean fail)
Creates an autolayout algorithm for the given diagram.

Parameters:
diag - the diagram where the objects are layout
container - the container EditPart
fail - If tset to true, the autolayout will not return the command if one of the node is out of the diagram
Method Detail

getCommand

public org.eclipse.gef.commands.Command getCommand(java.util.List elements)
                                            throws BoundsFormatException
Returns the autolayout command

Parameters:
elements - the list of elements to autolayout
Returns:
the autolayout command
Throws:
BoundsFormatException

getCommand

protected org.eclipse.gef.commands.Command getCommand(org.eclipse.draw2d.graph.DirectedGraph g)
                                               throws BoundsFormatException
Creates the list of commands for the given DirectedGraph

Parameters:
g - the autolayout graph
Returns:
the command to update the model objects
Throws:
BoundsFormatException - if the object cannot be autolayout (diagram too small)

setMargin

public void setMargin(int margin)
Define a margin in the autolayout

Parameters:
margin - The margin to set.

Modelers

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.