Search this API

y.module
Class LayoutModule

java.lang.Object
  extended by y.module.YModule
      extended by y.module.LayoutModule
Direct Known Subclasses:
BalloonLayoutModule, BusRouterModule, ChannelEdgeRouterModule, CircularLayoutModule, ClearAreaLayoutModule, CompactOrthogonalLayoutModule, ComponentLayoutModule, CurveRoutingStageModule, DirectedOrthogonalLayoutModule, EdgeBundlingStageModule, EdgeGroupConstraintModule, FamilyTreeLayoutModule, GraphTransformerModule, GRIPModule, HierarchicLayoutModule, IncrementalHierarchicLayoutModule, LabelingModule, OrganicEdgeRouterModule, OrganicLayoutModule, OrthogonalEdgeRouterModule, OrthogonalLayoutModule, ParallelEdgeLayoutModule, PartialLayoutModule, PolylineEdgeRouterModule, PortConstraintModule, RadialLayoutModule, RandomLayoutModule, SeriesParallelLayoutModule, ShuffleLayoutModule, SmartOrganicLayoutModule, TabularLayoutModule, TreeLayoutModule, TreeMapLayoutModule

public abstract class LayoutModule
extends YModule

Common base class for modules that launch layout algorithms.

 
Your browser does not support SVG content.

Field Summary
 
Fields inherited from class y.module.YModule
FAILED, moduleListenerSupport, PRECONDITION_VIOLATED, SUCCESS
 
Constructor Summary
protected LayoutModule(java.lang.String name)
          Creates a new instance of LayoutModule.
protected LayoutModule(java.lang.String name, java.lang.String author, java.lang.String description)
          Deprecated. Use LayoutModule(String) instead. Proper module description should take place in the API documentation.
 
Method Summary
protected  void backupDataProvider(Graph2D graph, java.lang.Object providerKey)
          Backs up and removes the data provider registered for the given key.
protected  AnimationPlayer createAnimationPlayer()
          Factory method used by the layout executor that itself is used by launchLayouter(y.layout.Layouter, boolean).
protected  Graph2DLayoutExecutor createLayoutExecutor()
          Factory method for the layout executor property.
protected  LayoutMorpher createLayoutMorpher()
          Callback method used by the layout executor to create the LayoutMorpher instance that will be used for the animation of the layout.
 boolean getBufferedMode()
          Returns whether or not to perform the layout process in buffered mode.
 Graph2DLayoutExecutor getLayoutExecutor()
          Gets the Graph2DLayoutExecutor that will be used by this instance in launchLayouter(y.layout.Layouter) to execute the layout.
 boolean isAbortable()
          Returns true; LayoutModules can be aborted.
 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 restoreDataProvider(Graph2D graph, java.lang.Object providerKey)
          Restores a data provider mapping that was backed up using method backupDataProvider(y.view.Graph2D, Object).
 void setBufferedMode(boolean buffered)
          Whether or not to perform the layout process in buffered mode.
 void setLayoutExecutor(Graph2DLayoutExecutor layoutExecutor)
          Sets the layout executor that will be used in launchLayouter(y.layout.Layouter, boolean)
 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 those parts of the execution that typically need to be done on the EDT (assignment of the coordinates, creation of buffered instance, etc.).
 
Methods inherited from class y.module.YModule
addModuleListener, createOptionHandler, createThread, dispose, exceptionHappened, fitGraph2DView, getAuthor, getDescription, getExitStatus, getGraph2D, getGraph2DView, getModuleListeners, getModuleName, getOptionHandler, getTimer, getView, init, initGuiFactory, 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(java.lang.String name,
                       java.lang.String author,
                       java.lang.String description)
Deprecated. Use LayoutModule(String) instead. Proper module description should take place in the API documentation.

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

LayoutModule

protected LayoutModule(java.lang.String name)
Creates a new instance of LayoutModule.

Parameters:
name - the module's name
Method Detail

getLayoutExecutor

public Graph2DLayoutExecutor getLayoutExecutor()
Gets the Graph2DLayoutExecutor that will be used by this instance in launchLayouter(y.layout.Layouter) to execute the layout.

Returns:
The instance that will be used for the layout execution.
See Also:
createLayoutExecutor()

createLayoutExecutor

protected Graph2DLayoutExecutor createLayoutExecutor()
Factory method for the layout executor property.

Returns:
A new instance of Graph2DLayoutExecutor which uses the createAnimationPlayer() and the useEventDispatchThread() callbacks from this instance for the corresponding methods.

setLayoutExecutor

public void setLayoutExecutor(Graph2DLayoutExecutor layoutExecutor)
Sets the layout executor that will be used in launchLayouter(y.layout.Layouter, boolean)

Parameters:
layoutExecutor - The new executor to use.

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 The actual task is delegated to the layout executor instance.

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.
See Also:
Graph2DLayoutExecutor.doLayout(y.view.Graph2DView, y.layout.Layouter)

createAnimationPlayer

protected AnimationPlayer createAnimationPlayer()
Factory method used by the layout executor that itself is used by launchLayouter(y.layout.Layouter, boolean).

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

createLayoutMorpher

protected LayoutMorpher createLayoutMorpher()
Callback method used by the layout executor to create the LayoutMorpher instance that will be used for the animation of the layout.

Returns:
the created LayoutMorpher

useEventDispatchThread

protected boolean useEventDispatchThread()
Determines whether to use the EDT for the those parts of the execution that typically need to be done on the EDT (assignment of the coordinates, creation of buffered instance, etc.).

Returns:
!SwingUtilities.isEventDispatchThread() && getGraph2DView() != null && getGraph2DView().isShowing();

isAbortable

public boolean isAbortable()
Returns true; LayoutModules can be aborted.

Overrides:
isAbortable in class YModule
Returns:
true.

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.

Parameters:
buffered - whether or not to enable the buffered mode

getBufferedMode

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

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.

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.

Parameters:
enabled - whether or not to use the layout stage PortCalculator

backupDataProvider

protected void backupDataProvider(Graph2D graph,
                                  java.lang.Object providerKey)
Backs up and removes the data provider registered for the given key. (After calling this method, the given key may be used to register a temporary data provider on the specified graph.)
Use restoreDataProvider(y.view.Graph2D, Object) to restore the original data provider mapping for the specified graph.

Parameters:
graph - the affected graph
providerKey - the look-up key identifying the data to backup
Throws:
java.lang.IllegalStateException - if data for the given key has already been backed up.
See Also:
DataProvider, Graph.addDataProvider(Object, y.base.DataProvider), Graph.getDataProvider(Object)

restoreDataProvider

protected void restoreDataProvider(Graph2D graph,
                                   java.lang.Object providerKey)
Restores a data provider mapping that was backed up using method backupDataProvider(y.view.Graph2D, Object).

Parameters:
graph - the affected graph
providerKey - the look-up key identifying the data to restore
Throws:
java.lang.IllegalStateException - if there is no backup data for the given key.
See Also:
DataProvider, Graph.addDataProvider(Object, y.base.DataProvider), Graph.getDataProvider(Object)

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