jmathlib.tools.junit.swingui
Class TestTreeModel

java.lang.Object
  extended by jmathlib.tools.junit.swingui.TestTreeModel
All Implemented Interfaces:
javax.swing.tree.TreeModel

 class TestTreeModel
extends java.lang.Object
implements javax.swing.tree.TreeModel

A tree model for a Test.


Field Summary
private  java.util.Hashtable fErrors
           
private  java.util.Hashtable fFailures
           
private  java.util.Vector fModelListeners
           
private  Test fRoot
           
private  java.util.Hashtable fRunTests
           
 
Constructor Summary
TestTreeModel(Test root)
          Constructs a tree model with the given test as its root.
 
Method Summary
(package private)  void addError(Test t)
          Remembers a test error
(package private)  void addFailure(Test t)
          Remembers a test failure
(package private)  void addRunTest(Test t)
          Remembers that a test was run
 void addTreeModelListener(javax.swing.event.TreeModelListener l)
          adds a TreeModelListener
 int findTest(Test target, Test node, java.util.Vector path)
          Finds the path to a test.
 void fireNodeChanged(javax.swing.tree.TreePath path, int index)
          Fires a node changed event
 java.lang.Object getChild(java.lang.Object parent, int index)
          Gets the test at the given index
 int getChildCount(java.lang.Object parent)
          Gets the number of tests.
 int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
          Gets the index of a test in a test suite
 java.lang.Object getRoot()
          Returns the root of the tree
(package private)  boolean isError(Test t)
          Tests whether a test was an error
(package private)  boolean isFailure(Test t)
          Tests whether a test was a failure
 boolean isLeaf(java.lang.Object node)
          Tests if the test is a leaf.
(package private)  TestSuite isTestSuite(java.lang.Object node)
          Tests if the node is a TestSuite.
 void removeTreeModelListener(javax.swing.event.TreeModelListener l)
          Removes a TestModelListener
(package private)  void resetResults()
          Resets the test results
 void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
          Called when the value of the model object was changed in the view
(package private)  boolean wasRun(Test t)
          Returns whether a test was run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fRoot

private Test fRoot

fModelListeners

private java.util.Vector fModelListeners

fFailures

private java.util.Hashtable fFailures

fErrors

private java.util.Hashtable fErrors

fRunTests

private java.util.Hashtable fRunTests
Constructor Detail

TestTreeModel

public TestTreeModel(Test root)
Constructs a tree model with the given test as its root.

Method Detail

addTreeModelListener

public void addTreeModelListener(javax.swing.event.TreeModelListener l)
adds a TreeModelListener

Specified by:
addTreeModelListener in interface javax.swing.tree.TreeModel

removeTreeModelListener

public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
Removes a TestModelListener

Specified by:
removeTreeModelListener in interface javax.swing.tree.TreeModel

findTest

public int findTest(Test target,
                    Test node,
                    java.util.Vector path)
Finds the path to a test. Returns the index of the test in its parent test suite.


fireNodeChanged

public void fireNodeChanged(javax.swing.tree.TreePath path,
                            int index)
Fires a node changed event


getChild

public java.lang.Object getChild(java.lang.Object parent,
                                 int index)
Gets the test at the given index

Specified by:
getChild in interface javax.swing.tree.TreeModel

getChildCount

public int getChildCount(java.lang.Object parent)
Gets the number of tests.

Specified by:
getChildCount in interface javax.swing.tree.TreeModel

getIndexOfChild

public int getIndexOfChild(java.lang.Object parent,
                           java.lang.Object child)
Gets the index of a test in a test suite

Specified by:
getIndexOfChild in interface javax.swing.tree.TreeModel

getRoot

public java.lang.Object getRoot()
Returns the root of the tree

Specified by:
getRoot in interface javax.swing.tree.TreeModel

isLeaf

public boolean isLeaf(java.lang.Object node)
Tests if the test is a leaf.

Specified by:
isLeaf in interface javax.swing.tree.TreeModel

isTestSuite

TestSuite isTestSuite(java.lang.Object node)
Tests if the node is a TestSuite.


valueForPathChanged

public void valueForPathChanged(javax.swing.tree.TreePath path,
                                java.lang.Object newValue)
Called when the value of the model object was changed in the view

Specified by:
valueForPathChanged in interface javax.swing.tree.TreeModel

addFailure

void addFailure(Test t)
Remembers a test failure


addError

void addError(Test t)
Remembers a test error


addRunTest

void addRunTest(Test t)
Remembers that a test was run


wasRun

boolean wasRun(Test t)
Returns whether a test was run


isError

boolean isError(Test t)
Tests whether a test was an error


isFailure

boolean isFailure(Test t)
Tests whether a test was a failure


resetResults

void resetResults()
Resets the test results


FOOTER

BOTTOM