de.cau.cs.kieler.kiml.graphiti
Class GraphitiDiagramLayoutManager

java.lang.Object
  extended by de.cau.cs.kieler.kiml.ui.diagram.GefDiagramLayoutManager<org.eclipse.graphiti.mm.pictograms.PictogramElement>
      extended by de.cau.cs.kieler.kiml.graphiti.GraphitiDiagramLayoutManager
All Implemented Interfaces:
IDiagramLayoutManager<org.eclipse.graphiti.mm.pictograms.PictogramElement>

public class GraphitiDiagramLayoutManager
extends GefDiagramLayoutManager<org.eclipse.graphiti.mm.pictograms.PictogramElement>

Generic layout manager implementation for Graphiti diagrams.

Rating red

Field Summary
static IProperty<List<org.eclipse.graphiti.mm.pictograms.Connection>> CONNECTIONS
          list of all connections in the diagram.
static IProperty<org.eclipse.graphiti.ui.editor.DiagramEditor> DIAGRAM_EDITOR
          diagram editor of the currently layouted diagram.
static IProperty<Command> LAYOUT_COMMAND
          the command that is executed for applying automatic layout.
 
Constructor Summary
GraphitiDiagramLayoutManager()
           
 
Method Summary
protected  void applyLayout(LayoutMapping<org.eclipse.graphiti.mm.pictograms.PictogramElement> mapping)
          Apply the transferred layout to the original diagram.
 LayoutMapping<org.eclipse.graphiti.mm.pictograms.PictogramElement> buildLayoutGraph(IWorkbenchPart workbenchPart, Object diagramPart)
          Build a KGraph instance for the given diagram.
static KInsets calcInsets(org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm graphicsAlgorithm)
          Calculate insets from an invisible rectangle to the first visible shape.
 IMutableLayoutConfig getLayoutConfig()
          Return a framework-specific layout configuration.
 boolean supports(Object object)
          Determine whether this layout manager is able to perform layout for the given object.
protected  void transferLayout(LayoutMapping<org.eclipse.graphiti.mm.pictograms.PictogramElement> mapping)
          Transfer all layout data from the last created KGraph instance to the original diagram.
 
Methods inherited from class de.cau.cs.kieler.kiml.ui.diagram.GefDiagramLayoutManager
applyLayout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIAGRAM_EDITOR

public static final IProperty<org.eclipse.graphiti.ui.editor.DiagramEditor> DIAGRAM_EDITOR
diagram editor of the currently layouted diagram.


LAYOUT_COMMAND

public static final IProperty<Command> LAYOUT_COMMAND
the command that is executed for applying automatic layout.


CONNECTIONS

public static final IProperty<List<org.eclipse.graphiti.mm.pictograms.Connection>> CONNECTIONS
list of all connections in the diagram.

Constructor Detail

GraphitiDiagramLayoutManager

public GraphitiDiagramLayoutManager()
Method Detail

supports

public boolean supports(Object object)
Determine whether this layout manager is able to perform layout for the given object.

Parameters:
object - a workbench part or edit part
Returns:
true if this layout manager supports the object

buildLayoutGraph

public LayoutMapping<org.eclipse.graphiti.mm.pictograms.PictogramElement> buildLayoutGraph(IWorkbenchPart workbenchPart,
                                                                                           Object diagramPart)
Build a KGraph instance for the given diagram. The resulting layout graph should reflect the structure of the original diagram.

Parameters:
workbenchPart - the workbench part for which layout is performed
diagramPart - the parent object for which layout is performed, or null if the whole diagram shall be layouted
Returns:
a layout graph mapping

transferLayout

protected void transferLayout(LayoutMapping<org.eclipse.graphiti.mm.pictograms.PictogramElement> mapping)
Transfer all layout data from the last created KGraph instance to the original diagram. The diagram is not modified yet, but all required preparations are performed.

Specified by:
transferLayout in class GefDiagramLayoutManager<org.eclipse.graphiti.mm.pictograms.PictogramElement>
Parameters:
mapping - a layout mapping that was created by this layout manager

applyLayout

protected void applyLayout(LayoutMapping<org.eclipse.graphiti.mm.pictograms.PictogramElement> mapping)
Apply the transferred layout to the original diagram. This final step is where the actual change to the diagram is done.

Specified by:
applyLayout in class GefDiagramLayoutManager<org.eclipse.graphiti.mm.pictograms.PictogramElement>
Parameters:
mapping - a layout mapping that was created by this layout manager

getLayoutConfig

public IMutableLayoutConfig getLayoutConfig()
Return a framework-specific layout configuration.

Returns:
a layout configuration for this diagram layout manager

calcInsets

public static KInsets calcInsets(org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm graphicsAlgorithm)
Calculate insets from an invisible rectangle to the first visible shape.

Parameters:
graphicsAlgorithm - the parent graphics algorithm
Returns:
the insets