junit.extensions.jfcunit.eventdata
Class AbstractMouseEventData

java.lang.Object
  extended byjunit.extensions.jfcunit.eventdata.AbstractEventData
      extended byjunit.extensions.jfcunit.eventdata.AbstractMouseEventData
All Implemented Interfaces:
EventDataConstants
Direct Known Subclasses:
JComboBoxMouseEventData, JListMouseEventData, JMenuMouseEventData, JSpinnerMouseEventData, JTabbedPaneMouseEventData, JTableHeaderMouseEventData, JTableMouseEventData, JTextComponentMouseEventData, JTreeMouseEventData, MouseEventData

public abstract class AbstractMouseEventData
extends AbstractEventData

Abstract data container class that holds most of the data necessary for jfcUnit to fire mouse events.

Author:
Vijay Aravamudhan : ThoughtWorks Inc.

Field Summary
private  boolean m_isPopupTrigger
          boolean specifying whether this event will show a popup.
private  int m_numberOfClicks
          Number of clicks in the MouseEvent (1 for single-click, 2 for double clicks).
 
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
AbstractMouseEventData()
           
 
Method Summary
 boolean canConsume(java.awt.AWTEvent ae)
          Check if this event can consume the AWTEvent.
 boolean consume(java.awt.AWTEvent ae)
          Get the attribute value.
 boolean equals(java.lang.Object o)
          Compare to event datas and determine if they are equal.
 int getDefaultModifiers()
          Get the default popup trigger.
static int getDefaultModifiers(boolean popupTrigger)
          Get the default modifiers for the popup trigger.
 int getDefaultNumberOfClicks()
          Return the default number of clicks.
 boolean getDefaultPopupTrigger()
          Get the default Popup trigger setting.
 java.lang.String getModifierText()
          Get the string representing the current modifiers.
 int getNumberOfClicks()
          Get the attribute value.
 boolean getPopupTrigger()
          Get the attribute value.
 int hashCode()
          hashCode is delegated to the super class.
 void populate(org.w3c.dom.Element e)
          Populate the element given with the attributes of the event.
 boolean sameSource(java.awt.AWTEvent ae)
          Check if the event has the same source as this event data.
 void setNumberOfClicks(int numberOfClicks)
          Set the attribute value.
 void setPopupTrigger(boolean isPopupTrigger)
          Set the attribute value.
 java.lang.String toString()
          Return a string representing the eventdata.
 
Methods inherited from class junit.extensions.jfcunit.eventdata.AbstractEventData
calculatePoint, getComponent, getDefaultPosition, getDefaultSleepTime, getLocationOnScreen, getModifiers, getPosition, getReferencePoint, getRoot, getRoot, getSleepTime, getTestCase, isMetaChar, isValid, isValidForProcessing, prepareComponent, setLocationOnScreen, setModifiers, setPosition, setReferencePoint, setSleepTime, setTestCase, setValid
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

m_isPopupTrigger

private boolean m_isPopupTrigger
boolean specifying whether this event will show a popup.


m_numberOfClicks

private int m_numberOfClicks
Number of clicks in the MouseEvent (1 for single-click, 2 for double clicks).

Constructor Detail

AbstractMouseEventData

public AbstractMouseEventData()
Method Detail

getDefaultModifiers

public static int getDefaultModifiers(boolean popupTrigger)
Get the default modifiers for the popup trigger.

Parameters:
popupTrigger - true if to enable the popup menu.
Returns:
int popup modifiers else DEFAULT_MOUSE_MODIFIERS.

getDefaultModifiers

public int getDefaultModifiers()
Get the default popup trigger.

Specified by:
getDefaultModifiers in class AbstractEventData
Returns:
int popup modifers else DEFAULT_MOUSE_MODIFIERS

getModifierText

public final java.lang.String getModifierText()
Get the string representing the current modifiers.

Specified by:
getModifierText in class AbstractEventData
Returns:
String version of the modifiers.

setNumberOfClicks

public final void setNumberOfClicks(int numberOfClicks)
Set the attribute value.

Parameters:
numberOfClicks - The new value of the attribute

getNumberOfClicks

public final int getNumberOfClicks()
Get the attribute value.

Returns:
int The value of the attribute

getDefaultNumberOfClicks

public int getDefaultNumberOfClicks()
Return the default number of clicks.

Returns:
defaut number of clicks.

getDefaultPopupTrigger

public boolean getDefaultPopupTrigger()
Get the default Popup trigger setting.

Returns:
default popup trigger setting.

setPopupTrigger

public void setPopupTrigger(boolean isPopupTrigger)
Set the attribute value.

Parameters:
isPopupTrigger - The new value of the attribute

getPopupTrigger

public boolean getPopupTrigger()
Get the attribute value.

Returns:
boolean The value of the attribute

canConsume

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

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

consume

public boolean consume(java.awt.AWTEvent ae)
Get the attribute value.

Specified by:
consume in class AbstractEventData
Parameters:
ae - Event to be processed.
Returns:
boolean The value of the attribute

equals

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

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

hashCode

public int hashCode()
hashCode is delegated to the super class.

Overrides:
hashCode in class AbstractEventData
Returns:
hashCode of the super class.

populate

public void populate(org.w3c.dom.Element e)
Populate the element given with the attributes of the event.

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

sameSource

public boolean sameSource(java.awt.AWTEvent ae)
Check if the event has the same source as this event data.

Parameters:
ae - AWTEvent to be checked.
Returns:
true if the events have the same source.

toString

public java.lang.String toString()
Return a string representing the eventdata.

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


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