Allow chains to initialize right before the start() template runs

Description

I have been working a lot with chains, and creating chains that actually add steps themselves. About three times I have overridden start() to add a protected method initialize. IE

override public function start():void
{
initialize();
super.start();
}

This allows the following;

protected function initialize():void
{
addCommand(new ShowModalStep(true, note));
addCommand(new OpenConfirmDialogStep(dispatcher, note));
addCommand(new ShowModalStep(false, note));
}

1. This allows any chain subclass to alter predetermined steps by the superclass.
2. It only creates the steps right before starting.
3. The initialize() method could allow a chain to adjust it's state based on runtime factors.

I'm just requesting this so if you think it's in left field, I'll just keep doing it the way I have been.

The implementation could be as simple as;

AbstractChain.as:

public function start():void
{
initialize();
dispatchEvent( new ChainEvent( ChainEvent.CHAIN_START ) );
position = -1;
proceed();
}

protected function initialize():void
{
}

Mike

Environment

None

Status

Assignee

Ben Clinkinbeard

Reporter

Michael Schmalle

Labels

None

Fix versions

Priority

Minor
Configure