org.zkoss.zk.au
Class Command

java.lang.Object
  extended by org.zkoss.zk.au.Command
Direct Known Subclasses:
BookmarkChangedCommand, CheckCommand, ClientInfoCommand, DropCommand, DummyCommand, ErrorCommand, GenericCommand, GetUploadInfoCommand, InputCommand, KeyCommand, MouseCommand, MoveCommand, OpenCommand, RedrawCommand, RemoveCommand, RemoveDesktopCommand, RenderCommand, ScrollCommand, SelectCommand, SelectionCommand, SizeCommand, UpdateResultCommand, ZIndexCommand

public abstract class Command
extends java.lang.Object

Represents a command of a request (AuRequest). Each command is unique no matter getId() is the same or not. All commands must be declared as static members of AuRequest such that they will be initialized sequentially at begining. Also, if a command will generate an event, it shall register the event in its constructor.

Author:
tomyeh

Field Summary
static int CTRL_GROUP
          Whether this command belongs to the control group.
static int IGNORABLE
          Whether this command is ignorable.
static int IGNORE_IMMEDIATE_OLD_EQUIV
          Whether to drop the existent command (in the queue) if it is the same as the immediate following one.
static int IGNORE_OLD_EQUIV
          Whether to drop the existent command (in the queue) if it is the same as the new arrival one.
static int SKIP_IF_EVER_ERROR
          Whether to skip this command if previous commands ever caused errors.
 
Constructor Summary
protected Command(java.lang.String id, int flags)
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
 int getFlags()
          Returns the attributes of this command, a combination of SKIP_IF_EVER_ERROR, IGNORABLE and others.
 java.lang.String getId()
          Returns ID of this command.
protected abstract  void process(AuRequest request)
          Derived must override this method to process this command.
 void process(AuRequest request, boolean everError)
          Called to process the specified request.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SKIP_IF_EVER_ERROR

public static final int SKIP_IF_EVER_ERROR
Whether to skip this command if previous commands ever caused errors. In other words, it decides whether to skip this command when process(AuRequest,boolean) is called with errorEver = true; This argument is used to control the behavior of process(AuRequest,boolean).

Part of the returned value of getFlags().

See Also:
Constant Field Values

IGNORABLE

public static final int IGNORABLE
Whether this command is ignorable. In other words, the ignorable command is dropped, if a new command is received before the ignorable command is processed.

Part of the returned value of getFlags().

See Also:
Constant Field Values

CTRL_GROUP

public static final int CTRL_GROUP
Whether this command belongs to the control group. The new control-group command is dropped if a control-group command is in the queue or in processing.

See Also:
Constant Field Values

IGNORE_OLD_EQUIV

public static final int IGNORE_OLD_EQUIV
Whether to drop the existent command (in the queue) if it is the same as the new arrival one. By the same we mean both command's ID and target are the same.

See Also:
Constant Field Values

IGNORE_IMMEDIATE_OLD_EQUIV

public static final int IGNORE_IMMEDIATE_OLD_EQUIV
Whether to drop the existent command (in the queue) if it is the same as the immediate following one. By the same we mean both command's ID and target are the same.

See Also:
Constant Field Values
Constructor Detail

Command

protected Command(java.lang.String id,
                  int flags)
Parameters:
flags - a combination of SKIP_IF_EVER_ERROR, IGNORABLE and others
Method Detail

getFlags

public final int getFlags()
Returns the attributes of this command, a combination of SKIP_IF_EVER_ERROR, IGNORABLE and others.


getId

public final java.lang.String getId()
Returns ID of this command.


toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public final boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

process

protected abstract void process(AuRequest request)
Derived must override this method to process this command.


process

public final void process(AuRequest request,
                          boolean everError)
Called to process the specified request. You don't override this method directly. Rather, override process(AuRequest).

Parameters:
everError - whether any error ever occured before processing this command. Notice that multiple commands might be processed in one execution.


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.