Class ShortestPathConnectionRouter

java.lang.Object
org.eclipse.draw2d.AbstractRouter
org.eclipse.draw2d.ShortestPathConnectionRouter
All Implemented Interfaces:
ConnectionRouter

public final class ShortestPathConnectionRouter extends AbstractRouter
Routes multiple connections around the children of a given container figure.
Since:
3.1
  • Constructor Details

    • ShortestPathConnectionRouter

      public ShortestPathConnectionRouter(IFigure container)
      Creates a new shortest path router with the given container. The container contains all the figure's which will be treated as obstacles for the connections to avoid. Any time a child of the container moves, one or more connections will be revalidated to process the new obstacle locations. The connections being routed must not be contained within the container.
      Parameters:
      container - the container
  • Method Details

    • getConstraint

      public List<Bendpoint> getConstraint(Connection connection)
      Gets the constraint for the given Connection. The constraint is the paths list of bend points for this connection.
      Specified by:
      getConstraint in interface ConnectionRouter
      Overrides:
      getConstraint in class AbstractRouter
      Parameters:
      connection - The connection whose constraint we are retrieving
      Returns:
      The constraint
      Since:
      3.15
    • getSpacing

      public int getSpacing()
      Returns the default spacing maintained on either side of a connection. The default value is 4.
      Returns:
      the connection spacing
      Since:
      3.2
    • invalidate

      public void invalidate(Connection connection)
      Description copied from class: AbstractRouter
      Causes the router to discard any cached information about the given Connection.
      Specified by:
      invalidate in interface ConnectionRouter
      Overrides:
      invalidate in class AbstractRouter
      Parameters:
      connection - The connection to invalidate
      See Also:
    • remove

      public void remove(Connection connection)
      Description copied from class: AbstractRouter
      Removes the given Connection from this routers list of Connections it is responsible for.
      Specified by:
      remove in interface ConnectionRouter
      Overrides:
      remove in class AbstractRouter
      Parameters:
      connection - The connection to remove
      See Also:
    • route

      public void route(Connection conn)
      Description copied from interface: ConnectionRouter
      Routes the Connection.
      Parameters:
      conn - The Connection to route
      See Also:
    • getPathsAfterRouting

      public List<Path> getPathsAfterRouting()
      Returns:
      All connection paths after routing dirty paths. Some of the paths that were not dirty may change as well, as a consequence of new routings.
      Since:
      3.5
    • setConstraint

      public void setConstraint(Connection connection, Object constraint)
      Description copied from class: AbstractRouter
      Sets the constraint for the given Connection.
      Specified by:
      setConstraint in interface ConnectionRouter
      Overrides:
      setConstraint in class AbstractRouter
      Parameters:
      connection - The connection
      constraint - The constraint
      See Also:
    • setSpacing

      public void setSpacing(int spacing)
      Sets the default space that should be maintained on either side of a connection. This causes the connections to be separated from each other and from the obstacles. The default value is 4.
      Parameters:
      spacing - the connection spacing
      Since:
      3.2
    • hasMoreConnections

      public boolean hasMoreConnections()
      Returns:
      true if there are connections routed by this router, false otherwise
      Since:
      3.5
    • getContainer

      public IFigure getContainer()
      Returns:
      the container which contains connections routed by this router
      Since:
      3.5
    • setIgnoreInvalidate

      public void setIgnoreInvalidate(boolean b)
      Sets the value indicating if connection invalidation should be ignored.
      Parameters:
      b - true if invalidation should be skipped, false otherwise
      Since:
      3.5
    • shouldIgnoreInvalidate

      public boolean shouldIgnoreInvalidate()
      Returns the value indicating if connection invalidation should be ignored.
      Returns:
      true if invalidation should be skipped, false otherwise
      Since:
      3.5
    • isDirty

      public boolean isDirty()
      Returns the value indicating if the router is dirty, i.e. if there are any outstanding connections that need to be routed
      Returns:
      true if there are connections to be routed, false otherwise
      Since:
      3.5
    • containsConnection

      public boolean containsConnection(Connection conn)
      Returns true if the given connection is routed by this router, false otherwise
      Parameters:
      conn - Connection whose router is questioned
      Returns:
      true if this is the router used for conn
      Since:
      3.5