Eclipse Draw2d 3.3

## org.eclipse.draw2d
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

Nested Class Summary

Nested classes/interfaces inherited from interface org.eclipse.draw2d.ConnectionRouter
`ConnectionRouter.NullConnectionRouter`

Field Summary

Fields inherited from interface org.eclipse.draw2d.ConnectionRouter
`NULL`

Constructor Summary
`ShortestPathConnectionRouter(IFigure container)` Creates a new shortest path router with the given container.

Method Summary
`boolean` `containsConnection(Connection conn)` Returns true if the given connection is routed by this router, false otherwise
`java.lang.Object` `getConstraint(Connection connection)` Gets the constraint for the given `Connection`.
`IFigure` `getContainer()`
`java.util.List` `getPathsAfterRouting()`
`int` `getSpacing()` Returns the default spacing maintained on either side of a connection.
`boolean` `hasMoreConnections()`
`void` `invalidate(Connection connection)` Causes the router to discard any cached information about the given Connection.
`boolean` `isDirty()` Returns the value indicating if the router is dirty, i.e. if there are any outstanding connections that need to be routed
`void` `remove(Connection connection)` Removes the given Connection from this routers list of Connections it is responsible for.
`void` `route(Connection conn)` Routes the Connection.
`void` `setConstraint(Connection connection, java.lang.Object constraint)` Sets the constraint for the given Connection.
`void` `setIgnoreInvalidate(boolean b)` Sets the value indicating if connection invalidation should be ignored.
`void` `setSpacing(int spacing)` Sets the default space that should be maintained on either side of a connection.
`boolean` `shouldIgnoreInvalidate()` Returns the value indicating if connection invalidation should be ignored.

Methods inherited from class org.eclipse.draw2d.AbstractRouter
`getEndPoint, getStartPoint`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### 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 Detail

### getConstraint

    public java.lang.Object 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

### 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:
    `ConnectionRouter.invalidate(Connection)`

### 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:
    `ConnectionRouter.remove(Connection)`

### route

    public void route(Connection conn)

  Description copied from interface: `ConnectionRouter`
  Routes the Connection.

  Parameters:
    `conn` - The Connection to route
  See Also:
    `ConnectionRouter.route(Connection)`

### getPathsAfterRouting

    public java.util.List 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,
                              java.lang.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:
    `ConnectionRouter.setConstraint(Connection, Object)`

### 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

Eclipse Draw2d 3.3

Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.