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 class
Listens 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, nodes
Fields inherited from interface org.eclipse.zest.layouts.interfaces.SubgraphLayout
BOTTOM_UP, LEFT_RIGHT, RIGHT_LEFT, TOP_DOWN
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
FigureSubgraph
(NodeLayout[] nodes, LayoutContext context) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addNodes
(NodeLayout[] nodes) Adds nodes to this subgraph.protected void
protected abstract void
Creates a figure for this subgraph and stores it infigure
.protected void
dispose()
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.boolean
Returns true if this subgraph is visualized as a particular object on the graph.boolean
protected void
Makes sure that value returned byDefaultSubgraph.getLocation()
will be equal to current location of this subgraph.void
removeNodes
(NodeLayout[] nodes) Removes nodes from this subgraph.void
setLocation
(double x, double y) Sets the position of this entity.protected abstract void
Updates the figure stored infigure
depending 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 infigure
depending on current nodes contained in this subgraph. If this method creates a new instance of IFigure, it should remember to add aFigureSubgraph.SubgraphFigrueListener
to 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:
addNodes
in interfaceSubgraphLayout
- Overrides:
addNodes
in classDefaultSubgraph
- Parameters:
nodes
- array of nodes to add
-
removeNodes
Description copied from interface:SubgraphLayout
Removes nodes from this subgraph.- Specified by:
removeNodes
in interfaceSubgraphLayout
- Overrides:
removeNodes
in classDefaultSubgraph
- Parameters:
nodes
- array of nodes to remove
-
getSuccessingEntities
Description copied from interface:EntityLayout
Returns 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
GraphEntities
and contain at least one successor node of node N
GraphEntity
are:- all unpruned nodes that are successor of at least one node from subgraph S
- all subgraphs that are
GraphEntities
and contain at least one node that is a successor of at least one node from subgraph S
GraphEntities
an 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:
getSuccessingEntities
in interfaceEntityLayout
- Overrides:
getSuccessingEntities
in classDefaultSubgraph
- Returns:
- array of successors of this node
-
getPredecessingEntities
Description copied from interface:EntityLayout
Returns 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
GraphEntities
and contain at least one predecessor node of node N
GraphEntity
are:- all unpruned nodes that are predecessor of at least one node from subgraph S
- all subgraphs that are
GraphEntities
and contain at least one node that is a predecessor of at least one node from subgraph S
GraphEntities
an 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:
getPredecessingEntities
in interfaceEntityLayout
- Overrides:
getPredecessingEntities
in classDefaultSubgraph
- Returns:
- array of predecessors of this node
-
getSize
- Specified by:
getSize
in interfaceEntityLayout
- Overrides:
getSize
in classDefaultSubgraph
-
getLocation
Description copied from interface:EntityLayout
Returns a point laying in the center of this entity. Any subsequent changes to the returned point won't affect this node.- Specified by:
getLocation
in interfaceEntityLayout
- Overrides:
getLocation
in classDefaultSubgraph
- Returns:
- position of the center of this node
-
setLocation
public void setLocation(double x, double y) Description copied from interface:EntityLayout
Sets the position of this entity. The node will be moved so that it's center is located in the given point.- Specified by:
setLocation
in interfaceEntityLayout
- Overrides:
setLocation
in classDefaultSubgraph
- Parameters:
x
- the x-positiony
- the y-position
-
refreshLocation
protected void refreshLocation()Description copied from class:DefaultSubgraph
Makes sure that value returned byDefaultSubgraph.getLocation()
will be equal to current location of this subgraph.- Overrides:
refreshLocation
in classDefaultSubgraph
-
isGraphEntity
public boolean isGraphEntity()Description copied from interface:SubgraphLayout
Returns 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:
isGraphEntity
in interfaceSubgraphLayout
- Overrides:
isGraphEntity
in classDefaultSubgraph
- Returns:
- whether or not this subgraph is a graph entity that should be laid out.
-
isMovable
public boolean isMovable()- Specified by:
isMovable
in interfaceEntityLayout
- Overrides:
isMovable
in classDefaultSubgraph
-
dispose
protected void dispose()- Overrides:
dispose
in classDefaultSubgraph
-
applyLayoutChanges
protected void applyLayoutChanges()- Overrides:
applyLayoutChanges
in classDefaultSubgraph
-