y.module
Class LayoutModule

java.lang.Object
  extended by y.module.YModule
      extended by y.module.LayoutModule
Direct Known Subclasses:
ChannelEdgeRouterModule, CircularLayoutModule, CompactOrthogonalLayoutModule, ComponentLayoutModule, DirectedOrthogonalLayoutModule, EdgeGroupConstraintModule, FamilyTreeLayoutModule, GraphTransformerModule, GRIPModule, HierarchicLayoutModule, IncrementalHierarchicLayoutModule, OrganicEdgeRouterModule, OrganicLayoutModule, OrthogonalEdgeRouterModule, OrthogonalLayoutModule, ParallelEdgeLayoutModule, PortConstraintModule, RandomLayoutModule, ShuffleLayoutModule, SmartOrganicLayoutModule, TreeLayoutModule

public abstract class LayoutModule
extends YModule

Common base class for modules that launch layout algorithms.

 

Field Summary
 
Fields inherited from class y.module.YModule
FAILED, moduleListenerSupport, PRECONDITION_VIOLATED, SUCCESS
 
Constructor Summary
protected LayoutModule(String name, String author, String description)
          Creates a new instance of LayoutModule.
 
Method Summary
protected  AnimationPlayer createAnimationPlayer()
          Factory method used by performAnimation(y.view.Graph2DView, y.layout.GraphLayout).
protected  LayoutMorpher createLayoutMorpher(Graph2DView view, GraphLayout result)
          Factory method used by performAnimation(y.view.Graph2DView, y.layout.GraphLayout).
 boolean getBufferedMode()
          Returns whether or not to perform the layout process in buffered mode.
 boolean isAbortable()
          LayoutModules are abortable.
 boolean isMorphingEnabled()
          Getter for property morphingEnabled.
 boolean isPortIntersectionCalculatorEnabled()
          Returns the value of property portIntersectionCalculatorEnabled.
protected  void launchLayouter(Layouter layouter)
          Triggers the specified Layouter's Layouter.doLayout(y.layout.LayoutGraph) method on the Graph2D instance associated with this module.
protected  void launchLayouter(Layouter layouter, boolean buffered)
          Triggers the specified Layouter's Layouter.doLayout(y.layout.LayoutGraph) method on the Graph2D instance associated with this module after determining and applying this module's context settings.
protected  void performAnimation(Graph2DView graph2DView, GraphLayout result)
          Callback to perform the actual animation / morphing.
 void setBufferedMode(boolean buffered)
          Whether or not to perform the layout process in buffered mode.
 void setMorphingEnabled(boolean morphingEnabled)
          Setter for property morphingEnabled.
 void setPortIntersectionCalculatorEnabled(boolean enabled)
          Sets whether or not layout stage PortCalculator should be automatically prepended to the layouter before it is invoked.
protected  boolean useEventDispatchThread()
          Determines whether to use the EDT for the final assignment of the coordinates if this module is run in buffered mode.
 
Methods inherited from class y.module.YModule
addModuleListener, createOptionHandler, createThread, dispose, exceptionHappened, fitGraph2DView, getAuthor, getDescription, getExitStatus, getGraph2D, getGraph2DView, getModuleName, getOptionHandler, getTimer, getView, init, isBackupRealizersEnabled, mainrun, removeModuleListener, run, setBackupRealizersEnabled, setExitStatus, setGraph2D, setModuleName, setOptionHandler, start, startAsThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LayoutModule

protected LayoutModule(String name,
                       String author,
                       String description)
Creates a new instance of LayoutModule.

Parameters:
name - the module's name
author - the module's author
description - a short description of the module's functionality
Method Detail

launchLayouter

protected void launchLayouter(Layouter layouter)
Triggers the specified Layouter's Layouter.doLayout(y.layout.LayoutGraph) method on the Graph2D instance associated with this module. This method is the equivalent of launchLayouter(layouter,bufferedMode);.

Parameters:
layouter - the layout algorithm to be applied to this module's graph
See Also:
launchLayouter(y.layout.Layouter, boolean)

launchLayouter

protected void launchLayouter(Layouter layouter,
                              boolean buffered)
Triggers the specified Layouter's Layouter.doLayout(y.layout.LayoutGraph) method on the Graph2D instance associated with this module after determining and applying this module's context settings. This includes

Parameters:
layouter - the layout algorithm to be applied to this module's graph
buffered - specifies whether to calculate the layout for this module's graph in buffered mode. Buffered mode means that the actual layout calculation is done on a copy of this module's graph and the calculated layout information is applied to this module's graph only after the layout algorithm has finished.

performAnimation

protected void performAnimation(Graph2DView graph2DView,
                                GraphLayout result)
Callback to perform the actual animation / morphing. This method will be called if isMorphingEnabled() yields true.

Parameters:
graph2DView - the view to apply the morphing to
result - the GraphLayout result to use for the morphing

createAnimationPlayer

protected AnimationPlayer createAnimationPlayer()
Factory method used by performAnimation(y.view.Graph2DView, y.layout.GraphLayout).

Returns:
an AnimationPlayer that will be used to animate the LayoutMorpher

createLayoutMorpher

protected LayoutMorpher createLayoutMorpher(Graph2DView view,
                                            GraphLayout result)
Factory method used by performAnimation(y.view.Graph2DView, y.layout.GraphLayout).

Parameters:
view - the view to apply the morphing to
result - the GraphLayout result to use for the morphing
Returns:
a readily configured LayoutMorpher instance

useEventDispatchThread

protected boolean useEventDispatchThread()
Determines whether to use the EDT for the final assignment of the coordinates if this module is run in buffered mode. This implementation returns !SwingUtilities.isEventDispatchThread() && getGraph2DView().isShowing();


isAbortable

public boolean isAbortable()
LayoutModules are abortable.

Overrides:
isAbortable in class YModule

setBufferedMode

public void setBufferedMode(boolean buffered)
Whether or not to perform the layout process in buffered mode. When in buffered mode the layout call will be wrapped by an instance of BufferedLayouter. Layout morphing can only be performed when in buffered mode.

By default the layout module will perform in buffered mode.


getBufferedMode

public boolean getBufferedMode()
Returns whether or not to perform the layout process in buffered mode.


isMorphingEnabled

public boolean isMorphingEnabled()
Getter for property morphingEnabled.

Returns:
Value of property morphingEnabled.

setMorphingEnabled

public void setMorphingEnabled(boolean morphingEnabled)
Setter for property morphingEnabled.

Parameters:
morphingEnabled - New value of property morphingEnabled.

isPortIntersectionCalculatorEnabled

public boolean isPortIntersectionCalculatorEnabled()
Returns the value of property portIntersectionCalculatorEnabled.

See Also:
setPortIntersectionCalculatorEnabled(boolean)

setPortIntersectionCalculatorEnabled

public void setPortIntersectionCalculatorEnabled(boolean enabled)
Sets whether or not layout stage PortCalculator should be automatically prepended to the layouter before it is invoked. If no IntersectionCalculator DataProviders are registered with the graph, this class will use DataProviders of type NodeRealizerIntersectionCalculator. By default this feature is disabled.


© Copyright 2000-2008,
yWorks GmbH.
All rights reserved.