junit.extensions.jfcunit.eventdata
Class JSpinnerMouseEventData

java.lang.Object
  extended byjunit.extensions.jfcunit.eventdata.AbstractEventData
      extended byjunit.extensions.jfcunit.eventdata.AbstractMouseEventData
          extended byjunit.extensions.jfcunit.eventdata.JSpinnerMouseEventData
All Implemented Interfaces:
EventDataConstants

public class JSpinnerMouseEventData
extends AbstractMouseEventData

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 Component on which to trigger the event.
private  int m_offset
          Offset into the text component.
private  java.awt.Component m_source
          The Source on which to trigger the event.
private  int m_subComponent
          The subcomponent type to send click.
private static java.lang.Class s_spinnerClass
          Class for spinner component.
 
Fields inherited from class junit.extensions.jfcunit.eventdata.AbstractMouseEventData
 
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
JSpinnerMouseEventData()
          Default Constructor.
JSpinnerMouseEventData(JFCTestCase testCase, java.awt.Component comp, int subComponent)
          Constructor - Defualt click cell.
JSpinnerMouseEventData(JFCTestCase testCase, java.awt.Component comp, int subComponent, int numberOfClicks)
          Constructor.
JSpinnerMouseEventData(JFCTestCase testCase, java.awt.Component comp, int subComponent, int numberOfClicks, boolean isPopupTrigger)
          Constructor.
JSpinnerMouseEventData(JFCTestCase testCase, java.awt.Component comp, int subComponent, int numberOfClicks, boolean isPopupTrigger, long sleepTime)
          Constructor.
JSpinnerMouseEventData(JFCTestCase testCase, java.awt.Component comp, int subComponent, int numberOfClicks, int modifiers)
          Constructor.
JSpinnerMouseEventData(JFCTestCase testCase, java.awt.Component comp, int subComponent, int numberOfClicks, int modifiers, boolean isPopupTrigger)
          Constructor.
JSpinnerMouseEventData(JFCTestCase testCase, java.awt.Component comp, int subComponent, int numberOfClicks, int modifiers, boolean isPopupTrigger, long sleepTime)
          Constructor.
JSpinnerMouseEventData(JFCTestCase testCase, java.awt.Component comp, int subComponent, int numberOfClicks, int modifiers, boolean isPopupTrigger, long sleepTime, int position)
          Constructor.
JSpinnerMouseEventData(JFCTestCase testCase, java.awt.Component comp, int subComponent, int numberOfClicks, int modifiers, boolean isPopupTrigger, long sleepTime, int position, java.awt.Point referencePoint, int offset)
          Constructor.
JSpinnerMouseEventData(JFCTestCase testCase, java.awt.Component comp, int subComponent, int numberOfClicks, int modifiers, boolean isPopupTrigger, long sleepTime, java.awt.Point referencePoint)
          Constructor.
JSpinnerMouseEventData(JFCTestCase testCase, java.awt.Component comp, int subComponent, int numberOfClicks, long sleepTime)
          Constructor.
JSpinnerMouseEventData(JFCTestCase testCase, java.awt.Component comp, int subComponent, long sleepTime)
          Constructor.
 
Method Summary
 boolean canConsume(java.awt.AWTEvent ae)
          Returns true if the event can be consumed by this instnace of event data.
 boolean consume(java.awt.AWTEvent ae)
          Consume the event.
 boolean equals(java.lang.Object o)
          Compare to event data and deterime if they are equal.
 java.awt.Component getComponent()
          The component on which the event has to be fired.
 int getOffset()
          Get the offset into the text.
 java.awt.Component getSource()
          Get the attribute value.
 int getSubComponent()
          Get the sub-component.
 int hashCode()
          Get the hashCode.
 void populate(org.w3c.dom.Element e)
          Populate the XML Element.
 boolean prepareComponent()
          Prepare the component for firing the mouse event.
 void setComponent(java.awt.Component comp)
          The component on which the event has to be fired.
 void setOffset(int offset)
          Set the offset into the text.
 void setSource(java.awt.Component comp)
          Set the attribute value.
 void setSubComponent(int subComponent)
          Set the sub-component.
 
Methods inherited from class junit.extensions.jfcunit.eventdata.AbstractMouseEventData
getDefaultModifiers, getDefaultModifiers, getDefaultNumberOfClicks, getDefaultPopupTrigger, getModifierText, getNumberOfClicks, getPopupTrigger, sameSource, setNumberOfClicks, setPopupTrigger, toString
 
Methods inherited from class junit.extensions.jfcunit.eventdata.AbstractEventData
calculatePoint, getDefaultPosition, getDefaultSleepTime, getLocationOnScreen, getModifiers, getPosition, getReferencePoint, getRoot, getRoot, getSleepTime, getTestCase, isMetaChar, isValid, isValidForProcessing, setLocationOnScreen, setModifiers, setPosition, setReferencePoint, setSleepTime, setTestCase, setValid
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

s_spinnerClass

private static java.lang.Class s_spinnerClass
Class for spinner component.


m_comp

private java.awt.Component m_comp
The Component on which to trigger the event.


m_source

private java.awt.Component m_source
The Source on which to trigger the event.


m_offset

private int m_offset
Offset into the text component.


m_subComponent

private int m_subComponent
The subcomponent type to send click.

Constructor Detail

JSpinnerMouseEventData

public JSpinnerMouseEventData()
Default Constructor.


JSpinnerMouseEventData

public JSpinnerMouseEventData(JFCTestCase testCase,
                              java.awt.Component comp,
                              int subComponent)
Constructor - Defualt click cell.

Parameters:
testCase - The JFCTestCase on whose thread awtSleep() has to be invoked.
comp - The component on which to trigger the event.
subComponent - Sub-component of the JSpinner.

JSpinnerMouseEventData

public JSpinnerMouseEventData(JFCTestCase testCase,
                              java.awt.Component comp,
                              int subComponent,
                              int numberOfClicks)
Constructor.

Parameters:
testCase - The JFCTestCase on whose thread awtSleep() has to be invoked.
comp - The component on which to trigger the event.
subComponent - Sub-component of the JSpinner.
numberOfClicks - Number of clicks in the MouseEvent (1 for single-click, 2 for double clicks)

JSpinnerMouseEventData

public JSpinnerMouseEventData(JFCTestCase testCase,
                              java.awt.Component comp,
                              int subComponent,
                              long sleepTime)
Constructor.

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

JSpinnerMouseEventData

public JSpinnerMouseEventData(JFCTestCase testCase,
                              java.awt.Component comp,
                              int subComponent,
                              int numberOfClicks,
                              int modifiers)
Constructor.

Parameters:
testCase - The JFCTestCase on whose thread awtSleep() has to be invoked.
comp - The component on which to trigger the event.
subComponent - Sub-component of the JSpinner.
numberOfClicks - Number of clicks in the MouseEvent (1 for single-click, 2 for double clicks)
modifiers - The modifier key values that need to be passed onto the event.

JSpinnerMouseEventData

public JSpinnerMouseEventData(JFCTestCase testCase,
                              java.awt.Component comp,
                              int subComponent,
                              int numberOfClicks,
                              boolean isPopupTrigger)
Constructor.

Parameters:
testCase - The JFCTestCase on whose thread awtSleep() has to be invoked.
comp - The component on which to trigger the event.
subComponent - Sub-component of the JSpinner.
numberOfClicks - Number of clicks in the MouseEvent (1 for single-click, 2 for double clicks)
isPopupTrigger - boolean specifying whether this event will show a popup.

JSpinnerMouseEventData

public JSpinnerMouseEventData(JFCTestCase testCase,
                              java.awt.Component comp,
                              int subComponent,
                              int numberOfClicks,
                              long sleepTime)
Constructor.

Parameters:
testCase - The JFCTestCase on whose thread awtSleep() has to be invoked.
comp - The component on which to trigger the event.
subComponent - Sub-component of the JSpinner.
numberOfClicks - Number of clicks in the MouseEvent (1 for single-click, 2 for double clicks)
sleepTime - The wait time in ms between each event.

JSpinnerMouseEventData

public JSpinnerMouseEventData(JFCTestCase testCase,
                              java.awt.Component comp,
                              int subComponent,
                              int numberOfClicks,
                              int modifiers,
                              boolean isPopupTrigger)
Constructor.

Parameters:
testCase - The JFCTestCase on whose thread awtSleep() has to be invoked.
comp - The component on which to trigger the event.
subComponent - Sub-component of the JSpinner.
numberOfClicks - Number of clicks in the MouseEvent (1 for single-click, 2 for double clicks)
modifiers - The modifier key values that need to be passed onto the event.
isPopupTrigger - boolean specifying whether this event will show a popup.

JSpinnerMouseEventData

public JSpinnerMouseEventData(JFCTestCase testCase,
                              java.awt.Component comp,
                              int subComponent,
                              int numberOfClicks,
                              boolean isPopupTrigger,
                              long sleepTime)
Constructor.

Parameters:
testCase - The JFCTestCase on whose thread awtSleep() has to be invoked.
comp - The component on which to trigger the event.
subComponent - Sub-component of the JSpinner.
numberOfClicks - Number of clicks in the MouseEvent (1 for single-click, 2 for double clicks)
isPopupTrigger - boolean specifying whether this event will show a popup.
sleepTime - The wait time in ms between each event.

JSpinnerMouseEventData

public JSpinnerMouseEventData(JFCTestCase testCase,
                              java.awt.Component comp,
                              int subComponent,
                              int numberOfClicks,
                              int modifiers,
                              boolean isPopupTrigger,
                              long sleepTime)
Constructor.

Parameters:
testCase - The JFCTestCase on whose thread awtSleep() has to be invoked.
comp - The component on which to trigger the event.
subComponent - Sub-component of the JSpinner.
numberOfClicks - Number of clicks in the MouseEvent (1 for single-click, 2 for double clicks)
modifiers - The modifier key values that need to be passed onto the event.
isPopupTrigger - boolean specifying whether this event will show a popup.
sleepTime - The wait time in ms between each event.

JSpinnerMouseEventData

public JSpinnerMouseEventData(JFCTestCase testCase,
                              java.awt.Component comp,
                              int subComponent,
                              int numberOfClicks,
                              int modifiers,
                              boolean isPopupTrigger,
                              long sleepTime,
                              int position)
Constructor.

Parameters:
testCase - The JFCTestCase on whose thread awtSleep() has to be invoked.
comp - The component on which to trigger the event.
subComponent - Sub-component of the JSpinner.
numberOfClicks - Number of clicks in the MouseEvent (1 for single-click, 2 for double clicks)
modifiers - The modifier key values that need to be passed onto the event.
isPopupTrigger - boolean specifying whether this event will show a popup.
sleepTime - The wait time in ms between each event.
position - The relative mouse position within the cell.

JSpinnerMouseEventData

public JSpinnerMouseEventData(JFCTestCase testCase,
                              java.awt.Component comp,
                              int subComponent,
                              int numberOfClicks,
                              int modifiers,
                              boolean isPopupTrigger,
                              long sleepTime,
                              java.awt.Point referencePoint)
Constructor.

Parameters:
testCase - The JFCTestCase on whose thread awtSleep() has to be invoked.
comp - The component on which to trigger the event.
subComponent - Sub-component of the JSpinner.
numberOfClicks - Number of clicks in the MouseEvent (1 for single-click, 2 for double clicks)
modifiers - The modifier key values that need to be passed onto the event.
isPopupTrigger - boolean specifying whether this event will show a popup.
sleepTime - The wait time in ms between each event.
referencePoint - The CUSTOM mouse position within the cell.

JSpinnerMouseEventData

public JSpinnerMouseEventData(JFCTestCase testCase,
                              java.awt.Component comp,
                              int subComponent,
                              int numberOfClicks,
                              int modifiers,
                              boolean isPopupTrigger,
                              long sleepTime,
                              int position,
                              java.awt.Point referencePoint,
                              int offset)
Constructor.

Parameters:
testCase - The JFCTestCase on whose thread awtSleep() has to be invoked.
comp - The component on which to trigger the event.
subComponent - Sub-component of the JSpinner.
numberOfClicks - Number of clicks in the MouseEvent (1 for single-click, 2 for double clicks)
modifiers - The modifier key values that need to be passed onto the event.
isPopupTrigger - boolean specifying whether this event will show a popup.
sleepTime - The wait time in ms between each event.
position - The relative mouse position within the cell.
referencePoint - If _position is CUSTOM then the point is a offset from the location of the component. If the _position is PERCENT then the location is a percentage offset of the hight and width. Otherwise, the _referencePoint is unused.
offset - The offset into the text.
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 NOTE: This is left as a Component so that the class may still compile under jdk1.3 and below where JSpinner is not implemented.

setSubComponent

public final void setSubComponent(int subComponent)
Set the sub-component.

Parameters:
subComponent - SubComponent UP_ARROW_COMPONENT, DOWN_ARROW_COMPONENT, EDITOR_COMPONENT

getSubComponent

public final int getSubComponent()
Get the sub-component.

Returns:
_subComponent Component constant.

setComponent

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

Parameters:
comp - The component.

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.

setOffset

public final void setOffset(int offset)
Set the offset into the text.

Parameters:
offset - The offset into the text.

getOffset

public final int getOffset()
Get the offset into the text.

Returns:
int offset into the text.

canConsume

public boolean canConsume(java.awt.AWTEvent ae)
Returns true if the event can be consumed by this instnace of event data. However, since the JSpinner class is a composite of Buttons and JFormattedTextField, no events can be issued, on the JSpinner. Thus this call always returns false.

Overrides:
canConsume in class AbstractMouseEventData
Parameters:
ae - Event to be consumed.
Returns:
true if the event was consumed.

consume

public boolean consume(java.awt.AWTEvent ae)
Consume the event. This method always returns false (see canConsume).

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

equals

public boolean equals(java.lang.Object o)
Compare to event data and deterime if they are equal.

Overrides:
equals in class AbstractMouseEventData
Parameters:
o - Object to be compared.
Returns:
true if the events are the same.

hashCode

public int hashCode()
Get the hashCode.

Overrides:
hashCode in class AbstractMouseEventData
Returns:
int hashCode.

populate

public void populate(org.w3c.dom.Element e)
Populate the XML Element.

Overrides:
populate in class AbstractMouseEventData
Parameters:
e - element to be populated.

prepareComponent

public boolean prepareComponent()
Prepare the component for firing the mouse event.

Overrides:
prepareComponent in class AbstractEventData
Returns:
boolean true if the component is ready.


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