public abstract class AbstractLayoutContext extends java.lang.Object implements ILayoutContext
AbstractLayoutContext
is an abstract ILayoutContext
implementation which supports the (un-)registration of
PropertyChangeListener
s and firing of events, the (un-)registration
of any layout listeners and firing of events, 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
ILayoutContext . |
LAYOUT_ALGORITHM_PROPERTY
Constructor and Description |
---|
AbstractLayoutContext() |
Modifier and Type | Method and Description |
---|---|
protected void |
addEdge(IEdgeLayout edge)
Adds the given
IEdgeLayout to the list of edges and fires a
corresponding connection-added-event. |
void |
addLayoutFilter(ILayoutFilter layoutFilter)
Adds the given ILayoutFilter to this
ILayoutContext . |
protected void |
addNode(INodeLayout node)
Adds the given
INodeLayout to the list of nodes and fires a
corresponding node-added-event. |
void |
applyLayout(boolean clear)
Applies the layout algorithm of this LayoutContext.
|
protected void |
clearEdges()
Removes all edges from this context using individual
removeEdge(IEdgeLayout) calls. |
protected void |
clearNodes()
Removes all nodes from this context using individual
removeNode(INodeLayout) calls. |
void |
flushChanges()
Executes all scheduled post-layout
Runnable s (previously added by
schedulePostLayoutPass(Runnable) . |
IEdgeLayout[] |
getConnections(INodeLayout layoutEntity1,
INodeLayout layoutEntity2)
Returns all the connections between given source and target entities.
|
IEdgeLayout[] |
getEdges()
Returns all the connections between nodes that should be laid out.
|
ILayoutAlgorithm |
getLayoutAlgorithm()
Gets the value of the property layoutAlgorithm.
|
INodeLayout[] |
getNodes()
Returns all the nodes that should be laid out.
|
boolean |
isLayoutIrrelevant(IEdgeLayout connLayout)
Returns
true when the given IEdgeLayout is not
relevant for layout according to the configured layout filters . |
boolean |
isLayoutIrrelevant(INodeLayout nodeLayout)
Returns
true when the given INodeLayout 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
ILayoutContext . |
protected void |
removeEdge(IEdgeLayout edge)
Removes the given
IEdgeLayout from the list of edges and fires a
corresponding connection-removed-event. |
void |
removeLayoutFilter(ILayoutFilter layoutFilter)
Removes the given ILayoutFilter from this
ILayoutContext . |
protected void |
removeNode(INodeLayout node)
Removes the given
INodeLayout from the managed list of nodes and
fires a corresponding node-removed-event. |
void |
schedulePostLayoutPass(java.lang.Runnable runnable)
Adds the given
Runnable to the list of runnables which are called
when this ILayoutContext is asked to apply all changes made to
its elements to the display, i.e. within ILayoutContext.flushChanges() . |
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
ILayoutContext.applyLayout(boolean) . |
void |
setLayoutAlgorithm(ILayoutAlgorithm newLayoutAlgorithm)
Sets the value of the property layoutAlgorithm.
|
void |
unschedulePostLayoutPass(java.lang.Runnable runnable)
Removes the given
Runnable from the list of runnables which are
called when this ILayoutContext is asked to apply all changes
made to its elements to the display, i.e. within ILayoutContext.flushChanges() . |
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
ILayoutContext.applyLayout(boolean) . |
public javafx.beans.property.ObjectProperty<ILayoutAlgorithm> layoutAlgorithmProperty
layoutAlgorithmProperty
in interface ILayoutContext
ILayoutContext.LAYOUT_ALGORITHM_PROPERTY
.getLayoutAlgorithm()
,
setLayoutAlgorithm(ILayoutAlgorithm)
protected void addEdge(IEdgeLayout edge)
IEdgeLayout
to the list of edges and fires a
corresponding connection-added-event.edge
- IEdgeLayout
to addpublic void addLayoutFilter(ILayoutFilter layoutFilter)
ILayoutContext
ILayoutContext
.addLayoutFilter
in interface ILayoutContext
layoutFilter
- The ILayoutFilter to add to this context.protected void addNode(INodeLayout node)
INodeLayout
to the list of nodes and fires a
corresponding node-added-event.node
- INodeLayout
to addpublic void applyLayout(boolean clear)
ILayoutContext
applyLayout
in interface ILayoutContext
clear
- true
to indicate that the algorithm has to fully
re-compute the layout, otherwise false
.protected void clearEdges()
removeEdge(IEdgeLayout)
calls.protected void clearNodes()
removeNode(INodeLayout)
calls.public void flushChanges()
Runnable
s (previously added by
schedulePostLayoutPass(Runnable)
.flushChanges
in interface ILayoutContext
public IEdgeLayout[] getEdges()
ILayoutContext
getEdges
in interface ILayoutContext
public IEdgeLayout[] getConnections(INodeLayout layoutEntity1, INodeLayout layoutEntity2)
ILayoutContext
getConnections
in interface ILayoutContext
layoutEntity1
- The source entity.layoutEntity2
- The target entity.public INodeLayout[] getNodes()
ILayoutContext
getNodes
in interface ILayoutContext
public ILayoutAlgorithm getLayoutAlgorithm()
getLayoutAlgorithm
in interface ILayoutContext
ILayoutContext
.public boolean isLayoutIrrelevant(IEdgeLayout connLayout)
ILayoutContext
true
when the given IEdgeLayout
is not
relevant for layout according to the configured layout filters
. Otherwise returns false
.isLayoutIrrelevant
in interface ILayoutContext
connLayout
- The IEdgeLayout
in question.true
when the given IEdgeLayout
is not
relevant for layout according to the configure layout filters,
otherwise false
.public boolean isLayoutIrrelevant(INodeLayout nodeLayout)
ILayoutContext
true
when the given INodeLayout
is not
relevant for layout according to the configured layout filters
. Otherwise returns false
.isLayoutIrrelevant
in interface ILayoutContext
nodeLayout
- The INodeLayout
in question.true
when the given INodeLayout
is not
relevant for layout according to the configure layout filters,
otherwise false
.public javafx.beans.property.ObjectProperty<ILayoutAlgorithm> layoutAlgorithmProperty()
ILayoutContext
ILayoutContext
.layoutAlgorithmProperty
in interface ILayoutContext
ILayoutContext.LAYOUT_ALGORITHM_PROPERTY
.getLayoutAlgorithm()
,
setLayoutAlgorithm(ILayoutAlgorithm)
protected void removeEdge(IEdgeLayout edge)
IEdgeLayout
from the list of edges and fires a
corresponding connection-removed-event.edge
- IEdgeLayout
to removepublic void removeLayoutFilter(ILayoutFilter layoutFilter)
ILayoutContext
ILayoutContext
.removeLayoutFilter
in interface ILayoutContext
layoutFilter
- The ILayoutFilter to remove to this context.protected void removeNode(INodeLayout node)
INodeLayout
from the managed list of nodes and
fires a corresponding node-removed-event.node
- INodeLayout
to removepublic void schedulePostLayoutPass(java.lang.Runnable runnable)
ILayoutContext
Runnable
to the list of runnables which are called
when this ILayoutContext
is asked to apply all changes made to
its elements to the display, i.e. within ILayoutContext.flushChanges()
.schedulePostLayoutPass
in interface ILayoutContext
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)
ILayoutContext
Runnable
to the list of Runnable
s which
are executed before applying a layout, i.e. before
ILayoutContext.applyLayout(boolean)
.schedulePreLayoutPass
in interface ILayoutContext
runnable
- The Runnable
to add to the list of Runnable
s
which are executed before applying a layout.public void setLayoutAlgorithm(ILayoutAlgorithm newLayoutAlgorithm)
setLayoutAlgorithm
in interface ILayoutContext
newLayoutAlgorithm
- The new static ILayoutAlgorithm
for this
ILayoutContext
.public void unschedulePostLayoutPass(java.lang.Runnable runnable)
ILayoutContext
Runnable
from the list of runnables which are
called when this ILayoutContext
is asked to apply all changes
made to its elements to the display, i.e. within ILayoutContext.flushChanges()
.unschedulePostLayoutPass
in interface ILayoutContext
runnable
- The Runnable
that should no longer get called when
flushing changes.public void unschedulePreLayoutPass(java.lang.Runnable runnable)
ILayoutContext
Runnable
from the list of Runnable
s
which are executed before applying a layout, i.e. before
ILayoutContext.applyLayout(boolean)
.unschedulePreLayoutPass
in interface ILayoutContext
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.