Interface LayoutContext
public interface LayoutContext
Objects implementing LayoutContext interface are used for exchanging of
 information between layout algorithms and graphical objects displaying
 graphs.
- Since:
- 2.0
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddContextListener(ContextListener listener) Adds a listener to the context that will be notified about changes related to its configuration.voidAdds a listener to the context that will be notified about changes in graph structure, that is addition and removal of nodes and connections.voidaddLayoutListener(LayoutListener 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.voidaddPruningListener(PruningListener listener) Adds a listener to the context that will be notified about changes in graph pruning, that is hiding and showing of nodes.createSubgraph(NodeLayout[] nodes) Creates a subgraph containing given nodes and adds it to this context.voidflushChanges(boolean animationHint) Causes all the changes made to elements in this context to affect the display.Returns all the connections between nodes that should be laid out.getConnections(EntityLayout layoutEntity1, EntityLayout layoutEntity2) Returns all the connections between given source and target entities.Returns all entities that are currently placed on the graph, that is subgraphs and unpruned nodes.getNodes()Returns all the nodes that should be laid out.Returns all the subgraphs this context's nodes were pruned to.booleanChecks if this layout context allows layout algorithms to work continuously in background and change the layout with time or in reaction to some events.booleanbooleanvoidremoveContextListener(ContextListener listener) Removes a context listener from this context.voidRemoves a graph structure listener from this context.voidremoveLayoutListener(LayoutListener listener) Removes a layout listener from this context.voidremovePruningListener(PruningListener listener) Removes a pruning structure listener from this context.voidsetExpandCollapseManager(ExpandCollapseManager expandCollapseManager) Sets the expand/collapse manager for this context.voidsetMainLayoutAlgorithm(LayoutAlgorithm algorithm) Sets the main layout algorithm for this context.
- 
Method Details- 
getNodesNodeLayout[] getNodes()Returns all the nodes that should be laid out. Replacing elements in the returned array does not affect this context.- Returns:
- array of nodes to lay out
 
- 
getConnectionsConnectionLayout[] getConnections()Returns all the connections between nodes that should be laid out. Replacing elements in the returned array does not affect this context.- Returns:
- array of connections between nodes
 
- 
getEntitiesEntityLayout[] getEntities()Returns all entities that are currently placed on the graph, that is subgraphs and unpruned nodes. Replacing elements in the returned array does not affect this context.- Returns:
- array of entities to layout
 
- 
getConnectionsReturns all the connections between given source and target entities. If given entity is a subgraph, connections adjacent to each of its nodes will be included in the result. All the undirected nodes connecting the two nodes will be also included in the result. Replacing elements in the returned array does not affect this context.- Parameters:
- layoutEntity1-
- layoutEntity2-
 
- 
getBoundsDisplayIndependentRectangle getBounds()- Returns:
- bounds in which the graph elements can be placed
 
- 
isBoundsExpandableboolean isBoundsExpandable()- Returns:
- true if a layout algorithm is allowed to place graph elements outside of suggested bounds
 
- 
getSubgraphsSubgraphLayout[] getSubgraphs()Returns all the subgraphs this context's nodes were pruned to. Replacing elements in the returned array does not affect this context.- Returns:
- array of subgraphs (may be empty)
 
- 
createSubgraphCreates a subgraph containing given nodes and adds it to this context. If given nodes already belong to another subgraphs, they are removed from them prior to adding to the new subgraph.- Parameters:
- nodes- nodes to add to the new subgraph
 
- 
isPruningEnabledboolean isPruningEnabled()- Returns:
- true if this layout context allows pruning nodes into subgraphs
 
- 
isBackgroundLayoutEnabledboolean isBackgroundLayoutEnabled()Checks if this layout context allows layout algorithms to work continuously in background and change the layout with time or in reaction to some events. If background changes are not allowed, a layout algorithm can make changes in layout context only whenLayoutAlgorithm.applyLayout(boolean)is called (otherwise a runtime exception will be thrown).- Returns:
- true if background layout changes are enabled
 
- 
setMainLayoutAlgorithmSets the main layout algorithm for this context. Main algorithm will be used to relayout graph items usingLayoutAlgorithm.applyLayout(boolean)after every event that is not intercepted by any listener.- Parameters:
- algorithm-
 
- 
getMainLayoutAlgorithmLayoutAlgorithm getMainLayoutAlgorithm()- Returns:
- the main algorithm of this context (see
         setMainLayoutAlgorithm(LayoutAlgorithm)for details)
 
- 
setExpandCollapseManagerSets the expand/collapse manager for this context. The manger will be used to handle expansion related methods called on the owner of this context.- Parameters:
- expandCollapseManager-
 
- 
getExpandCollapseManagerExpandCollapseManager getExpandCollapseManager()- Returns:
- current expand/collapse manager (can be null, which means that pruning is not enabled).
 
- 
addLayoutListenerAdds a listener to the context that will be notified about changes in this context's layout, that is movement and resizing of nodes / subgraphs. The notifications will not include changes made with API included in layout related interfaces, so that layout algorithms won't be notified about changes they invoke. Only internal changes of the system will fire events.- Parameters:
- listener- listener to add
 
- 
removeLayoutListenerRemoves a layout listener from this context.- Parameters:
- listener- listener to remove
 
- 
addGraphStructureListenerAdds a listener to the context that will be notified about changes in graph structure, that is addition and removal of nodes and connections. The notifications will not include changes made with API included in layout related interfaces, so that layout algorithms won't be notified about changes they invoke. Only internal changes of the system will fire events.- Parameters:
- listener- listener to add
 
- 
removeGraphStructureListenerRemoves a graph structure listener from this context.- Parameters:
- listener- listener to remove
 
- 
addContextListenerAdds a listener to the context that will be notified about changes related to its configuration.- Parameters:
- listener- listener to add
 
- 
removeContextListenerRemoves a context listener from this context.- Parameters:
- listener- listener to remove
 
- 
addPruningListenerAdds a listener to the context that will be notified about changes in graph pruning, that is hiding and showing of nodes. The notifications will not include changes made with API included in layout related interfaces, so that layout algorithms won't be notified about changes they invoke. Only internal changes of the system will fire events.- Parameters:
- listener- listener to add
 
- 
removePruningListenerRemoves a pruning structure listener from this context.- Parameters:
- listener- listener to remove
 
- 
flushChangesvoid flushChanges(boolean animationHint) Causes all the changes made to elements in this context to affect the display.- Parameters:
- animationHint- a hint for display mechanism indicating whether changes are major and should be animated (if true) or not.
 
 
-