Class AbstractRouter

java.lang.Object
org.eclipse.draw2d.AbstractRouter
All Implemented Interfaces:
ConnectionRouter
Direct Known Subclasses:
AutomaticRouter, BendpointConnectionRouter, ConnectionRouter.NullConnectionRouter, ManhattanConnectionRouter, ShortestPathConnectionRouter

public abstract class AbstractRouter extends Object implements ConnectionRouter
Base class for implementing a connection router. This class provides stubs for constraint usage, and some utility methods.
  • Constructor Details

    • AbstractRouter

      public AbstractRouter()
  • Method Details

    • getConstraint

      public Object getConstraint(Connection connection)
      Returns the constraint for the given Connection.
      Specified by:
      getConstraint in interface ConnectionRouter
      Parameters:
      connection - The connection
      Returns:
      The constraint
      Since:
      2.0
    • getEndPoint

      protected Point getEndPoint(Connection connection)
      A convenience method for obtaining a connection's endpoint. The connection's endpoint is a point in absolute coordinates obtained by using its source and target ConnectionAnchor. The returned Point is a static singleton that is reused to reduce garbage collection. The caller may modify this point in any way. However, the point will be reused and its values overwritten during the next call to this method.
      Parameters:
      connection - The connection
      Returns:
      The endpoint
      Since:
      2.0
    • getStartPoint

      protected Point getStartPoint(Connection conn)
      A convenience method for obtaining a connection's start point. The connection's startpoint is a point in absolute coordinates obtained by using its source and target ConnectionAnchor. The returned Point is a static singleton that is reused to reduce garbage collection. The caller may modify this point in any way. However, the point will be reused and its values overwritten during the next call to this method.
      Parameters:
      conn - The connection
      Returns:
      The start point
      Since:
      2.0
    • invalidate

      public void invalidate(Connection connection)
      Causes the router to discard any cached information about the given Connection.
      Specified by:
      invalidate in interface ConnectionRouter
      Parameters:
      connection - The connection to invalidate
      Since:
      2.0
    • remove

      public void remove(Connection connection)
      Removes the given Connection from this routers list of Connections it is responsible for.
      Specified by:
      remove in interface ConnectionRouter
      Parameters:
      connection - The connection to remove
      Since:
      2.0
    • setConstraint

      public void setConstraint(Connection connection, Object constraint)
      Sets the constraint for the given Connection.
      Specified by:
      setConstraint in interface ConnectionRouter
      Parameters:
      connection - The connection
      constraint - The constraint
      Since:
      2.0