Elexis API documentation
Version 2.1.6 as of December 11 2011

ch.elexis.actions
Class DelayableJob

java.lang.Object
  extended by Job
      extended by 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

Nested Class Summary
static interface DelayableJob.IWorker
           
 
Field Summary
static int DELAY_ADAPTIVE
           
 
Constructor Summary
DelayableJob(java.lang.String name, DelayableJob.IWorker worker)
           
 
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
 

Field Detail

DELAY_ADAPTIVE

public static final int DELAY_ADAPTIVE
See Also:
Constant Field Values
Constructor Detail

DelayableJob

public DelayableJob(java.lang.String name,
                    DelayableJob.IWorker worker)
Method Detail

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 key
value - 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

Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis