rsence-pre 2.2.0.38 → 2.2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/INSTALL.rdoc +1 -1
  2. data/VERSION +1 -1
  3. data/conf/default_conf.yaml +0 -4
  4. data/conf/rsence_command_strings.yaml +1 -1
  5. data/js/comm/queue/queue.js +17 -8
  6. data/js/comm/transporter/transporter.js +117 -93
  7. data/js/comm/values/values.js +2 -2
  8. data/js/controls/button/themes/bright/button_parts1.png +0 -0
  9. data/js/controls/button/themes/default/button_parts1.png +0 -0
  10. data/js/controls/checkbox/themes/default/checkbox_parts1.png +0 -0
  11. data/js/controls/dialogs/sheet/sheet.js +1 -1
  12. data/js/controls/dialogs/sheet/themes/default/sheet_bg.png +0 -0
  13. data/js/controls/dialogs/sheet/themes/default/sheet_dim.png +0 -0
  14. data/js/controls/dialogs/sheet/themes/default/sheet_parts1.png +0 -0
  15. data/js/controls/dialogs/sheet/themes/default/sheet_parts2.png +0 -0
  16. data/js/controls/dialogs/sheet/themes/default/sheet_warning.png +0 -0
  17. data/js/controls/radiobutton/themes/default/radiobutton_parts1.png +0 -0
  18. data/js/controls/searchfield/themes/default/searchfield.css +3 -3
  19. data/js/controls/searchfield/themes/default/searchfield_parts1.png +0 -0
  20. data/js/controls/sliders/slider/themes/default/hslider_tracks.png +0 -0
  21. data/js/controls/sliders/slider/themes/default/slider_thumbs.png +0 -0
  22. data/js/controls/sliders/vslider/themes/default/vslider_tracks.png +0 -0
  23. data/js/controls/tab/tab.js +4 -3
  24. data/js/controls/tab/themes/bright/tab_bg_color.png +0 -0
  25. data/js/controls/tab/themes/bright/tab_border_pattern.png +0 -0
  26. data/js/controls/tab/themes/bright/tab_parts1.png +0 -0
  27. data/js/controls/tab/themes/default/tab_bg_color.png +0 -0
  28. data/js/controls/tab/themes/default/tab_border_pattern.png +0 -0
  29. data/js/controls/tab/themes/default/tab_parts1.png +0 -0
  30. data/js/controls/textcontrol/textcontrol.js +3 -1
  31. data/js/controls/textcontrol/themes/default/textcontrol.css +1 -1
  32. data/js/controls/textcontrol/themes/default/textcontrol_parts1.png +0 -0
  33. data/js/controls/textcontrol/themes/default/textcontrol_parts2.png +0 -0
  34. data/js/controls/textcontrol/themes/default/textcontrol_parts3.png +0 -0
  35. data/js/controls/validatorview/themes/default/validator.png +0 -0
  36. data/js/controls/window/themes/default/window.css +66 -54
  37. data/js/controls/window/themes/default/window.html +6 -2
  38. data/js/controls/window/themes/default/window_bg_active.png +0 -0
  39. data/js/controls/window/themes/default/window_bg_inactive.png +0 -0
  40. data/js/controls/window/themes/default/window_buttons.png +0 -0
  41. data/js/controls/window/themes/default/window_parts1.png +0 -0
  42. data/js/controls/window/themes/default/window_parts2.png +0 -0
  43. data/js/controls/window/window.js +167 -40
  44. data/js/core/class/class.js +10 -0
  45. data/js/core/elem/elem.coffee +54 -27
  46. data/js/core/event/event.js +2 -2
  47. data/js/datetime/calendar/calendar.coffee +24 -8
  48. data/js/datetime/calendar/themes/default/calendar.html +2 -2
  49. data/js/datetime/calendar/themes/default/calendar_arrows.png +0 -0
  50. data/js/datetime/calendar/themes/default/calendar_bg.png +0 -0
  51. data/js/datetime/calendar/themes/default/calendar_parts1.png +0 -0
  52. data/js/datetime/calendar/themes/default/calendar_parts2.png +0 -0
  53. data/js/datetime/timesheet_item/themes/default/timesheet_item_icons.png +0 -0
  54. data/js/datetime/timesheet_item/timesheet_item.js +1 -1
  55. data/js/foundation/application/application.js +28 -7
  56. data/js/foundation/control/eventresponder/eventresponder.js +7 -4
  57. data/js/foundation/eventmanager/eventmanager.js +28 -3
  58. data/js/foundation/geom/rect/rect.js +83 -46
  59. data/js/foundation/json_renderer/json_renderer.js +5 -5
  60. data/js/foundation/thememanager/thememanager.js +3 -0
  61. data/js/foundation/view/markupview/markupview.js +13 -13
  62. data/js/foundation/view/view.js +209 -56
  63. data/js/lists/propertylist/propertylist.js +33 -31
  64. data/js/menus/minimenu/minimenu.js +23 -6
  65. data/js/menus/minimenu/themes/default/minimenu.png +0 -0
  66. data/js/menus/minimenuitem/minimenuitem.js +11 -1
  67. data/js/menus/minimenuitem/themes/default/minimenuitem_checkmark.png +0 -0
  68. data/js/menus/popupmenu/themes/default/popupmenu.png +0 -0
  69. data/js/util/reloadapp/themes/default/reloadapp_warning.png +0 -0
  70. data/lib/rsence/argv/startup_argv.rb +1 -1
  71. data/lib/rsence/daemon.rb +2 -2
  72. data/lib/rsence/default_config.rb +2 -2
  73. data/lib/rsence/http/broker.rb +2 -4
  74. data/lib/rsence/msg.rb +1 -0
  75. data/lib/rsence/plugins/plugin.rb +11 -4
  76. data/lib/rsence/sessionmanager.rb +99 -37
  77. data/lib/rsence/sessionstorage.rb +29 -15
  78. data/lib/rsence/transporter.rb +3 -5
  79. data/plugins/client_pkg/client_pkg.rb +7 -8
  80. data/plugins/client_pkg/lib/client_pkg_build.rb +212 -95
  81. data/plugins/client_pkg/lib/client_pkg_cache.rb +1 -1
  82. data/plugins/main/main.rb +5 -1
  83. data/plugins/ticket/ticket.rb +9 -1
  84. metadata +72 -66
@@ -19,7 +19,7 @@ BROWSER_TYPE =
19
19
  firefox: false
20
20
  firefox2: false
21
21
  firefox3: false
22
- firefox4: false
22
+ firefox4: false # version 4 or newer
23
23
 
24
24
  ###
25
25
  The DOM Element abstraction engine
@@ -260,8 +260,10 @@ ELEM = HClass.extend
260
260
  Sets the opcity of the element as a number equaling or between 0 and 1
261
261
  ###
262
262
  setOpacity: (_id, _opacity)->
263
- @_elements[_id].style.setProperty('opacity', _opacity, '')
264
- @_setOpacityIE( _id, _opacity) if BROWSER_TYPE.ie6 or BROWSER_TYPE.ie7 or BROWSER_TYPE.ie8
263
+ if BROWSER_TYPE.ie6 or BROWSER_TYPE.ie7 or BROWSER_TYPE.ie8
264
+ @_setOpacityIE( _id, _opacity)
265
+ else
266
+ @_elements[_id].style.setProperty('opacity', _opacity.toString(), '')
265
267
  null
266
268
 
267
269
  ###
@@ -449,7 +451,7 @@ ELEM = HClass.extend
449
451
  for i in [ 1.._loopMaxL ]
450
452
  _key = _currTodo.shift()
451
453
  _val = _attrCache[_key]
452
- _elem.setAttribute( _key, _val )
454
+ _elem[_key] = _val
453
455
  null
454
456
 
455
457
  ###
@@ -457,27 +459,31 @@ ELEM = HClass.extend
457
459
  ###
458
460
  _getAttrDirect: (_id, _key)->
459
461
  _elem = @_elements[_id]
460
- _elem.getAttribute( _key )
462
+ _attr = _elem[_key]
463
+ return _attr if _attr? and _attr != null
464
+ return _elem.getAttribute(_key)
461
465
 
462
466
  ###
463
467
  Gets a named element attribute from the cache or selectively direct
464
468
  ###
465
469
  getAttr: (_id, _key, _noCache)->
466
- if _noCache
470
+ return null unless @_attrCache[_id]?
471
+ _key = 'className' if _key == 'class'
472
+ _val = @_attrCache[_id][_key]
473
+ if _noCache or not _val?
467
474
  _val = @_getAttrDirect( _id, _key )
468
- else
469
- _val = @_attrCache[_id][_key]
470
- @_attrCache[_id][_key] = _val
475
+ @_attrCache[_id][_key] = _val
471
476
  _val
472
477
 
473
478
  ###
474
479
  Sets a named element attribute into the cache and buffer or selectively direct
475
480
  ###
476
481
  setAttr: (_id, _key, _value, _noCache)->
482
+ return null unless @_elements[_id]? # item is deleted
477
483
  _attrTodo = @_attrTodo[_id]
478
484
  _attrCache = @_attrCache[_id]
479
- @_elements[_id].setAttribute( _key, _value ) if _noCache
480
- _reCache = _value != @getAttr( _id, _key )
485
+ @_elements[_id][_key] = _value if _noCache
486
+ _reCache = ( _value != @getAttr( _id, _key ) )
481
487
  if _reCache or _noCache
482
488
  _attrCache[_key] = _value
483
489
  unless _noCache
@@ -486,25 +492,27 @@ ELEM = HClass.extend
486
492
  @_elemTodo.push( _id )
487
493
  @_elemTodoH[ _id ] = true
488
494
  @_checkNeedFlush()
489
- null
495
+ true
490
496
 
491
497
  ###
492
498
  Deletes a named element attribute
493
499
  ###
494
500
  delAttr: (_id, _key)->
495
- _attrTodo = @_attrtodo[_id]
501
+ return null unless @_elements[_id]? # item is deleted
502
+ _attrTodo = @_attrTodo[_id]
496
503
  _attrCache = @_attrCache[_id]
497
504
  delete _attrCache[_key]
498
505
  @_elements[_id].removeAttribute( _key )
499
506
  _todoIndex = _attrTodo.indexOf( _key )
500
507
  _attrTodo.splice( _todoIndex, 1 ) unless _todoIndex == -1
501
508
  @_checkNeedFlush()
502
- null
509
+ true
503
510
 
504
511
  ###
505
512
  Checks if the element has a named CSS className
506
513
  ###
507
514
  hasClassName: (_id, _className)->
515
+ return null unless @_elements[_id]? # item is deleted
508
516
  _classNames = @_elements[_id].className.split(' ')
509
517
  return _classNames.indexOf( _className ) != -1
510
518
 
@@ -512,6 +520,7 @@ ELEM = HClass.extend
512
520
  Adds a named CSS className to the element
513
521
  ###
514
522
  addClassName: (_id, _className)->
523
+ return null unless @_elements[_id]? # item is deleted
515
524
  unless @hasClassName( _id, _className )
516
525
  _elem = @_elements[_id]
517
526
  if _elem.className.trim() == ''
@@ -525,7 +534,8 @@ ELEM = HClass.extend
525
534
  ###
526
535
  Removes a named CSS className of the element
527
536
  ###
528
- removeClassName: (_id, _className)->
537
+ delClassName: (_id, _className)->
538
+ return null unless @_elements[_id]? # item is deleted
529
539
  if @hasClassName( _id, _className )
530
540
  _elem = @_elements[_id]
531
541
  _classNames = _elem.className.split(' ')
@@ -533,6 +543,10 @@ ELEM = HClass.extend
533
543
  _elem.className = _classNames.join(' ')
534
544
  null
535
545
 
546
+ removeClassName: (_id, _className)->
547
+ console.log( 'ELEM.removeClassName is deprecated. Use ELEM.delClassName instead.' )
548
+ return @delClassName( _id, _className )
549
+
536
550
  ###
537
551
  Checks if buffers need to be flushed
538
552
  ###
@@ -571,7 +585,10 @@ ELEM = HClass.extend
571
585
  IE version of _setElementStyle
572
586
  ###
573
587
  _setElementStyleIE: (_elem, _key, _value)->
574
- _elem.style[@_camelize(_key)] = _value
588
+ try
589
+ _elem.style[@_camelize(_key)] = _value
590
+ catch e
591
+ console.log('ie setstyle error:'+_key+', '+_value+', '+e)
575
592
  if BROWSER_TYPE.ie6
576
593
  unless iefix._traverseStyleProperties.indexOf(_key) == -1
577
594
  @_ieFixesNeeded = true
@@ -581,9 +598,10 @@ ELEM = HClass.extend
581
598
  Sets and buffers the named style attribute value or selectively direct
582
599
  ###
583
600
  setStyle: (_id, _key, _value, _noCache)->
601
+ return null unless @_elements[_id]? # item is deleted
584
602
  if _id == undefined
585
603
  console.log('ERROR; undefined id in ELEM#setStyle(',_id, _key, _value, _noCache,')')
586
- _noCache = true if BROWSER_TYPE.ie9
604
+ # _noCache = true if BROWSER_TYPE.ie9
587
605
  try
588
606
  _cached = @_styleCache[_id]
589
607
  catch e
@@ -633,9 +651,9 @@ ELEM = HClass.extend
633
651
  ###
634
652
  windowSize: ->
635
653
  _size = [ window.innerWidth, window.innerHeight ]
636
- unless _size[0] or _size[1]
654
+ if _size[0] == undefined or _size[1] == undefined
637
655
  _docElem = document.documentElement
638
- _size = [ _docElem.clientWidth, _docElem.clientHeigh ]
656
+ _size = [ _docElem.clientWidth, _docElem.clientHeight ]
639
657
  _size
640
658
 
641
659
  ###
@@ -650,12 +668,16 @@ ELEM = HClass.extend
650
668
  _getComputedStyleIE: (_elem, _key)->
651
669
  return _elem.clientWidth if _key == 'width'
652
670
  return _elem.clientHeight if _key == 'height'
653
- _elem.currentStyle[@_camelize(_key)]
654
-
671
+ if _elem.currentStyle?
672
+ return _elem.currentStyle[@_camelize(_key)]
673
+ else
674
+ return _elem.style[@_camelize(_key)]
675
+
655
676
  ###
656
677
  Gets the named element style attribute value.
657
678
  ###
658
679
  getStyle: (_id, _key, _noCache)->
680
+ return null unless @_styleCache[_id]?
659
681
  _cached = @_styleCache[_id]
660
682
  _key = @_deCamelize(_key)
661
683
  if _cached[_key] == undefined or _noCache
@@ -750,13 +772,14 @@ ELEM = HClass.extend
750
772
  _browserType.ie8 = _ua.indexOf('MSIE 8') != -1
751
773
  _browserType.ie9 = _ua.indexOf('MSIE 9') != -1
752
774
  _browserType.ie10 = _ua.indexOf('MSIE 10') != -1
753
- _browserType.ie9 = _browserType.ie10 # IE 10 is treated like IE 9
775
+ unless _browserType.ie9
776
+ _browserType.ie9 = _browserType.ie10 # IE 10 is treated like IE 9
754
777
  _browserType.mac = _ua.indexOf('Macintosh') != -1
755
778
  _browserType.win = _ua.indexOf('Windows') != -1
756
779
  _browserType.firefox = _ua.indexOf('Firefox') != -1
757
780
  _browserType.firefox2 = _ua.indexOf('Firefox/2.') != -1
758
781
  _browserType.firefox3 = _ua.indexOf('Firefox/3.') != -1
759
- _browserType.firefox4 = _ua.indexOf('Firefox/4.') != -1
782
+ _browserType.firefox4 = _browserType.firefox and not _browserType.firefox2 and not _browserType.firefox3
760
783
  @_domWaiter()
761
784
  null
762
785
 
@@ -775,13 +798,17 @@ ELEM = HClass.extend
775
798
  ###
776
799
  _domWaiter: ->
777
800
  if BROWSER_TYPE.ie6 or BROWSER_TYPE.ie7 or BROWSER_TYPE.ie8
778
- if location.protocol = 'https:'
801
+ if location.protocol == 'https:'
779
802
  _ie_proto = 'src=//0'
780
803
  else
781
804
  _ie_proto = 'javascript:void(0)'
782
- document.write('<scr'+'ipt id=__ie_onload defer src='+ _ie_proto +'></scr'+'ipt>')
783
- document.getElementById('__ie_onload').onreadystatechange ->
784
- if ELEM.readyState == 'complete'
805
+ _s1 = '<scr'
806
+ _s2 = 'ipt id=__ie_onload defer src='
807
+ _s3 = '></scr'
808
+ _s4 = 'ipt>'
809
+ document.write(_s1+_s2+_ie_proto+_s3+_s4)
810
+ document.getElementById('__ie_onload').onreadystatechange = ->
811
+ if this.readyState == 'complete'
785
812
  clearTimeout( ELEM._domLoadTimer )
786
813
  ELEM._domLoadStatus = true
787
814
  ELEM._init()
@@ -92,7 +92,7 @@ Event = {
92
92
  Event.observers = false;
93
93
  },
94
94
 
95
- /** Starts observing the named event of the element and
95
+ /** Starts observing the named event of the element and
96
96
  * specifies a callback function.
97
97
  **/
98
98
  observe: function(_elem, _name, _function, _useCapture) {
@@ -145,7 +145,7 @@ Event = {
145
145
 
146
146
  };
147
147
 
148
- // Activates the garbage collector of Internet Explorer
148
+ // Activates the garbage collector of Internet Explorer
149
149
  // when the document is unloaded:
150
150
  if (BROWSER_TYPE.ie && !BROWSER_TYPE.ie9) {
151
151
  Event.observe(window, "unload", Event.unloadCache, false);
@@ -11,15 +11,16 @@
11
11
  ## and weeks as rows. Its value is a date/time number specified in seconds
12
12
  ## since or before epoch (1970-01-01 00:00:00 UTC).
13
13
  ####
14
- HCalendar = HControl.extend(
14
+ HCalendar = HControl.extend
15
15
 
16
16
  componentName: 'calendar'
17
+ markupElemNames: [ 'control', 'state', 'label', 'value', 'prevMonth', 'nextMonth' ]
17
18
 
18
19
  ## Disable the mouseWheel event to prevent prev/next -month switching with
19
20
  ## the mouse wheel or equivalent content-scrolling user interface gesture
20
21
  defaultEvents:
21
22
  mouseWheel: true
22
- click: true
23
+ # click: true
23
24
 
24
25
  ## Calls HCalendar#nextMonth or HCalendar#prevMonth based on delta change
25
26
  ## of the mouseWheel event
@@ -33,6 +34,15 @@ HCalendar = HControl.extend(
33
34
  click: ->
34
35
  false
35
36
 
37
+ drawSubviews: ->
38
+ _this = @
39
+ Event.observe( @elemOfPart( 'prevMonth' ), 'click', ->
40
+ _this.prevMonth()
41
+ )
42
+ Event.observe( @elemOfPart( 'nextMonth' ), 'click', ->
43
+ _this.nextMonth()
44
+ )
45
+
36
46
  ## Returns an array of week day names starting with the short name of the word "week".
37
47
  ## The default locale returns: ['Wk','Mon','Tue','Wed','Thu','Fri','Sat','Sun']
38
48
  ## See HLocale for more details
@@ -244,6 +254,7 @@ HCalendar = HControl.extend(
244
254
  _parentElem = @markupElemIds.value
245
255
  ELEM.setStyle( _parentElem, 'visibility', 'hidden', true )
246
256
  _elems = []
257
+ _this = @
247
258
  for _row in [0..5]
248
259
  _weekElem = ELEM.make( _parentElem )
249
260
  _elems.push( _weekElem )
@@ -276,7 +287,11 @@ HCalendar = HControl.extend(
276
287
  ELEM.addClassName( _colElem, 'calendar_weeks_week_col_no' )
277
288
  else
278
289
  ELEM.addClassName( _colElem, 'calendar_weeks_week_col_yes' )
279
- ELEM.setAttr( _colElem, 'href', "javascript:HSystem.views[#{@viewId}].setValue(#{_colSecs})" )
290
+ ELEM.setAttr( _colElem, '_colSecs', _colSecs )
291
+ Event.observe( ELEM.get( _colElem ), 'click', ->
292
+ _this.setValue( @_colSecs )
293
+ )
294
+ # ELEM.setAttr( _colElem, 'href', "javascript:HSystem.views[#{@viewId}].setValue(#{_colSecs})" )
280
295
  _left = (_col*_colWidth+_leftPlus)
281
296
  ELEM.setStyle( _colElem, 'left', _left+'px' )
282
297
  ELEM.setStyle( _colElem, 'width', (_colWidth-1)+'px' )
@@ -286,22 +301,23 @@ HCalendar = HControl.extend(
286
301
  ELEM.setStyle( _parentElem, 'visibility', 'inherit' )
287
302
  _stateElem = @markupElemIds.state
288
303
 
289
- @_monthMenu = ELEM.make( _stateElem, 'a' )
304
+ @_monthMenu = ELEM.make( _stateElem, 'span' )#, 'a' )
290
305
  _elems.push( @_monthMenu )
291
- ELEM.setAttr( @_monthMenu, 'href', "javascript:HSystem.views[#{@viewId}].monthMenu()" )
306
+ # ELEM.setAttr( @_monthMenu, 'href', "javascript:HSystem.views[#{@viewId}].monthMenu()" )
307
+ Event.observe( ELEM.get( @_monthMenu ), 'click', ( -> _this.monthMenu() ), false )
292
308
  ELEM.setHTML( @_monthMenu, @monthName( _date ) )
293
309
 
294
310
  _spacer = ELEM.make( _stateElem, 'span' )
295
311
  _elems.push( _spacer )
296
312
  ELEM.setHTML( _spacer, '&nbsp;' )
297
313
 
298
- @_yearMenu = ELEM.make( _stateElem, 'a' )
314
+ @_yearMenu = ELEM.make( _stateElem, 'span' )#, 'a' )
299
315
  _elems.push( @_yearMenu )
300
- ELEM.setAttr( @_yearMenu, 'href', "javascript:HSystem.views[#{@viewId}].yearMenu()" )
316
+ Event.observe( ELEM.get( @_yearMenu ), 'click', ( -> _this.yearMenu() ), false )
317
+ # ELEM.setAttr( @_yearMenu, 'href', "javascript:HSystem.views[#{@viewId}].yearMenu()" )
301
318
  ELEM.setHTML( @_yearMenu, @year( _date ) )
302
319
 
303
320
  @viewMonth = [ _monthFirst.getUTCFullYear(), _monthFirst.getUTCMonth() ]
304
321
  @_drawCalendarElems = _elems
305
- )
306
322
 
307
323
  HCalendar.implement( HDateTime )
@@ -11,9 +11,9 @@
11
11
  </div>
12
12
  <div class="calendar_control" id="control#{_ID}">
13
13
  <div class="calendar_head">
14
- <div class="calendar_head_prev_month" onclick="HSystem.views[#{this.viewId}].prevMonth();"></div>
14
+ <div class="calendar_head_prev_month" id="prevMonth#{_ID}"></div>
15
15
  <div class="calender_head_month_year" id="state#{_ID}"></div>
16
- <div class="calendar_head_next_month" onclick="HSystem.views[#{this.viewId}].nextMonth();"></div>
16
+ <div class="calendar_head_next_month" id="nextMonth#{_ID}"></div>
17
17
  </div>
18
18
  <div class="calendar_weekdays" id="label#{_ID}"></div>
19
19
  <div class="calendar_weeks" id="value#{_ID}"></div>
@@ -73,7 +73,7 @@ HTimeSheetItem = HControl.extend({
73
73
  ELEM.addClassName( this.elemId, 'locked' );
74
74
  }
75
75
  else {
76
- ELEM.removeClassName( this.elemId, 'locked' );
76
+ ELEM.delClassName( this.elemId, 'locked' );
77
77
  }
78
78
  this.refreshState();
79
79
  this.clearAllIcons();
@@ -94,7 +94,7 @@ HApplication = HClass.extend({
94
94
  /** = Description
95
95
  * Adds a view to the app, +HView+ defines an indentical structure for subviews.
96
96
  *
97
- * Called from inside the +HView+ constructor and should be automatic for all
97
+ * Called from inside the +HView+ constructor and should be automatic for all
98
98
  * components that accept the +_parent+ parameter, usually the second argument,
99
99
  * after the +HRect+ instance.
100
100
  *
@@ -192,17 +192,36 @@ HApplication = HClass.extend({
192
192
  }
193
193
  },
194
194
 
195
+ renice: function(_priority){
196
+ HSystem.reniceApp(this.appId,_priority);
197
+ },
195
198
 
196
199
  /* Calls the idle method of each view. Don't extend this method. */
197
200
  _pollViews: function(){
198
- var i, _viewId, _view;
199
- for(i=0;i<this.views.length;i++){
200
- _viewId = this.views[i];
201
+ this._pollViewsRecurse( this.views );
202
+ },
203
+ _pollViewsRecurse: function( _views ){
204
+ var i = 0, _viewId, _view, _pollViews = [];
205
+ for( ; i < _views.length;i++){
206
+ _viewId = _views[i];
201
207
  _view = HSystem.views[_viewId];
202
- if((_view!==null)&&(_view['onIdle']!==undefined)){
203
- _view.onIdle();
208
+ if( _view !== undefined && _view !== null && typeof _view === 'object' ){
209
+ if( _view['idle'] !== undefined && typeof _view['idle'] === 'function' ){
210
+ _view.idle();
211
+ }
212
+ if( _view['onIdle'] !== undefined && typeof _view['onIdle'] === 'function' ){
213
+ _view.onIdle();
214
+ }
215
+ if( _view['hasAncestor'] !== undefined && typeof _view.hasAncestor === 'function' && _view.hasAncestor( HView ) ) {
216
+ if( _view.views && _view.views instanceof Array ){
217
+ _pollViews.push( _view.views );
218
+ }
219
+ }
204
220
  }
205
221
  }
222
+ while( _pollViews.length > 0 ){
223
+ this._pollViewsRecurse( _pollViews.shift() );
224
+ }
206
225
  },
207
226
 
208
227
  /** Gets called by +HSystem+. It makes +onIdle+ extensions more failure
@@ -213,6 +232,7 @@ HApplication = HClass.extend({
213
232
  HSystem.busyApps[ _this.appId ] = true;
214
233
  this._busyTimer = setTimeout(
215
234
  function(){
235
+ _this.idle();
216
236
  _this.onIdle();
217
237
  _this._pollViews();
218
238
  HSystem.busyApps[ _this.appId ] = false;
@@ -231,6 +251,7 @@ HApplication = HClass.extend({
231
251
  **/
232
252
  onIdle: function(){
233
253
  /* Your code here */
234
- }
254
+ },
255
+ idle: function(){}
235
256
  });
236
257
  HApplication.implement(HValueResponder.nu());
@@ -503,15 +503,18 @@ HEventResponder = HClass.extend({
503
503
  *
504
504
  **/
505
505
  lostActiveStatus: function(_newActiveControl) {
506
-
506
+ return true;
507
507
  },
508
508
 
509
509
  // --A low-level handler for lost active status, don't extend this.++
510
510
  _lostActiveStatus: function(_newActiveControl) {
511
- if(this.enabled) {
512
- this.toggleCSSClass(this.elemId, HControl.CSS_ACTIVE, false);
511
+ if( this.lostActiveStatus(_newActiveControl) !== false ){
512
+ if(this.enabled) {
513
+ this.toggleCSSClass(this.elemId, HControl.CSS_ACTIVE, false);
514
+ }
515
+ return true;
513
516
  }
514
- this.lostActiveStatus(_newActiveControl);
517
+ return false;
515
518
  },
516
519
 
517
520
 
@@ -275,7 +275,9 @@ EVENT = {
275
275
  }
276
276
  if(_ctrl.drawn){
277
277
  _this._updateHoverItems();
278
- (_this.hovered.length !== 0) && (_this.hovered.indexOf(_ctrl.elemId) === _this.hovered.length-1) && _this.focus(_ctrl);
278
+ if (_this.hovered.length !== 0 && _this.hovered.indexOf(_ctrl.elemId) === _this.hovered.length-1){
279
+ _this.focus(_ctrl);
280
+ }
279
281
  }
280
282
  },
281
283
 
@@ -581,6 +583,7 @@ EVENT = {
581
583
  *
582
584
  **/
583
585
  startDragging: function(_ctrl, _isLeftButton) {
586
+ // console.log('startDragging');
584
587
  var _this = EVENT;
585
588
  _this.dragItems = [_ctrl.elemId];
586
589
  _this.focus(_ctrl);
@@ -597,6 +600,7 @@ EVENT = {
597
600
  *
598
601
  **/
599
602
  mouseDown: function(e, _isLeftButton) {
603
+ // console.log('mouseDown');
600
604
  var
601
605
  _this = EVENT,
602
606
  _didStartDrag = false,
@@ -685,6 +689,13 @@ EVENT = {
685
689
  *
686
690
  **/
687
691
  click: function(e, _isLeftButton) {
692
+ // if( new Date().getTime() - EVENT.lastMouseUp < 10 ){
693
+ // console.log('should prevent click?');
694
+ // // return false; // prevent click and mousedown coexistence
695
+ // }
696
+ // else{
697
+ // console.log('click');
698
+ // }
688
699
  var _this = EVENT,
689
700
  x = _this.status[_this.crsrX],
690
701
  y = _this.status[_this.crsrY],
@@ -722,6 +733,7 @@ EVENT = {
722
733
  }
723
734
  // Handle the active control selection.
724
735
  if (_newActiveControl) {
736
+ // console.log('click new active control');
725
737
  _this.changeActiveControl(_newActiveControl);
726
738
  }
727
739
  var _stopEvent = _clickElementIds.length;
@@ -746,6 +758,7 @@ EVENT = {
746
758
  changeActiveControl: function(_ctrl) {
747
759
  var
748
760
  _this = EVENT,
761
+ _disAllowLose = true,
749
762
  // Store the currently active control so we can inform it,
750
763
  // if it's no longer the active control.
751
764
  _prevActiveCtrl = _this.activeControl;
@@ -754,11 +767,20 @@ EVENT = {
754
767
  if (_prevActiveCtrl && _prevActiveCtrl._lostActiveStatus) {
755
768
  // Previously active control just lost the active status.
756
769
  if( _prevActiveCtrl ){
770
+ _disAllowLose = _prevActiveCtrl._lostActiveStatus(_ctrl) === false;
771
+ if( _disAllowLose ){
772
+ // console.log('disallow losing focus: ',_prevActiveCtrl.componentName,' -> ',_ctrl.componentName);
773
+ return;
774
+ }
775
+ // else{
776
+ // console.log('allow losing focus: ',_prevActiveCtrl.componentName,' -> ',_ctrl.componentName);
777
+ // }
757
778
  _prevActiveCtrl.active = false;
758
- _prevActiveCtrl._lostActiveStatus(_ctrl);
759
779
  if(_this.focusTrace){
760
780
  _prevActiveCtrl.setStyle('border','2px solid green');
761
- _this.prevActiveCtrl && _this.prevActiveCtrl.setStyle('border','2px solid blue');
781
+ if( _this.prevActiveCtrl ){
782
+ _this.prevActiveCtrl.setStyle('border','2px solid blue');
783
+ }
762
784
  }
763
785
  }
764
786
  _this.prevActiveCtrl = _prevActiveCtrl;
@@ -789,7 +811,10 @@ EVENT = {
789
811
  * - endDrag
790
812
  *
791
813
  **/
814
+ // lastMouseUp: 0,
792
815
  mouseUp: function(e) {
816
+ // console.log('mouseUp',EVENT.dragItems.length);
817
+ // EVENT.lastMouseUp = new Date().getTime();
793
818
  var
794
819
  _this = EVENT,
795
820
  _didEndDrag = false,