junit.extensions.jfcunit.eventdata
Class BaseEventDataTagHandler

java.lang.Object
  extended byjunit.extensions.xml.elements.AbstractTagHandler
      extended byjunit.extensions.jfcunit.eventdata.BaseEventDataTagHandler
All Implemented Interfaces:
EventDataConstants, JFCXMLConstants, XMLConstants
Direct Known Subclasses:
JComboBoxMouseEventDataTagHandler, JListMouseEventDataTagHandler, JMenuMouseEventDataTagHandler, JSpinnerMouseEventDataTagHandler, JTabbedPaneMouseEventDataTagHandler, JTableHeaderMouseEventDataTagHandler, JTableMouseEventDataTagHandler, JTextComponentMouseEventDataTagHandler, JTreeMouseEventDataTagHandler, MouseEventDataTagHandler, MouseWheelEventDataTagHandler

public abstract class BaseEventDataTagHandler
extends AbstractTagHandler
implements EventDataConstants, JFCXMLConstants

Implements the common methods used by many of the EventData classes.

Author:
Kevin Wilson

Field Summary
private  AbstractMouseEventData m_eventData
          Event data generated by the tag handler implementation.
 
Fields inherited from class junit.extensions.xml.elements.AbstractTagHandler
 
Fields inherited from interface junit.extensions.jfcunit.eventdata.EventDataConstants
CENTER, CUSTOM, DEFAULT_HOLDTIME, DEFAULT_ISPOPUPTRIGGER, DEFAULT_KEY_MODIFIERS, DEFAULT_MOUSE_MODIFIERS, DEFAULT_NUMBEROFCLICKS, DEFAULT_POPUP_MODIFIERS, DEFAULT_POSITION, DEFAULT_SCROLL_AMOUNT, DEFAULT_SLEEPTIME, DEFAULT_WHEEL_ROTATION, DOWN_ARROW_SUBCOMPONENT, EAST, EDITOR_SUBCOMPONENT, INVALID_SUBCOMPONENT, INVALID_TEXT_OFFSET, NORTH, NORTH_EAST, NORTH_WEST, OFFSET, PERCENT, POSITIONSTRINGS, SOUTH, SOUTH_EAST, SOUTH_WEST, UP_ARROW_SUBCOMPONENT, WEST
 
Fields inherited from interface junit.extensions.jfcunit.xml.JFCXMLConstants
ALT, ALTGR, AMOUNT, ASSERTEXIT, AWTTHREAD, BUTTON1, BUTTON2, BUTTON3, CASEINDEPENDENT, CLASS, CLICK, CLICKS, CODE, CONTAINER, CONTAINS, CTRL, DESTINATION, DOWN, DRAG, DURATION, EDITOR, ENDSWITH, EQUALS, FIND, FINDER, FLUSH, ICONDESCRIPTION, ICONFILE, INDEXDELIMITER, INDEXES, KEY, LABEL, MATCH, META, MODIFIERS, NODEVALUE, OPERATION, PATH, PATHDELIMITER, PAUSE, POINT, POPUPTRIGGER, POSITION, RECORDING, REFERENCE, RESUME, ROBOT, ROTATION, SHIFT, SHOW, SLEEP, SLEEPTIME, SOURCE, STARTSWITH, STRING, SUBCOMPONENT, TERMINATOR, TITLE, UP, WAIT
 
Fields inherited from interface junit.extensions.xml.XMLConstants
ACTION, ACTUALOBJ, ACTUALREFID, ADD, ASSERTENABLED, ASSERTEQUALS, ASSERTNOTEQUALS, ASSERTNOTNULL, ASSERTNOTSAME, ASSERTNULL, ASSERTSAME, CALL, CASE, CHOOSE, CLASSNAME, COLUMN, CONFIRM, DEBUG, DEFAULT, DELIMITER, DIALOG, DUMP, ECHO, ENABLED, ENCODING, EVALUATE, EXPECTEDOBJ, EXPECTEDREFID, FAIL, FILE, FOCUS, FOREACH, ID, INDEX, JFCFILELOC, LESSTHAN, LISTITEM, LOG, MARK, MESSAGE, METHOD, MODE, NAME, OTHERWISE, PATHREFID, PROCEDURE, PROPERTY, RECURSIVE, REFID, RELATIVE, REMOVE, ROW, SAVE, STDERR, STDOUT, STOPWATCH, SUITE, SWITCH, TABLECELL, TAGHANDLERS, TAGNAME, TEST, TYPE, USERE, VALUE, WHEN, WHILE
 
Constructor Summary
BaseEventDataTagHandler(org.w3c.dom.Element element, IXMLTestCase testCase)
          Constructor for BaseEventDataTagHandler.
 
Method Summary
protected  int getClicks()
          Returns the value of the CLICKS attribute for this element.
protected  java.awt.Component getComponent()
          Returns the value of the (previously found) component whose name is the value of the REFID attribute for this element.
(package private)  AbstractMouseEventData getEventData()
          Gets the event data generated by this class.
 JFCTestCase getJFCTestCase()
          Returns the test case.
protected  int getModifiers()
          Returns the value of theMODIFIERS attribute for this element.
protected  int getModifiers(int defaultValue)
          Returns the value of the MODIFIERS attribute for this element.
protected  int getOffset()
          Returns the value of the INDEX attribute for this element.
protected  boolean getPopupTrigger()
          Returns the value of the POPUPTRIGGER attribute for this element.
protected  int getPosition()
          Returns the constant (defined in EventDataConstants) which corresponds to the value of the POSITION attribute of this element.
protected  java.awt.Point getReference()
          Returns the value of the REFERENCE attribute for this element.
protected  long getSleepTime()
          Returns the value of the SLEEPTIME attribute for this element.
(package private)  void setEventData(AbstractMouseEventData data)
          Set the event data.
 void validateElement()
          Sub-classes should implement this method to provide validation of the element attributes, etc.
 
Methods inherited from class junit.extensions.xml.elements.AbstractTagHandler
checkAtLeastOneRequiredAttribute, checkAtLeastOneRequiredAttribute, checkElementTagName, checkOneRequiredAttribute, checkOneRequiredAttribute, checkRequiredAttribute, checkRequiredAttribute, getBoolean, getBoolean, getBoolean, getBoolean, getElement, getInt, getInt, getLong, getLong, getPoint, getPoint, getString, getString, getString, getString, getTagName, getTest, getTestCase, getXMLTestCase, getXMLTestSuite, processElement, resolveVariables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_eventData

private AbstractMouseEventData m_eventData
Event data generated by the tag handler implementation.

Constructor Detail

BaseEventDataTagHandler

public BaseEventDataTagHandler(org.w3c.dom.Element element,
                               IXMLTestCase testCase)
Constructor for BaseEventDataTagHandler.

Parameters:
element - The element to be processed
testCase - The IXMLTestCase that uses this element
Method Detail

getJFCTestCase

public JFCTestCase getJFCTestCase()
Returns the test case.

Returns:
testCase

validateElement

public void validateElement()
                     throws XMLException
Description copied from class: AbstractTagHandler
Sub-classes should implement this method to provide validation of the element attributes, etc.

Overrides:
validateElement in class AbstractTagHandler
Throws:
XMLException - when the required elements are not present.
See Also:
AbstractTagHandler.validateElement()

getClicks

protected int getClicks()
Returns the value of the CLICKS attribute for this element. Defaults to DEFAULT_NUMBEROFCLICKS.

Returns:
int The value of the CLICKS attribute, DEFAULT_NUMBEROFCLICKS if not specified.

getComponent

protected java.awt.Component getComponent()
Returns the value of the (previously found) component whose name is the value of the REFID attribute for this element.

Returns:
Component The found component whose name matches with the REFID attribute.

getModifiers

protected int getModifiers()
Returns the value of theMODIFIERS attribute for this element. Defaults to DEFAULT_MOUSE_MODIFIERS.

Returns:
int The value of the MODIFIERS attribute, DEFAULT_MOUSE_MODIFIERS if not specified.

getModifiers

protected int getModifiers(int defaultValue)
Returns the value of the MODIFIERS attribute for this element. Defaults to defaultValue.

Parameters:
defaultValue - value to be returned if the element does not exist.
Returns:
int The value of the MODIFIERS attribute, defaultValue if not specified.

getOffset

protected int getOffset()
Returns the value of the INDEX attribute for this element. Defaults to 0 (zero) if not found.

Returns:
int The value of the parsed INDEX attribute, zero if not found.

getPopupTrigger

protected boolean getPopupTrigger()
Returns the value of the POPUPTRIGGER attribute for this element.

Returns:
boolean The value of the POPUPTRIGGER attribute.

getPosition

protected int getPosition()
Returns the constant (defined in EventDataConstants) which corresponds to the value of the POSITION attribute of this element.

Returns:
int The corresponding constant from EventDataConstants.

getReference

protected java.awt.Point getReference()
                               throws XMLException
Returns the value of the REFERENCE attribute for this element. Defaults to null.

Returns:
Point The value of the REFERENCE attribute. Defaults to null of not found.
Throws:
XMLException - may be throws if the point cannot be parsed properly.

getSleepTime

protected long getSleepTime()
Returns the value of the SLEEPTIME attribute for this element. Defaults to DEFAULT_SLEEPTIME if not found.

Returns:
long The value of the SLEEPTIME attribute. Defaults to DEFAULT_SLEEPTIME.

setEventData

void setEventData(AbstractMouseEventData data)
Set the event data.

Parameters:
data - Data to be used as the event data for this TagHandler.

getEventData

AbstractMouseEventData getEventData()
                              throws XMLException
Gets the event data generated by this class.

Returns:
event data created.
Throws:
XMLException - may be thrown when processing children.


Licensed under: GNU Lesser General Public License, Ver 2.1, February 1999