/
Command.as
61 lines (51 loc) · 1.27 KB
/
Command.as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* Copyright (c) 2009 the original author or authors
*
* Permission is hereby granted to use, modify, and distribute this file
* in accordance with the terms of the license agreement accompanying it.
*/
package org.robotlegs.mvcs
{
import flash.display.DisplayObjectContainer;
import flash.events.Event;
import flash.events.IEventDispatcher;
import org.robotlegs.core.ICommandMap;
import org.robotlegs.core.IInjector;
import org.robotlegs.core.IMediatorMap;
/**
* Abstract MVCS command implementation
*/
public class Command
{
[Inject]
public var contextView:DisplayObjectContainer;
[Inject]
public var commandMap:ICommandMap;
[Inject]
public var eventDispatcher:IEventDispatcher;
[Inject]
public var injector:IInjector;
[Inject]
public var mediatorMap:IMediatorMap;
public function Command()
{
}
/**
* @inheritDoc
*/
public function execute():void
{
}
/**
* Dispatch helper method
*
* @param event The <code>Event</code> to dispatch on the <code>IContext</code>'s <code>IEventDispatcher</code>
*/
protected function dispatch(event:Event):Boolean
{
if(eventDispatcher.hasEventListener(event.type))
return eventDispatcher.dispatchEvent(event);
return false;
}
}
}