My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?xml version="1.0" encoding="utf-8"?>
<EventMap
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns="http://mate.asfusion.com/"
>

<fx:Script>
<![CDATA[

import com.cafetownsend.events.*;
import com.cafetownsend.model.constants.*;
import com.cafetownsend.model.managers.*;
import com.cafetownsend.ui.presenters.*;
import com.cafetownsend.ui.views.*;

import mx.events.*;
import mx.events.FlexEvent;

]]>
</fx:Script>


<fx:Declarations>

<!-- ======================================================================================== -->
<!-- Config -->
<!-- _________________________________________________________________________________________ -->


<!-- InjectorSettings ___________________________________________________________ -->

<!-- Inject properties to any views as soon as possible listening to FlexEvent.PREINITIALIZE -->

<InjectorSettings
eventType="{ FlexEvent.PREINITIALIZE }"
/>


<!-- Services Note: you can have an external file if you have more services -->

<s:HTTPService id="employeesService" url="assets/data/Employees.xml" resultFormat="e4x" />


<!-- ======================================================================================== -->
<!-- Events -->
<!-- _________________________________________________________________________________________ -->


<!-- FlexEvent.PREINITIALIZE __________________________________________________________________ -->

<EventHandlers type="{ FlexEvent.PREINITIALIZE }">
<ObjectBuilder
generator="{ EmployeeManager }"
>
<Properties dispatcher="{ scope.dispatcher }"/>
</ObjectBuilder>
</EventHandlers>

<!-- FlexEvent.APPLICATION_COMPLETE ___________________________________________________________ -->

<EventHandlers type="{FlexEvent.APPLICATION_COMPLETE}">

<HTTPServiceInvoker instance="{employeesService}">
<resultHandlers>
<MethodInvoker generator="{EmployeeParser}"
method="loadEmployeesFromXML" arguments="{resultObject}" />

<MethodInvoker generator="{EmployeeManager}" method="saveEmpoyeeList" arguments="{lastReturn}" />
</resultHandlers>
</HTTPServiceInvoker>

</EventHandlers>

<!-- LoginEvent.LOGIN ________________________________________________________________________ -->

<!-- Loging in, normally this would send a server request, but we are making it simple here -->
<EventHandlers type="{LoginEvent.LOGIN}">
<MethodInvoker generator="{ AuthorizationManager }" method="login" arguments="{[event.username, event.password]}" />
<MethodInvoker generator="{ NavigationManager }" method="updateAfterLogin" arguments="{ lastReturn }"/>
</EventHandlers>

<!-- LoginEvent.LOGOUT _________________________________________________________________________ -->
<EventHandlers type="{LoginEvent.LOGOUT}">
<MethodInvoker generator="{ AuthorizationManager }" method="logout"/>
<MethodInvoker generator="{ NavigationManager }" method="updatePath" arguments="{ Navigation.LOGIN }"/>
</EventHandlers>


<!-- NavigationEvent.EMPLOYEE_LIST _________________________________________________________________________ -->
<EventHandlers type="{NavigationEvent.EMPLOYEE_LIST}">
<MethodInvoker generator="{ NavigationManager }" method="updatePath" arguments="{ Navigation.EMPLOYEE_LIST }"/>
</EventHandlers>


<!-- ======================================================================================== -->
<!-- Injectors -->
<!-- _________________________________________________________________________________________ -->

<!-- MainUI + MainUIPresentationModel __________________________________________________________________ -->

<Injectors target="{ MainUI }" >
<ObjectBuilder
generator="{ MainUIPresentationModel }"
constructorArguments="{ scope.dispatcher }"
/>
<PropertyInjector
targetKey="model"
source="{ lastReturn }"
/>
</Injectors>


<Injectors target="{ MainUIPresentationModel }" >
<PropertyInjector targetKey="navigationPath" source="{ NavigationManager }" sourceKey="navigationPath"/>
</Injectors>


<!-- Login + LoginPresentationModel __________________________________________________________________ -->

<Injectors target="{ Login }" >
<ObjectBuilder
generator="{ LoginPresentationModel }"
constructorArguments="{ scope.dispatcher }"
/>
<PropertyInjector targetKey="model" source="{ lastReturn }" />
</Injectors>

<Injectors target="{ LoginPresentationModel }" >
<PropertyInjector targetKey="loginStatus" source="{ AuthorizationManager }" sourceKey="status" />
</Injectors>



</fx:Declarations>

</EventMap>

Change log

r97 by sectore on Mar 15, 2010   Diff
refactoring for using a LocalEventMap,
code cleaned up
Go to: 
Project members, sign in to write a code review

Older revisions

r96 by sectore on Mar 14, 2010   Diff
new design including some needed
refactoring
r93 by sectore on Mar 12, 2010   Diff
source of cafeTownsendFlex4 added
All revisions of this file

File info

Size: 4794 bytes, 137 lines

File properties

svn:executable
*
Powered by Google Project Hosting