public abstract class AbstractLayoutContext extends java.lang.Object implements ILayoutContext
AbstractLayoutContext is an abstract ILayoutContext
implementation which supports the (un-)registration of
PropertyChangeListeners and firing of events, the (un-)registration
of any layout listeners and firing of events, the handling and execution of
pre and post Runnables, 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
Runnables (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 Runnables 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 Runnables
which are executed before applying a layout, i.e. before
ILayoutContext.applyLayout(boolean). |
public javafx.beans.property.ObjectProperty<ILayoutAlgorithm> layoutAlgorithmProperty
layoutAlgorithmProperty in interface ILayoutContextILayoutContext.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)
ILayoutContextILayoutContext.addLayoutFilter in interface ILayoutContextlayoutFilter - 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)
ILayoutContextapplyLayout in interface ILayoutContextclear - 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()
Runnables (previously added by
schedulePostLayoutPass(Runnable).flushChanges in interface ILayoutContextpublic IEdgeLayout[] getEdges()
ILayoutContextgetEdges in interface ILayoutContextpublic IEdgeLayout[] getConnections(INodeLayout layoutEntity1, INodeLayout layoutEntity2)
ILayoutContextgetConnections in interface ILayoutContextlayoutEntity1 - The source entity.layoutEntity2 - The target entity.public INodeLayout[] getNodes()
ILayoutContextgetNodes in interface ILayoutContextpublic ILayoutAlgorithm getLayoutAlgorithm()
getLayoutAlgorithm in interface ILayoutContextILayoutContext.public boolean isLayoutIrrelevant(IEdgeLayout connLayout)
ILayoutContexttrue when the given IEdgeLayout is not
relevant for layout according to the configured layout filters. Otherwise returns false.isLayoutIrrelevant in interface ILayoutContextconnLayout - 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)
ILayoutContexttrue when the given INodeLayout is not
relevant for layout according to the configured layout filters. Otherwise returns false.isLayoutIrrelevant in interface ILayoutContextnodeLayout - 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()
ILayoutContextILayoutContext.layoutAlgorithmProperty in interface ILayoutContextILayoutContext.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)
ILayoutContextILayoutContext.removeLayoutFilter in interface ILayoutContextlayoutFilter - 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)
ILayoutContextRunnable 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 ILayoutContextrunnable - 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)
ILayoutContextRunnable to the list of Runnables which
are executed before applying a layout, i.e. before
ILayoutContext.applyLayout(boolean).schedulePreLayoutPass in interface ILayoutContextrunnable - The Runnable to add to the list of Runnables
which are executed before applying a layout.public void setLayoutAlgorithm(ILayoutAlgorithm newLayoutAlgorithm)
setLayoutAlgorithm in interface ILayoutContextnewLayoutAlgorithm - The new static ILayoutAlgorithm for this
ILayoutContext.public void unschedulePostLayoutPass(java.lang.Runnable runnable)
ILayoutContextRunnable 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 ILayoutContextrunnable - The Runnable that should no longer get called when
flushing changes.public void unschedulePreLayoutPass(java.lang.Runnable runnable)
ILayoutContextRunnable from the list of Runnables
which are executed before applying a layout, i.e. before
ILayoutContext.applyLayout(boolean).unschedulePreLayoutPass in interface ILayoutContextrunnable - The Runnable to remove from the list of
Runnables which are executed before applying a layout.Copyright (c) 2014 itemis AG and others. All rights reserved.