abbot.tester.extensions
Class JGraphLocation

java.lang.Object
  extended by abbot.tester.ComponentLocation
      extended by abbot.tester.extensions.JGraphLocation

public class JGraphLocation
extends ComponentLocation

Provides encapsulation of the location of vertices and edges in a JGraph (a coordinate or item index). This class provides an example of a ComponentLocation extension. Note that all bounds information must be converted to screen coordinates with JGraph#toScreen(Point2D) or JGraph#toScreen(Rectangle2D) before use in actions.


Field Summary
 
Fields inherited from class abbot.tester.ComponentLocation
CENTER
 
Constructor Summary
JGraphLocation()
           
JGraphLocation(int index)
           
JGraphLocation(Point where)
           
 
Method Summary
protected  String badFormat(String encoded)
           
 boolean equals(Object o)
          Returns whether the given object is an equivalent ComponentLocation.
 Rectangle getBounds(Component c)
          Return the bounds of this location.
protected  Rectangle getCellBounds(JGraph graph, Object o)
          Return the bounds of the cell in screen coordinates.
 Point getPoint(Component c)
          Return a concrete point for the abstract location.
protected  Point indexToPoint(JGraph graph, int index)
          Convert the given object index into a screen coordinate.
 ComponentLocation parse(String encoded)
          Convert the given encoding into the proper location.
protected  Point toScreen(JGraph graph, int x, int y)
           
protected  Rectangle toScreen(JGraph graph, Rectangle2D rect)
           
 String toString()
           
 
Methods inherited from class abbot.tester.ComponentLocation
encodeIndex, encodeValue, isIndex, isValue, parseIndex, parseValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JGraphLocation

public JGraphLocation()

JGraphLocation

public JGraphLocation(int index)

JGraphLocation

public JGraphLocation(Point where)
Method Detail

badFormat

protected String badFormat(String encoded)
Overrides:
badFormat in class ComponentLocation

getCellBounds

protected Rectangle getCellBounds(JGraph graph,
                                  Object o)
Return the bounds of the cell in screen coordinates.


indexToPoint

protected Point indexToPoint(JGraph graph,
                             int index)
Convert the given object index into a screen coordinate.


getPoint

public Point getPoint(Component c)
Return a concrete point for the abstract location.

Overrides:
getPoint in class ComponentLocation

getBounds

public Rectangle getBounds(Component c)
Return the bounds of this location. If the location refers to a cell, returns the cell's bounding box.

Overrides:
getBounds in class ComponentLocation

equals

public boolean equals(Object o)
Description copied from class: ComponentLocation
Returns whether the given object is an equivalent ComponentLocation.

Overrides:
equals in class ComponentLocation

toString

public String toString()
Overrides:
toString in class ComponentLocation

parse

public ComponentLocation parse(String encoded)
Description copied from class: ComponentLocation
Convert the given encoding into the proper location. Allowed formats: (x, y)

Overrides:
parse in class ComponentLocation

toScreen

protected Point toScreen(JGraph graph,
                         int x,
                         int y)

toScreen

protected Rectangle toScreen(JGraph graph,
                             Rectangle2D rect)


Copyright © 2002-2008 Timothy Wall. All Rights Reserved.
Abbot is hosted on

SourceForge