de.cau.cs.kieler.kiml
Class AbstractLayoutProvider

java.lang.Object
  extended by de.cau.cs.kieler.kiml.AbstractLayoutProvider
Direct Known Subclasses:
BoxLayoutProvider, Draw2DLayoutProvider, FixedLayoutProvider, ForceLayoutProvider, GraphvizLayoutProvider, HierarchicalDataflowLayoutProvider, LayeredLayoutProvider, OgdfLayoutProvider, RandomLayoutProvider

public abstract class AbstractLayoutProvider
extends Object

A layout provider executes a layout algorithm to layout the child elements of a node.

When used in Eclipse, layout providers must register through the layoutProviders extension point. All layout providers published to Eclipse this way are collected in the LayoutDataService singleton, provided the UI plugin is loaded.

Rating proposed yellow
(2011-01-17) reviewed by haf, cmot, soh

Constructor Summary
AbstractLayoutProvider()
           
 
Method Summary
 void dispose()
          Dispose the layout provider by releasing any resources that are held.
abstract  void doLayout(KNode parentNode, IKielerProgressMonitor progressMonitor)
          Performs the actual layout process, that is attaches layout information to the given node object.
 IDebugCanvas getDebugCanvas()
          Returns the current debug canvas.
 void initialize(String parameter)
          Initialize the layout provider with the given parameter.
 void setDebugCanvas(IDebugCanvas thedebugCanvas)
          Sets the current debug canvas.
 boolean supportsHierarchy(KNode layoutNode)
          Determines whether this layout provider would handle the complete hierarchy of the given layout node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLayoutProvider

public AbstractLayoutProvider()
Method Detail

initialize

public void initialize(String parameter)
Initialize the layout provider with the given parameter.

Parameters:
parameter - a string used to parameterize the layout provider instance

dispose

public void dispose()
Dispose the layout provider by releasing any resources that are held.


doLayout

public abstract void doLayout(KNode parentNode,
                              IKielerProgressMonitor progressMonitor)
Performs the actual layout process, that is attaches layout information to the given node object.

Parameters:
parentNode - the parent node which should be laid out
progressMonitor - progress monitor used to keep track of progress
Throws:
UnsupportedGraphException - if the given KGraph is not supported by this algorithm

supportsHierarchy

public boolean supportsHierarchy(KNode layoutNode)
Determines whether this layout provider would handle the complete hierarchy of the given layout node. If it does, it is expected to layout not only the first hierarchy level of the input graph, but also all its children.

Parameters:
layoutNode - the parent node for which layout is requested
Returns:
true if the layout provider supports hierarchy

setDebugCanvas

public final void setDebugCanvas(IDebugCanvas thedebugCanvas)
Sets the current debug canvas. Should not be used by subclasses.

Parameters:
thedebugCanvas - the debug canvas

getDebugCanvas

public final IDebugCanvas getDebugCanvas()
Returns the current debug canvas. A debug canvas can be used to draw something onto the diagram that is layouted in order to analyze and debug the layout algorithm code. {@link IDebugCanvas#setOffset(KNode, float, float) should be set before anything is drawn.

Returns:
the debug canvas