|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--wtanaka.praya.IdleTracker
Tracker of idle time. Generates events corresponding to idle/non-idle. Does not quite function correctly, in order to avoid a synchronized block in touch(). It's possible for two unidle events to be generated at the same time. But it should tell you about at least as many transitions as there actually are.
Return to
or the Praya Homepage
| Inner Class Summary | |
private class |
IdleTracker.Tracker
This runnable will sleep for one second at a time and increment a counter representing the approximate idle time. |
| Field Summary | |
private static IdleTracker |
instance
|
private int |
m_definedIdleSeconds
If idle time reaches this number of seconds, the idle tracker will generate an idle event. |
private int |
m_idleSeconds
|
private boolean |
m_isIdle
|
private java.util.Vector |
m_listeners
|
private boolean |
m_resetCounter
Internal flag used to signal the counter thread to reset the timer. |
private java.lang.Thread |
m_thread
|
| Constructor Summary | |
IdleTracker()
|
|
| Method Summary | |
void |
addIdleListener(IdleListener l)
Adds an idle listener to listen for idle/unidle events |
void |
fireIdle()
tells listeners that user has been inactive. |
void |
fireUnidle()
tells listeners that user became active. |
long |
getDefinedIdleSeconds()
The time defined by the system such that the user is considered "idle" if she is idle for longer than this time. |
int |
getIdleSeconds()
idle time in seconds |
java.lang.String |
getIdleString()
Convenience method which returns the idle time as a string. |
static IdleTracker |
getInstance()
|
void |
removeIdleListener(IdleListener l)
Removes an idle listener |
void |
setDefinedIdleLength(int seconds)
The time defined by the system such that the user is considered "idle" if she is idle for longer than this time. |
void |
touch()
The user just did something. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private volatile int m_idleSeconds
private boolean m_resetCounter
private java.util.Vector m_listeners
private static IdleTracker instance
private java.lang.Thread m_thread
private boolean m_isIdle
private int m_definedIdleSeconds
| Constructor Detail |
public IdleTracker()
| Method Detail |
public void addIdleListener(IdleListener l)
public void removeIdleListener(IdleListener l)
public void fireUnidle()
public void fireIdle()
public void touch()
public int getIdleSeconds()
public java.lang.String getIdleString()
public long getDefinedIdleSeconds()
public void setDefinedIdleLength(int seconds)
seconds - the new length in secondspublic static IdleTracker getInstance()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||