public class LayoutContext
extends java.lang.Object
LayoutContext
provides the context in which to layout a
Graph
. It maintains an ILayoutAlgorithm
that can be applied,
supports the handling and execution of pre and post Runnable
s, and
filtering of layout objects using ILayoutFilter
.Type | Property and Description |
---|---|
javafx.beans.property.ObjectProperty<ILayoutAlgorithm> |
layoutAlgorithm
A property representing the layout algorithm used by this
LayoutContext . |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LAYOUT_ALGORITHM_PROPERTY
An
LayoutContext notifies registered listeners about changes to
the layout algorithm using this property name. |
Constructor and Description |
---|
LayoutContext() |
Modifier and Type | Method and Description |
---|---|
void |
addLayoutFilter(ILayoutFilter layoutFilter)
Adds the given ILayoutFilter to this
LayoutContext . |
void |
applyLayout(boolean clear)
Applies the layout algorithm of this LayoutContext.
|
org.eclipse.gef.graph.Edge[] |
getEdges()
Returns all the connections between nodes that should be laid out.
|
org.eclipse.gef.graph.Graph |
getGraph()
Returns the graph that is to be layouted.
|
ILayoutAlgorithm |
getLayoutAlgorithm()
Returns the static layout algorithm used to layout a newly initialized
graph or after heavy changes to it.
|
org.eclipse.gef.graph.Node[] |
getNodes()
Returns all the nodes that should be laid out.
|
boolean |
isLayoutIrrelevant(org.eclipse.gef.graph.Edge edge)
Returns
true when the given Edge is not relevant for
layout according to the configured layout filters . |
boolean |
isLayoutIrrelevant(org.eclipse.gef.graph.Node nodeLayout)
Returns
true when the given Node is not relevant for
layout according to the configured layout filters . |
javafx.beans.property.ObjectProperty<ILayoutAlgorithm> |
layoutAlgorithmProperty()
A property representing the layout algorithm used by this
LayoutContext . |
void |
postLayout()
Initiated by the context or by an
ILayoutAlgorithm to perform
steps that are scheduled to be run after the layout pass. |
void |
preLayout()
Initiated by the context or by an
ILayoutAlgorithm to perform
steps that are scheduled to be run before the layout pass. |
void |
removeLayoutFilter(ILayoutFilter layoutFilter)
Removes the given ILayoutFilter from this
LayoutContext . |
void |
schedulePostLayoutPass(java.lang.Runnable runnable)
Adds the given
Runnable to the list of runnables which are called
when this LayoutContext is asked to apply all changes made to its
elements to the display. |
void |
schedulePreLayoutPass(java.lang.Runnable runnable)
Adds the given
Runnable to the list of Runnable s which
are executed before applying a layout, i.e. before
applyLayout(boolean) . |
void |
setGraph(org.eclipse.gef.graph.Graph graph)
Sets the graph that is to be layouted by this context.
|
void |
setLayoutAlgorithm(ILayoutAlgorithm algorithm)
Sets the layout algorithm for this context.
|
void |
unschedulePostLayoutPass(java.lang.Runnable runnable)
Removes the given
Runnable from the list of runnables which are
called when this LayoutContext is asked to apply all changes made
to its elements to the display. |
void |
unschedulePreLayoutPass(java.lang.Runnable runnable)
Removes the given
Runnable from the list of Runnable s
which are executed before applying a layout, i.e. before
applyLayout(boolean) . |
public javafx.beans.property.ObjectProperty<ILayoutAlgorithm> layoutAlgorithmProperty
LayoutContext
.public static final java.lang.String LAYOUT_ALGORITHM_PROPERTY
LayoutContext
notifies registered listeners about changes to
the layout algorithm using this property name.public void addLayoutFilter(ILayoutFilter layoutFilter)
LayoutContext
.layoutFilter
- The ILayoutFilter to add to this context.public void applyLayout(boolean clear)
clear
- true
to indicate that the algorithm has to fully
re-compute the layout, otherwise false
.public void postLayout()
ILayoutAlgorithm
to perform
steps that are scheduled to be run after the layout pass. Should not be
called by clients.public void preLayout()
ILayoutAlgorithm
to perform
steps that are scheduled to be run before the layout pass. Should not be
called by clients.public org.eclipse.gef.graph.Graph getGraph()
Graph
that is to be layouted.public void setGraph(org.eclipse.gef.graph.Graph graph)
graph
- The Graph
to layout.public org.eclipse.gef.graph.Node[] getNodes()
public org.eclipse.gef.graph.Edge[] getEdges()
public ILayoutAlgorithm getLayoutAlgorithm()
LayoutContext
.public boolean isLayoutIrrelevant(org.eclipse.gef.graph.Edge edge)
true
when the given Edge
is not relevant for
layout according to the configured layout filters
.
Otherwise returns false
.edge
- The Edge
in question.true
when the given Edge
is not relevant for
layout according to the configure layout filters, otherwise
false
.public boolean isLayoutIrrelevant(org.eclipse.gef.graph.Node nodeLayout)
true
when the given Node
is not relevant for
layout according to the configured layout filters
.
Otherwise returns false
.nodeLayout
- The Node
in question.true
when the given Node
is not relevant for
layout according to the configure layout filters, otherwise
false
.public javafx.beans.property.ObjectProperty<ILayoutAlgorithm> layoutAlgorithmProperty()
LayoutContext
.public void removeLayoutFilter(ILayoutFilter layoutFilter)
LayoutContext
.layoutFilter
- The ILayoutFilter to remove to this context.public void schedulePostLayoutPass(java.lang.Runnable runnable)
Runnable
to the list of runnables which are called
when this LayoutContext
is asked to apply all changes made to its
elements to the display.runnable
- A Runnable
called whenever this context is asked to
apply all changes made to its elements to the display.public void schedulePreLayoutPass(java.lang.Runnable runnable)
Runnable
to the list of Runnable
s which
are executed before applying a layout, i.e. before
applyLayout(boolean)
.runnable
- The Runnable
to add to the list of Runnable
s
which are executed before applying a layout.public void setLayoutAlgorithm(ILayoutAlgorithm algorithm)
algorithm
- The new ILayoutAlgorithm
for this
LayoutContext
.public void unschedulePostLayoutPass(java.lang.Runnable runnable)
Runnable
from the list of runnables which are
called when this LayoutContext
is asked to apply all changes made
to its elements to the display.runnable
- The Runnable
that should no longer get called when
flushing changes.public void unschedulePreLayoutPass(java.lang.Runnable runnable)
Runnable
from the list of Runnable
s
which are executed before applying a layout, i.e. before
applyLayout(boolean)
.runnable
- The Runnable
to remove from the list of
Runnable
s which are executed before applying a layout.Copyright (c) 2014 itemis AG and others. All rights reserved.