Package org.eclipse.draw2d
Class AutomaticRouter
java.lang.Object
org.eclipse.draw2d.AbstractRouter
org.eclipse.draw2d.AutomaticRouter
- All Implemented Interfaces:
- ConnectionRouter
- Direct Known Subclasses:
- FanRouter
An abstract router implementation which detects when multiple connections are
 overlapping. Two connections overlap if the combination of source and target
 anchors are equal. Subclasses must implement
 
handleCollision(PointList, int) to determine how to avoid the
 overlap.
 This router can delegate to another connection router. The wrappered router will route the connections first, after which overlapping will be determined.
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.eclipse.draw2d.ConnectionRouterConnectionRouter.NullConnectionRouter
- 
Field SummaryFields inherited from interface org.eclipse.draw2d.ConnectionRouterNULL
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptiongetConstraint(Connection connection) Returns the constraint for the given Connection.protected abstract voidhandleCollision(PointList list, int index) Handles collisions between 2 or more Connections.voidinvalidate(Connection conn) Causes the router to discard any cached information about the given Connection.protected ConnectionRouternext()Returns the next router in the chain.voidremove(Connection conn) Removes the given Connection from this routers list of Connections it is responsible for.voidroute(Connection conn) Routes the given connection.voidsetConstraint(Connection connection, Object constraint) An AutomaticRouter needs no constraints for the connections it routes.protected voidsetEndPoints(Connection conn) Sets the start and end points for the given connection.voidsetNextRouter(ConnectionRouter router) Sets the next router.Methods inherited from class org.eclipse.draw2d.AbstractRoutergetEndPoint, getStartPoint
- 
Constructor Details- 
AutomaticRouterpublic AutomaticRouter()
 
- 
- 
Method Details- 
getConstraintDescription copied from class:AbstractRouterReturns the constraint for the given Connection.- Specified by:
- getConstraintin interface- ConnectionRouter
- Overrides:
- getConstraintin class- AbstractRouter
- Parameters:
- connection- The connection
- Returns:
- The constraint
- See Also:
 
- 
handleCollisionHandles collisions between 2 or more Connections. Collisions are currently defined as 2 connections with no bendpoints and whose start and end points coincide. In other words, the 2 connections are the exact same line.- Parameters:
- list- The PointList of a connection that collides with another connection
- index- The index of the current connection in the list of colliding connections
 
- 
invalidateDescription copied from class:AbstractRouterCauses the router to discard any cached information about the given Connection.- Specified by:
- invalidatein interface- ConnectionRouter
- Overrides:
- invalidatein class- AbstractRouter
- Parameters:
- conn- The connection to invalidate
- See Also:
 
- 
nextReturns the next router in the chain.- Returns:
- The next router
- Since:
- 2.0
 
- 
removeDescription copied from class:AbstractRouterRemoves the given Connection from this routers list of Connections it is responsible for.- Specified by:
- removein interface- ConnectionRouter
- Overrides:
- removein class- AbstractRouter
- Parameters:
- conn- The connection to remove
- See Also:
 
- 
routeRoutes the given connection. Calls the 'next' router first (if one exists) and if no bendpoints were added by the next router, collisions are dealt with by callinghandleCollision(PointList, int).- Parameters:
- conn- The connection to route
 
- 
setConstraintAn AutomaticRouter needs no constraints for the connections it routes. This method invalidates the connections and callssetConstraint(Connection, Object)on thenext()router.- Specified by:
- setConstraintin interface- ConnectionRouter
- Overrides:
- setConstraintin class- AbstractRouter
- Parameters:
- connection- The connection
- constraint- The constraint
- See Also:
 
- 
setEndPointsSets the start and end points for the given connection.- Parameters:
- conn- The connection
 
- 
setNextRouterSets the next router.- Parameters:
- router- The ConnectionRouter
- Since:
- 2.0
 
 
-