Command
| Kind of class: | interface |
|---|---|
| Inherits from: | none |
| Implemented by: | |
| Known subinterfaces: | |
| Version: | 1.0 |
| Author: | Francis Bourre |
| Classpath: | com.bourre.commands.Command |
| File last modified: | Wednesday, 31 October 2007, 07:35:29 |
Command is the basic interface to encapsulate a request as an object, thereby letting you parameterize clients with different requests,
queue or log requests, and support undoable operations.
Example:
// class example
import com.bourre.commands.*;
class DisplayDateCommand implements Command
{
private var _tViewHelper:TextField;
public function DisplayDateCommand(tViewHelper:TextField)
{
_tViewHelper = tViewHelper;
}
public function execute() : Void
{
_tViewHelper.text = String(new Date());
}
}
// usage:
import DisplayDateCommand;
this.createTextField("__txt", 1, 30, 30, 200, 20);
var ddc:DisplayDateCommand = new DisplayDateCommand( this.__txt );
ddc.execute();
import com.bourre.commands.*;
class DisplayDateCommand implements Command
{
private var _tViewHelper:TextField;
public function DisplayDateCommand(tViewHelper:TextField)
{
_tViewHelper = tViewHelper;
}
public function execute() : Void
{
_tViewHelper.text = String(new Date());
}
}
// usage:
import DisplayDateCommand;
this.createTextField("__txt", 1, 30, 30, 200, 20);
var ddc:DisplayDateCommand = new DisplayDateCommand( this.__txt );
ddc.execute();
Summary
Instance methods
Instance methods
execute
function execute (
e:IEvent) : Void
A concrete Command object always has execute() method that is called when an action occurs.