Package org.eclipse.draw2d
Class ShortestPathConnectionRouter
java.lang.Object
org.eclipse.draw2d.AbstractRouter
org.eclipse.draw2d.ShortestPathConnectionRouter
- All Implemented Interfaces:
ConnectionRouter
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
ConstructorsConstructorDescriptionShortestPathConnectionRouter
(IFigure container) Creates a new shortest path router with the given container. -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsConnection
(Connection conn) Returns true if the given connection is routed by this router, false otherwisegetConstraint
(Connection connection) Gets the constraint for the givenConnection
.int
Returns the default spacing maintained on either side of a connection.boolean
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 routedvoid
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, 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
Returns the value indicating if connection invalidation should be ignored.Methods inherited from class org.eclipse.draw2d.AbstractRouter
getEndPoint, getStartPoint
-
Constructor Details
-
ShortestPathConnectionRouter
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
Gets the constraint for the givenConnection
. The constraint is the paths list of bend points for this connection.- Specified by:
getConstraint
in interfaceConnectionRouter
- Overrides:
getConstraint
in classAbstractRouter
- 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
Description copied from class:AbstractRouter
Causes the router to discard any cached information about the given Connection.- Specified by:
invalidate
in interfaceConnectionRouter
- Overrides:
invalidate
in classAbstractRouter
- Parameters:
connection
- The connection to invalidate- See Also:
-
remove
Description copied from class:AbstractRouter
Removes the given Connection from this routers list of Connections it is responsible for.- Specified by:
remove
in interfaceConnectionRouter
- Overrides:
remove
in classAbstractRouter
- Parameters:
connection
- The connection to remove- See Also:
-
route
Description copied from interface:ConnectionRouter
Routes the Connection.- Parameters:
conn
- The Connection to route- See Also:
-
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
Description copied from class:AbstractRouter
Sets the constraint for the given Connection.- Specified by:
setConstraint
in interfaceConnectionRouter
- Overrides:
setConstraint
in classAbstractRouter
- Parameters:
connection
- The connectionconstraint
- 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
- 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
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
-