qat.gui
Class TestTree

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byqat.gui.TestTree
All Implemented Interfaces:
java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.io.Serializable, javax.swing.event.TreeExpansionListener

public class TestTree
extends javax.swing.JComponent
implements java.awt.event.MouseListener, javax.swing.event.TreeExpansionListener

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TestTree()
          This constructor creates the tree
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener c)
          This add a listener interested in recieiveing events whenever a node of this tree changes.
 void addTreeSelectionListener(javax.swing.event.TreeSelectionListener l)
           
 void collapseLevel()
           
 void expandAll()
           
 void expandLevel()
           
 void fireChangeEvent(TestTreeNode node)
           
 java.util.ArrayList getAllNodes()
          This method returns all the TestTreeNode in the tree.
 java.util.ArrayList getAllNodes(TestTreeNode node)
          This method returns all the TestTreeNode starting at the node parameter.
 java.util.ArrayList getAllTestNodes()
          This method returns all the TestTreeNodes in the test tree.
 java.util.ArrayList getAllTestNodes(TestTreeNode node)
          This method returns all the TestTreeNodes starting at the node parameter.
 java.util.ArrayList getAllTests()
          This method returns all the tests in the test tree.
 java.util.ArrayList getAllTests(TestTreeNode node)
          This method returns all the tests starting at the node parameter.
 java.util.ArrayList getAllTestsByParent()
          This method returns all the tests in the test tree on a per node basis.
 java.util.Properties getDefaultProperties()
           
 java.lang.String[] getKeyWordList()
           
 TestTreeNode getNode(TestSpecification test)
          This method returns the TestTreeNode matching the test parameter.
 TestTreeNode getNode(javax.swing.tree.TreePath tree)
          This method returns the TestTreeNode matching the TreePath parameter.
 QAT getParentQAT()
           
 java.lang.String getProjectRoot()
           
 TestTreeNode getRoot()
           
 java.util.ArrayList getSelectedTestNodes()
          This method returns an array of all selected TestTreeNodes.
 java.util.ArrayList getSelectedTests()
          This method returns an array of all selected TestSpecifications.
 TestSpecification getTestSpecification(java.lang.String testSpecPath)
          This method will return the test which has a matching testSpecPath, which should be unique for each test.
 javax.swing.JTree getTree()
          Returns the tree object used by TestTree.
 javax.swing.tree.TreePath getTreePath(TestTreeNode node)
           
 void loadNewTestDir(java.lang.String dirPath, StatusWindow status)
          This method clears all the tests currently in the tree, and load all tests & subdirectorys contained within the specified path.
 void loadNode(java.io.ObjectInputStream in, TestTreeNode parent)
           
 void loadTests(java.io.ObjectInputStream in)
          This method loads the test tree from file.
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void nodeChanged(TestTreeNode node)
           
 TestSpecification parseTest(TestSpecification test, ParserInterface parser)
           
 void parseTestNode(TestTreeNode node, ParserInterface parser)
           
 void parseTestsFrom(TestTreeNode thisRoot, StatusWindow status)
          This method is called to re-check if any new tests exist in the directory thisRoot, or if any have been deleted.
 void pauseListeners()
          When we select tests by keyword selection, it is neccesary to remove all registered selection listeners to prevent each trace file being loaded as the tests are selected.
 void removeAllNodes()
           
 void removeChangeListener(javax.swing.event.ChangeListener c)
           
 void resetSelectedTestStatus()
          This method resets the status of all selected tests to NOTRUN.
 void resumeListeners()
          This method re-adds all required selection listeners to this tree.
 void saveNode(java.io.ObjectOutputStream out, TestTreeNode node)
           
 void saveTests(java.io.ObjectOutputStream out)
          This method writes out the test tree to file.
 void selectAll()
          Selects all the nodes in the tree, and expands the entire tree so that all the selected nodes are visible.
 void selectAllWithStatus(int status)
           
 void selectNode(TestTreeNode node)
          Searches for the node in the tree matching test, and sets it to selected.
 void selectTest(TestSpecification test)
          Searches for the node in the tree matching test, and sets it to selected.
 void setDefaultProperties(java.util.Properties p)
           
 void setParentQAT(QAT q)
          This method gives us a handle to the parent QAT to pass on to the NodePopup Menu, so we can use it's runSingleTest method and have access to the GUI from the NodeMenu.
 boolean setTest(TestSpecification test)
          This method searchs the tree starting at node, until a TestSpecification name matches the parameter test, and then replaces it with test.
 void sortTree()
          This method sorts all of the nodes in this tree.
 void treeCollapsed(javax.swing.event.TreeExpansionEvent event)
           
 void treeExpanded(javax.swing.event.TreeExpansionEvent event)
           
 void unSelectAll()
          Unselects all the nodes in the tree.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestTree

public TestTree()
This constructor creates the tree

Method Detail

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener c)
This add a listener interested in recieiveing events whenever a node of this tree changes. No duplicates are allowed.


removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener c)

fireChangeEvent

public void fireChangeEvent(TestTreeNode node)

addTreeSelectionListener

public void addTreeSelectionListener(javax.swing.event.TreeSelectionListener l)

pauseListeners

public void pauseListeners()
When we select tests by keyword selection, it is neccesary to remove all registered selection listeners to prevent each trace file being loaded as the tests are selected.


resumeListeners

public void resumeListeners()
This method re-adds all required selection listeners to this tree.


setDefaultProperties

public void setDefaultProperties(java.util.Properties p)

getDefaultProperties

public java.util.Properties getDefaultProperties()

getRoot

public TestTreeNode getRoot()

getProjectRoot

public java.lang.String getProjectRoot()

getTestSpecification

public TestSpecification getTestSpecification(java.lang.String testSpecPath)
This method will return the test which has a matching testSpecPath, which should be unique for each test.


getKeyWordList

public java.lang.String[] getKeyWordList()

loadNewTestDir

public void loadNewTestDir(java.lang.String dirPath,
                           StatusWindow status)
This method clears all the tests currently in the tree, and load all tests & subdirectorys contained within the specified path.


removeAllNodes

public void removeAllNodes()

parseTestsFrom

public void parseTestsFrom(TestTreeNode thisRoot,
                           StatusWindow status)
This method is called to re-check if any new tests exist in the directory thisRoot, or if any have been deleted.


getNode

public TestTreeNode getNode(javax.swing.tree.TreePath tree)
This method returns the TestTreeNode matching the TreePath parameter.


getNode

public TestTreeNode getNode(TestSpecification test)
This method returns the TestTreeNode matching the test parameter.


getTreePath

public javax.swing.tree.TreePath getTreePath(TestTreeNode node)

getTree

public javax.swing.JTree getTree()
Returns the tree object used by TestTree.


selectNode

public void selectNode(TestTreeNode node)
Searches for the node in the tree matching test, and sets it to selected. If not visible, the tree will be expanded until this node is visible.


selectTest

public void selectTest(TestSpecification test)
Searches for the node in the tree matching test, and sets it to selected. If not visible, the tree will be expanded until this node is visible.


selectAll

public void selectAll()
Selects all the nodes in the tree, and expands the entire tree so that all the selected nodes are visible.


unSelectAll

public void unSelectAll()
Unselects all the nodes in the tree.


selectAllWithStatus

public void selectAllWithStatus(int status)

expandAll

public void expandAll()

expandLevel

public void expandLevel()

collapseLevel

public void collapseLevel()

getSelectedTests

public java.util.ArrayList getSelectedTests()
This method returns an array of all selected TestSpecifications. If a sub-directory is selected, any tests contained within that directory are considered as selected.


getSelectedTestNodes

public java.util.ArrayList getSelectedTestNodes()
This method returns an array of all selected TestTreeNodes. If a sub-directory is selected, any tests contained within that directory are considered as selected.


setTest

public boolean setTest(TestSpecification test)
This method searchs the tree starting at node, until a TestSpecification name matches the parameter test, and then replaces it with test. Note: the node is not explictly repainted

Parameters:
test - - the test we will replace the one in the list with
Returns:
- returns true if the test was found and replaced, else returns false.

getAllTestNodes

public java.util.ArrayList getAllTestNodes()
This method returns all the TestTreeNodes in the test tree.

Returns:
a ArrayList containing all the TestTreeNodes containing TestSpecification objects in this tree.

getAllTests

public java.util.ArrayList getAllTests()
This method returns all the tests in the test tree.

Returns:
a ArrayList containing all the TestSpecification objects in this tree.

getAllTestsByParent

public java.util.ArrayList getAllTestsByParent()
This method returns all the tests in the test tree on a per node basis. Used by the Http interface for displaying test overview.

Returns:
an ArrayList of ArrayLists, each containing in position zero the String name for a node, and in the rest all the TestSpecification objects.

getAllTestNodes

public java.util.ArrayList getAllTestNodes(TestTreeNode node)
This method returns all the TestTreeNodes starting at the node parameter.

Parameters:
node - - the root to start building the test list from.
Returns:
a ArrayList containing all the TestTreeNode objects in this tree.

getAllTests

public java.util.ArrayList getAllTests(TestTreeNode node)
This method returns all the tests starting at the node parameter.

Parameters:
node - - the root to start building the test list from.
Returns:
a ArrayList containing all the TestSpecification objects in this tree.

getAllNodes

public java.util.ArrayList getAllNodes()
This method returns all the TestTreeNode in the tree.

Returns:
a ArrayList containing all the TestTreeNode objects in this tree.

getAllNodes

public java.util.ArrayList getAllNodes(TestTreeNode node)
This method returns all the TestTreeNode starting at the node parameter.

Parameters:
node - - the root to start building the test list from.
Returns:
a ArrayList containing all the TestTreeNode objects in this tree.

parseTestNode

public void parseTestNode(TestTreeNode node,
                          ParserInterface parser)

parseTest

public TestSpecification parseTest(TestSpecification test,
                                   ParserInterface parser)

resetSelectedTestStatus

public void resetSelectedTestStatus()
This method resets the status of all selected tests to NOTRUN.


nodeChanged

public void nodeChanged(TestTreeNode node)

saveTests

public void saveTests(java.io.ObjectOutputStream out)
               throws java.io.IOException,
                      java.lang.ClassNotFoundException
This method writes out the test tree to file.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

saveNode

public void saveNode(java.io.ObjectOutputStream out,
                     TestTreeNode node)
              throws java.io.IOException,
                     java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

loadTests

public void loadTests(java.io.ObjectInputStream in)
               throws java.io.IOException,
                      java.lang.ClassNotFoundException
This method loads the test tree from file.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

loadNode

public void loadNode(java.io.ObjectInputStream in,
                     TestTreeNode parent)
              throws java.io.IOException,
                     java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

setParentQAT

public void setParentQAT(QAT q)
This method gives us a handle to the parent QAT to pass on to the NodePopup Menu, so we can use it's runSingleTest method and have access to the GUI from the NodeMenu.


getParentQAT

public QAT getParentQAT()

sortTree

public void sortTree()
This method sorts all of the nodes in this tree.


mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

treeExpanded

public void treeExpanded(javax.swing.event.TreeExpansionEvent event)
Specified by:
treeExpanded in interface javax.swing.event.TreeExpansionListener

treeCollapsed

public void treeCollapsed(javax.swing.event.TreeExpansionEvent event)
Specified by:
treeCollapsed in interface javax.swing.event.TreeExpansionListener


See QAT project for licensing details