|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.extensions.jfcunit.eventdata.JFCEventManager
This class provides a recording capabilities for AWTEvents.
AWTEvent
s are translated into their coresponding
Event Data types. An application may register a listener against
this class, to receive the event data.
This class temporarily holds events until either a different
event type is received or a timer expires on the event.
Field Summary | |
static int |
DEBUG_ALL
All debugging types. |
static int |
DEBUG_CREATE
EventData creations. |
static int |
DEBUG_INPUT
AWTEvent inputs. |
static int |
DEBUG_OUTPUT
EventData outputs. |
static java.lang.String |
EVENT_DEBUG
Used to turn on debug info. |
static java.lang.String |
EVENT_MAPPING_PROPERTY
Event Mapping Property. |
private long |
m_holdTime
Hold time for the timer thread before firing the pending event. |
private long |
m_lastEventTime
Time when the last event was recorded. |
private javax.swing.event.EventListenerList |
m_listenerList
Listener list. |
private AbstractEventData |
m_pendingEvent
Pending event held for consolidation. |
private boolean |
m_recording
Recording state. |
private java.lang.Thread |
m_timerThread
Timer Thread used to send the pending event. |
private static boolean |
s_debug
Debug flag set by UIManager property JFCEventManager.debug="true". |
private static int |
s_debugType
Debugging type to be used. |
private static JFCEventManager |
s_singleton
This is a singleton class. |
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 | |
private |
JFCEventManager(long holdTime)
Private constructor. |
Method Summary | |
void |
addJFCEventDataListener(JFCEventDataListener jl)
Add a listener. |
boolean |
convertDrag(java.awt.AWTEvent ae)
Converts the event to a drag event if necessary. |
AbstractEventData |
createEvent(java.awt.AWTEvent ae)
Create a event for the data given. |
void |
eventDispatched(java.awt.AWTEvent ae)
This method implements the AWTEventListener interface. |
protected void |
fireEventData()
Fire event data to the listeners. |
static boolean |
getDebug()
Get the state of debugging. |
static int |
getDebugType()
Get the debugging type. |
static JFCEventManager |
getEventManager()
Returns a singleton instance of this class. |
static JFCEventManager |
getEventManager(long holdTime)
Returns a singleton instance of this class. |
long |
getHoldTime()
Get the maximum hold time for a event. |
boolean |
getRecording()
Get the current recording state. |
protected void |
processEventData(java.awt.AWTEvent ae)
This method converts the AWTEvent to the corresponding
AbstractEventData. |
void |
removeAllJFCEventDataListeners()
Remove all listeners. |
void |
removeJFCEventDataListener(JFCEventDataListener jl)
Remove a listener. |
static void |
setDebug(boolean aValue)
Enable/Disable debug tracing of events. |
static void |
setDebugType(int type)
Set the debugging type. |
void |
setHoldTime(long holdTime)
Set the maximum hold time for a event. |
static void |
setRecording(boolean recording)
Set the recording state. |
private void |
setRecordingImpl(boolean recording)
Set the recording state. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String EVENT_MAPPING_PROPERTY
public static final java.lang.String EVENT_DEBUG
private static JFCEventManager s_singleton
private static boolean s_debug
public static final int DEBUG_INPUT
public static final int DEBUG_OUTPUT
public static final int DEBUG_CREATE
public static final int DEBUG_ALL
private static int s_debugType
private AbstractEventData m_pendingEvent
private javax.swing.event.EventListenerList m_listenerList
private java.lang.Thread m_timerThread
Thread
used to send the pending event.
private boolean m_recording
private long m_holdTime
private volatile long m_lastEventTime
Constructor Detail |
private JFCEventManager(long holdTime)
getEventManager()
should be used instead.
holdTime
- duration to hold a pending event.Method Detail |
public static void setDebug(boolean aValue)
aValue
- true if debugging is to be
turned on.public static boolean getDebug()
public static void setDebugType(int type)
type
- DEBUG_INPUT, DEBUG_OUTPUT and/or DEBUG_CREATEpublic static int getDebugType()
public static JFCEventManager getEventManager()
public static JFCEventManager getEventManager(long holdTime)
holdTime
- druration a event should be held
to attempt to consolidate events.
public static void setRecording(boolean recording)
recording
- true if enabled. Otherwise false.public void setHoldTime(long holdTime)
holdTime
- maximum duration in millis to
hold a event.public long getHoldTime()
public boolean getRecording()
public void addJFCEventDataListener(JFCEventDataListener jl)
jl
- Listener to be added.public boolean convertDrag(java.awt.AWTEvent ae)
ae
- Event to be processed.
public AbstractEventData createEvent(java.awt.AWTEvent ae)
ae
- Event to be processed.
public void eventDispatched(java.awt.AWTEvent ae)
AWTEventListener
interface.
This method will be accessed for every AWTEvent
which is
of the type: MOUSE_MOTION_EVENT, MOUSE_EVENT, KEY_EVENT, or
TEXT_EVENT.
eventDispatched
in interface java.awt.event.AWTEventListener
ae
- Event to be processed.public void removeAllJFCEventDataListeners()
public void removeJFCEventDataListener(JFCEventDataListener jl)
jl
- Listener to be removed.protected void fireEventData()
protected void processEventData(java.awt.AWTEvent ae)
AWTEvent
to the corresponding
AbstractEventData.
ae
- AWTEvent to be processed.private void setRecordingImpl(boolean recording)
recording
- true if recording is to be enabled.
otherwise false.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |