junit.extensions.jfcunit.eventdata
Class StringEventData

java.lang.Object
  extended byjunit.extensions.jfcunit.eventdata.AbstractEventData
      extended byjunit.extensions.jfcunit.eventdata.AbstractKeyEventData
          extended byjunit.extensions.jfcunit.eventdata.StringEventData
All Implemented Interfaces:
EventDataConstants

public class StringEventData
extends AbstractKeyEventData

Data container class that holds all the data necessary for jfcUnit to fire mouse events.

Author:
Vijay Aravamudhan : ThoughtWorks Inc.

Field Summary
private  java.awt.Component m_comp
          The string code to be fired.
private  java.lang.String m_string
          The string code to be fired.
 
Fields inherited from class junit.extensions.jfcunit.eventdata.AbstractKeyEventData
 
Fields inherited from class junit.extensions.jfcunit.eventdata.AbstractEventData
 
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
 
Constructor Summary
StringEventData()
          Default Constructor.
StringEventData(JFCTestCase testCase, java.awt.Component comp, java.lang.String string)
          Constructor.
StringEventData(JFCTestCase testCase, java.awt.Component comp, java.lang.String string, int modifiers, long sleepTime)
          Constructor.
StringEventData(JFCTestCase testCase, java.awt.Component comp, java.lang.String string, long sleepTime)
          Constructor.
 
Method Summary
 boolean canConsume(java.awt.AWTEvent ae)
          Check if this event can consume the AWTEvent.
 boolean consume(java.awt.AWTEvent ae)
          Consume the event.
 java.awt.Component getComponent()
          The component on which the event has to be fired.
 java.awt.Component getSource()
          Get the attribute value.
 java.lang.String getString()
          Get the string to be sent.
 void populate(org.w3c.dom.Element e)
          Populate the element with the key code.
 void setSource(java.awt.Component comp)
          Set the attribute value.
 void setString(java.lang.String string)
          Set the string to be sent.
protected  void setupKeyStrokes()
          Setup the keystrokes for the event.
 java.lang.String toString()
          Generate a description of the event.
 
Methods inherited from class junit.extensions.jfcunit.eventdata.AbstractKeyEventData
addKeyStrokes, applyModifier, clearKeyStrokes, equals, getDefaultModifiers, getKeyMapping, getKeyStrokes, getModifierText, hashCode, prepareComponent, setKeyMapping, setModifiers
 
Methods inherited from class junit.extensions.jfcunit.eventdata.AbstractEventData
calculatePoint, getDefaultPosition, getDefaultSleepTime, getLocationOnScreen, getModifiers, getPosition, getReferencePoint, getRoot, getRoot, getSleepTime, getTestCase, isMetaChar, isValid, isValidForProcessing, setLocationOnScreen, setPosition, setReferencePoint, setSleepTime, setTestCase, setValid
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

m_comp

private java.awt.Component m_comp
The string code to be fired.


m_string

private java.lang.String m_string
The string code to be fired.

Constructor Detail

StringEventData

public StringEventData()
Default Constructor.


StringEventData

public StringEventData(JFCTestCase testCase,
                       java.awt.Component comp,
                       java.lang.String string)
Constructor.

Parameters:
testCase - The JFCTestCase on whose thread awtSleep() has to be invoked.
comp - The component on which to trigger the event.
string - The string to be sent to the component

StringEventData

public StringEventData(JFCTestCase testCase,
                       java.awt.Component comp,
                       java.lang.String string,
                       long sleepTime)
Constructor.

Parameters:
testCase - The JFCTestCase on whose thread awtSleep() has to be invoked.
comp - The component on which to trigger the event.
string - The string to be sent to the component
sleepTime - The wait time in ms between each event.

StringEventData

public StringEventData(JFCTestCase testCase,
                       java.awt.Component comp,
                       java.lang.String string,
                       int modifiers,
                       long sleepTime)
Constructor.

Parameters:
testCase - The JFCTestCase on whose thread awtSleep() has to be invoked.
comp - The component on which to trigger the event.
string - The string to be sent to the component
modifiers - The modifier string values that need to be passed onto the event.
sleepTime - The wait time in ms between each event.
Method Detail

setSource

public final void setSource(java.awt.Component comp)
Set the attribute value.

Parameters:
comp - The new value of the attribute.

getSource

public final java.awt.Component getSource()
Get the attribute value.

Returns:
Component The value of the attribute.

setString

public final void setString(java.lang.String string)
Set the string to be sent.

Parameters:
string - Key code.

getComponent

public java.awt.Component getComponent()
The component on which the event has to be fired.

Specified by:
getComponent in class AbstractEventData
Returns:
The component

getString

public java.lang.String getString()
Get the string to be sent.

Returns:
String string to be sent.

canConsume

public boolean canConsume(java.awt.AWTEvent ae)
Check if this event can consume the AWTEvent.

Overrides:
canConsume in class AbstractKeyEventData
Parameters:
ae - Event to be consumed.
Returns:
boolean true if the event can be consumed.

consume

public boolean consume(java.awt.AWTEvent ae)
Consume the event.

Overrides:
consume in class AbstractKeyEventData
Parameters:
ae - Event to be consumed.
Returns:
boolean true if the event was consumed.

populate

public void populate(org.w3c.dom.Element e)
Populate the element with the key code.

Overrides:
populate in class AbstractEventData
Parameters:
e - Element to be populated with the data for this event.

toString

public java.lang.String toString()
Generate a description of the event.

Overrides:
toString in class AbstractEventData
Returns:
String description of the event.

setupKeyStrokes

protected void setupKeyStrokes()
Setup the keystrokes for the event.

Specified by:
setupKeyStrokes in class AbstractKeyEventData


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