Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Draw2d
3.3

org.eclipse.draw2d
Class AutomaticRouter

java.lang.Object
  extended by

org.eclipse.draw2d.AbstractRouter
      extended by
org.eclipse.draw2d.AutomaticRouter
All Implemented Interfaces:
ConnectionRouter
Direct Known Subclasses:
FanRouter

public abstract class AutomaticRouter
extends AbstractRouter

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 Summary
 
Nested classes inherited from class org.eclipse.draw2d. ConnectionRouter
ConnectionRouter.NullConnectionRouter
 
Field Summary
 
Fields inherited from interface org.eclipse.draw2d. ConnectionRouter
NULL
 
Constructor Summary
AutomaticRouter ()
           
 
Method Summary
 java.lang.Object getConstraint ( Connection connection)
          Returns the constraint for the given Connection.
protected abstract  void handleCollision ( PointList list, int index)
          Handles collisions between 2 or more Connections.
 void invalidate ( Connection conn)
          Causes the router to discard any cached information about the given Connection.
protected   ConnectionRouter next ()
          Returns the next router in the chain.
 void remove ( Connection conn)
          Removes the given Connection from this routers list of Connections it is responsible for.
 void route ( Connection conn)
          Routes the given connection.
 void setConstraint ( Connection connection, java.lang.Object constraint)
          An AutomaticRouter needs no constraints for the connections it routes.
protected  void setEndPoints ( Connection conn)
          Sets the start and end points for the given connection.
 void setNextRouter ( ConnectionRouter router)
          Sets the next router.
 
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

AutomaticRouter

public AutomaticRouter()
Method Detail

getConstraint

public java.lang.Object getConstraint(
Connection connection)
Description copied from class: AbstractRouter
Returns the constraint for the given Connection.

Specified by:
getConstraint in interface ConnectionRouter
Overrides:
getConstraint in class AbstractRouter
Parameters:
connection - The connection
Returns:
The constraint
See Also:
ConnectionRouter.getConstraint(Connection)

handleCollision

protected abstract void handleCollision(
PointList list,
                                        int index)
Handles 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

invalidate

public void invalidate(
Connection conn)
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:
conn - The connection to invalidate
See Also:
ConnectionRouter.invalidate(Connection)

next

protected 
ConnectionRouter next()
Returns the next router in the chain.

Returns:
The next router
Since:
2.0

remove

public void remove(
Connection conn)
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:
conn - The connection to remove
See Also:
ConnectionRouter.remove(Connection)

route

public void route(
Connection conn)
Routes 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 calling handleCollision(PointList, int).

Parameters:
conn - The connection to route

setConstraint

public void setConstraint(
Connection connection,
                          java.lang.Object constraint)
An AutomaticRouter needs no constraints for the connections it routes. This method invalidates the connections and calls setConstraint(Connection, Object) on the next() router.

Specified by:
setConstraint in interface ConnectionRouter
Overrides:
setConstraint in class AbstractRouter
Parameters:
connection - The connection
constraint - The constraint
See Also:
ConnectionRouter.setConstraint(Connection, Object)

setEndPoints

protected void setEndPoints(
Connection conn)
Sets the start and end points for the given connection.

Parameters:
conn - The connection

setNextRouter

public void setNextRouter(
ConnectionRouter router)
Sets the next router.

Parameters:
router - The ConnectionRouter
Since:
2.0

Eclipse Draw2d
3.3

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

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire