de.cau.cs.kieler.kiml.ui.diagram
Class DiagramLayoutEngine

java.lang.Object
  extended by de.cau.cs.kieler.kiml.ui.diagram.DiagramLayoutEngine

public class DiagramLayoutEngine
extends Object

The entry class for automatic layout of graphical diagrams.

Rating red

Field Summary
static DiagramLayoutEngine INSTANCE
          the singleton instance that can be used whenever layout needs to be performed.
static IProperty<IKielerProgressMonitor> PROGRESS_MONITOR
          property for layout context: the progress monitor that was used for layout.
 
Constructor Summary
DiagramLayoutEngine()
           
 
Method Summary
static int calcAnimationTime(LayoutMapping<?> mapping, boolean animate)
          Calculates animation time for the given graph size.
 LayoutOptionManager getOptionManager()
          Returns the currently used layout option manager.
<T> LayoutMapping<T>
layout(IDiagramLayoutManager<T> layoutManager, IWorkbenchPart workbenchPart, Object diagramPart, boolean animate, boolean progressBar, boolean layoutAncestors, boolean zoom, ILayoutConfig extraLayoutConfig)
          Perform layout on the given workbench part using the given layout manager.
 LayoutMapping<?> layout(IWorkbenchPart workbenchPart, Object diagramPart, boolean animate, boolean progressBar, boolean layoutAncestors, boolean zoom)
          Perform layout on the given workbench part.
 LayoutMapping<?> layout(IWorkbenchPart workbenchPart, Object diagramPart, boolean animate, boolean progressBar, boolean layoutAncestors, boolean zoom, ILayoutConfig extraLayoutConfig)
          Perform layout on the given workbench part.
 IStatus layout(LayoutMapping<?> mapping, IKielerProgressMonitor progressMonitor, ILayoutConfig extraLayoutConfig)
          Perform layout on the given layout graph mapping.
 IStatus layout(LayoutMapping<?> mapping, Object diagramPart, IKielerProgressMonitor progressMonitor, ILayoutConfig extraLayoutConfig, boolean layoutAncestors)
          Perform layout on the given layout graph mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final DiagramLayoutEngine INSTANCE
the singleton instance that can be used whenever layout needs to be performed.


PROGRESS_MONITOR

public static final IProperty<IKielerProgressMonitor> PROGRESS_MONITOR
property for layout context: the progress monitor that was used for layout.

Constructor Detail

DiagramLayoutEngine

public DiagramLayoutEngine()
Method Detail

layout

public LayoutMapping<?> layout(IWorkbenchPart workbenchPart,
                               Object diagramPart,
                               boolean animate,
                               boolean progressBar,
                               boolean layoutAncestors,
                               boolean zoom)
Perform layout on the given workbench part.

Parameters:
workbenchPart - the workbench part for which layout is performed
diagramPart - the parent diagram part for which layout is performed, or null if the whole diagram shall be layouted
animate - if true, animation is activated
progressBar - if true, a progress bar is displayed
layoutAncestors - if true, layout is not only performed for the selected diagram part, but also for its ancestors
zoom - if true, automatic zoom-to-fit is activated
Returns:
the layout mapping used in this session

layout

public LayoutMapping<?> layout(IWorkbenchPart workbenchPart,
                               Object diagramPart,
                               boolean animate,
                               boolean progressBar,
                               boolean layoutAncestors,
                               boolean zoom,
                               ILayoutConfig extraLayoutConfig)
Perform layout on the given workbench part.

Parameters:
workbenchPart - the workbench part for which layout is performed
diagramPart - the parent diagram part for which layout is performed, or null if the whole diagram shall be layouted
animate - if true, animation is activated
progressBar - if true, a progress bar is displayed
layoutAncestors - if true, layout is not only performed for the selected diagram part, but also for its ancestors
zoom - if true, automatic zoom-to-fit is activated
extraLayoutConfig - an additional layout configuration to use, or null
Returns:
the layout mapping used in this session

layout

public <T> LayoutMapping<T> layout(IDiagramLayoutManager<T> layoutManager,
                                   IWorkbenchPart workbenchPart,
                                   Object diagramPart,
                                   boolean animate,
                                   boolean progressBar,
                                   boolean layoutAncestors,
                                   boolean zoom,
                                   ILayoutConfig extraLayoutConfig)
Perform layout on the given workbench part using the given layout manager.

Type Parameters:
T - the type of diagram part that is handled by the given diagram layout manager
Parameters:
layoutManager - a diagram layout manager
workbenchPart - the workbench part for which layout is performed
diagramPart - the parent diagram part for which layout is performed, or null if the whole diagram shall be layouted
animate - if true, animation is activated
progressBar - if true, a progress bar is displayed
layoutAncestors - if true, layout is not only performed for the selected diagram part, but also for its ancestors
zoom - if true, automatic zoom-to-fit is activated
extraLayoutConfig - an additional layout configuration to use, or null
Returns:
the layout mapping used in this session

calcAnimationTime

public static int calcAnimationTime(LayoutMapping<?> mapping,
                                    boolean animate)
Calculates animation time for the given graph size.

Parameters:
mapping - a mapping of the layout graph
animate - whether animation should be performed
Returns:
number of milliseconds to animate, or 0 if no animation is desired

getOptionManager

public LayoutOptionManager getOptionManager()
Returns the currently used layout option manager.

Returns:
the layout option manager

layout

public IStatus layout(LayoutMapping<?> mapping,
                      Object diagramPart,
                      IKielerProgressMonitor progressMonitor,
                      ILayoutConfig extraLayoutConfig,
                      boolean layoutAncestors)
Perform layout on the given layout graph mapping.

Parameters:
mapping - a mapping for the layout graph
diagramPart - the parent diagram part for which layout is performed, or null if the whole diagram shall be layouted
progressMonitor - a progress monitor to which progress of the layout algorithm is reported
extraLayoutConfig - an additional layout configuration to use, or null
layoutAncestors - if true, layout is not only performed for the selected diagram part, but also for its ancestors
Returns:
a status indicating success or failure

layout

public IStatus layout(LayoutMapping<?> mapping,
                      IKielerProgressMonitor progressMonitor,
                      ILayoutConfig extraLayoutConfig)
Perform layout on the given layout graph mapping.

Parameters:
mapping - a mapping for the layout graph
progressMonitor - a progress monitor to which progress of the layout algorithm is reported
extraLayoutConfig - an additional layout configuration to use, or null
Returns:
a status indicating success or failure