KoExecutePolicy Class Reference

Each action that is called 'execute()' on will be executed according to policy. More...

#include <KoExecutePolicy.h>

List of all members.

Public Member Functions

virtual void schedule (KoAction *action, KoJobsListPolicy *jobsList, const QVariant &params)=0
 schedule an action according to policy.

Static Public Attributes

static KoExecutePolicy *const onlyLastPolicy = new KoOnlyLastPolicy()
 This policy will enqueue the action; but will remove others that would call the same target method.
static KoExecutePolicy *const directPolicy = new KoDirectPolicy()
 This policy will execute the action in the calling thread.
static KoExecutePolicy *const queuedPolicy = new KoQueuedPolicy()
 This policy will queue each action to be executed serially, while disabling the action when running.
static KoExecutePolicy *const simpleQueuedPolicy = new KoSimpleQueuedPolicy()
 This policy will queue each action to be executed serially.


Detailed Description

Each action that is called 'execute()' on will be executed according to policy.

Each action will have a policy set; that policy will be used on execution of that action to determine what will happen next.


Member Function Documentation

virtual void KoExecutePolicy::schedule ( KoAction action,
KoJobsListPolicy jobsList,
const QVariant &  params 
) [pure virtual]

schedule an action according to policy.

Parameters:
action the action to be scheduled.
jobsList the list of jobs currently associated with the action.
params a parameters object that belongs with the current action.


Member Data Documentation

KoExecutePolicy *const KoExecutePolicy::onlyLastPolicy = new KoOnlyLastPolicy() [static]

This policy will enqueue the action; but will remove others that would call the same target method.

In the case of a delayed-initialisation action being executed from one or even several actions it is unwanted to let the actions queue-up and be executed serially; this policy will prevent that. (Example) Consider having a list of items that will be previed when you click it. The creation of the preview is a slow process. In this example it is possible for the user to select 5 items in a row which will then be previewed one after another; making the update of the preview incredably slow. If you use this policy only the last action will be executed and the other actions will be discarded. Effect is that only the last preview will be generated and the first 4 ignored.

KoExecutePolicy *const KoExecutePolicy::queuedPolicy = new KoQueuedPolicy() [static]

This policy will queue each action to be executed serially, while disabling the action when running.

When an action comes in it will be disabled and queued; after executing it will be enabled again. This way only one action can be executed at the same time and additional executes will be ignored until the first is done.


The documentation for this class was generated from the following files:
Generated on Sun Jul 20 22:37:41 2008 for libs by  doxygen 1.4.7