forked from ariatemplates/ariatemplates
/
ITemplate.js
251 lines (225 loc) · 11.6 KB
/
ITemplate.js
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
/*
* Copyright 2012 Amadeus s.a.s.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Interface exposed from a template context to its template.
* @class aria.templates.ITemplate
*/
Aria.interfaceDefinition({
$classpath : 'aria.templates.ITemplate',
$extends : 'aria.templates.IBaseTemplate',
$events : {
"SectionRefreshed" : {
description : "Raised when a section in the template has been refreshed",
properties : {
sectionID : "{String} ID of the section which has been refreshed - if defined, null otherwise."
}
}
},
$interface : {
/**
* Data available for the template.
* @type Object
*/
data : "Object",
/**
* Module controller of the template.
* @type Object
*/
moduleCtrl : "Object",
/**
* Flow controller linked to the module controller of the template.
* @type Object
*/
flowCtrl : "Object",
/**
* Resources from the module controller of the template.
* @type Object
*/
moduleRes : "Object",
/**
* Do a partial or whole refresh of the template, using the specified macro and section. This method can be
* called from templates and template scripts.
* @param {aria.templates.CfgBeans.RefreshCfg} args macro and section for the refresh. If not specified, do a
* complete refresh.
*/
$refresh : function (args) {},
/**
* Returns an HTMLElement wrapped in DomElementWrapper. This method can be called from templates and template
* scripts.
* @param {String} id specified in the templates
* @param {Number} Index of child element to return
*/
$getChild : function (id, index) {},
/**
* Returns an HTMLElement wrapped in DomElementWrapper. This method can be called from templates and template
* scripts.
* @param {String} id specified in the templates
*/
$getElementById : function (id) {},
/**
* Focus a widget with a specified id programmatically. This method can be called from templates and template
* scripts. It throws an error if the focus fails
* @param {String} template id of the widget to focus
*/
$focus : function (id) {},
/**
* Returns an array containing the widgetId, and templateIds from child to parent.
* @return{Array} Contains the widget and template Ids.
*/
$getFocusedWidget : function () {},
/**
* Retrieves the currently focused widget, and extracts the widget Id and template Ids which combined form the
* widget path. This is then set into a property of the templates context.
*/
$setFocusedWidget : function () {},
/**
* Return a computed horizontal size. This method can be called from templates and template scripts.
* @param {Number} min the size of the element (in pixels) when the template has its minimum size
* @param {Number} incrementFactor [optional, default: 1] the proportion of the extra space (if available) which
* should be added to the previous min argument
* @param {Number} max [optional] the maximum size of the element (in pixels)
*/
$hdim : function (min, incrementFactor, max) {},
/**
* Return a computed vertical size. This method can be called from templates and template scripts.
* @param {Number} min the size of the element (in pixels) when the template has its minimum size
* @param {Number} incrementFactor [optional, default: 1] the proportion of the extra space (if available) which
* should be added to the previous min argument
* @param {Number} max [optional] the maximum size of the element (in pixels)
*/
$vdim : function (min, incrementFactor, max) {},
/**
* Return a global id from an id specified in a template. It adds a template-specific suffix or prefix so that
* there is no name collision between several instances of the same template, or different templates.
* @param {String} id specified in the template
* @return {String} global id which should not collide with ids from other templates
*/
$getId : function (id) {},
/**
* Return an object with the scrollTop and the scrollLeft values of the HTMLElement that contains the div of the
* template
* @return {Object} scrollTop and scrollLeft of the div that contains the template
*/
getContainerScroll : function () {},
/**
* Set the scrollTop and the scrollLeft values of the HTMLElement that contains the div of the template
* @param {Object} contains the desired scrollTop and scrollLeft values
*/
setContainerScroll : function (scrollPositions) {},
/*
* All the remaining methods in this interface are internal methods of the framework which need to be used from
* the template generated code. They are not intended to be used from anywhere else and could change from one
* release to another.
*/
/**
* Write generated ID to DOM Element. This method is intended to be called only from the generated code of
* templates (created in aria.templates.ClassGenerator) and never directly from developper code. A call to this
* method is generated for the {id ...} statement
* @private
* @param {String} id specified in the template
*/
__$writeId : function (id) {},
/**
* Write the markup for a widget not used as a container. This method is intended to be called only from the
* generated code of templates (created in aria.templates.ClassGenerator) and never directly from developper
* code. A call of this method is generated for widget statements: <code>{@libraryName:widgetName {...}/}</code>
* @private
* @param {String} lib library name
* @param {String} widget widget name in the library
* @param {Object} cfg widget configuration
* @param {Number} lineNbr line number in the template where the widget is
*/
__$processWidgetMarkup : function (lib, widget, cfg, lineNbr) {},
/**
* Write the beginning of the markup for a widget used as a container. This method is intended to be called only
* from the generated code of templates (created in aria.templates.ClassGenerator) and never directly from
* developper code. A call of this method is generated for opening widget statements:
* <code>{@libraryName:widgetName {...}}...{/@libraryName:widgetName}</code>
* @private
* @param {String} lib library name
* @param {String} widget widget name in the library
* @param {Object} cfg widget configuration
* @param {Number} lineNbr line number in the template where the widget is
*/
__$beginContainerWidget : function (lib, widget, cfg, lineNbr) {},
/**
* Write the end of the markup for a widget used as a container. This method is intended to be called only from
* the generated code of templates (created in aria.templates.ClassGenerator) and never directly from developper
* code. A call of this method is generated for closing widget statements:
* <code>{@libraryName:widgetName {...}}...{/@libraryName:widgetName}</code>
* @private
*/
__$endContainerWidget : function () {},
/**
* Write markup to handle dom events. This method is intended to be called only from the generated code of
* templates (created in aria.templates.ClassGenerator) and never directly from developper code. A call to this
* method is generated for {on .../} statements.
* @private
* @param {String} eventName name of the event
* @param {aria.core.JsObject.Callback} callback callback to be called when the event is raised
* @param {String} lineNumber
*/
__$statementOnEvent : function (eventName, callback, lineNumber) {},
/**
* Create a repeater. This method is intended to be called only from the generated code of templates (created in
* aria.templates.ClassGenerator) and never directly from developper code. A call to this method is generated
* for {repeater .../} statements.
* @private
* @param {Number} lineNumber
* @param {aria.templates.CfgBeans.RepeaterCfg} param
*/
__$statementRepeater : function (lineNumber, param) {},
/**
* Create a view if it does not exist already. This method is intended to be called only from the generated code
* of templates (created in aria.templates.ClassGenerator) and never directly from developper code. A call to
* this method is generated for the {createView ...} statement.
* @private
* @param {String} viewName
* @param {Object} parameters
* @param {Array} array
*/
__$createView : function (viewName, parameters, array) {},
/**
* Begin a section. This method is intended to be called only from the generated code of templates (created in
* aria.templates.ClassGenerator) and never directly from developper code. A call to this method is generated
* for the {section ...} opening statement.
* @param {Number} lineNumber line number at which the section begins, used for error reporting
* @param {Boolean} container true if the section statement is used as a container, false otherwise
* @param {Object/String} sectionParam section id, or configuration object
* @param {String} Dom element wrapper type to be created.
* @private
*/
__$beginSection : function (lineNumber, container, sectionParam, domType) {},
/**
* End a section previously started with a call to __$beginSection. This method is intended to be called only
* from the generated code of templates (created in aria.templates.ClassGenerator) and never directly from
* developper code. A call to this method is generated for the {/section} closing statement.
* @private
*/
__$endSection : function () {}
/* BACKWARD-COMPATIBILITY-BEGIN */,
/**
* Bind an automatic refresh to a section or the template. This method is intended to be called only from the
* generated code of templates (created in aria.templates.ClassGenerator) and never directly from developper
* code. A call to this method is generated for the bindRefreshTo statement.
* @private
* @param {Object} container object containing the parameter a section or template is bound to, or data
* @param {String} param parameter on which to bind, or null if binding to data
* @param {Number} linNumber
*/
__$bindAutoRefresh : function () {}
/* BACKWARD-COMPATIBILITY-END */
}
});