Package org.eclipse.zest.core.widgets
Class FigureSubgraph
java.lang.Object
org.eclipse.zest.core.widgets.DefaultSubgraph
org.eclipse.zest.core.widgets.FigureSubgraph
- All Implemented Interfaces:
EntityLayout,SubgraphLayout
- Direct Known Subclasses:
LabelSubgraph,TriangleSubgraph
A subgraph layout that represents a subgraph as a single figure. An entity
representing subgraph is not resizable by layout algorithm unless proper
methods are redefined in a subclass.
- Since:
- 1.14
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classListens to changes in this subgraph's figure and fires proper event in its layout context.Nested classes/interfaces inherited from class org.eclipse.zest.core.widgets.DefaultSubgraph
DefaultSubgraph.DefaultSubgraphFactory, DefaultSubgraph.LabelSubgraphFactory, DefaultSubgraph.PrunedSuccessorsSubgraphFactory, DefaultSubgraph.TriangleSubgraphFactory -
Field Summary
FieldsFields inherited from class org.eclipse.zest.core.widgets.DefaultSubgraph
context, disposed, nodesFields inherited from interface org.eclipse.zest.layouts.interfaces.SubgraphLayout
BOTTOM_UP, LEFT_RIGHT, RIGHT_LEFT, TOP_DOWN -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFigureSubgraph(NodeLayout[] nodes, LayoutContext context) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNodes(NodeLayout[] nodes) Adds nodes to this subgraph.protected voidprotected abstract voidCreates a figure for this subgraph and stores it infigure.protected voiddispose()Returns a point laying in the center of this entity.Returns all entities that are direct predecessors of this entity.getSize()Returns all entities that are direct successors of this entity.booleanReturns true if this subgraph is visualized as a particular object on the graph.booleanprotected voidMakes sure that value returned byDefaultSubgraph.getLocation()will be equal to current location of this subgraph.voidremoveNodes(NodeLayout[] nodes) Removes nodes from this subgraph.voidsetLocation(double x, double y) Sets the position of this entity.protected abstract voidUpdates the figure stored infiguredepending on current nodes contained in this subgraph.Methods inherited from class org.eclipse.zest.core.widgets.DefaultSubgraph
countNodes, getItems, getNodes, getPreferredAspectRatio, isDirectionDependant, isResizable, refreshConnectionsVisibility, refreshSize, removeDisposedNodes, setDirection, setSize
-
Field Details
-
figure
-
-
Constructor Details
-
FigureSubgraph
-
-
Method Details
-
createFigure
protected abstract void createFigure()Creates a figure for this subgraph and stores it infigure. This method may not be called right after creation of the subgraph but later when the figure is actually needed (lazy initialization). -
updateFigure
protected abstract void updateFigure()Updates the figure stored infiguredepending on current nodes contained in this subgraph. If this method creates a new instance of IFigure, it should remember to add aFigureSubgraph.SubgraphFigrueListenerto it. -
getFigure
-
addNodes
Adds nodes to this subgraph. If given nodes already belong to another subgraph, they are first removed from them. All nodes added to this subgraph are moved to the center of the figure (so that collapsing and expanding animation looks cool).- Specified by:
addNodesin interfaceSubgraphLayout- Overrides:
addNodesin classDefaultSubgraph- Parameters:
nodes- array of nodes to add
-
removeNodes
Description copied from interface:SubgraphLayoutRemoves nodes from this subgraph.- Specified by:
removeNodesin interfaceSubgraphLayout- Overrides:
removeNodesin classDefaultSubgraph- Parameters:
nodes- array of nodes to remove
-
getSuccessingEntities
Description 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 interfaceEntityLayout- Overrides:
getSuccessingEntitiesin classDefaultSubgraph- Returns:
- array of successors of this node
-
getPredecessingEntities
Description 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 interfaceEntityLayout- Overrides:
getPredecessingEntitiesin classDefaultSubgraph- Returns:
- array of predecessors of this node
-
getSize
- Specified by:
getSizein interfaceEntityLayout- Overrides:
getSizein classDefaultSubgraph
-
getLocation
Description 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 interfaceEntityLayout- Overrides:
getLocationin classDefaultSubgraph- Returns:
- position of the center of this node
-
setLocation
public 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 interfaceEntityLayout- Overrides:
setLocationin classDefaultSubgraph- Parameters:
x- the x-positiony- the y-position
-
refreshLocation
protected void refreshLocation()Description copied from class:DefaultSubgraphMakes sure that value returned byDefaultSubgraph.getLocation()will be equal to current location of this subgraph.- Overrides:
refreshLocationin classDefaultSubgraph
-
isGraphEntity
public 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 interfaceSubgraphLayout- Overrides:
isGraphEntityin classDefaultSubgraph- Returns:
- whether or not this subgraph is a graph entity that should be laid out.
-
isMovable
public boolean isMovable()- Specified by:
isMovablein interfaceEntityLayout- Overrides:
isMovablein classDefaultSubgraph
-
dispose
protected void dispose()- Overrides:
disposein classDefaultSubgraph
-
applyLayoutChanges
protected void applyLayoutChanges()- Overrides:
applyLayoutChangesin classDefaultSubgraph
-