public interface ILayoutContext
extends org.eclipse.gef4.common.properties.IPropertyStore
ILayoutContext
interface are used for exchanging
of information between layout algorithms and graphical objects displaying
graphs, i.e. an ILayoutContext
represents a graph within the layout
model.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DYNAMIC_LAYOUT_ALGORITHM_PROPERTY
An
ILayoutContext notifies registered listeners about changes to
the dynamic layout algorithm using this property name. |
static java.lang.String |
STATIC_LAYOUT_ALGORITHM_PROPERTY
An
ILayoutContext notifies registered listeners about changes to
the static layout algorithm using this property name. |
Modifier and Type | Method and Description |
---|---|
void |
addContextListener(IContextListener listener)
Adds a listener to the context that will be notified about changes
related to its configuration.
|
void |
addGraphStructureListener(IGraphStructureListener listener)
Adds a listener to the context that will be notified about changes in
graph structure, that is addition and removal of nodes and connections.
|
void |
addLayoutFilter(ILayoutFilter layoutFilter)
Adds the given ILayoutFilter to this
ILayoutContext . |
void |
addLayoutListener(ILayoutListener listener)
Adds a listener to the context that will be notified about changes in
this context's layout, that is movement and resizing of nodes /
subgraphs.
|
void |
addPruningListener(IPruningListener listener)
Adds a listener to the context that will be notified about changes in
graph pruning, that is hiding and showing of nodes.
|
void |
applyDynamicLayout(boolean clean)
Applies the background layout algorithm of this LayoutContext.
|
void |
applyStaticLayout(boolean clean)
Applies the static layout algorithm of this LayoutContext.
|
ISubgraphLayout |
createSubgraph(INodeLayout[] nodes)
Creates a subgraph containing given nodes and adds it to this context.
|
void |
fireBackgroundEnableChangedEvent()
Notifies all previously registered
IContextListener s about the
state of the background layout flag. |
void |
fireBoundsChangedEvent()
Notifies all previously registered
IContextListener s about the
bounds change. |
void |
fireConnectionAddedEvent(IConnectionLayout connection)
Notifies all previously registered
IGraphStructureListener s about
the newly added connection. |
void |
fireConnectionRemovedEvent(IConnectionLayout connection)
Notifies all previously registered
IGraphStructureListener s about
the removed connection. |
void |
fireNodeAddedEvent(INodeLayout node)
Notifies all previously registered
IGraphStructureListener s about
the newly added node. |
void |
fireNodeMovedEvent(INodeLayout node)
Notifies all previously registered
ILayoutListener s about the
moved node. |
void |
fireNodeRemovedEvent(INodeLayout node)
Notifies all previously registered
IGraphStructureListener s about
the removed node. |
void |
fireNodeResizedEvent(INodeLayout node)
Notifies all previously registered
ILayoutListener s about the
resized node. |
void |
firePruningEnableChangedEvent()
Notifies all previously registered
IContextListener s about the
state of the pruning flag. |
void |
fireSubgraphMovedEvent(ISubgraphLayout subgraph)
Notifies all previously registered
ILayoutListener s about the
moved subgraph. |
void |
fireSubgraphResizedEvent(ISubgraphLayout subgraph)
Notifies all previously registered
ILayoutListener s about the
resized subgraph. |
void |
flushChanges(boolean animationHint)
Causes all the changes made to elements in this context to affect the
display.
|
IConnectionLayout[] |
getConnections()
Returns all the connections between nodes that should be laid out.
|
IConnectionLayout[] |
getConnections(IEntityLayout layoutEntity1,
IEntityLayout layoutEntity2)
Returns all the connections between given source and target entities.
|
ILayoutAlgorithm |
getDynamicLayoutAlgorithm() |
IEntityLayout[] |
getEntities()
Returns all entities that are currently placed on the graph, that is
subgraphs and unpruned nodes.
|
INodeLayout[] |
getNodes()
Returns all the nodes that should be laid out.
|
ILayoutAlgorithm |
getStaticLayoutAlgorithm()
Returns the static layout algorithm used to layout a newly initialized
graph or after heavy changes to it.
|
ISubgraphLayout[] |
getSubgraphs()
Returns all the subgraphs this context's nodes were pruned to.
|
boolean |
isLayoutIrrelevant(IConnectionLayout connLayout)
Returns
true when the given IConnectionLayout 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 . |
void |
removeContextListener(IContextListener listener)
Removes a context listener from this context.
|
void |
removeGraphStructureListener(IGraphStructureListener listener)
Removes a graph structure listener from this context.
|
void |
removeLayoutFilter(ILayoutFilter layoutFilter)
Removes the given ILayoutFilter from this
ILayoutContext . |
void |
removeLayoutListener(ILayoutListener listener)
Removes a layout listener from this context.
|
void |
removePruningListener(IPruningListener listener)
Removes a pruning structure listener from this context.
|
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 flushChanges(boolean) . |
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
applyDynamicLayout(boolean) or
applyStaticLayout(boolean) . |
void |
setDynamicLayoutAlgorithm(ILayoutAlgorithm algorithm)
Sets the dynamic layout algorithm for this context.
|
void |
setStaticLayoutAlgorithm(ILayoutAlgorithm algorithm)
Sets the static 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 ILayoutContext is asked to apply all changes
made to its elements to the display, i.e. within
flushChanges(boolean) . |
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
applyDynamicLayout(boolean) or
applyStaticLayout(boolean) . |
static final java.lang.String STATIC_LAYOUT_ALGORITHM_PROPERTY
ILayoutContext
notifies registered listeners about changes to
the static layout algorithm using this property name.static final java.lang.String DYNAMIC_LAYOUT_ALGORITHM_PROPERTY
ILayoutContext
notifies registered listeners about changes to
the dynamic layout algorithm using this property name.void applyDynamicLayout(boolean clean)
clean
- true
to indicate that the algorithm has to fully
re-compute the layout, otherwise false
.void applyStaticLayout(boolean clean)
clean
- true
to indicate that the algorithm has to fully
re-compute the layout, otherwise false
.INodeLayout[] getNodes()
IConnectionLayout[] getConnections()
IEntityLayout[] getEntities()
IConnectionLayout[] getConnections(IEntityLayout layoutEntity1, IEntityLayout layoutEntity2)
layoutEntity1
- The source entity.layoutEntity2
- The target entity.ISubgraphLayout[] getSubgraphs()
ISubgraphLayout createSubgraph(INodeLayout[] nodes)
nodes
- nodes to add to the new subgraphISubgraphLayout
.void setDynamicLayoutAlgorithm(ILayoutAlgorithm algorithm)
ILayoutAlgorithm.applyLayout(boolean)
after every event that is
not intercepted by any listener when currently changes are not being
flushed and background layout is enabled. The clean flag for the
background layout algorithm can be set to false
by the
context when reacting to events.algorithm
- The new dynamic ILayoutAlgorithm
for this
ILayoutContext
.void setStaticLayoutAlgorithm(ILayoutAlgorithm algorithm)
algorithm
- The new static ILayoutAlgorithm
for this
ILayoutContext
.void schedulePostLayoutPass(java.lang.Runnable runnable)
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 flushChanges(boolean)
.runnable
- A Runnable
called whenever this context is asked to
apply all changes made to its elements to the display.void unschedulePostLayoutPass(java.lang.Runnable runnable)
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
flushChanges(boolean)
.runnable
- The Runnable
that should no longer get called when
flushing changes.boolean isLayoutIrrelevant(IConnectionLayout connLayout)
true
when the given IConnectionLayout
is not
relevant for layout according to the configured layout filters
. Otherwise returns false
.connLayout
- The IConnectionLayout
in question.true
when the given IConnectionLayout
is not
relevant for layout according to the configure layout filters,
otherwise false
.boolean isLayoutIrrelevant(INodeLayout nodeLayout)
true
when the given INodeLayout
is not
relevant for layout according to the configured layout filters
. Otherwise returns false
.nodeLayout
- The INodeLayout
in question.true
when the given INodeLayout
is not
relevant for layout according to the configure layout filters,
otherwise false
.void addLayoutFilter(ILayoutFilter layoutFilter)
ILayoutContext
.layoutFilter
- The ILayoutFilter to add to this context.void removeLayoutFilter(ILayoutFilter layoutFilter)
ILayoutContext
.layoutFilter
- The ILayoutFilter to remove to this context.ILayoutAlgorithm getStaticLayoutAlgorithm()
ILayoutAlgorithm getDynamicLayoutAlgorithm()
setDynamicLayoutAlgorithm(ILayoutAlgorithm)
for details)void addLayoutListener(ILayoutListener listener)
listener
- listener to addvoid removeLayoutListener(ILayoutListener listener)
listener
- listener to removevoid addGraphStructureListener(IGraphStructureListener listener)
listener
- listener to addvoid removeGraphStructureListener(IGraphStructureListener listener)
listener
- listener to removevoid addContextListener(IContextListener listener)
listener
- listener to addvoid removeContextListener(IContextListener listener)
listener
- listener to removevoid addPruningListener(IPruningListener listener)
listener
- listener to addvoid removePruningListener(IPruningListener listener)
listener
- listener to removevoid flushChanges(boolean animationHint)
animationHint
- a hint for display mechanism indicating whether changes are
major and should be animated (if true) or not.void fireNodeAddedEvent(INodeLayout node)
IGraphStructureListener
s about
the newly added node.node
- NodeLayout of newly added nodevoid fireNodeRemovedEvent(INodeLayout node)
IGraphStructureListener
s about
the removed node.node
- NodeLayout of removed nodevoid fireConnectionAddedEvent(IConnectionLayout connection)
IGraphStructureListener
s about
the newly added connection.connection
- ConnectionLayout of newly added connectionvoid fireConnectionRemovedEvent(IConnectionLayout connection)
IGraphStructureListener
s about
the removed connection.connection
- ConnectionLayout of removed connectionvoid fireBoundsChangedEvent()
IContextListener
s about the
bounds change.void fireBackgroundEnableChangedEvent()
IContextListener
s about the
state of the background layout flag.void fireNodeMovedEvent(INodeLayout node)
ILayoutListener
s about the
moved node.node
- NodeLayout of moved nodevoid fireNodeResizedEvent(INodeLayout node)
ILayoutListener
s about the
resized node.node
- NodeLayout of resized nodevoid fireSubgraphMovedEvent(ISubgraphLayout subgraph)
ILayoutListener
s about the
moved subgraph.subgraph
- SubgraphLayout of moved subgraphvoid fireSubgraphResizedEvent(ISubgraphLayout subgraph)
ILayoutListener
s about the
resized subgraph.subgraph
- SubgraphLayout of resized subgraphvoid firePruningEnableChangedEvent()
IContextListener
s about the
state of the pruning flag.void unschedulePreLayoutPass(java.lang.Runnable runnable)
Runnable
from the list of Runnable
s
which are executed before applying a layout, i.e. before
applyDynamicLayout(boolean)
or
applyStaticLayout(boolean)
.runnable
- The Runnable
to remove from the list of
Runnable
s which are executed before applying a layout.void schedulePreLayoutPass(java.lang.Runnable runnable)
Runnable
to the list of Runnable
s which
are executed before applying a layout, i.e. before
applyDynamicLayout(boolean)
or
applyStaticLayout(boolean)
.runnable
- The Runnable
to add to the list of Runnable
s
which are executed before applying a layout.Copyright (c) 2014 itemis AG and others. All rights reserved.