Java Doc for Tree.java in  » Testing » UISpec4J » org » uispec4j » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » UISpec4J » org.uispec4j 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.uispec4j.AbstractUIComponent
      org.uispec4j.Tree

Tree
public class Tree extends AbstractUIComponent (Code)
Wrapper for JTree components.

The nodes of a tree are identified using stringified paths. For instance, for the tree below:


 root
 |
 +- child
 |  |
 |  +- subChild
 |
 +- otherChild
 |
 +- otherSubChild
 
the "subChild" element is identified with the following path:

 child/subChild
 
Note that when defining paths the root element name is always omitted. The root node path itself is denoted by an empty string ("").

The default path separator is "/". However, this separator can be customized as follows:

When using paths, it is also possible to use substrings from the displayed node names. For instance, instead of writing:

 otherChild/otherSubChild
 
one can write:

 other/sub
 

The contents of the tree can be checked with Tree.contentEquals(String) , which is used as follows:


 assertTrue(jTree.contentEquals("root\n" +
 "  child1\n" +
 "    child1_1\n" +
 "  child2"));
 

The conversion between the values (Strings) given in the tests and the values actually displayed by the JTree renderer is performed by a dedicated TreeCellValueConverter , which retrieves the graphical component that draws the tree nodes and determines the displayed value accordingly. A DefaultTreeCellValueConverter is used by default by the Tree component.



Field Summary
final static  StringSEPARATOR_PROPERTY
    
final public static  Class[]SWING_CLASSES
    
final public static  StringTYPE_NAME
    
static  StringdefaultSeparator
    

Constructor Summary
public  Tree(JTree jTree)
    

Method Summary
public  voidaddToSelection(String path)
     Expands the current jTree selection with a given node.
public  voidaddToSelection(String parentPath, int childIndex)
     Expands the current jTree selection with a node identified by its position in its parent node.
static  StringbadTreePath(String path)
    
public  voidclearSelection()
     Removes the current selection.
public  voidclick(String path)
     Simulates a user left-click on a given node.
public  Assertioncontains(String path)
     Checks that a node identified by the given path is present in the jTree.
public  AssertioncontentEquals(String expectedContents)
     Checks the nodes structure displayed by the jTree.

The expected contents is a newline (\n) separated string where nodes are indented with two-space steps.

public  voidexpand(String path, boolean expand)
     Expands or collapses a given node.
public  voidexpandAll()
     Expands all the nodes of the jTree.
public  AssertionforegroundEquals(String path, String color)
     Checks the font color used on a given node.
public  ComponentgetAwtComponent()
    
public  intgetChildCount(String path)
     Returns the number of children of a given node.
public  StringgetDescriptionTypeName()
    
public  JTreegetJTree()
     Returns the JTree wrapped by this component.
public  StringgetSeparator()
     Returns the separator currently used for specifying node paths in this jTree instance.
public  AssertionpathIsExpanded(String path)
     Checks that the a given node of the jTree is expanded - i.e.
public  voidremoveFromSelection(String path)
     Removes the given node from the current jTree selection.
public  voidrightClick(String path)
     Simulates a user right-click on a given node.
public  voidrightClickInSelection()
     Right-clicks on the first selected node.
public  voidselect(String path)
     Sets the selection on the given node.
public  voidselect(String parentPath, int childIndex)
     Sets the jTree selection on a node identified by its position in its parent node.
public  voidselect(String parentPath, String childSubstring)
     Selects under a given parent all the nodes whose name contains a given substring.
public  voidselect(String[] paths)
    
public  voidselectRoot()
     Selects the root node of the jTree.
public  AssertionselectionEquals(String path)
     Checks that a given node is selected, and that is is the only selection.
public  AssertionselectionEquals(String[] paths)
     Checks the selection contents.
public  AssertionselectionIsEmpty()
     Checks that the selection is empty.
public  voidsetCellValueConverter(TreeCellValueConverter converter)
     Sets a new converter for retrieving the text displayed on the tree cells.
public static  voidsetDefaultSeparator(String separator)
     Sets the separator to be used for specifying node paths in new jTree instances.
public  voidsetSeparator(String separator)
     Sets the separator to be used for specifying node paths in this jTree instance.
public  StringtoString()
    
public  TriggertriggerClick(String path)
    
public  TriggertriggerRightClick(String path)
    
public  TriggertriggerRightClickInSelection()
    

Field Detail
SEPARATOR_PROPERTY
final static String SEPARATOR_PROPERTY(Code)



SWING_CLASSES
final public static Class[] SWING_CLASSES(Code)



TYPE_NAME
final public static String TYPE_NAME(Code)



defaultSeparator
static String defaultSeparator(Code)




Constructor Detail
Tree
public Tree(JTree jTree)(Code)




Method Detail
addToSelection
public void addToSelection(String path)(Code)
Expands the current jTree selection with a given node.



addToSelection
public void addToSelection(String parentPath, int childIndex)(Code)
Expands the current jTree selection with a node identified by its position in its parent node.

This method is preferred over Tree.addToSelection(String) when there are several nodes with the same name under a given parent.




badTreePath
static String badTreePath(String path)(Code)



clearSelection
public void clearSelection()(Code)
Removes the current selection.



click
public void click(String path)(Code)
Simulates a user left-click on a given node.



contains
public Assertion contains(String path)(Code)
Checks that a node identified by the given path is present in the jTree.



contentEquals
public Assertion contentEquals(String expectedContents)(Code)
Checks the nodes structure displayed by the jTree.

The expected contents is a newline (\n) separated string where nodes are indented with two-space steps. For instance:

 assertTrue(jTree.contentEquals("root\n" +
 "  child1\n" +
 "    child1_1\n" +
 "  child2"));
 
Text display properties such as boldness and color can be checked using a "#(...)" specifier. For instance:
 assertTrue(jTree.contentEquals("root\n" +
 "  child1 #(bold)\n" +
 "    child1_1 #(bold,color=red)\n" +
 "  child2"));
 
The properties are defined as follows:
  • The "bold" property must be present if and only if the node text is bold
  • The "color" property value can be numeric ("0000ee") or approximative ("blue") (see the Using colors page for more information)
  • The "bold" property, if present, must be placed before the "color" property



expand
public void expand(String path, boolean expand)(Code)
Expands or collapses a given node.
Parameters:
  path - a String identifying the path to be expanded or collapsed
Parameters:
  expand - if true, expand the node, and collapse it otherwise



expandAll
public void expandAll()(Code)
Expands all the nodes of the jTree.



foregroundEquals
public Assertion foregroundEquals(String path, String color)(Code)
Checks the font color used on a given node.



getAwtComponent
public Component getAwtComponent()(Code)



getChildCount
public int getChildCount(String path)(Code)
Returns the number of children of a given node.



getDescriptionTypeName
public String getDescriptionTypeName()(Code)



getJTree
public JTree getJTree()(Code)
Returns the JTree wrapped by this component.



getSeparator
public String getSeparator()(Code)
Returns the separator currently used for specifying node paths in this jTree instance.



pathIsExpanded
public Assertion pathIsExpanded(String path)(Code)
Checks that the a given node of the jTree is expanded - i.e. that its children are made visible.
Parameters:
  path - a String identifying the path to be expanded or collapsed



removeFromSelection
public void removeFromSelection(String path)(Code)
Removes the given node from the current jTree selection.



rightClick
public void rightClick(String path)(Code)
Simulates a user right-click on a given node.



rightClickInSelection
public void rightClickInSelection()(Code)
Right-clicks on the first selected node.



select
public void select(String path)(Code)
Sets the selection on the given node.



select
public void select(String parentPath, int childIndex)(Code)
Sets the jTree selection on a node identified by its position in its parent node.

This method is preferred over Tree.select(String) when there are several nodes with the same name under a given parent.




select
public void select(String parentPath, String childSubstring)(Code)
Selects under a given parent all the nodes whose name contains a given substring. This method will throw an exception if no the parent path was invalid or if no children were found.



select
public void select(String[] paths)(Code)



selectRoot
public void selectRoot()(Code)
Selects the root node of the jTree.



selectionEquals
public Assertion selectionEquals(String path)(Code)
Checks that a given node is selected, and that is is the only selection.



selectionEquals
public Assertion selectionEquals(String[] paths)(Code)
Checks the selection contents.



selectionIsEmpty
public Assertion selectionIsEmpty()(Code)
Checks that the selection is empty.



setCellValueConverter
public void setCellValueConverter(TreeCellValueConverter converter)(Code)
Sets a new converter for retrieving the text displayed on the tree cells.



setDefaultSeparator
public static void setDefaultSeparator(String separator)(Code)
Sets the separator to be used for specifying node paths in new jTree instances.



setSeparator
public void setSeparator(String separator)(Code)
Sets the separator to be used for specifying node paths in this jTree instance.



toString
public String toString()(Code)



triggerClick
public Trigger triggerClick(String path)(Code)



triggerRightClick
public Trigger triggerRightClick(String path)(Code)



triggerRightClickInSelection
public Trigger triggerRightClickInSelection()(Code)



Methods inherited from org.uispec4j.AbstractUIComponent
protected void addAttributes(Component component, XmlWriter.Tag tag)(Code)(Java Doc)
public Assertion backgroundEquals(String expectedColor)(Code)(Java Doc)
public Assertion foregroundEquals(String expectedColor)(Code)(Java Doc)
final public String getDescription()(Code)(Java Doc)
protected void getDescription(Component component, XmlWriter.Tag tag, boolean showVisibleOnly)(Code)(Java Doc)
public String getLabel()(Code)(Java Doc)
public String getName()(Code)(Java Doc)
protected void getSubDescription(Container container, XmlWriter.Tag tag)(Code)(Java Doc)
public Assertion isEnabled()(Code)(Java Doc)
public Assertion isVisible()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.