qat.gui
Class QAT

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Frame
                  extended byjavax.swing.JFrame
                      extended byqat.gui.QAT
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, QATInterface, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants, java.awt.event.WindowListener

public class QAT
extends javax.swing.JFrame
implements QATInterface, java.awt.event.ActionListener, java.awt.event.WindowListener

This class is the main object of the GUI for the test harness. All other gui objects are used by or contained in this object.

Version:
%W %E
Author:
webhiker
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
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
 KeywordComponent keywordComponent
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
QAT()
          This is the normal constructor for launching the QAT gui.
QAT(boolean visible)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void addChangeListener(javax.swing.event.ChangeListener listener)
           
 java.lang.Object[] calculateStatus()
           
 java.lang.Object[] calculateStatus(java.util.ArrayList tests)
           
 void clearProjectProperties()
           
 void closeQatInstance(boolean quiet)
          This method saves this instances session and project properties, and if no run/parse is in progress, will close the window.
 void editAgentSettingsCallback(AgentInfo editAgents)
           
 void editProjectCallback(EditProject editProject)
           
 void firePropertiesChanged(java.util.Properties properties)
          This indicates the proejct properties have changed, and they will be reloaded.
 void generateHtmlReport()
           
 void generateHtmlReport(java.lang.String directoryRoot, StatusWindow status)
           
 javax.swing.JFrame getOwnerHandle()
          Used to fulfil the QATInterface requirement to allow plugins to create modal dialogs based on the same Swing worker thread etc.
 javax.swing.JLabel getParserStatusLabel()
          Returns a handle to the label which displays the current QASH command being parsed.
 java.util.Properties getProjectProperties()
           
 java.lang.String getProjectResultsDirectory()
          This method returns the directory into which all parser trace files are put, and all traces retrieved from the agent by the parser.
 java.util.Properties getProperties()
          This allows other classes access to the project property values.
 java.lang.String getProperty(java.lang.String key)
          This allows other classes access to the project property values.
 java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
          This allows other classes access to the project property values.
 TestSpecification getSelectedTest()
          Returns the currectly selected test, or the first one of more than one is selected.
 TestTree getTestTree()
           
 boolean isTestRunning()
           
 void loadProject(java.lang.String fileName)
          Loads the project named in fileName.
 void parseSelectedTests()
          Reparses only the selected tests.
 void parseTest(TestTreeNode testNode, ParserInterface parser)
          Reparses all tests from this node.
 void parseTests()
          Reloads all the tests starting from the TESTPATH root.
 void parseTests(boolean visible)
           
 void reloadDirectory(TestTreeNode testNode)
          This will relook at the disk only from this directory onwards, instead of re-parsing the entire tree off disk.
 void removeChangeListener(javax.swing.event.ChangeListener listener)
           
 boolean runFailedTests()
          This method runs all tests with status FAILED, returning false if none were run for some reason (such as none exist etc).
 boolean runNotRunTests()
          This method runs all tests with status NOTRUN, returning false if none were run for some reason (such as none exist etc).
 boolean runPassedTests()
          This method runs all tests with status PASSED, returning false if none were run for some reason (such as none exist etc).
 void runSelectedTests()
          Run currently selected tests.
 void runSelectedTests(boolean quiet)
           
 void runSingleTest(TestSpecification test)
          This allows a single test to be run.
 boolean runTestsWithStatus(int status)
          This method runs all tests with matching status, returning false if none were run for some reason (such as none exist etc).
 boolean runUnresolvedTests()
          This method runs all tests with status UNRESOLVED, returning false if none were run for some reason (such as none exist etc).
 void saveProject()
          This method saves the current projectdisplaying GUI status windows during the save process.
 void saveProject(boolean quiet)
          This method saves the current project without displaying any GUI status windows during the save process.
 void saveProject(java.lang.String fileName, boolean quiet)
          Save the current project to the specified fileName.
 void selectAll()
          Selects all the tests in the tree.
 void setParserView(TestSpecification test)
          This allows other classes to update the parser output window.
 void setProjectProperties(java.util.Properties p)
           
 void setProperty(java.lang.String key, java.lang.String defaultValue)
          This allows other classes access to the project property values.
 void setStatus(java.lang.String msg)
          Set the status bar to display the message specified in msg.
 void setStatusGauge(double passed, double failed, double unresolved, double pending, double notrun)
           
 void setStatusGaugeMax(int max)
           
 void stopTestRun()
          Stops the current test run.
 void update()
          This forces a repaint of the QAT gui - used in TestTree when changing the status window.
 void updateStatus(java.lang.String msg)
          This form automatically calculates all the values required to display the entire test tree results.
 void updateStatus(java.lang.String msg, java.util.ArrayList tests)
           
 void updateStatus(java.lang.String msg, java.util.ArrayList tests, double runCount)
           
 void updateStatus(java.lang.String msg, double runCount)
           
 void updateTest(TestSpecification test, boolean evaluating)
          This method is called by the testRunner once the test result is known, and allows the test node to be repainted with the proper result.
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

keywordComponent

public KeywordComponent keywordComponent
Constructor Detail

QAT

public QAT(boolean visible)

QAT

public QAT()
This is the normal constructor for launching the QAT gui.

Method Detail

loadProject

public void loadProject(java.lang.String fileName)
                 throws java.io.IOException
Loads the project named in fileName.

Specified by:
loadProject in interface QATInterface
Parameters:
fileName - - name of the project to load.
Throws:
java.io.IOException

saveProject

public void saveProject()
This method saves the current projectdisplaying GUI status windows during the save process.


saveProject

public void saveProject(boolean quiet)
This method saves the current project without displaying any GUI status windows during the save process.


saveProject

public void saveProject(java.lang.String fileName,
                        boolean quiet)
Description copied from interface: QATInterface
Save the current project to the specified fileName.

Specified by:
saveProject in interface QATInterface
Parameters:
quiet - - if true, no status dialogs will be displayed to monitor save progress.

getTestTree

public TestTree getTestTree()

firePropertiesChanged

public void firePropertiesChanged(java.util.Properties properties)
Description copied from interface: QATInterface
This indicates the proejct properties have changed, and they will be reloaded.

Specified by:
firePropertiesChanged in interface QATInterface

setStatus

public void setStatus(java.lang.String msg)
Set the status bar to display the message specified in msg.

Parameters:
msg - - the message to display.

calculateStatus

public java.lang.Object[] calculateStatus()

calculateStatus

public java.lang.Object[] calculateStatus(java.util.ArrayList tests)

updateStatus

public void updateStatus(java.lang.String msg)
This form automatically calculates all the values required to display the entire test tree results.

Specified by:
updateStatus in interface QATInterface

updateStatus

public void updateStatus(java.lang.String msg,
                         double runCount)

updateStatus

public void updateStatus(java.lang.String msg,
                         java.util.ArrayList tests)

updateStatus

public void updateStatus(java.lang.String msg,
                         java.util.ArrayList tests,
                         double runCount)

parseTests

public void parseTests()
Description copied from interface: QATInterface
Reloads all the tests starting from the TESTPATH root.

Specified by:
parseTests in interface QATInterface

parseTests

public void parseTests(boolean visible)

reloadDirectory

public void reloadDirectory(TestTreeNode testNode)
This will relook at the disk only from this directory onwards, instead of re-parsing the entire tree off disk.


parseTest

public void parseTest(TestTreeNode testNode,
                      ParserInterface parser)
Description copied from interface: QATInterface
Reparses all tests from this node. Used by the NodeMenu object.

Specified by:
parseTest in interface QATInterface

parseSelectedTests

public void parseSelectedTests()
Description copied from interface: QATInterface
Reparses only the selected tests.

Specified by:
parseSelectedTests in interface QATInterface

update

public void update()
This forces a repaint of the QAT gui - used in TestTree when changing the status window.


editProjectCallback

public void editProjectCallback(EditProject editProject)

editAgentSettingsCallback

public void editAgentSettingsCallback(AgentInfo editAgents)

isTestRunning

public boolean isTestRunning()

stopTestRun

public void stopTestRun()
Description copied from interface: QATInterface
Stops the current test run.

Specified by:
stopTestRun in interface QATInterface

selectAll

public void selectAll()
Selects all the tests in the tree.

Specified by:
selectAll in interface QATInterface

generateHtmlReport

public void generateHtmlReport()

generateHtmlReport

public void generateHtmlReport(java.lang.String directoryRoot,
                               StatusWindow status)
                        throws java.lang.Exception
Throws:
java.lang.Exception

runPassedTests

public boolean runPassedTests()
This method runs all tests with status PASSED, returning false if none were run for some reason (such as none exist etc). Used by the Http interface.

Specified by:
runPassedTests in interface QATInterface

runFailedTests

public boolean runFailedTests()
This method runs all tests with status FAILED, returning false if none were run for some reason (such as none exist etc). Used by the Http interface.

Specified by:
runFailedTests in interface QATInterface

runUnresolvedTests

public boolean runUnresolvedTests()
This method runs all tests with status UNRESOLVED, returning false if none were run for some reason (such as none exist etc). Used by the Http interface.

Specified by:
runUnresolvedTests in interface QATInterface

runNotRunTests

public boolean runNotRunTests()
This method runs all tests with status NOTRUN, returning false if none were run for some reason (such as none exist etc). Used by the Http interface.

Specified by:
runNotRunTests in interface QATInterface

runTestsWithStatus

public boolean runTestsWithStatus(int status)
This method runs all tests with matching status, returning false if none were run for some reason (such as none exist etc). Used by the Http interface.

Specified by:
runTestsWithStatus in interface QATInterface

runSelectedTests

public void runSelectedTests()
Description copied from interface: QATInterface
Run currently selected tests.

Specified by:
runSelectedTests in interface QATInterface

runSelectedTests

public void runSelectedTests(boolean quiet)

getSelectedTest

public TestSpecification getSelectedTest()
Description copied from interface: QATInterface
Returns the currectly selected test, or the first one of more than one is selected.

Specified by:
getSelectedTest in interface QATInterface

runSingleTest

public void runSingleTest(TestSpecification test)
This allows a single test to be run. It is normally called by the Run method of NodeMenu when you right-click a test.


updateTest

public void updateTest(TestSpecification test,
                       boolean evaluating)
This method is called by the testRunner once the test result is known, and allows the test node to be repainted with the proper result.


closeQatInstance

public void closeQatInstance(boolean quiet)
This method saves this instances session and project properties, and if no run/parse is in progress, will close the window. If it is the last visible Qat instance, the JVM will be halted as well.


getProjectProperties

public java.util.Properties getProjectProperties()

setProjectProperties

public void setProjectProperties(java.util.Properties p)

clearProjectProperties

public void clearProjectProperties()

getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String defaultValue)
This allows other classes access to the project property values.


getProperty

public java.lang.String getProperty(java.lang.String key)
This allows other classes access to the project property values.


setProperty

public void setProperty(java.lang.String key,
                        java.lang.String defaultValue)
This allows other classes access to the project property values.


getProperties

public java.util.Properties getProperties()
This allows other classes access to the project property values.


setParserView

public void setParserView(TestSpecification test)
This allows other classes to update the parser output window.


setStatusGauge

public void setStatusGauge(double passed,
                           double failed,
                           double unresolved,
                           double pending,
                           double notrun)

setStatusGaugeMax

public void setStatusGaugeMax(int max)

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener listener)

removeChangeListener

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

getOwnerHandle

public javax.swing.JFrame getOwnerHandle()
Used to fulfil the QATInterface requirement to allow plugins to create modal dialogs based on the same Swing worker thread etc.

Specified by:
getOwnerHandle in interface QATInterface

getParserStatusLabel

public javax.swing.JLabel getParserStatusLabel()
Returns a handle to the label which displays the current QASH command being parsed. Used by ParserInterface.


getProjectResultsDirectory

public java.lang.String getProjectResultsDirectory()
This method returns the directory into which all parser trace files are put, and all traces retrieved from the agent by the parser.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener


See QAT project for licensing details