abbot.tester
Class JTreeLocation

java.lang.Object
  extended byabbot.tester.ComponentLocation
      extended byabbot.tester.JTreeLocation

public class JTreeLocation
extends ComponentLocation

Provides encapsulation of a location on a JTree. A row may be indicated with [row] or a tree path [root, parent, child].


Constructor Summary
JTreeLocation()
           
JTreeLocation(int row)
           
JTreeLocation(Point p)
           
JTreeLocation(TreePath treePath)
           
 
Method Summary
protected  String badFormat(String encoded)
           
(package private) static TreePath convertPath(JTree tree, TreePath path)
          Given a TreePath of Strings, return the equivalent TreePath for the given JTree.
 boolean equals(Object o)
           
 Rectangle getBounds(Component c)
          Convert the abstract location into a concrete area.
(package private)  TreePath getPath(JTree tree)
          Return the path represented by this JTree location.
 Point getPoint(Component c)
          Return a concrete point for the abstract location.
(package private)  int getRow(JTree tree)
          Return the row represented by this JTree location.
 ComponentLocation parse(String encoded)
          Convert the given encoding into the proper location.
protected  Point pathToPoint(JTree tree, TreePath path)
          Convert the given path to an x, y coordinate.
protected  Point rowToPoint(JTree tree, int row)
          Convert the given row to an x, y coordinate.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JTreeLocation

public JTreeLocation()

JTreeLocation

public JTreeLocation(int row)

JTreeLocation

public JTreeLocation(TreePath treePath)

JTreeLocation

public JTreeLocation(Point p)
Method Detail

rowToPoint

protected Point rowToPoint(JTree tree,
                           int row)
Convert the given row to an x, y coordinate.

Throws:
LocationUnavailableException - if the row is not visible.

pathToPoint

protected Point pathToPoint(JTree tree,
                            TreePath path)
Convert the given path to an x, y coordinate.

Throws:
LocationUnavailableException - if any part of the path is hidden.

getPath

TreePath getPath(JTree tree)
Return the path represented by this JTree location.


getRow

int getRow(JTree tree)
Return the row represented by this JTree location.


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)
Description copied from class: ComponentLocation
Convert the abstract location into a concrete area. If a point has been specified, returns a 1x1 rectangle, otherwise returns the a rectangle at (0, 0) of the Component's size.

Overrides:
getBounds in class ComponentLocation

equals

public boolean equals(Object o)
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

badFormat

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

convertPath

static TreePath convertPath(JTree tree,
                            TreePath path)
Given a TreePath of Strings, return the equivalent TreePath for the given JTree. If necessary, expands nodes in the tree until the requested path is fully visible.



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

SourceForge