利用者向け情報

開発者向け情報

[sandbox.akabana]/trunk/yui-frameworks/yui-command/src/main/flex/jp/akb7/yui/cmd/SequenceCommand.as

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1649 - (show annotations)
Wed Jul 13 20:57:02 2011 JST (22 months, 1 week ago) by e1arkw
Original Path: trunk/yui/yui-command/src/main/flex/org/seasar/akabana/yui/command/SequenceCommand.as
File size: 2280 byte(s)
シーケンスコマンドの結果
1 /*
2 * Copyright 2004-2011 the Seasar Foundation and the Others.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13 * either express or implied. See the License for the specific language
14 * governing permissions and limitations under the License.
15 */
16 package org.seasar.akabana.yui.command
17 {
18 import org.seasar.akabana.yui.command.core.impl.AbstractComplexCommand;
19 import org.seasar.akabana.yui.command.events.CommandEvent;
20
21 public class SequenceCommand extends AbstractComplexCommand {
22
23 protected var _currentCommandIndex:int;
24
25 protected override function run(...args):void{
26 _currentCommandIndex = 0;
27 if( _commands.length > 0 ){
28 doStartCommands(args);
29 } else {
30 done();
31 }
32 }
33
34 protected override function childCommandCompleteEventHandler(event:CommandEvent):void{
35 _lastCommand = event.command;
36 if( _childCompleteEventListener.handler != null ){
37 _childCompleteEventListener.handler(event);
38 }
39 _currentCommandIndex++;
40 if( _currentCommandIndex < _commands.length ){
41 doStartCommandAt(_currentCommandIndex);
42 } else {
43 done(_lastCommand.result);
44 }
45 }
46
47 protected override function childCommandErrorEventHandler(event:CommandEvent):void{
48 _lastCommand = event.command;
49 if( _childErrorEventListener.handler != null ){
50 _childErrorEventListener.handler(event);
51 }
52 failed(event);
53 }
54
55 protected function doStartCommands(args:Array):void{
56 _currentCommandIndex = 0;
57 _commandArguments = args;
58
59 doStartCommandAt(_currentCommandIndex);
60 }
61 }
62 }

Repository Top
ViewVC Help  
ViewVC logotype
Powered by ViewVC