|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.Graph2DLayoutExecutor
public class Graph2DLayoutExecutor
Convenience class for executing or launching layouts
on a graph
.
This class performs all commonly necessary preparation steps that are needed to calculate a layout
for a Graph2D
instance.
Several modes
are available that cover the most common use-cases.
Instances of this class can be configured and reused to perform multiple layout runs via one of the
doLayout
methods.
The recommended way of calculating a layout for Graph2D
instances is thus:
new Graph2DLayoutExecutor().doLayout(graph, layouter);
and if the graph is shown in a Graph2DView
:
view.doLayout(layouter); // equivalent to new Graph2DLayoutExecutor(Graph2DLayoutExecutor.DIRECT).doLayout(view, layouter);
doLayout(Graph2D, Layouter)
,
doLayout(Graph2DView, Layouter)
,
Graph2DView.applyLayout(Layouter)
,
Graph2DView.applyLayoutAnimated(Layouter)
Nested Class Summary | |
---|---|
static interface |
Graph2DLayoutExecutor.ExceptionListener
Interface used to report Exception s or Error s that happen during calls
to doLayout(Graph2D, Layouter, Runnable, y.view.Graph2DLayoutExecutor.ExceptionListener) . |
static interface |
Graph2DLayoutExecutor.LayoutThreadHandle
The interface of the handle that is returned by doLayout(Graph2DView, y.layout.Layouter, Runnable, y.view.Graph2DLayoutExecutor.ExceptionListener)
that can be used to query the state of the layout calculation. |
Field Summary | |
---|---|
static byte |
ANIMATED
Mode constant for use in setMode(byte) and getMode() that tells the executor to
run a buffered layout and then morph
the current graph to the newly calculated layout. |
static byte |
ANIMATED_THREADED
Mode constant for use in setMode(byte) and getMode() that tells the executor to
run a buffered layout and then morph
the current graph to the newly calculated layout. |
static byte |
BUFFERED
Mode constant for use in setMode(byte) and getMode() that tells the executor to
run a buffered layout and then apply
the calculated results to the graph. |
static byte |
THREADED
Mode constant for use in setMode(byte) and getMode() that tells the executor to
run a buffered layout and then apply
the calculated results to the graph. |
static byte |
UNBUFFERED
Mode constant for use in setMode(byte) and getMode() that tells the executor to
run the layout directly on Graph2D instance without buffering . |
Constructor Summary | |
---|---|
Graph2DLayoutExecutor()
Creates a new instance of Graph2DLayoutExecutor in ANIMATED mode. |
|
Graph2DLayoutExecutor(byte mode)
Creates a new instance of Graph2DLayoutExecutor in the provided mode. |
Method Summary | |
---|---|
protected void |
applyGraphLayout(Graph2D graph,
GraphLayout layout)
Applies the specified layout to the given graph. |
protected void |
configureComponentLayouter(Graph2DView view,
ComponentLayouter cl)
Callback that configures the ComponentLayouter according to the view. |
protected AnimationObject |
createAnimation(Graph2DView view,
Graph2D graph,
GraphLayout graphLayout)
Creates the AnimationObject that will be used after the layout has been calculated. |
protected AnimationPlayer |
createAnimationPlayer()
Factory method used for the LayoutMorpher to play the animation. |
protected LayoutMorpher |
createLayoutMorpher()
Factory method used to initialize the layout morpher
used for the animation. |
void |
doLayout(Graph2D graph,
Layouter layouter)
Calculates a layout without animating it. |
void |
doLayout(Graph2D graph,
Layouter layouter,
java.lang.Runnable doneListener,
Graph2DLayoutExecutor.ExceptionListener exceptionListener)
Calculates a layout without animating it. |
void |
doLayout(Graph2DView view,
Graph2D graph,
Layouter layouter)
Calculates a layout and applies it to the graph in the view. |
Graph2DLayoutExecutor.LayoutThreadHandle |
doLayout(Graph2DView view,
Graph2D graph,
Layouter layouter,
java.lang.Runnable doneListener,
Graph2DLayoutExecutor.ExceptionListener exceptionListener)
Calculates a layout and applies it to the provided graph in the provided view. |
void |
doLayout(Graph2DView view,
Layouter layouter)
Calculates a layout and applies it to the graph in the view. |
Graph2DLayoutExecutor.LayoutThreadHandle |
doLayout(Graph2DView view,
Layouter layouter,
java.lang.Runnable doneListener,
Graph2DLayoutExecutor.ExceptionListener exceptionListener)
Calculates a layout and applies it to the graph in the view. |
AbortHandler |
getDefaultAbortHandler()
Returns the default AbortHandler created for this Graph2DLayoutExecutor instance. |
LayoutMorpher |
getLayoutMorpher()
Yields the LayoutMorpher instance that is used by this instance to perform the animation
if this instance is in ANIMATED or ANIMATED_THREADED mode . |
byte |
getMode()
Returns the mode this instance has been created for. |
NodePortLayoutConfigurator |
getNodePortConfigurator()
Yields the NodePortLayoutConfigurator that is used by this
instance to prepare the graph for the layout. |
TableLayoutConfigurator |
getTableLayoutConfigurator()
Yields the TableLayoutConfigurator that is used by this instance
to prepare the graph for the layout. |
boolean |
isAddingSelectedItemsProvider()
Determines whether the Layouter.SELECTED_NODES and Layouter.SELECTED_EDGES data provider
instances should be registered with the graph to pass the current selection state to the layout algorithm. |
boolean |
isBackupRealizersEnabled()
Returns whether or not this layout executor will ask the given graph to backup all its realizers before it starts acting upon the graph. |
boolean |
isConfiguringComponentLayouter()
Determines whether this instance uses method configureComponentLayouter(Graph2DView, y.layout.ComponentLayouter)
to configure the current instance of the ComponentLayouter . |
boolean |
isConfiguringGrouping()
Determines whether this instance uses the GroupLayoutConfigurator
to prepare the graph for the calculation of a grouped Graph2D that has an associated
HierarchyManager . |
boolean |
isConfiguringNodePorts()
Determines whether or not this instance uses the NodePortLayoutConfigurator to prepare
the node ports of the graph for layout calculation. |
boolean |
isConfiguringTableNodeRealizers()
Determines whether this instance uses the TableLayoutConfigurator
to prepare the graph for the calculation of PartitionGrid s
based on the information available in the TableGroupNodeRealizer instances. |
boolean |
isLockingView()
Determines whether this mode should try to lock(y.view.Graph2DView, java.util.Map) and unlock(y.view.Graph2DView, java.util.Map) the Graph2DView
during the calculation of the layout. |
boolean |
isPortIntersectionCalculatorEnabled()
Determines whether a PortCalculator should be used to adjust port positions after the main
layout to lie on the visible boundaries of the NodeRealizer s. |
protected void |
lock(Graph2DView view,
java.util.Map lockState)
Called during one of the doLayout(Graph2DView, y.layout.Layouter) calls
on the EDT to lock the Graph2DView from receiving further input. |
protected GroupLayoutConfigurator |
prepareGroupLayoutConfigurator(Graph2DView view,
Graph2D graph,
Layouter layouter)
Callback method that creates a GroupLayoutConfigurator , and
prepares the graph for the layout. |
protected NodePortLayoutConfigurator |
prepareNodePortConfigurator(Graph2DView view,
Graph2D graph,
Layouter layouter)
Callback method that uses the NodePortConfigurator to prepare the graph for the layout. |
protected TableLayoutConfigurator |
prepareTableConfigurator(Graph2DView view,
Graph2D graph,
Layouter layouter)
Callback method that uses the TableLayoutConfigurator to
prepare the graph for the layout. |
protected void |
restoreGroupLayoutConfigurator(Graph2D graph,
GroupLayoutConfigurator configurator)
Callback that calls GroupLayoutConfigurator.restoreAll()
after the layout is done. |
protected void |
restoreNodePortConfigurator(Graph2D graph,
NodePortLayoutConfigurator configurator)
Callback that calls NodePortLayoutConfigurator.restoreAll(Graph2D)
after the layout is done. |
protected void |
restoreTableConfigurator(Graph2D graph,
TableLayoutConfigurator tableConfigurator)
Callback that calls TableLayoutConfigurator.restoreAll(Graph2D)
after the layout is done. |
void |
setAddingSelectedItemsProvider(boolean addingSelectedItemsProvider)
Determines whether the Layouter.SELECTED_NODES and Layouter.SELECTED_EDGES data provider
instances should be registered with the graph to pass the current selection state to the layout algorithm. |
void |
setBackupRealizersEnabled(boolean enabled)
Sets whether or not this layout executor will ask the given graph to backup all its realizers before it starts acting upon the graph. |
void |
setConfiguringComponentLayouter(boolean configuringComponentLayouter)
Determines whether this instance uses method configureComponentLayouter(Graph2DView, y.layout.ComponentLayouter)
to configure the current instance of the ComponentLayouter . |
void |
setConfiguringGrouping(boolean configuringGrouping)
Determines whether this instance should use the GroupLayoutConfigurator
to prepare the graph for the calculation of a grouped Graph2D that has an associated
HierarchyManager . |
void |
setConfiguringNodePorts(boolean configuringNodePorts)
Specifies whether or not this instance should use the NodePortLayoutConfigurator to prepare
the node ports of the graph for layout calculation. |
void |
setConfiguringTableNodeRealizers(boolean configuringTableNodeRealizers)
Determines whether this instance uses the TableLayoutConfigurator
to prepare the graph for the calculation of PartitionGrid s
based on the information available in the TableGroupNodeRealizer instances. |
void |
setLayoutMorpher(LayoutMorpher layoutMorpher)
Sets a new instance of LayoutMorpher that is used by this instance to perform the animation
if this instance is in ANIMATED or ANIMATED_THREADED mode . |
void |
setLockingView(boolean lockingView)
Determines whether this mode should try to lock(y.view.Graph2DView, java.util.Map) and unlock(y.view.Graph2DView, java.util.Map) the Graph2DView
during the calculation of the layout. |
void |
setMode(byte mode)
Sets the mode to use for this instance and the upcoming doLayout
calls. |
void |
setNodePortConfigurator(NodePortLayoutConfigurator configurator)
Sets the NodePortLayoutConfigurator that is used by this
instance to prepare the graph for the layout. |
void |
setPortIntersectionCalculatorEnabled(boolean enabled)
Sets whether or not layout stage PortCalculator should be
automatically executed after the main layouter. |
void |
setTableLayoutConfigurator(TableLayoutConfigurator tableLayoutConfigurator)
Sets the TableLayoutConfigurator that is used by this instance
to prepare the graph for the layout. |
protected void |
startThread(java.lang.Runnable runnable)
Callback method that creates and starts the thread for the execution of the ANIMATED_THREADED or THREADED
layout. |
protected void |
unlock(Graph2DView view,
java.util.Map lockState)
This method will unlock a previously locked view
after the layout has been calculated. |
protected boolean |
useEventDispatchThread(Graph2DView view)
Determines whether to use the EDT for the calculations that should be performed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte UNBUFFERED
setMode(byte)
and getMode()
that tells the executor to
run the layout directly on Graph2D
instance without buffering
.
This is not recommended. Use BUFFERED
instead.
Graph2DLayoutExecutor(byte)
,
Constant Field Valuespublic static final byte ANIMATED
setMode(byte)
and getMode()
that tells the executor to
run a buffered
layout and then morph
the current graph to the newly calculated layout.
This is the default mode for this class.
Graph2DLayoutExecutor(byte)
,
getLayoutMorpher()
,
Constant Field Valuespublic static final byte BUFFERED
setMode(byte)
and getMode()
that tells the executor to
run a buffered
layout and then apply
the calculated results to the graph. This prevents the original graph from being corrupted if an
exception happens during layout calculation.
Graph2DLayoutExecutor(byte)
,
Constant Field Valuespublic static final byte ANIMATED_THREADED
setMode(byte)
and getMode()
that tells the executor to
run a buffered
layout and then morph
the current graph to the newly calculated layout. All of the calculations and the animation is
performed on a separate thread
so the
doLayout
calls are non-blocking.
Graph2DLayoutExecutor(byte)
,
getLayoutMorpher()
,
doLayout(Graph2D, Layouter, Runnable, y.view.Graph2DLayoutExecutor.ExceptionListener)
,
doLayout(Graph2DView, Layouter, Runnable, y.view.Graph2DLayoutExecutor.ExceptionListener)
,
startThread(Runnable)
,
Constant Field Valuespublic static final byte THREADED
setMode(byte)
and getMode()
that tells the executor to
run a buffered
layout and then apply
the calculated results to the graph. This prevents the original graph from being corrupted if an
exception happens during layout calculation. All of the calculations are
performed on a separate thread
so the
doLayout
calls are non-blocking.
Graph2DLayoutExecutor(byte)
,
doLayout(Graph2D, Layouter, Runnable, y.view.Graph2DLayoutExecutor.ExceptionListener)
,
doLayout(Graph2DView, Layouter, Runnable, y.view.Graph2DLayoutExecutor.ExceptionListener)
,
startThread(Runnable)
,
Constant Field ValuesConstructor Detail |
---|
public Graph2DLayoutExecutor()
Graph2DLayoutExecutor
in ANIMATED
mode.
setMode(byte)
public Graph2DLayoutExecutor(byte mode)
Graph2DLayoutExecutor
in the provided mode.
mode
- one of BUFFERED
, ANIMATED
, THREADED
,
ANIMATED_THREADED
, or UNBUFFERED
.
java.lang.IllegalArgumentException
- if the argument is out of the range of possible values.Method Detail |
---|
public byte getMode()
BUFFERED
, ANIMATED
, THREADED
,
ANIMATED_THREADED
, or UNBUFFERED
.
BUFFERED
, ANIMATED
, THREADED
,
ANIMATED_THREADED
, or UNBUFFERED
.setMode(byte)
public void setMode(byte mode)
doLayout
calls.
mode
- One of BUFFERED
, ANIMATED
, THREADED
,
ANIMATED_THREADED
, or UNBUFFERED
.
java.lang.IllegalArgumentException
- If the argument is not one of the valid values.public boolean isLockingView()
lock(y.view.Graph2DView, java.util.Map)
and unlock(y.view.Graph2DView, java.util.Map)
the Graph2DView
during the calculation of the layout.
By default this feature is turned off.
locked
during layout calculation.public void setLockingView(boolean lockingView)
lock(y.view.Graph2DView, java.util.Map)
and unlock(y.view.Graph2DView, java.util.Map)
the Graph2DView
during the calculation of the layout.
By default this feature is turned off. The view will only be locked, if the
doLayout
variants are used that take a view argument.
lockingView
- whether the view should be locked
during layout calculation.public TableLayoutConfigurator getTableLayoutConfigurator()
TableLayoutConfigurator
that is used by this instance
to prepare the graph for the layout.
The reference can be used to fine-tune the settings available in the TableLayoutConfigurator
class.
public void setTableLayoutConfigurator(TableLayoutConfigurator tableLayoutConfigurator)
TableLayoutConfigurator
that is used by this instance
to prepare the graph for the layout.
tableLayoutConfigurator
- The new configurator instance to use.public NodePortLayoutConfigurator getNodePortConfigurator()
NodePortLayoutConfigurator
that is used by this
instance to prepare the graph for the layout.
The reference can be used to fine-tune the settings available in the
NodePortLayoutConfigurator
class.
public void setNodePortConfigurator(NodePortLayoutConfigurator configurator)
NodePortLayoutConfigurator
that is used by this
instance to prepare the graph for the layout.
configurator
- The new configurator instance to use.public LayoutMorpher getLayoutMorpher()
LayoutMorpher
instance that is used by this instance to perform the animation
if this instance is in ANIMATED
or ANIMATED_THREADED
mode
.
The reference can be used to fine-tune the settings available in the LayoutMorpher
class.
createLayoutMorpher()
public void setLayoutMorpher(LayoutMorpher layoutMorpher)
LayoutMorpher
that is used by this instance to perform the animation
if this instance is in ANIMATED
or ANIMATED_THREADED
mode
.
layoutMorpher
- The new instance to use for the upcoming doLayout
runs.getLayoutMorpher()
public boolean isConfiguringGrouping()
GroupLayoutConfigurator
to prepare the graph for the calculation of a grouped Graph2D
that has an associated
HierarchyManager
. By default this features is enabled.
GroupLayoutConfigurator
will be used for the layout.public void setConfiguringGrouping(boolean configuringGrouping)
GroupLayoutConfigurator
to prepare the graph for the calculation of a grouped Graph2D
that has an associated
HierarchyManager
. By default this features is enabled.
configuringGrouping
- whether the GroupLayoutConfigurator
will be used for the layout.public boolean isConfiguringComponentLayouter()
configureComponentLayouter(Graph2DView, y.layout.ComponentLayouter)
to configure the current instance of the ComponentLayouter
. By default this feature is enabled.
Note: enabling this option has no impact if the used layouter is not of type CanonicMultiStageLayouter
.
ComponentLayouter
that will be used for the layout.configureComponentLayouter(Graph2DView, y.layout.ComponentLayouter)
public void setConfiguringComponentLayouter(boolean configuringComponentLayouter)
configureComponentLayouter(Graph2DView, y.layout.ComponentLayouter)
to configure the current instance of the ComponentLayouter
. By default this feature is enabled.
Note: enabling this option has no impact if the used layouter is not of type CanonicMultiStageLayouter
.
configuringComponentLayouter
- whether to configure the ComponentLayouter
that will be used for the layout.configureComponentLayouter(Graph2DView, y.layout.ComponentLayouter)
public boolean isAddingSelectedItemsProvider()
Layouter.SELECTED_NODES
and Layouter.SELECTED_EDGES
data provider
instances should be registered with the graph to pass the current selection state to the layout algorithm.
By default this feature is enabled when there is no DataProvider
with the same key registered with the
graph at the same time.
Selections.createSelectionNodeMap(Graph2D)
,
Selections.createSelectionEdgeMap(Graph2D)
public void setAddingSelectedItemsProvider(boolean addingSelectedItemsProvider)
Layouter.SELECTED_NODES
and Layouter.SELECTED_EDGES
data provider
instances should be registered with the graph to pass the current selection state to the layout algorithm.
By default this feature is enabled when there is no DataProvider
with the same key registered with the
graph at the same time.
addingSelectedItemsProvider
- whether the providers should be registered.Selections.createSelectionNodeMap(Graph2D)
,
Selections.createSelectionEdgeMap(Graph2D)
public boolean isConfiguringTableNodeRealizers()
TableLayoutConfigurator
to prepare the graph for the calculation of PartitionGrid
s
based on the information available in the TableGroupNodeRealizer
instances.
By default this features is disabled.
TableLayoutConfigurator
will be used for the layout.public void setConfiguringTableNodeRealizers(boolean configuringTableNodeRealizers)
TableLayoutConfigurator
to prepare the graph for the calculation of PartitionGrid
s
based on the information available in the TableGroupNodeRealizer
instances.
By default this features is disabled.
configuringTableNodeRealizers
- whether the TableLayoutConfigurator
should be used for the layout.public boolean isConfiguringNodePorts()
NodePortLayoutConfigurator
to prepare
the node ports of the graph for layout calculation.
By default, this feature is enabled. This feature should be disabled if
port constraints or edge groups for edges connecting to node ports are
explicitly given by PortConstraintKeys
data providers.
true
if node ports are automatically prepared for
layout calculation and false
otherwise.setConfiguringNodePorts(boolean)
public void setConfiguringNodePorts(boolean configuringNodePorts)
NodePortLayoutConfigurator
to prepare
the node ports of the graph for layout calculation.
By default, this feature is enabled. This feature should be disabled if
port constraints or edge groups for edges connecting to node ports are
explicitly given by PortConstraintKeys
data providers.
configuringNodePorts
- if true
node ports are
automatically prepared for layout calculationisConfiguringNodePorts()
public boolean isBackupRealizersEnabled()
setBackupRealizersEnabled(boolean)
,
setBackupRealizersEnabled(boolean)
public void setBackupRealizersEnabled(boolean enabled)
isBackupRealizersEnabled()
,
Graph2D.backupRealizers()
public AbortHandler getDefaultAbortHandler()
AbortHandler
created for this Graph2DLayoutExecutor
instance.
If no AbortHandler
was assigned to the graph for which a layout is calculated, the
Graph2DLayoutExecutor
will use this AbortHandler
to provide early termination of the
layouter.
Note: If there is already an AbortHandler
associated with the graph, the instance that is returned
here won't be the same as the one that is provided by the LayoutThreadHandle which is returned when running
Graph2DLayoutExecutor
in a multi-threaded mode.
doLayout(Graph2DView, y.layout.Layouter, Runnable, y.view.Graph2DLayoutExecutor.ExceptionListener)
,
doLayout(Graph2DView, Graph2D, y.layout.Layouter, Runnable, y.view.Graph2DLayoutExecutor.ExceptionListener)
protected GroupLayoutConfigurator prepareGroupLayoutConfigurator(Graph2DView view, Graph2D graph, Layouter layouter)
GroupLayoutConfigurator
, and
prepares
the graph for the layout.
view
- The view that has been passed to doLayout(Graph2DView, Layouter)
or null
.graph
- The graph that should be prepared.layouter
- The layouter for which the layout will be executed.
restoreGroupLayoutConfigurator(Graph2D, GroupLayoutConfigurator)
protected TableLayoutConfigurator prepareTableConfigurator(Graph2DView view, Graph2D graph, Layouter layouter)
TableLayoutConfigurator
to
prepare the graph for the layout.
view
- The view that has been passed to doLayout(Graph2DView, Layouter)
or null
.graph
- The graph that should be prepared.layouter
- The layouter for which the layout will be executed.
restoreTableConfigurator(Graph2D, y.view.tabular.TableLayoutConfigurator)
.protected NodePortLayoutConfigurator prepareNodePortConfigurator(Graph2DView view, Graph2D graph, Layouter layouter)
NodePortConfigurator
to prepare the graph for the layout.
view
- The view that has been passed to
doLayout(Graph2DView, Layouter)
or null
.graph
- The graph that should be prepared.layouter
- The layouter for which the layout will be executed.
restoreNodePortConfigurator(Graph2D, NodePortLayoutConfigurator)
.protected void restoreGroupLayoutConfigurator(Graph2D graph, GroupLayoutConfigurator configurator)
GroupLayoutConfigurator.restoreAll()
after the layout is done.
graph
- The graph that had been prepared.configurator
- The configurator that has earlier been created in
prepareGroupLayoutConfigurator(Graph2DView, Graph2D, Layouter)
protected void restoreTableConfigurator(Graph2D graph, TableLayoutConfigurator tableConfigurator)
TableLayoutConfigurator.restoreAll(Graph2D)
after the layout is done.
graph
- The graph that had been prepared.tableConfigurator
- The configurator that has earlier been returned by
prepareTableConfigurator(Graph2DView, Graph2D, Layouter)
.protected void restoreNodePortConfigurator(Graph2D graph, NodePortLayoutConfigurator configurator)
NodePortLayoutConfigurator.restoreAll(Graph2D)
after the layout is done.
graph
- The graph that had been prepared.configurator
- The configurator that has earlier been returned by
prepareNodePortConfigurator(Graph2DView, Graph2D, y.layout.Layouter)
.public void doLayout(Graph2D graph, Layouter layouter)
mode
is set to ANIMATED
or ANIMATED_THREADED
this call will perform no animation.
Use the doLayout(Graph2DView, Layouter)
or doLayout(Graph2DView, Graph2D, Layouter)
methods for animations
instead.
graph
- The graph to calculate and apply a layout for.layouter
- The layouter instance to use.public void doLayout(Graph2DView view, Layouter layouter)
view
- the view with the graph to calculate and apply a layout for. May not be null
.layouter
- The layouter instance to use. May not be null
java.lang.IllegalArgumentException
- if any of the required parameters is null
.public void doLayout(Graph2DView view, Graph2D graph, Layouter layouter)
mode
is set to ANIMATED
or ANIMATED_THREADED
this call will perform no animation if the view is null
.
view
- The view to run the animated layout in.graph
- The graph to calculate and apply a layout for. May not be null
.layouter
- The layouter instance to use. May not be null
java.lang.IllegalArgumentException
- if any of the required parameters is null
.public void doLayout(Graph2D graph, Layouter layouter, java.lang.Runnable doneListener, Graph2DLayoutExecutor.ExceptionListener exceptionListener)
mode
is set to ANIMATED
or ANIMATED_THREADED
this call will perform no animation.
Use the doLayout(Graph2DView, Layouter, Runnable, ExceptionListener)
or doLayout(Graph2DView, Graph2D, Layouter, Runnable, ExceptionListener)
methods for animations instead.
graph
- The graph to calculate and apply a layout for. May not be null
.layouter
- The layouter instance to use. May not be null
doneListener
- if not null
this listener will be Runnable.run()
after the operation is complete.exceptionListener
- if not null
this listener will be used to report asynchronous and synchronous caught exceptions.public Graph2DLayoutExecutor.LayoutThreadHandle doLayout(Graph2DView view, Layouter layouter, java.lang.Runnable doneListener, Graph2DLayoutExecutor.ExceptionListener exceptionListener)
mode
is set to ANIMATED
or ANIMATED_THREADED
this call will perform no animation if the view is null
.
Use the doLayout(Graph2DView, Layouter)
or doLayout(Graph2DView, Graph2D, Layouter)
methods instead.
This method is useful for the ANIMATED_THREADED
and THREADED
modes
and will return immediately to report progress via the doneListener
and exceptionListener
.
doneListener
- if not null
this listener will be Runnable.run()
after the operation is complete.exceptionListener
- if not null
this listener will be used to report asynchronous and synchronous caught exceptions.view
- The view to run the animated layout in.layouter
- The layouter instance to use. May not be null
java.lang.IllegalArgumentException
- if any of the required parameters is null
.public Graph2DLayoutExecutor.LayoutThreadHandle doLayout(Graph2DView view, Graph2D graph, Layouter layouter, java.lang.Runnable doneListener, Graph2DLayoutExecutor.ExceptionListener exceptionListener)
mode
is set to ANIMATED
or ANIMATED_THREADED
this call will perform no animation if the view is null
.
Use the doLayout(Graph2DView, Layouter)
or doLayout(Graph2DView, Graph2D, Layouter)
methods instead.
This method is useful for the ANIMATED_THREADED
and THREADED
modes
and will return immediately to report progress via the doneListener
and exceptionListener
.
doneListener
- if not null
this listener will be Runnable.run()
after the operation is complete.exceptionListener
- if not null
this listener will be used to report asynchronous and synchronous caught exceptions.view
- The view to run the animated layout in.graph
- The graph to calculate and apply a layout for. May not be null
.layouter
- The layouter instance to use. May not be null
java.lang.IllegalArgumentException
- if any of the required parameters is null
.protected void startThread(java.lang.Runnable runnable)
ANIMATED_THREADED
or THREADED
layout. This method needs to initiate the launch of the runnable.
This implementation creates a new Thread
and sets the daemon flag
on it
before starting it.
runnable
- The runnable to execute.protected void lock(Graph2DView view, java.util.Map lockState)
doLayout(Graph2DView, y.layout.Layouter)
calls
on the EDT to lock the Graph2DView
from receiving further input.
This implementation will set the wait cursor in the view and
suppress input on it
.
view
- The view to be locked downlockState
- A map that can be used to store key value pairs that will later be
provided to unlock(Graph2DView, java.util.Map)
.unlock(Graph2DView, java.util.Map)
protected void unlock(Graph2DView view, java.util.Map lockState)
locked
view
after the layout has been calculated.
view
- The view to unlock.lockState
- The map that was passed to lock(Graph2DView, java.util.Map)
previously.protected void configureComponentLayouter(Graph2DView view, ComponentLayouter cl)
ComponentLayouter
according to the view.
If the size of the view is not specified at this point, ComponentLayouter
will be configured with
the preferred size of the view. If preferred size is not specified either, a default size of 400x400 is used.
view
- The view the layout is run in.cl
- The ComponentLayouter
to configure.protected AnimationPlayer createAnimationPlayer()
LayoutMorpher
to play the animation.
protected LayoutMorpher createLayoutMorpher()
layout morpher
used for the animation.
protected AnimationObject createAnimation(Graph2DView view, Graph2D graph, GraphLayout graphLayout)
AnimationObject
that will be used after the layout has been calculated.
view
- The view the animation will be used in.graph
- The graph that should be animated.graphLayout
- The target layout for the graph.
animate
.protected boolean useEventDispatchThread(Graph2DView view)
!SwingUtilities.isEventDispatchThread() && view != null && view.isShowing();
view
- current view
protected void applyGraphLayout(Graph2D graph, GraphLayout layout)
BUFFERED
and
THREADED
or when the current graph should be morphed to the
calculated layout but
createAnimation(Graph2DView, Graph2D, y.layout.GraphLayout)
returns null
.
graph
- the graph whose layout has to be updated.layout
- the new coordinates for the elements of the specified graph.public boolean isPortIntersectionCalculatorEnabled()
PortCalculator
should be used to adjust port positions after the main
layout to lie on the visible boundaries of the NodeRealizer
s.
By default this feature is turned off.
setPortIntersectionCalculatorEnabled(boolean)
public void setPortIntersectionCalculatorEnabled(boolean enabled)
PortCalculator
should be
automatically executed after the main layouter.
If no IntersectionCalculator DataProviders are registered with the
graph, this class will use DataProviders of
type NodeRealizerIntersectionCalculator
.
By default this feature is disabled.
enabled
- if true, port intersection calculation gets enabled and disabled otherwise
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |