Package org.eclipse.zest.core.widgets
Class DefaultSubgraph
java.lang.Object
org.eclipse.zest.core.widgets.DefaultSubgraph
- All Implemented Interfaces:
- EntityLayout,- SubgraphLayout
- Direct Known Subclasses:
- FigureSubgraph
Default implementation of 
SubgraphLayout. Every subgraph added to
 Zest Graph should inherit from this class. The default implementation
 is very simple. A node pruned to this subgraph is minimized and all
 connections adjacent to it are made invisible. No additional graphic elements
 are added to the graph, but subclasses may add them.- Since:
- 1.14
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classDefault factory forDefaultSubgraph.static classstatic classFactory forPrunedSuccessorsSubgraph.static class
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final org.eclipse.zest.core.widgets.InternalLayoutContextprotected booleanprotected final Set<NodeLayout> Fields inherited from interface org.eclipse.zest.layouts.interfaces.SubgraphLayoutBOTTOM_UP, LEFT_RIGHT, RIGHT_LEFT, TOP_DOWN
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddNodes(NodeLayout[] nodes) Adds nodes to this subgraph.protected voidintprotected voiddispose()Item[]getItems()Returns all graph items that are represented using this single entity.Returns a point laying in the center of this entity.getNodes()Returns all the nodes belonging to this subgraph.Returns all entities that are direct predecessors of this entity.doubleReturns aspect ratio that is preferred for this entity.getSize()Returns all entities that are direct successors of this entity.booleanbooleanReturns true if this subgraph is visualized as a particular object on the graph.booleanbooleanprotected voidrefreshConnectionsVisibility(ConnectionLayout[] connections) protected voidMakes sure that value returned bygetLocation()will be equal to current location of this subgraph.protected voidMakes sure that value returned bygetSize()will be equal to current size of this subgraph.voidvoidremoveNodes(NodeLayout[] nodes) Removes nodes from this subgraph.voidsetDirection(int direction) Sets the direction of this subgraph (does nothing in case of subgraphs that don't depend on direction)voidsetLocation(double x, double y) Sets the position of this entity.voidsetSize(double width, double height) 
- 
Field Details- 
contextprotected final org.eclipse.zest.core.widgets.InternalLayoutContext context
- 
nodes
- 
disposedprotected boolean disposed
 
- 
- 
Constructor Details- 
DefaultSubgraph
 
- 
- 
Method Details- 
isGraphEntitypublic boolean isGraphEntity()Description copied from interface:SubgraphLayoutReturns true if this subgraph is visualized as a particular object on the graph. If this method returns false, it means that this subgraph will not be visible so all methods related to location, size and direction should be ignored.- Specified by:
- isGraphEntityin interface- SubgraphLayout
- Returns:
- whether or not this subgraph is a graph entity that should be laid out.
 
- 
setSizepublic void setSize(double width, double height) - Specified by:
- setSizein interface- EntityLayout
 
- 
setLocationpublic void setLocation(double x, double y) Description copied from interface:EntityLayoutSets the position of this entity. The node will be moved so that it's center is located in the given point.- Specified by:
- setLocationin interface- EntityLayout
- Parameters:
- x- the x-position
- y- the y-position
 
- 
isResizablepublic boolean isResizable()- Specified by:
- isResizablein interface- EntityLayout
 
- 
isMovablepublic boolean isMovable()- Specified by:
- isMovablein interface- EntityLayout
 
- 
getSuccessingEntitiesDescription copied from interface:EntityLayoutReturns all entities that are direct successors of this entity. Successor entities of an unpruned node N are:- all unpruned successor nodes of node N
- all subgraphs that are GraphEntitiesand contain at least one successor node of node N
 GraphEntityare:- all unpruned nodes that are successor of at least one node from subgraph S
- all subgraphs that are GraphEntitiesand contain at least one node that is a successor of at least one node from subgraph S
 GraphEntitiesan empty array will be returned.
 Entities connected with this node by a bidirectional connection are considered both successors and predecessors. Any subsequent changes to the returned array do not affect this node.- Specified by:
- getSuccessingEntitiesin interface- EntityLayout
- Returns:
- array of successors of this node
 
- 
getSize- Specified by:
- getSizein interface- EntityLayout
 
- 
getPreferredAspectRatiopublic double getPreferredAspectRatio()Description copied from interface:EntityLayoutReturns aspect ratio that is preferred for this entity. Can be 0 if this node can't be resized anyway or it doesn't care about about its ratio.- Specified by:
- getPreferredAspectRatioin interface- EntityLayout
- Returns:
- aspect ratio (width / height)
 
- 
getPredecessingEntitiesDescription copied from interface:EntityLayoutReturns all entities that are direct predecessors of this entity. Predecessor entities of an unpruned node A are:- all unpruned predecessor nodes of node N
- all subgraphs that are GraphEntitiesand contain at least one predecessor node of node N
 GraphEntityare:- all unpruned nodes that are predecessor of at least one node from subgraph S
- all subgraphs that are GraphEntitiesand contain at least one node that is a predecessor of at least one node from subgraph S
 GraphEntitiesan empty array will be returned.
 Entities connected with this node by a bidirectional connection are considered both successors and predecessors. Any subsequent changes to the returned array do not affect this node.- Specified by:
- getPredecessingEntitiesin interface- EntityLayout
- Returns:
- array of predecessors of this node
 
- 
getLocationDescription copied from interface:EntityLayoutReturns a point laying in the center of this entity. Any subsequent changes to the returned point won't affect this node.- Specified by:
- getLocationin interface- EntityLayout
- Returns:
- position of the center of this node
 
- 
isDirectionDependantpublic boolean isDirectionDependant()- Specified by:
- isDirectionDependantin interface- SubgraphLayout
- Returns:
- true if this subgraph is visualized differently depending on direction
 
- 
setDirectionpublic void setDirection(int direction) Description copied from interface:SubgraphLayoutSets the direction of this subgraph (does nothing in case of subgraphs that don't depend on direction)- Specified by:
- setDirectionin interface- SubgraphLayout
- Parameters:
- direction- one of constants:- SubgraphLayout.TOP_DOWN,- SubgraphLayout.BOTTOM_UP,- SubgraphLayout.LEFT_RIGHT,- SubgraphLayout.RIGHT_LEFT
 
- 
removeNodesDescription copied from interface:SubgraphLayoutRemoves nodes from this subgraph.- Specified by:
- removeNodesin interface- SubgraphLayout
- Parameters:
- nodes- array of nodes to remove
 
- 
removeDisposedNodespublic void removeDisposedNodes()
- 
getNodesDescription copied from interface:SubgraphLayoutReturns all the nodes belonging to this subgraph. Replacing elements in the returned array does not affect this subgraph.- Specified by:
- getNodesin interface- SubgraphLayout
- Returns:
- array of nodes
 
- 
getItemsDescription copied from interface:EntityLayoutReturns all graph items that are represented using this single entity. They are useful when a layout would get information about the graph it draws.- Specified by:
- getItemsin interface- EntityLayout
- Returns:
- an array of graph items
 
- 
countNodespublic int countNodes()- Specified by:
- countNodesin interface- SubgraphLayout
- Returns:
- number of nodes pruned into this subgraph
 
- 
addNodesDescription copied from interface:SubgraphLayoutAdds nodes to this subgraph. If given nodes already belong to another subgraph, they are first removed from them.- Specified by:
- addNodesin interface- SubgraphLayout
- Parameters:
- nodes- array of nodes to add
 
- 
refreshConnectionsVisibility
- 
refreshLocationprotected void refreshLocation()Makes sure that value returned bygetLocation()will be equal to current location of this subgraph.
- 
refreshSizeprotected void refreshSize()Makes sure that value returned bygetSize()will be equal to current size of this subgraph.
- 
applyLayoutChangesprotected void applyLayoutChanges()
- 
disposeprotected void dispose()
 
-