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

public abstract class FigureSubgraph extends DefaultSubgraph
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
  • Field Details

    • figure

      protected IFigure figure
  • Constructor Details

  • Method Details

    • createFigure

      protected abstract void createFigure()
      Creates a figure for this subgraph and stores it in figure. 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 in figure depending on current nodes contained in this subgraph. If this method creates a new instance of IFigure, it should remember to add a FigureSubgraph.SubgraphFigrueListener to it.
    • getFigure

      public IFigure getFigure()
    • addNodes

      public void addNodes(NodeLayout[] nodes)
      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 interface SubgraphLayout
      Overrides:
      addNodes in class DefaultSubgraph
      Parameters:
      nodes - array of nodes to add
    • removeNodes

      public void removeNodes(NodeLayout[] nodes)
      Description copied from interface: SubgraphLayout
      Removes nodes from this subgraph.
      Specified by:
      removeNodes in interface SubgraphLayout
      Overrides:
      removeNodes in class DefaultSubgraph
      Parameters:
      nodes - array of nodes to remove
    • getSuccessingEntities

      public EntityLayout[] 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
      Successor entities of a subgraph S that is a 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
      For subgraphs that are not 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 interface EntityLayout
      Overrides:
      getSuccessingEntities in class DefaultSubgraph
      Returns:
      array of successors of this node
    • getPredecessingEntities

      public EntityLayout[] 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
      Successor entities of a subgraph S that is a 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
      For subgraphs that are not 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 interface EntityLayout
      Overrides:
      getPredecessingEntities in class DefaultSubgraph
      Returns:
      array of predecessors of this node
    • getSize

      public DisplayIndependentDimension getSize()
      Specified by:
      getSize in interface EntityLayout
      Overrides:
      getSize in class DefaultSubgraph
    • getLocation

      public DisplayIndependentPoint 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 interface EntityLayout
      Overrides:
      getLocation in class DefaultSubgraph
      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 interface EntityLayout
      Overrides:
      setLocation in class DefaultSubgraph
      Parameters:
      x - the x-position
      y - the y-position
    • refreshLocation

      protected void refreshLocation()
      Description copied from class: DefaultSubgraph
      Makes sure that value returned by DefaultSubgraph.getLocation() will be equal to current location of this subgraph.
      Overrides:
      refreshLocation in class DefaultSubgraph
    • 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 interface SubgraphLayout
      Overrides:
      isGraphEntity in class DefaultSubgraph
      Returns:
      whether or not this subgraph is a graph entity that should be laid out.
    • isMovable

      public boolean isMovable()
      Specified by:
      isMovable in interface EntityLayout
      Overrides:
      isMovable in class DefaultSubgraph
    • dispose

      protected void dispose()
      Overrides:
      dispose in class DefaultSubgraph
    • applyLayoutChanges

      protected void applyLayoutChanges()
      Overrides:
      applyLayoutChanges in class DefaultSubgraph