ch.elexis.actions
Class DelayableJob
java.lang.Object
  
Job
      
ch.elexis.actions.DelayableJob
public class DelayableJob
- extends Job
 
A job that does not execute immediately on launch but waits if there comes another call - e.g a
 key press of the user. The time the job waits is configurable but can also be adaptive - it
 remembers the time between earlier calls and decides accordingly, how long it should wait next
 time. The use if this class is to prevent lengthy operations to run unnecessarily - only the last
 of a series of calls will be executed
- Author:
 
  - gerry
 
 
 
 
| 
Method Summary | 
 java.lang.Object | 
getRuntimeData(java.lang.String key)
 
          retrieve a formerly set data object | 
 void | 
launch(int delayMillis)
 
          Launch the job after a specified delay. | 
 void | 
setRuntimeData(java.lang.String key,
               java.lang.Object value)
 
          set arbitrary data that can be retrieved at run time | 
 
| Methods inherited from class java.lang.Object | 
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
DELAY_ADAPTIVE
public static final int DELAY_ADAPTIVE
- See Also:
 - Constant Field Values
 
DelayableJob
public DelayableJob(java.lang.String name,
                    DelayableJob.IWorker worker)
launch
public void launch(int delayMillis)
- Launch the job after a specified delay. If a re-launch occurs within the delay time, the
 counter is reset and will wait for the specified time again. If the Job was already launched
 when a re-launch occurs, the Job will be stopped if possible.
 
 If the delay is DELAY_ADAPTIVE, the Job will try to find the optimal delay by analyzing
 earlier calls. So different typing speeds of different users can be handled.
- Parameters:
 delayMillis - 
 
 
setRuntimeData
public void setRuntimeData(java.lang.String key,
                           java.lang.Object value)
- set arbitrary data that can be retrieved at run time
- Parameters:
 key - a unique keyvalue - an arbitrary object
 
 
getRuntimeData
public java.lang.Object getRuntimeData(java.lang.String key)
- retrieve a formerly set data object
- Parameters:
 key - the unique key
- Returns:
 - the object associated with this key. This can be null if no such object exists, or if
         null was associated with this key
 
 
 
				Copyright 2005-2010 by Gerry Weirich, Elexis