rsence 2.0.0.10.pre → 2.0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +10 -0
- data/INSTALL.rdoc +52 -86
- data/{LICENSE → LICENSE.txt} +0 -0
- data/README.rdoc +52 -49
- data/VERSION +1 -1
- data/bin/rsence +4 -6
- data/conf/default_conf.yaml +314 -305
- data/conf/default_strings.yaml +70 -71
- data/docs/ExampleGuiPlugin.rdoc +193 -0
- data/{js/comm/comm/autosync/js.inc → docs/JavascriptBundles.rdoc} +0 -0
- data/docs/PluginBundleInfo.rdoc +173 -0
- data/docs/PluginBundles.rdoc +96 -0
- data/docs/Values.rdoc +163 -0
- data/js/comm/{comm/autosync → autosync}/autosync.js +1 -2
- data/js/comm/{comm → autosync}/js.inc +0 -0
- data/js/comm/{comm/comm.js → comm.js} +1 -0
- data/js/comm/{comm/queue/js.inc → js.inc} +0 -0
- data/js/comm/jsloader/jsloader.js +2 -4
- data/js/comm/{comm/session → queue}/js.inc +0 -0
- data/js/comm/{comm/queue → queue}/queue.js +1 -0
- data/js/comm/{comm/sessionwatcher → session}/js.inc +0 -0
- data/js/comm/{comm/session → session}/session.js +4 -3
- data/js/comm/{comm/transporter → sessionwatcher}/js.inc +0 -0
- data/js/comm/{comm/sessionwatcher → sessionwatcher}/sessionwatcher.js +1 -0
- data/js/comm/{comm/urlresponder → transporter}/js.inc +0 -0
- data/js/comm/{comm/transporter → transporter}/transporter.js +1 -0
- data/js/comm/{comm/values → urlresponder}/js.inc +0 -0
- data/js/comm/{comm/urlresponder → urlresponder}/urlresponder.js +1 -0
- data/js/comm/{reloadapp → values}/js.inc +0 -0
- data/js/comm/{comm/values → values}/values.js +1 -0
- data/js/controls/button/button.js +10 -1
- data/js/controls/checkbox/checkbox.js +2 -0
- data/js/controls/dialogs/alert_sheet/alert_sheet.js +1 -0
- data/js/controls/dialogs/confirm_sheet/confirm_sheet.js +1 -0
- data/js/controls/dialogs/sheet/sheet.js +1 -0
- data/js/controls/imageview/imageview.js +1 -0
- data/js/controls/passwordcontrol/passwordcontrol.js +1 -0
- data/js/controls/progress/progressbar/progressbar.js +1 -0
- data/js/controls/progress/progressindicator/progressindicator.js +1 -0
- data/js/controls/radiobutton/radiobutton.js +3 -1
- data/js/controls/sliders/slider/slider.js +1 -0
- data/js/controls/sliders/vslider/vslider.js +1 -0
- data/js/controls/stepper/stepper.js +1 -0
- data/js/controls/stringview/stringview.js +2 -2
- data/js/controls/tab/tab.js +7 -5
- data/js/controls/textarea/textarea.js +1 -0
- data/js/controls/textcontrol/textcontrol.js +3 -1
- data/js/controls/uploader/uploader.js +1 -0
- data/js/controls/validatorview/validatorview.js +62 -59
- data/js/controls/window/window.js +1 -0
- data/js/core/class/class.js +2 -1
- data/js/core/elem/elem.js +27 -27
- data/js/core/event/event.js +3 -874
- data/js/{comm/sha → core/rsence_ns}/js.inc +0 -0
- data/js/core/rsence_ns/rsence_ns.js +15 -0
- data/js/{controls/datetime → datetime}/calendar/calendar.js +1 -0
- data/js/{comm/values/value → datetime/calendar}/js.inc +0 -0
- data/js/{controls/datetime → datetime}/calendar/themes/default/calendar.css +0 -0
- data/js/{controls/datetime → datetime}/calendar/themes/default/calendar.html +0 -0
- data/js/{controls/datetime → datetime}/calendar/themes/default/calendar_arrows-ie6.gif +0 -0
- data/js/{controls/datetime → datetime}/calendar/themes/default/calendar_arrows.png +0 -0
- data/js/{controls/datetime → datetime}/datetimevalue/datetimevalue.js +1 -0
- data/js/{comm/values/valuematrix → datetime/datetimevalue}/js.inc +0 -0
- data/js/{controls/datetime/calendar → datetime/timesheet}/js.inc +0 -0
- data/js/{controls/datetime → datetime}/timesheet/themes/default/timesheet.css +0 -0
- data/js/{controls/datetime → datetime}/timesheet/themes/default/timesheet.html +0 -0
- data/js/{controls/datetime → datetime}/timesheet/timesheet.js +1 -0
- data/js/{controls/datetime/datetimevalue → datetime/timesheet_item}/js.inc +0 -0
- data/js/{controls/datetime → datetime}/timesheet_item/themes/default/timesheet_item.css +0 -0
- data/js/{controls/datetime → datetime}/timesheet_item/themes/default/timesheet_item.html +0 -0
- data/js/{controls/datetime → datetime}/timesheet_item/timesheet_item.js +1 -0
- data/js/{controls/datetime/timesheet → datetime/timesheet_item_edit}/js.inc +0 -0
- data/js/{controls/datetime → datetime}/timesheet_item_edit/timesheet_item_edit.js +1 -1
- data/js/foundation/application/application.js +1 -2
- data/js/foundation/control/control.js +1 -4
- data/js/foundation/control/controldefaults/controldefaults.js +1 -4
- data/js/foundation/control/dummyvalue/dummyvalue.js +1 -0
- data/js/foundation/control/dyncontrol/dyncontrol.js +1 -2
- data/js/foundation/control/eventresponder/eventresponder.js +11 -3
- data/js/{controls/datetime/timesheet_item → foundation/control/valuematrix}/js.inc +0 -0
- data/js/{comm/values → foundation/control}/valuematrix/valuematrix.js +2 -5
- data/js/foundation/control/valueresponder/valueresponder.js +3 -1
- data/js/foundation/eventmanager/eventmanager.js +884 -0
- data/js/{controls/datetime/timesheet_item_edit → foundation/eventmanager}/js.inc +0 -0
- data/js/foundation/geom/point/point.js +2 -2
- data/js/foundation/geom/rect/rect.js +1 -0
- data/js/foundation/json_renderer/json_renderer.js +2 -0
- data/js/foundation/system/system.js +2 -1
- data/js/foundation/thememanager/thememanager.js +29 -23
- data/js/{controls/lists/checkboxlist → foundation/value}/js.inc +0 -0
- data/js/{comm/values → foundation}/value/value.js +1 -0
- data/js/foundation/view/markupview/markupview.js +2 -1
- data/js/foundation/view/morphanimation/morphanimation.js +1 -0
- data/js/foundation/view/view.js +6 -12
- data/js/foundation/view/viewdefaults/viewdefaults.js +1 -0
- data/js/{controls/lists → lists}/checkboxlist/checkboxlist.js +1 -0
- data/js/{controls/lists/listitems → lists/checkboxlist}/js.inc +0 -0
- data/js/{controls/lists/radiobuttonlist → lists/listitems}/js.inc +0 -0
- data/js/{controls/lists → lists}/listitems/listitems.js +22 -3
- data/js/lists/radiobuttonlist/js.inc +0 -0
- data/js/{controls/lists → lists}/radiobuttonlist/radiobuttonlist.js +2 -12
- data/js/util/reloadapp/js.inc +0 -0
- data/js/{comm → util}/reloadapp/reloadapp.js +10 -8
- data/js/{comm → util}/reloadapp/themes/default/reloadapp_warning-ie6.gif +0 -0
- data/js/{comm → util}/reloadapp/themes/default/reloadapp_warning.png +0 -0
- data/js/util/sha/js.inc +0 -0
- data/js/{comm → util}/sha/sha.js +27 -33
- data/js/views/centerview/centerview.js +33 -3
- data/js/views/inlineview/inlineview.js +1 -0
- data/js/views/scrollview/scrollview.js +1 -0
- data/lib/conf/argv.rb +34 -22
- data/lib/conf/default.rb +165 -173
- data/lib/daemon/daemon.rb +9 -9
- data/lib/daemon/sigcomm.rb +4 -4
- data/lib/http/broker.rb +30 -27
- data/lib/http/rackup.rb +2 -3
- data/lib/http/request.rb +1 -2
- data/lib/http/response.rb +10 -10
- data/lib/plugins/dependencies.rb +2 -1
- data/lib/plugins/gui_plugin.rb +77 -50
- data/lib/plugins/guiparser.rb +26 -22
- data/lib/plugins/plugin.rb +207 -427
- data/lib/plugins/plugin_base.rb +162 -0
- data/lib/plugins/plugin_plugins.rb +21 -15
- data/lib/plugins/plugin_sqlite_db.rb +45 -20
- data/lib/plugins/pluginmanager.rb +10 -5
- data/lib/plugins/plugins.rb +65 -31
- data/lib/plugins/servlet.rb +74 -26
- data/lib/rsence.rb +32 -0
- data/lib/session/msg.rb +131 -96
- data/lib/session/sessionmanager.rb +5 -4
- data/lib/session/sessionstorage.rb +4 -3
- data/lib/transporter/transporter.rb +30 -21
- data/lib/util/gzstring.rb +4 -2
- data/lib/util/ruby19_fixes.rb +18 -0
- data/lib/values/hvalue.rb +139 -88
- data/lib/values/valuemanager.rb +60 -46
- data/plugins/client_pkg/client_pkg.rb +6 -5
- data/plugins/client_pkg/lib/client_pkg_build.rb +5 -5
- data/plugins/client_pkg/lib/client_pkg_serve.rb +8 -0
- data/plugins/index_html/index_html.rb +3 -1
- data/plugins/index_html/tmpl/index.html +2 -3
- data/plugins/main/js/main.js +84 -0
- data/plugins/main/main.rb +54 -27
- data/plugins/ticket/lib/common.rb +4 -2
- data/plugins/ticket/lib/favicon.rb +3 -2
- data/plugins/ticket/lib/file.rb +2 -2
- data/plugins/ticket/lib/img.rb +2 -2
- data/plugins/ticket/lib/objblob.rb +2 -2
- data/plugins/ticket/lib/rsrc.rb +2 -2
- data/plugins/ticket/lib/upload.rb +9 -8
- data/plugins/ticket/ticket.rb +141 -8
- data/setup/welcome/welcome.rb +1 -0
- metadata +76 -72
- data/lib/plugins/plugin_util.rb +0 -107
- data/plugins/index_html/tmpl/startup_index.html +0 -29
- data/plugins/main/js/riassence_ns.js +0 -87
- data/setup/legacy/info.yaml +0 -18
- data/setup/legacy/legacy.rb +0 -17
- data/setup/welcome/gui/welcome.yaml +0 -68
- data/setup/welcome/text/welcome.html +0 -8
data/js/core/event/event.js
CHANGED
@@ -6,9 +6,11 @@
|
|
6
6
|
* with this software package. If not, contact licensing@riassence.com
|
7
7
|
*/
|
8
8
|
|
9
|
+
|
9
10
|
/*** = Description
|
10
11
|
** Abstracts the DOM Event differences between browsers.
|
11
12
|
***/
|
13
|
+
var//RSence.Core
|
12
14
|
Event = {
|
13
15
|
|
14
16
|
/** Returns the element of the event.
|
@@ -137,6 +139,7 @@ Event = {
|
|
137
139
|
KEY_END: 35,
|
138
140
|
KEY_PAGEUP: 33,
|
139
141
|
KEY_PAGEDOWN: 34
|
142
|
+
|
140
143
|
};
|
141
144
|
|
142
145
|
// Activates the garbage collector of Internet Explorer
|
@@ -145,877 +148,3 @@ if (BROWSER_TYPE.ie) {
|
|
145
148
|
Event.observe(window, "unload", Event.unloadCache, false);
|
146
149
|
}
|
147
150
|
|
148
|
-
// Default options for focus (all false)
|
149
|
-
_defaultFocusOptions = {
|
150
|
-
mouseMove: false,
|
151
|
-
mouseDown: false,
|
152
|
-
click: false,
|
153
|
-
mouseUp: false,
|
154
|
-
draggable: false,
|
155
|
-
droppable: false,
|
156
|
-
keyDown: false,
|
157
|
-
keyUp: false,
|
158
|
-
mouseWheel: false,
|
159
|
-
textEnter: false
|
160
|
-
};
|
161
|
-
|
162
|
-
/*** = Description
|
163
|
-
** Mid-level event abstraction manager.
|
164
|
-
**
|
165
|
-
** This engine serves the HControl classes, so usually the existence of it
|
166
|
-
** is not obvious. The main interface to use it is the methods in HControl.
|
167
|
-
***/
|
168
|
-
EVENT = {
|
169
|
-
|
170
|
-
/** = Description
|
171
|
-
* Array that keeps the last known global event status type.
|
172
|
-
*
|
173
|
-
* The format is an array with an index per "interesting" event value.
|
174
|
-
*
|
175
|
-
* = Indexes
|
176
|
-
* +EVENT.status[ EVENT.button1 ]+:: The state of the left mouse button.
|
177
|
-
* 0 when not pressed
|
178
|
-
* 1 when pressed.
|
179
|
-
*
|
180
|
-
* +EVENT.status[ EVENT.button2 ]+:: The state of the right mouse button.
|
181
|
-
* 0 when not pressed
|
182
|
-
* 1 when pressed.
|
183
|
-
*
|
184
|
-
* +EVENT.status[ EVENT.crsrX ]+:: The x-coordinate of the mouse cursor.
|
185
|
-
*
|
186
|
-
* +EVENT.status[ EVENT.crsrY ]+:: The y-coordinate of the mouse cursor.
|
187
|
-
*
|
188
|
-
* +EVENT.status[ EVENT.keysDown ]+:: A list of keycodes of all the keys
|
189
|
-
* currently held down in the order of
|
190
|
-
* occurrence (first pressed comes first,
|
191
|
-
* last pressed last).
|
192
|
-
*
|
193
|
-
* +EVENT.status[ EVENT.altKeyDown ]+:: The boolean status of the Alt
|
194
|
-
* modifier key being held down.
|
195
|
-
*
|
196
|
-
* +EVENT.status[ EVENT.ctrlKeyDown ]+:: The boolean status of the Ctrl
|
197
|
-
* modifier key being held down.
|
198
|
-
*
|
199
|
-
* +EVENT.status[ EVENT.shiftKeyDown ]+:: The boolean status of the Shift
|
200
|
-
* modifier key being held down.
|
201
|
-
*
|
202
|
-
**/
|
203
|
-
status: [false, false, 0, 0, [], false, false, false],
|
204
|
-
|
205
|
-
/** The index in the status array for the left mouse button.
|
206
|
-
**/
|
207
|
-
button1: 0,
|
208
|
-
|
209
|
-
/** The index in the status array for the right mouse button.
|
210
|
-
**/
|
211
|
-
button2: 1,
|
212
|
-
|
213
|
-
/** The index in the status array for the mouse cursor x coordinate.
|
214
|
-
**/
|
215
|
-
crsrX: 2,
|
216
|
-
|
217
|
-
/** The index in the status array for the mouse cursor y coordinate.
|
218
|
-
**/
|
219
|
-
crsrY: 3,
|
220
|
-
|
221
|
-
/** The index in the status array for the list of keycodes of all the
|
222
|
-
* keys currently held down in the order of occurrence (first pressed
|
223
|
-
* comes first, last pressed last).
|
224
|
-
*
|
225
|
-
**/
|
226
|
-
keysDown: 4,
|
227
|
-
|
228
|
-
/** The index in the status orray for the state of the Alt modifier key.
|
229
|
-
**/
|
230
|
-
altKeyDown: 5,
|
231
|
-
|
232
|
-
/** The index in the status orray for the state of the Ctrl modifier key.
|
233
|
-
**/
|
234
|
-
ctrlKeyDown: 6,
|
235
|
-
|
236
|
-
/** The index in the status orray for the state of the Shift modifier key.
|
237
|
-
**/
|
238
|
-
shiftKeyDown: 7,
|
239
|
-
|
240
|
-
/** A flag to disable, if your applications don't need drop events.
|
241
|
-
* Setting this to false when not needed improves overall performance,
|
242
|
-
* because the drop events need constant calculation of the mouse cursor
|
243
|
-
* location against all possible drop targets.
|
244
|
-
*
|
245
|
-
**/
|
246
|
-
enableDroppableChecks: true,
|
247
|
-
|
248
|
-
/** Initializes the members used by the drop -related events.
|
249
|
-
* This method is called from within EVENT and is never called,
|
250
|
-
* if enableDroppableChecks is false.
|
251
|
-
**/
|
252
|
-
startDroppable: function() {
|
253
|
-
var _this = EVENT;
|
254
|
-
_this.hovered = [];
|
255
|
-
// items currently under the mouse cursor
|
256
|
-
_this.hoverInterval = 50;
|
257
|
-
// 50 means send hover events at most with 50ms intervals
|
258
|
-
_this.hoverTimer = new Date().getTime();
|
259
|
-
// Time since last hover event triggered
|
260
|
-
},
|
261
|
-
|
262
|
-
/** Starts event listening.
|
263
|
-
**/
|
264
|
-
start: function() {
|
265
|
-
var _globalEventTargetElement = BROWSER_TYPE.ie?document:window,
|
266
|
-
_this = EVENT;
|
267
|
-
// _eventMap = [
|
268
|
-
Event.observe( _globalEventTargetElement, 'mousemove', _this.mouseMove );
|
269
|
-
Event.observe( _globalEventTargetElement, 'mouseup', _this.mouseUp );
|
270
|
-
Event.observe( _globalEventTargetElement, 'mousedown', _this.mouseDown );
|
271
|
-
Event.observe( _globalEventTargetElement, 'click', _this.click );
|
272
|
-
Event.observe( _globalEventTargetElement, 'keyup', _this.keyUp );
|
273
|
-
Event.observe( _globalEventTargetElement, 'keydown', _this.keyDown );
|
274
|
-
Event.observe( _globalEventTargetElement, 'keypress', _this.keyPress );
|
275
|
-
Event.observe( _globalEventTargetElement, 'contextmenu', _this.contextMenu );
|
276
|
-
Event.observe( _globalEventTargetElement, 'resize', _this.resize );
|
277
|
-
Event.observe( _globalEventTargetElement, 'mousewheel', _this.mouseWheel );
|
278
|
-
// ],
|
279
|
-
// i = 0;
|
280
|
-
// for (; i !== _eventMap.length; i++) {
|
281
|
-
// Event.observe(_globalEventTargetElement, _eventMap[i][0], _eventMap[i][1]);
|
282
|
-
// }
|
283
|
-
if (window.addEventListener) {
|
284
|
-
window.addEventListener('DOMMouseScroll', EVENT.mouseWheel, false);
|
285
|
-
window.addEventListener('resize', EVENT.resize, false);
|
286
|
-
}
|
287
|
-
//window.onmousewheel=document.onmousewheel=EVENT.mouseWheel;
|
288
|
-
_this.listeners = [];
|
289
|
-
// keep elemId buffer of all listeners
|
290
|
-
_this.focused = [];
|
291
|
-
// keep elemId buffer of all focused listeners
|
292
|
-
_this.resizeListeners = [];
|
293
|
-
// list of resize-event listeners
|
294
|
-
_this.coordListeners = [];
|
295
|
-
// global mouse movement listeners
|
296
|
-
_this.focusOptions = {};
|
297
|
-
// keep property lists by elemId
|
298
|
-
_this.dragItems = [];
|
299
|
-
// elemId of currently dragged items
|
300
|
-
if (_this.enableDroppableChecks) {
|
301
|
-
_this.startDroppable();
|
302
|
-
}
|
303
|
-
|
304
|
-
_this.topmostDroppable = null;
|
305
|
-
// the currently hovered element accepting droppable items
|
306
|
-
_this.textEnterCtrls = [];
|
307
|
-
// ID of controls with textfields
|
308
|
-
// position caching benefits performance, see coordCacheFlush
|
309
|
-
_this._coordCache = [];
|
310
|
-
_this._coordCacheFlag = true;
|
311
|
-
_this._lastCoordFlushTimeout = null;
|
312
|
-
|
313
|
-
_this.activeControl = null;
|
314
|
-
// control that currently has the focus
|
315
|
-
_this._lastKeyDown = null;
|
316
|
-
// the most recent keypress
|
317
|
-
},
|
318
|
-
|
319
|
-
/** Flushes the position cache by elemId, if no elemId is specified,
|
320
|
-
* everything is flushed.
|
321
|
-
**/
|
322
|
-
coordCacheFlush: function(_elemId) {
|
323
|
-
if (_elemId) {
|
324
|
-
EVENT._coordCache[_elemId] = null;
|
325
|
-
}
|
326
|
-
else {
|
327
|
-
EVENT._coordCache = [];
|
328
|
-
}
|
329
|
-
},
|
330
|
-
|
331
|
-
/** Registers the _ctrl object by event listener flags in _focusOptions.
|
332
|
-
**/
|
333
|
-
reg: function(_ctrl, _focusOptions) {
|
334
|
-
var _elemId,
|
335
|
-
_elem,
|
336
|
-
_this = EVENT,
|
337
|
-
_propIn;
|
338
|
-
// Binds the class to the element (so it can be called on the event)
|
339
|
-
_elemId = _ctrl.elemId;
|
340
|
-
_elem = ELEM.get(_elemId);
|
341
|
-
if (BROWSER_TYPE.ie) {
|
342
|
-
_elem.setAttribute('ctrl', _ctrl);
|
343
|
-
}
|
344
|
-
else {
|
345
|
-
_elem.ctrl = _ctrl;
|
346
|
-
}
|
347
|
-
_this.listeners[_elemId] = true;
|
348
|
-
_this.focused[_elemId] = false;
|
349
|
-
for (_propIn in _defaultFocusOptions) {
|
350
|
-
if (_focusOptions[_propIn] === undefined) {
|
351
|
-
_focusOptions[_propIn] = _defaultFocusOptions[_propIn];
|
352
|
-
}
|
353
|
-
}
|
354
|
-
_this.focusOptions[_elemId] = _focusOptions;
|
355
|
-
var _coordListenIdx = _this.coordListeners.indexOf(_elemId);
|
356
|
-
if (_focusOptions.mouseMove) {
|
357
|
-
if (_coordListenIdx === -1) {
|
358
|
-
_this.coordListeners.push(_elemId);
|
359
|
-
}
|
360
|
-
}
|
361
|
-
else if (_coordListenIdx !== -1) {
|
362
|
-
_this.coordListeners.splice(_coordListenIdx, 1);
|
363
|
-
}
|
364
|
-
//console.log('focusOptions:',_focusOptions);
|
365
|
-
//console.log('focusOptions.textEnter: ',_focusOptions.textEnter);
|
366
|
-
if (_focusOptions.textEnter) {
|
367
|
-
if (_this.textEnterCtrls.indexOf(_ctrl.viewId) === -1) {
|
368
|
-
_this.textEnterCtrls.push(_ctrl.viewId);
|
369
|
-
}
|
370
|
-
}
|
371
|
-
if (_focusOptions.resize) {
|
372
|
-
if (_this.resizeListeners.indexOf(_ctrl.viewId) === -1) {
|
373
|
-
_this.resizeListeners.push(_ctrl.viewId);
|
374
|
-
}
|
375
|
-
}
|
376
|
-
Event.observe(_elem, 'mouseover', _this._mouseOver);
|
377
|
-
},
|
378
|
-
|
379
|
-
/** Unregisters the _ctrl object event listeners
|
380
|
-
**/
|
381
|
-
unreg: function(_ctrl) {
|
382
|
-
var _this = EVENT,
|
383
|
-
_elemId,
|
384
|
-
_elem;
|
385
|
-
if (_ctrl === this.activeControl) {
|
386
|
-
_this.changeActiveControl(null);
|
387
|
-
}
|
388
|
-
_elemId = _ctrl.elemId;
|
389
|
-
_elem = ELEM.get(_elemId);
|
390
|
-
|
391
|
-
_this._coordCache[_elemId] = null;
|
392
|
-
|
393
|
-
_this.listeners[_elemId] = false;
|
394
|
-
_this.focused[_elemId] = false;
|
395
|
-
_this.focusOptions[_elemId] = { ctrl: _ctrl };
|
396
|
-
var _coordListenIdx = _this.coordListeners.indexOf(_elemId);
|
397
|
-
if (_coordListenIdx !== -1) {
|
398
|
-
_this.coordListeners.splice(_coordListenIdx, 1);
|
399
|
-
}
|
400
|
-
|
401
|
-
var _textEnterIndex = _this.textEnterCtrls.indexOf(_ctrl.viewId);
|
402
|
-
if (_textEnterIndex !== -1) {
|
403
|
-
_this.textEnterCtrls.splice(_textEnterIndex, 1);
|
404
|
-
}
|
405
|
-
var _resizeIndex = _this.resizeListeners.indexOf(_ctrl.viewId);
|
406
|
-
if (_resizeIndex !== -1) {
|
407
|
-
_this.resizeListeners.splice(_resizeIndex, 1);
|
408
|
-
}
|
409
|
-
if (_elem !== undefined) {
|
410
|
-
Event.stopObserving(_elem, 'mouseover', _this._mouseOver);
|
411
|
-
}
|
412
|
-
},
|
413
|
-
|
414
|
-
/** Receiver of the onResize event.
|
415
|
-
* Delegates calls to the high-level event receivers of all
|
416
|
-
* controls registered for the event.
|
417
|
-
**/
|
418
|
-
resize: function(e) {
|
419
|
-
var i = 0,
|
420
|
-
_this = EVENT,
|
421
|
-
_ctrlID,
|
422
|
-
_ctrl;
|
423
|
-
for (; i < _this.resizeListeners.length; i++) {
|
424
|
-
_ctrlID = _this.resizeListeners[i];
|
425
|
-
_ctrl = HSystem.views[_ctrlID];
|
426
|
-
if (_ctrl['resize']) {
|
427
|
-
_ctrl.resize();
|
428
|
-
}
|
429
|
-
if (_ctrl['onResize']) {
|
430
|
-
_ctrl.onResize();
|
431
|
-
}
|
432
|
-
}
|
433
|
-
},
|
434
|
-
|
435
|
-
/* Element-specific mouse over/out event receiver. */
|
436
|
-
_mouseOver: function(e) {
|
437
|
-
if (!Event.element) {
|
438
|
-
return;
|
439
|
-
}
|
440
|
-
var _that = Event.element(e);
|
441
|
-
while (_that && _that.ctrl === undefined) {
|
442
|
-
_that = _that.parentNode;
|
443
|
-
}
|
444
|
-
if (!_that) {
|
445
|
-
return;
|
446
|
-
}
|
447
|
-
var _this = _that.ctrl;
|
448
|
-
EVENT.focus(_this);
|
449
|
-
Event.stop(e);
|
450
|
-
},
|
451
|
-
|
452
|
-
/* Element-specific mouse over/out event receiver. */
|
453
|
-
_mouseOut: function(e) {
|
454
|
-
if (!Event.element) {
|
455
|
-
return;
|
456
|
-
}
|
457
|
-
var _that = Event.element(e);
|
458
|
-
while (_that && _that.ctrl === undefined) {
|
459
|
-
_that = _that.parentNode;
|
460
|
-
}
|
461
|
-
if (!_that) {
|
462
|
-
return;
|
463
|
-
}
|
464
|
-
var _this = _that.ctrl;
|
465
|
-
EVENT.blur(_this);
|
466
|
-
Event.stop(e);
|
467
|
-
},
|
468
|
-
|
469
|
-
/** Mid-level focus manager.
|
470
|
-
* Gets called on the onMouseOver event.
|
471
|
-
* Starts listening for onMouseOut to blur.
|
472
|
-
* Delegates focus calls to the high-level event receivers of all
|
473
|
-
* enabled controls registered.
|
474
|
-
**/
|
475
|
-
focus: function(_ctrl) {
|
476
|
-
var _this = EVENT,
|
477
|
-
_elemId = _ctrl.elemId,
|
478
|
-
_elem = ELEM.get(_elemId);
|
479
|
-
if (_this.focused[_elemId] === false ){ // && _this.dragItems.indexOf(_elemId) === -1) {
|
480
|
-
Event.stopObserving(_elem, 'mouseover', _this._mouseOver);
|
481
|
-
Event.observe(_elem, 'mouseout', _this._mouseOut);
|
482
|
-
_this.focused[_elemId] = true;
|
483
|
-
if (_ctrl['focus']) {
|
484
|
-
_ctrl.focus();
|
485
|
-
}
|
486
|
-
}
|
487
|
-
},
|
488
|
-
|
489
|
-
/** Mid-level blur (focus lost) manager.
|
490
|
-
* Gets called on the onMouseOut event.
|
491
|
-
* Starts listening for onMouseOver to (re)focus.
|
492
|
-
* Delegates blur calls to the high-level event receivers of all
|
493
|
-
* enabled controls registered.
|
494
|
-
**/
|
495
|
-
blur: function(_ctrl) {
|
496
|
-
var _this = EVENT,
|
497
|
-
_elemId = _ctrl.elemId,
|
498
|
-
_elem = ELEM.get(_elemId);
|
499
|
-
if (_this.focused[_elemId] === true ){ // && _this.dragItems.indexOf(_elemId) === -1) {
|
500
|
-
Event.stopObserving(_elem, 'mouseout', _this._mouseOut);
|
501
|
-
Event.observe(_elem, 'mouseover', _this._mouseOver);
|
502
|
-
_this.focused[_elemId] = false;
|
503
|
-
if (_ctrl['blur']) {
|
504
|
-
_ctrl.blur();
|
505
|
-
}
|
506
|
-
}
|
507
|
-
},
|
508
|
-
|
509
|
-
/** Mid-level mouse movement manager.
|
510
|
-
* Gets called on the onMouseMove event.
|
511
|
-
* Delegates the following calls to the high-level event receivers of all
|
512
|
-
* enabled controls registered, depending on the events they registered:
|
513
|
-
* - drag
|
514
|
-
* - mouseMove
|
515
|
-
* - endHover
|
516
|
-
* - startHover
|
517
|
-
*
|
518
|
-
**/
|
519
|
-
mouseMove: function(e) {
|
520
|
-
var _this = EVENT,
|
521
|
-
x = Event.pointerX(e),
|
522
|
-
y = Event.pointerY(e),
|
523
|
-
_currentlyDragging = _this.flushMouseMove(x, y);
|
524
|
-
_this.status[_this.crsrX] = x;
|
525
|
-
_this.status[_this.crsrY] = y;
|
526
|
-
_this._modifiers(e);
|
527
|
-
// might work
|
528
|
-
if (_currentlyDragging) {
|
529
|
-
Event.stop(e);
|
530
|
-
}
|
531
|
-
// Only prevent default action when we are dragging something.
|
532
|
-
},
|
533
|
-
|
534
|
-
/** Processes dragging calculations, triggered by mouseMove.
|
535
|
-
**/
|
536
|
-
flushMouseMove: function(x, y) {
|
537
|
-
var _this = EVENT,
|
538
|
-
_currentlyDragging = false,
|
539
|
-
i = 0,
|
540
|
-
j,
|
541
|
-
_elemId,
|
542
|
-
_ctrl;
|
543
|
-
|
544
|
-
clearTimeout(_this._lastCoordFlushTimeout);
|
545
|
-
|
546
|
-
// send drag event to all drag-interested ctrls
|
547
|
-
for (; i !== _this.dragItems.length; i++) {
|
548
|
-
_elemId = _this.dragItems[i];
|
549
|
-
_this.focusOptions[_elemId].ctrl.drag(x, y);
|
550
|
-
_this.coordCacheFlush(_elemId);
|
551
|
-
_currentlyDragging = true;
|
552
|
-
}
|
553
|
-
|
554
|
-
if (_this.enableDroppableChecks) {
|
555
|
-
// Check which items are under the mouse coordinates now.
|
556
|
-
if (new Date().getTime() > _this.hoverTimer + _this.hoverInterval) {
|
557
|
-
// sends mouseMove pseudo-events to ctrls interested
|
558
|
-
for (i = 0; i !== _this.coordListeners.length; i++) {
|
559
|
-
_elemId = _this.coordListeners[i];
|
560
|
-
_ctrl = _this.focusOptions[_elemId].ctrl;
|
561
|
-
_ctrl.mouseMove(x, y);
|
562
|
-
}
|
563
|
-
if (_this.enableDroppableChecks) {
|
564
|
-
_this._updateHoverItems();
|
565
|
-
}
|
566
|
-
// sends drag&drop pseudo-events
|
567
|
-
var _wasTopmostDroppable;
|
568
|
-
for (i = 0; i !== _this.dragItems.length; i++) {
|
569
|
-
// Find the current droppable while dragging.
|
570
|
-
_wasTopmostDroppable = _this.topmostDroppable;
|
571
|
-
_this.topmostDroppable = null;
|
572
|
-
_elemId = _this.dragItems[i];
|
573
|
-
_ctrl = _this.focusOptions[_elemId].ctrl;
|
574
|
-
|
575
|
-
// Check for a drop target from the currently hovered items
|
576
|
-
var _hoverIndex,
|
577
|
-
_dropCtrl;
|
578
|
-
for (j = 0; j !== _this.hovered.length; j++) {
|
579
|
-
_hoverIndex = _this.hovered[j];
|
580
|
-
if (_hoverIndex !== _elemId && _this.focusOptions[_hoverIndex].ctrl) {
|
581
|
-
_dropCtrl = _this.focusOptions[_hoverIndex].ctrl;
|
582
|
-
if (!_this.topmostDroppable ||
|
583
|
-
// First time
|
584
|
-
_dropCtrl.zIndex() > _this.topmostDroppable.zIndex() ||
|
585
|
-
// Z beaten
|
586
|
-
_dropCtrl.supr === _this.topmostDroppable) {
|
587
|
-
// subview
|
588
|
-
if (_this.focusOptions[_dropCtrl.elemId].droppable) {
|
589
|
-
_this.topmostDroppable = _dropCtrl;
|
590
|
-
// Finally, the item must accept drop events.
|
591
|
-
}
|
592
|
-
}
|
593
|
-
}
|
594
|
-
}
|
595
|
-
|
596
|
-
// Topmost item has changed, send startHover or endHover to the droppable.
|
597
|
-
if (_wasTopmostDroppable !== _this.topmostDroppable) {
|
598
|
-
if (_wasTopmostDroppable) {
|
599
|
-
_wasTopmostDroppable.endHover(_ctrl);
|
600
|
-
}
|
601
|
-
if (_this.topmostDroppable) {
|
602
|
-
_this.topmostDroppable.startHover(_ctrl);
|
603
|
-
}
|
604
|
-
}
|
605
|
-
}
|
606
|
-
_this.hoverTimer = new Date().getTime();
|
607
|
-
}
|
608
|
-
else {
|
609
|
-
_this._lastCoordFlushTimeout = setTimeout(
|
610
|
-
function(){
|
611
|
-
EVENT.flushMouseMove(x,y);
|
612
|
-
}, _this.hoverInterval
|
613
|
-
);
|
614
|
-
}
|
615
|
-
}
|
616
|
-
return _currentlyDragging;
|
617
|
-
},
|
618
|
-
|
619
|
-
// Loops through all registered items and store indices of elements
|
620
|
-
// that are currenly under the mouse cursor in .hovered array. Uses
|
621
|
-
// cached position and dimensions value when possible.
|
622
|
-
_updateHoverItems: function() {
|
623
|
-
var _this = EVENT,
|
624
|
-
x = _this.status[_this.crsrX],
|
625
|
-
y = _this.status[_this.crsrY],
|
626
|
-
i = 0,
|
627
|
-
_ctrl,
|
628
|
-
_elem,
|
629
|
-
_pos,
|
630
|
-
_size,
|
631
|
-
_coords;
|
632
|
-
_this.hovered = [];
|
633
|
-
for (; i !== _this.listeners.length; i++) {
|
634
|
-
if (!_this.listeners[i] || !_this.focusOptions[i].ctrl) {
|
635
|
-
continue;
|
636
|
-
}
|
637
|
-
_ctrl = _this.focusOptions[i].ctrl;
|
638
|
-
_elem = ELEM.get(i);
|
639
|
-
if (!_this._coordCacheFlag || !_this._coordCache[i]) {
|
640
|
-
_pos = ELEM.getVisiblePosition(_ctrl.elemId);
|
641
|
-
// [x,y]
|
642
|
-
_size = ELEM.getVisibleSize(_ctrl.elemId);
|
643
|
-
// [w,h]
|
644
|
-
_this._coordCache[i] = [_pos[0], _pos[1], _size[0], _size[1]];
|
645
|
-
}
|
646
|
-
_coords = _this._coordCache[i];
|
647
|
-
|
648
|
-
// Is the mouse pointer inside the element's rectangle?
|
649
|
-
if (x >= _coords[0] && x <= _coords[0] + _coords[2] && y >= _coords[1] && y <= _coords[1] + _coords[3]) {
|
650
|
-
_this.hovered.push(i);
|
651
|
-
}
|
652
|
-
}
|
653
|
-
},
|
654
|
-
|
655
|
-
/** = Description
|
656
|
-
* Starts dragging the control given.
|
657
|
-
*
|
658
|
-
* Call this method to start dragging another component.
|
659
|
-
*
|
660
|
-
* = Parameters
|
661
|
-
* +_ctrl+:: An object that uses the HControl API, becomes new drag target.
|
662
|
-
*
|
663
|
-
**/
|
664
|
-
startDragging: function(_ctrl) {
|
665
|
-
var _this = EVENT;
|
666
|
-
_this.dragItems = [_ctrl.elemId];
|
667
|
-
_this.focus(_ctrl);
|
668
|
-
_this.changeActiveControl(_ctrl);
|
669
|
-
_ctrl.startDrag(_this.status[_this.crsrX], _this.status[_this.crsrY]);
|
670
|
-
},
|
671
|
-
|
672
|
-
/** Mid-level mouse button press manager.
|
673
|
-
* Gets called on the onMouseDown event.
|
674
|
-
* Delegates the following calls to the high-level event receivers of all
|
675
|
-
* enabled controls registered, depending on the events they registered:
|
676
|
-
* - mouseDown
|
677
|
-
* - startDrag
|
678
|
-
*
|
679
|
-
**/
|
680
|
-
mouseDown: function(e, _isLeftButton) {
|
681
|
-
var _this = EVENT,
|
682
|
-
_didStartDrag = false,
|
683
|
-
x = _this.status[_this.crsrX],
|
684
|
-
y = _this.status[_this.crsrY],
|
685
|
-
i = 0,
|
686
|
-
|
687
|
-
// Unset the active control when clicking on anything.
|
688
|
-
_newActiveControl = null,
|
689
|
-
|
690
|
-
// The startDrag and mouseDown event receivers are first collected into
|
691
|
-
// these arrays and the events are sent after the active control status has
|
692
|
-
// been changed.
|
693
|
-
_startDragElementIds = [],
|
694
|
-
_mouseDownElementIds = [];
|
695
|
-
|
696
|
-
_this._modifiers(e);
|
697
|
-
if (_isLeftButton === undefined) {
|
698
|
-
_isLeftButton = Event.isLeftClick(e);
|
699
|
-
}
|
700
|
-
if (_isLeftButton) {
|
701
|
-
_this.status[_this.button1] = true;
|
702
|
-
}
|
703
|
-
else {
|
704
|
-
_this.status[_this.button2] = true;
|
705
|
-
}
|
706
|
-
|
707
|
-
for (; i !== _this.focused.length; i++) {
|
708
|
-
if (_this.focused[i] === true) {
|
709
|
-
// Set the active control to the currently focused item.
|
710
|
-
if (_this.focusOptions[i].ctrl.enabled) {
|
711
|
-
_newActiveControl = _this.focusOptions[i].ctrl;
|
712
|
-
}
|
713
|
-
if ((_this.focusOptions[i].draggable === true) && _this.dragItems.indexOf(i) === -1) {
|
714
|
-
_startDragElementIds.push(i);
|
715
|
-
}
|
716
|
-
else if (_this.focusOptions[i].mouseDown === true) {
|
717
|
-
_mouseDownElementIds.push(i);
|
718
|
-
}
|
719
|
-
}
|
720
|
-
}
|
721
|
-
// Handle the active control selection.
|
722
|
-
if (_newActiveControl) {
|
723
|
-
_this.changeActiveControl(_newActiveControl);
|
724
|
-
}
|
725
|
-
// Call the mouseDown and startDrag events after the active control change has been handled.
|
726
|
-
for (i = 0; i !== _startDragElementIds.length; i++) {
|
727
|
-
_this.dragItems.push(_startDragElementIds[i]);
|
728
|
-
_this.focusOptions[_startDragElementIds[i]].ctrl.startDrag(x, y);
|
729
|
-
_didStartDrag = true;
|
730
|
-
}
|
731
|
-
|
732
|
-
var _stopEvent = _mouseDownElementIds.length;
|
733
|
-
for (i = 0; i !== _mouseDownElementIds.length; i++) {
|
734
|
-
if (_this.focusOptions[_mouseDownElementIds[i]].ctrl.mouseDown(x, y, _isLeftButton)) {
|
735
|
-
_stopEvent--;
|
736
|
-
}
|
737
|
-
}
|
738
|
-
if (_didStartDrag) {
|
739
|
-
// Remove possible selections.
|
740
|
-
document.body.focus();
|
741
|
-
// Prevent text selection in MSIE when dragging starts.
|
742
|
-
_this._storedOnSelectStart = document.onselectstart;
|
743
|
-
document.onselectstart = function() {
|
744
|
-
return false;
|
745
|
-
};
|
746
|
-
Event.stop(e);
|
747
|
-
}
|
748
|
-
// Stop the event only when we are hovering over some control, allows normal DOM events to co-exist.
|
749
|
-
if (this.enableDroppableChecks) {
|
750
|
-
if ((_stopEvent === 0) && (_this.hovered.length !== 0) && (_newActiveControl && (_newActiveControl.textElemId === false))) {
|
751
|
-
Event.stop(e);
|
752
|
-
}
|
753
|
-
}
|
754
|
-
return true;
|
755
|
-
},
|
756
|
-
|
757
|
-
/** Mid-level mouse click manager.
|
758
|
-
* Gets called on the onClick event.
|
759
|
-
* Delegates click calls to the high-level event receivers of all
|
760
|
-
* controls registered for that event.
|
761
|
-
*
|
762
|
-
**/
|
763
|
-
click: function(e, _isLeftButton) {
|
764
|
-
var _this = EVENT,
|
765
|
-
x = _this.status[_this.crsrX],
|
766
|
-
y = _this.status[_this.crsrY],
|
767
|
-
i = 0,
|
768
|
-
// Unset the active control when clicking on anything.
|
769
|
-
_newActiveControl = null,
|
770
|
-
// The startDrag and mouseDown event receivers are first collected into
|
771
|
-
// these arrays and the events are sent after the active control status has
|
772
|
-
// been changed.
|
773
|
-
_clickElementIds = [];
|
774
|
-
_this._modifiers(e);
|
775
|
-
if (_isLeftButton === undefined) {
|
776
|
-
_isLeftButton = Event.isLeftClick(e);
|
777
|
-
}
|
778
|
-
if (_isLeftButton) {
|
779
|
-
_this.status[_this.button1] = true;
|
780
|
-
}
|
781
|
-
else {
|
782
|
-
_this.status[_this.button2] = true;
|
783
|
-
}
|
784
|
-
for (; i !== _this.focused.length; i++) {
|
785
|
-
if (_this.focused[i] === true) {
|
786
|
-
// Set the active control to the currently focused item.
|
787
|
-
if (_this.focusOptions[i].ctrl.enabled) {
|
788
|
-
_newActiveControl = _this.focusOptions[i].ctrl;
|
789
|
-
}
|
790
|
-
if (_this.focusOptions[i].click === true) {
|
791
|
-
_clickElementIds.push(i);
|
792
|
-
}
|
793
|
-
}
|
794
|
-
}
|
795
|
-
// Handle the active control selection.
|
796
|
-
if (_newActiveControl) {
|
797
|
-
_this.changeActiveControl(_newActiveControl);
|
798
|
-
}
|
799
|
-
var _stopEvent = _clickElementIds.length;
|
800
|
-
for (i = 0; i !== _clickElementIds.length; i++) {
|
801
|
-
if (_this.focusOptions[_clickElementIds[i]].ctrl.click(x, y, _isLeftButton)) {
|
802
|
-
_stopEvent--;
|
803
|
-
}
|
804
|
-
}
|
805
|
-
// Stop the event only when we are hovering over some control, allows normal DOM events to co-exist.
|
806
|
-
if (_this.enableDroppableChecks) {
|
807
|
-
if ((_stopEvent === 0) && (_this.hovered.length !== 0) && (_newActiveControl && (_newActiveControl.textElemId === false))) {
|
808
|
-
Event.stop(e);
|
809
|
-
}
|
810
|
-
}
|
811
|
-
//if(_this.hovered.length!==0){Event.stop(e);}
|
812
|
-
return true;
|
813
|
-
},
|
814
|
-
|
815
|
-
/** Changes active ctrl.
|
816
|
-
* The previous active ctrl gets the _lostActiveStatus pseudo-event,
|
817
|
-
* The new active ctrl gets the _gainedActiveStatus pseudo-event
|
818
|
-
**/
|
819
|
-
changeActiveControl: function(_ctrl) {
|
820
|
-
//console.log('EVENT.changeActiveControl: ',_ctrl);
|
821
|
-
var _this = EVENT,
|
822
|
-
// Store the currently active control so we can inform it, if it no longer is the active control.
|
823
|
-
_prevActiveCtrl = _this.activeControl;
|
824
|
-
// Did the active control change?
|
825
|
-
if (_ctrl !== _prevActiveCtrl) {
|
826
|
-
if (_prevActiveCtrl) {
|
827
|
-
// Previously active control just lost the active status.
|
828
|
-
_prevActiveCtrl.active = false;
|
829
|
-
_prevActiveCtrl._lostActiveStatus(_ctrl);
|
830
|
-
}
|
831
|
-
_this.activeControl = null;
|
832
|
-
if (_ctrl) {
|
833
|
-
// A new control gained the active status.
|
834
|
-
_ctrl.active = true;
|
835
|
-
_this.activeControl = _ctrl;
|
836
|
-
_ctrl._gainedActiveStatus(_prevActiveCtrl);
|
837
|
-
}
|
838
|
-
}
|
839
|
-
},
|
840
|
-
|
841
|
-
|
842
|
-
/** Mid-level mouse button release manager.
|
843
|
-
* Gets called on the onMouseUp event.
|
844
|
-
* Delegates the following calls to the high-level event receivers of all
|
845
|
-
* enabled controls registered, depending on the events they registered:
|
846
|
-
* - mouseUp
|
847
|
-
* - endHover
|
848
|
-
* - drop
|
849
|
-
* - endDrag
|
850
|
-
*
|
851
|
-
**/
|
852
|
-
mouseUp: function(e) {
|
853
|
-
var _this = EVENT,
|
854
|
-
_didEndDrag = false,
|
855
|
-
_isLeftButton = Event.isLeftClick(e),
|
856
|
-
x = _this.status[_this.crsrX],
|
857
|
-
y = _this.status[_this.crsrY],
|
858
|
-
_elemId,
|
859
|
-
_ctrl,
|
860
|
-
i = 0;
|
861
|
-
_this._modifiers(e);
|
862
|
-
_this.status[_this.button1] = false;
|
863
|
-
_this.status[_this.button2] = false;
|
864
|
-
// Send endDrag for the currently dragged items even when they don't have focus, and clear the drag item array.
|
865
|
-
for (; i !== _this.dragItems.length; i++) {
|
866
|
-
_elemId = _this.dragItems[i];
|
867
|
-
_ctrl = _this.focusOptions[_elemId].ctrl;
|
868
|
-
_ctrl.endDrag(x, y);
|
869
|
-
_didEndDrag = true;
|
870
|
-
// If the mouse slipped off the dragged item before the mouse button was released, blur the item manually
|
871
|
-
if (_this.enableDroppableChecks) {
|
872
|
-
_this._updateHoverItems();
|
873
|
-
if (_this.hovered.indexOf(_elemId) === -1) {
|
874
|
-
_this.blur(_ctrl);
|
875
|
-
}
|
876
|
-
}
|
877
|
-
// If there is a drop target in the currently hovered items, send drop to it.
|
878
|
-
if (_this.topmostDroppable) {
|
879
|
-
// Droppable found at the release point.
|
880
|
-
_this.topmostDroppable.endHover(_ctrl);
|
881
|
-
_this.topmostDroppable.drop(_ctrl);
|
882
|
-
_this.topmostDroppable = null;
|
883
|
-
}
|
884
|
-
}
|
885
|
-
_this.dragItems = [];
|
886
|
-
// Restore MSIE's ability to select text after dragging has ended.
|
887
|
-
if (_didEndDrag) {
|
888
|
-
document.onselectstart = _this._storedOnSelectStart;
|
889
|
-
}
|
890
|
-
// Check for mouseUp listeners.
|
891
|
-
for (i = 0; i !== _this.focused.length; i++) {
|
892
|
-
if (_this.focused[i] === true) {
|
893
|
-
if (_this.focusOptions[i].mouseUp === true) {
|
894
|
-
_this.focusOptions[i].ctrl.mouseUp(x, y, _isLeftButton);
|
895
|
-
}
|
896
|
-
}
|
897
|
-
}
|
898
|
-
return true;
|
899
|
-
},
|
900
|
-
|
901
|
-
|
902
|
-
/** Mid-level key press manager.
|
903
|
-
* Gets called on the onKeyDown event.
|
904
|
-
* Delegates keyDown calls to the high-level event receivers of all
|
905
|
-
* controls registered for that event.
|
906
|
-
**/
|
907
|
-
keyDown: function(e) {
|
908
|
-
var _this = EVENT,
|
909
|
-
_theKeyCode = e.keyCode;
|
910
|
-
_this._modifiers(e);
|
911
|
-
if (_this.activeControl && _this.focusOptions[_this.activeControl.elemId].keyDown === true) {
|
912
|
-
Event.stop(e);
|
913
|
-
// Workaround for msie rapid fire keydown
|
914
|
-
if (_this._lastKeyDown !== _theKeyCode) {
|
915
|
-
_this.activeControl.keyDown(_theKeyCode);
|
916
|
-
}
|
917
|
-
}
|
918
|
-
// Insert key to the realtime array, remove in keyUp
|
919
|
-
if (_this.status[_this.keysDown].indexOf(_theKeyCode) === -1) {
|
920
|
-
_this.status[_this.keysDown].push(_theKeyCode);
|
921
|
-
}
|
922
|
-
_this._lastKeyDown = _theKeyCode;
|
923
|
-
},
|
924
|
-
|
925
|
-
|
926
|
-
/** Mid-level key release manager.
|
927
|
-
* Gets called on the onKeyUp event.
|
928
|
-
* Delegates keyUp calls to the high-level event receivers of all
|
929
|
-
* controls registered for that event.
|
930
|
-
* Also delegates the textEnter calls to all controls
|
931
|
-
* registered for that event.
|
932
|
-
**/
|
933
|
-
keyUp: function(e) {
|
934
|
-
var _this = EVENT,
|
935
|
-
_theKeyCode = e.keyCode,
|
936
|
-
_keyCodeIndex,
|
937
|
-
i = 0,
|
938
|
-
_ctrlId,
|
939
|
-
_ctrl;
|
940
|
-
_this._modifiers(e);
|
941
|
-
_this._lastKeyDown = null;
|
942
|
-
if (_this.activeControl && _this.focusOptions[_this.activeControl.elemId].keyUp === true) {
|
943
|
-
_this.activeControl.keyUp(_theKeyCode);
|
944
|
-
}
|
945
|
-
for (; i < _this.textEnterCtrls.length; i++) {
|
946
|
-
_ctrlId = _this.textEnterCtrls[i];
|
947
|
-
_ctrl = HSystem.views[_ctrlId];
|
948
|
-
if (_ctrl.textEnter) {
|
949
|
-
_ctrl.textEnter();
|
950
|
-
}
|
951
|
-
}
|
952
|
-
// Remove the key from the realtime array, inserted in keyDown
|
953
|
-
_keyCodeIndex = _this.status[_this.keysDown].indexOf(_theKeyCode);
|
954
|
-
if (_keyCodeIndex !== -1) {
|
955
|
-
_this.status[_this.keysDown].splice(_keyCodeIndex, 1);
|
956
|
-
}
|
957
|
-
},
|
958
|
-
|
959
|
-
/* Prevents the onKeyPress event (key being hold down; we don't need that event) */
|
960
|
-
keyPress: function(e) {
|
961
|
-
var _this = EVENT;
|
962
|
-
if (_this.activeControl && _this.focusOptions[_this.activeControl.elemId].keyDown === true) {
|
963
|
-
Event.stop(e);
|
964
|
-
}
|
965
|
-
},
|
966
|
-
|
967
|
-
|
968
|
-
/** Mid-level mouse scroll wheel event manager.
|
969
|
-
* Delegates mouseWheel calls to the high-level event receivers of all
|
970
|
-
* controls registered for that event.
|
971
|
-
**/
|
972
|
-
mouseWheel: function(e) {
|
973
|
-
var _this = EVENT,
|
974
|
-
_delta = 0,
|
975
|
-
i = 0;
|
976
|
-
if (!e) {
|
977
|
-
e = window.event;
|
978
|
-
}
|
979
|
-
if (e.wheelDelta) {
|
980
|
-
_delta = 0 - (e.wheelDelta / 120);
|
981
|
-
}
|
982
|
-
else if (e.detail) {
|
983
|
-
_delta = 0 - (e.detail / 3);
|
984
|
-
}
|
985
|
-
if (BROWSER_TYPE.opera || BROWSER_TYPE.safari) {
|
986
|
-
_delta = 0 - _delta;
|
987
|
-
}
|
988
|
-
for (; i !== _this.focused.length; i++) {
|
989
|
-
if (_this.focused[i] === true) {
|
990
|
-
if (_this.focusOptions[i].mouseWheel === true) {
|
991
|
-
Event.stop(e);
|
992
|
-
_this.focusOptions[i].ctrl.mouseWheel(_delta);
|
993
|
-
}
|
994
|
-
}
|
995
|
-
}
|
996
|
-
},
|
997
|
-
|
998
|
-
/* Alternative right button detection, wrapper for the mouseDown method */
|
999
|
-
contextMenu: function(e) {
|
1000
|
-
EVENT.mouseDown(e, false);
|
1001
|
-
Event.stop(e);
|
1002
|
-
},
|
1003
|
-
|
1004
|
-
/* Handle the event modifiers. */
|
1005
|
-
_modifiers: function(e) {
|
1006
|
-
var _this = EVENT;
|
1007
|
-
_this.status[_this.altKeyDown] = e.altKey;
|
1008
|
-
_this.status[_this.ctrlKeyDown] = e.ctrlKey;
|
1009
|
-
_this.status[_this.shiftKeyDown] = e.shiftKey;
|
1010
|
-
}
|
1011
|
-
|
1012
|
-
};
|
1013
|
-
|
1014
|
-
/** Starts the only instance
|
1015
|
-
*/
|
1016
|
-
LOAD(
|
1017
|
-
function() {
|
1018
|
-
EVENT.start();
|
1019
|
-
}
|
1020
|
-
);
|
1021
|
-
|