rsence-pre 3.0.0.8 → 3.0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/client/conf/client_pkg.yaml +6 -2
  4. data/client/js/comm/queue/queue.js +32 -44
  5. data/client/js/comm/transporter/transporter.js +24 -16
  6. data/client/js/comm/values/values.js +27 -15
  7. data/client/js/controls/button/button.coffee +14 -5
  8. data/client/js/controls/button/themes/default/button.css +4 -2
  9. data/client/js/controls/checkbox/checkbox.js +4 -4
  10. data/client/js/controls/dialogs/sheet/sheet.js +11 -11
  11. data/client/js/controls/dialogs/sheet/themes/default/sheet.html +1 -1
  12. data/client/js/controls/imageview/imageview.js +15 -15
  13. data/client/js/controls/numerictextcontrol/numerictextcontrol.coffee +32 -10
  14. data/client/js/controls/onoffbutton/onoffbutton.coffee +5 -5
  15. data/client/js/controls/progress/progressbar/progressbar.js +6 -7
  16. data/client/js/controls/progress/progressbar/themes/default/progressbar.css +4 -4
  17. data/client/js/controls/progress/progressbar/themes/default/progressbar.html +1 -2
  18. data/client/js/controls/sliders/slider/slider.js +74 -79
  19. data/client/js/controls/stepper/stepper.js +31 -31
  20. data/client/js/controls/stringview/stringview.js +20 -8
  21. data/client/js/controls/tab/tab.js +57 -63
  22. data/client/js/controls/tab/themes/default/tab.html +4 -1
  23. data/client/js/controls/textcontrol/textcontrol.coffee +13 -3
  24. data/client/js/controls/validatorview/validatorview.js +4 -4
  25. data/client/js/controls/window/window.js +43 -56
  26. data/client/js/core/class/class.js +25 -23
  27. data/client/js/core/elem/elem.coffee +8 -1
  28. data/client/js/core/rsence_ns/rsence_ns.coffee +6 -2
  29. data/client/js/core/util/util_methods/util_methods.coffee +57 -15
  30. data/client/js/datetime/calendar/calendar.coffee +196 -199
  31. data/client/js/datetime/calendar/themes/default/calendar.css +81 -159
  32. data/client/js/datetime/calendar/themes/default/calendar.html +9 -18
  33. data/client/js/datetime/datepicker/datepicker.coffee +18 -3
  34. data/client/js/datetime/datetimepicker/datetimepicker.coffee +6 -1
  35. data/client/js/datetime/datetimevalue/datetimevalue.coffee +194 -0
  36. data/client/js/datetime/momentjs/momentjs.js +310 -76
  37. data/client/js/datetime/timepicker/timepicker.coffee +6 -1
  38. data/client/js/datetime/timesheet/timesheet.js +59 -61
  39. data/client/js/foundation/control/control.js +45 -44
  40. data/client/js/foundation/control/controldefaults/controldefaults.js +13 -9
  41. data/client/js/foundation/control/dyncontrol/dyncontrol.js +45 -57
  42. data/client/js/foundation/control/eventresponder/eventresponder.js +97 -97
  43. data/client/js/foundation/control/valuematrix/valuematrix.js +13 -13
  44. data/client/js/foundation/eventmanager/eventmanager.coffee +50 -32
  45. data/client/js/foundation/geom/rect/rect.js +43 -32
  46. data/client/js/foundation/locale_settings/locale_settings.js +36 -25
  47. data/client/js/foundation/system/system.js +79 -67
  48. data/client/js/foundation/thememanager/thememanager.coffee +11 -1
  49. data/client/js/foundation/value/pullvalue/pullvalue.coffee +7 -0
  50. data/client/js/foundation/value/pushvalue/pushvalue.coffee +25 -0
  51. data/client/js/foundation/value/value.js +22 -15
  52. data/client/js/foundation/view/view.js +94 -55
  53. data/client/js/foundation/view/viewdefaults/viewdefaults.js +5 -1
  54. data/client/js/lists/listitems/listitems.js +26 -4
  55. data/client/js/menus/combobox/combobox.coffee +55 -0
  56. data/client/js/menus/minimenu/minimenu.js +61 -30
  57. data/client/js/menus/minimenu/themes/default/minimenu.css +1 -6
  58. data/client/js/menus/minimenu/themes/default/minimenu.html +5 -4
  59. data/client/js/menus/minimenuitem/minimenuitem.js +6 -6
  60. data/client/js/menus/popupmenu/themes/default/popupmenu.css +1 -6
  61. data/client/js/menus/popupmenu/themes/default/popupmenu.html +5 -4
  62. data/client/js/tables/table/table.coffee +109 -64
  63. data/client/js/tables/table/themes/default/table.css +4 -0
  64. data/lib/rsence/msg.rb +64 -64
  65. data/lib/rsence/plugins/plugin.rb +68 -52
  66. data/lib/rsence/session/sequel_sessionstorage.rb +5 -5
  67. data/lib/rsence/value.rb +79 -59
  68. data/plugins/client_pkg/lib/client_pkg_build.rb +5 -1
  69. data/plugins/client_pkg/lib/client_pkg_serve.rb +40 -32
  70. data/plugins/main/js/main.js +46 -28
  71. metadata +6 -8
  72. data/client/js/datetime/calendar/themes/default/calendar_arrows.png +0 -0
  73. data/client/js/datetime/calendar/themes/default/calendar_bg.png +0 -0
  74. data/client/js/datetime/calendar/themes/default/calendar_parts1.png +0 -0
  75. data/client/js/datetime/calendar/themes/default/calendar_parts2.png +0 -0
  76. data/client/js/datetime/datetimepicker/datetimepicker.js +0 -210
  77. data/client/js/datetime/datetimevalue/datetimevalue.js +0 -265
@@ -10,7 +10,7 @@
10
10
  ***/
11
11
  var//RSence.Foundation
12
12
  HSystem = {
13
-
13
+
14
14
  /** When the focus behaviour is 1, clicking on any subview brings
15
15
  * the window to front, if attached to a HWindow instance.
16
16
  * If the behaviour is 0, only direct clicks on the HWindow controls
@@ -18,44 +18,44 @@ HSystem = {
18
18
  *
19
19
  **/
20
20
  windowFocusMode: 1,
21
-
21
+
22
22
  /** Singleton class; has no constructor **/
23
23
  // constructor: null,
24
-
24
+
25
25
  /** An array of HApplication instances, index is the appId **/
26
26
  apps: [],
27
-
27
+
28
28
  /** An array (in the same order as apps): holds priority values **/
29
29
  appPriorities: [],
30
-
30
+
31
31
  /** An array (in the same order as apps): holds busy status **/
32
32
  busyApps: [],
33
-
33
+
34
34
  /** This array holds free app id:s **/
35
35
  freeAppIds: [],
36
-
36
+
37
37
  /** The default HSystem ticker interval. Unit is milliseconds. **/
38
38
  defaultInterval: 10,
39
39
 
40
40
  // The ticker interval, when window has no focus.
41
41
  _blurredInterval: 300,
42
-
42
+
43
43
  /** The default HApplication priority. Unit is "On the n:th tick: poll". **/
44
44
  defaultPriority: 20,
45
-
46
- /** The z-index of root-level +HView+ instances. All the array operations
45
+
46
+ /** The z-index of root-level +HView+ instances. All the array operations
47
47
  * are done by the inner logic of +HApplication+ and +HView+ instances.
48
48
  **/
49
49
  viewsZOrder: [],
50
-
50
+
51
51
  /** This is the internal "clock" counter. Gets updated on every tick. **/
52
52
  ticks: 0,
53
-
53
+
54
54
  /** Time in milliseconds for the timeout of a poll to finish before
55
55
  * being classified as stuck and thus forcibly terminated.
56
56
  **/
57
57
  maxAppRunTime: 5000,
58
-
58
+
59
59
  /** Calls applications, uses the prority as a prioritizer.
60
60
  **/
61
61
  scheduler: function(){
@@ -76,7 +76,7 @@ HSystem = {
76
76
  if( this.ticks % _priority === 0 ){
77
77
  // Set the app busy, the app itself should "unbusy" itself, when the idle call is done.
78
78
  // That happens in <HApplication._startIdle>
79
-
79
+
80
80
  // If the app is not busy, then make a idle call:
81
81
  if(HSystem.apps[_appId]){
82
82
  HSystem.apps[_appId]._startIdle();
@@ -85,13 +85,14 @@ HSystem = {
85
85
  }
86
86
  }
87
87
  }
88
-
88
+
89
+
89
90
  if(this._updateZIndexOfChildrenBuffer.length!==0){
90
91
  this._flushUpdateZIndexOfChilden();
91
92
  }
92
-
93
+
93
94
  },
94
-
95
+
95
96
  _updateFlexibleRects: function(){
96
97
  var
97
98
  _view,
@@ -103,21 +104,32 @@ HSystem = {
103
104
  }
104
105
  }
105
106
  },
106
-
107
+
108
+ paused: false,
109
+ pause: function(){
110
+ clearTimeout(this._tickTimeout);
111
+ this.paused = true;
112
+ },
113
+ resume: function(){
114
+ this.paused = false;
115
+ this.ticker();
116
+ },
117
+
107
118
  /** Calls the scheduler and then calls itself after a timeout to keep
108
119
  * the loop going on.
109
120
  **/
110
121
  ticker: function(){
122
+ if(this.paused){return;}
111
123
  // Increment the tick counter:
112
124
  this.ticks++;
113
125
  this.scheduler();
114
126
  this._tickTimeout = setTimeout( function(){HSystem.ticker();},this.defaultInterval);
115
127
  },
116
-
117
-
128
+
129
+
118
130
  /** = Description
119
131
  * Adds the structures needed for a new +HApplication+ instance.
120
- *
132
+ *
121
133
  * Called from inside the +HApplication+ constructor.
122
134
  * Binds an app and gives it a unique id.
123
135
  *
@@ -139,18 +151,18 @@ HSystem = {
139
151
  this.apps.push(_app);
140
152
  _appId = this.apps.length-1;
141
153
  }
142
-
154
+
143
155
  // sets self as parent
144
156
  _app.parent = this;
145
157
  _app.parents = [this];
146
-
158
+
147
159
  _app.appId = _appId;
148
-
160
+
149
161
  this.startApp(_appId, _priority);
150
-
162
+
151
163
  return _appId;
152
164
  },
153
-
165
+
154
166
  /** = Description
155
167
  * Starts polling an app instance (and its components).
156
168
  *
@@ -166,7 +178,7 @@ HSystem = {
166
178
  this.appPriorities[ _appId ] = _priority;
167
179
  this.busyApps[_appId] = false;
168
180
  },
169
-
181
+
170
182
  /** = Description
171
183
  * Stops polling an app instance (and its components).
172
184
  *
@@ -177,7 +189,7 @@ HSystem = {
177
189
  stopApp: function(_appId){
178
190
  this.busyApps[_appId] = true;
179
191
  },
180
-
192
+
181
193
  /** = Description
182
194
  * Changes the priority of the app. Calls +stopApp+ and +startApp+.
183
195
  *
@@ -189,7 +201,7 @@ HSystem = {
189
201
  reniceApp: function(_appId,_priority){
190
202
  this.appPriorities[ _appId ] = _priority;
191
203
  },
192
-
204
+
193
205
  /** = Description
194
206
  * Stops polling and deletes an app instance (and its components).
195
207
  *
@@ -227,19 +239,19 @@ HSystem = {
227
239
 
228
240
  _forceKillApp: function( _appId ){
229
241
  this.busyApps[_appId] = true;
230
-
242
+
231
243
  this.apps[ _appId ].destroyAllViews();
232
244
  this.apps[ _appId ] = null;
233
-
245
+
234
246
  this.freeAppIds.push( _appId );
235
247
  },
236
-
248
+
237
249
  /** All +HView+ instances that are defined **/
238
250
  views: [],
239
-
251
+
240
252
  /** List of free +viwes+ indexes **/
241
253
  _freeViewIds: [],
242
-
254
+
243
255
  /** = Description
244
256
  * Adds a view and assigns it an id.
245
257
  *
@@ -262,7 +274,7 @@ HSystem = {
262
274
  }
263
275
  return _newId;
264
276
  },
265
-
277
+
266
278
  /** = Description
267
279
  * Removes a view and recycles its id.
268
280
  *
@@ -274,10 +286,10 @@ HSystem = {
274
286
  this.views[_viewId] = null;
275
287
  this._freeViewIds.push(_viewId);
276
288
  },
277
-
289
+
278
290
  /** The view id of the active window. 0 means none. **/
279
291
  activeWindowId: 0,
280
-
292
+
281
293
  /** = Description
282
294
  * Focuses the window given and blurs the previous one.
283
295
  *
@@ -296,17 +308,17 @@ HSystem = {
296
308
  _viewId = _view.viewId;
297
309
  if(_views[_activeWindowId]){
298
310
  if (_views[_activeWindowId]["windowBlur"]) {
299
- _views[_activeWindowId].windowBlur();
311
+ _views[_activeWindowId].windowBlur();
300
312
  }
301
313
  }
302
314
  this.activeWindowId=_viewId;
303
315
  _view.bringToFront();
304
316
  _view.windowFocus();
305
317
  },
306
-
318
+
307
319
  /** optimization of zindex buffer, see +HView+ **/
308
320
  _updateZIndexOfChildrenBuffer: [],
309
-
321
+
310
322
  /** Updates the z-indexes of the children of the given +_viewId+. **/
311
323
  updateZIndexOfChildren: function(_viewId) {
312
324
  if(!~this._updateZIndexOfChildrenBuffer.indexOf(_viewId)){
@@ -316,78 +328,78 @@ HSystem = {
316
328
  (!~this._updateZIndexOfChildrenBuffer.indexOf(null)) && this._updateZIndexOfChildrenBuffer.push(null);
317
329
  }
318
330
  },
319
-
331
+
320
332
  /** Flushes the z-indexes. This is a fairly expensive operation,
321
333
  * thas's why the info is buffered.
322
334
  **/
323
335
  _flushUpdateZIndexOfChilden: function() {
324
-
336
+
325
337
  var
326
-
338
+
327
339
  j = 0, // buffer index
328
-
340
+
329
341
  // reference to the HSystem namespace
330
342
  _this = HSystem,
331
-
343
+
332
344
  // reference to the buffer
333
345
  _buffer = _this._updateZIndexOfChildrenBuffer,
334
-
346
+
335
347
  // the length of the buffer
336
348
  _bufLen = _buffer.length;
337
-
349
+
338
350
  // loop buffer length times to get the items
339
351
  for ( ; j < _bufLen; j++ ) {
340
-
341
-
352
+
353
+
342
354
  // get and remove view the view id from the z-index flush status buffer:
343
355
  var
344
356
  _viewId = _buffer.shift(),
345
-
357
+
346
358
  // reference to the view's z-index array or the system root-level views if _viewId is null
347
359
  _views = ((_viewId === null)?(_this.viewsZOrder):(_this.views[ _viewId ].viewsZOrder)),
348
-
360
+
349
361
  // the length of the view's z-index array
350
362
  _viewLen = _views.length,
351
-
363
+
352
364
  // reference to the setStyle method of the element manager
353
-
365
+
354
366
  // reference to HSystem.views (collection of all views, by index)
355
367
  _sysViews = _this.views,
356
-
368
+
357
369
  // assign variables for use inside the inner loop:
358
-
370
+
359
371
  // the viewId of the view to be updated
360
372
  _subViewId,
361
-
373
+
362
374
  // the view itself with the viewId above
363
375
  _view,
364
-
376
+
365
377
  // the elemId property, used as a [] -lookup in the loop
366
378
  _elemIdStr = 'elemId',
367
-
379
+
368
380
  // the css property name
369
381
  _zIdxStr = 'z-index',
370
-
382
+
371
383
  // the loop index
372
384
  i=0,
373
-
385
+
374
386
  // the element id of the view
375
387
  _elemId;
376
-
388
+
377
389
  // end of var declarations
378
-
390
+
379
391
  // loop through all subviews and update the indexes:
380
392
  for ( ; i < _viewLen; i++ ) {
381
-
393
+
382
394
  // get the viewId to be updated based on the z-index array
383
395
  _subViewId = _views[ i ];
384
-
396
+
385
397
  // reference to the view itself
386
398
  _view = _sysViews[ _subViewId ];
387
-
399
+
388
400
  // the element id of the view
389
401
  _elemId = _view[ _elemIdStr ];
390
-
402
+
391
403
  if( _elemId === undefined ){
392
404
  continue;
393
405
  }
@@ -398,7 +410,7 @@ HSystem = {
398
410
  }
399
411
  }
400
412
  };
401
-
413
+
402
414
  // });
403
415
 
404
416
  // Starts the ticking, when the document is loaded:
@@ -114,7 +114,17 @@ HThemeManager = HClass.extend
114
114
  _tmplHTML = _tmplHTML.replace( _variableMatch, _callValue( RegExp.$1 ) )
115
115
  # console.log('tmplHTML:',_tmplHTML) if _componentName == 'tab'
116
116
  return _tmplHTML
117
-
117
+ gradientStyle: ->
118
+ _colors = []
119
+ _colors.push( _color ) for _color in arguments
120
+ [_key, _value] = ELEM._linearGradientStyle(
121
+ start: _colors.shift()
122
+ end: _colors.pop()
123
+ steps: _colors
124
+ )
125
+ _style = {}
126
+ _style[_key] = _value
127
+ _style
118
128
  gradientCSS: ->
119
129
  _colors = []
120
130
  _colors.push( _color ) for _color in arguments
@@ -0,0 +1,7 @@
1
+ # Opposite of HPushValue (Server -> Client push)
2
+ HPullValue = HValue.extend
3
+ s: (_values)->
4
+ for _value in _values
5
+ @value = _value
6
+ @refresh()
7
+
@@ -0,0 +1,25 @@
1
+ # Client -> Server push value buffer.
2
+ # Works like HValue, but only streams out changes
3
+ # instead of keeping only the last state.
4
+ # The nature of the buffer is volatile, so don't rely
5
+ # on re-transmission on failures.
6
+ # Ideal for event logging purposes.
7
+ HPushValue = HValue.extend
8
+ constructor: (_id,_value)->
9
+ @buffer = [_value]
10
+ @base(_id,_value)
11
+ toSync: ->
12
+ _arr = []
13
+ _histLen = @buffer.length
14
+ for i in [0..(_histLen)]
15
+ _arr.push( @buffer.shift() )
16
+ _arr
17
+ set: (_value)->
18
+ @buffer.push(_value)
19
+ @value = _value
20
+ COMM.Values.changed(@)
21
+ @refresh()
22
+ die: ->
23
+ @buffer = null
24
+ delete @buffer
25
+ @base()
@@ -28,12 +28,12 @@
28
28
  ** +id+:: Value Id, used by the whole value management system to identify individual values.
29
29
  ** +type+:: '[HValue]'
30
30
  ** +value+:: The container/"payload" data value itself.
31
- ** +views+:: A list of Components that uses this value.
31
+ ** +views+:: A list of Components that uses this value.
32
32
  ** Used for automatic value syncronization between responders.
33
33
  ***/
34
34
  var//RSence.Foundation
35
35
  HValue = HClass.extend({
36
-
36
+
37
37
  /** = Description
38
38
  * Constructs a value with the initial value +_value+ and the unique id +_id+.
39
39
  *
@@ -42,7 +42,7 @@ HValue = HClass.extend({
42
42
  *
43
43
  * = Parameters
44
44
  * +_id+:: The source id (ideally set by server, should be unique)
45
- * +_value+:: The initial data
45
+ * +_value+:: The initial data
46
46
  *
47
47
  **/
48
48
  constructor: function(_id,_value){
@@ -53,7 +53,7 @@ HValue = HClass.extend({
53
53
  COMM.Values.add(_id,this);
54
54
  }
55
55
  },
56
-
56
+
57
57
  /** Destructor method. Releases all bindings.
58
58
  **/
59
59
  die: function(){
@@ -66,7 +66,14 @@ HValue = HClass.extend({
66
66
  COMM.Values.del(this.id);
67
67
  }
68
68
  },
69
-
69
+
70
+ /** = Description
71
+ * Interface for valuemanager, returns its to-be-sent-to-server value.
72
+ **/
73
+ toSync: function(){
74
+ return this.value;
75
+ },
76
+
70
77
  /** = Description
71
78
  * Replaces the data of the value.
72
79
  *
@@ -85,7 +92,7 @@ HValue = HClass.extend({
85
92
  this.refresh();
86
93
  }
87
94
  },
88
-
95
+
89
96
  /** Compares +_value+ with +self.value+.
90
97
  * = Returns
91
98
  * true or false, depending on the equality
@@ -93,17 +100,17 @@ HValue = HClass.extend({
93
100
  differs: function(_value){
94
101
  return (COMM.Values.encode(_value) !== COMM.Values.encode(this.value));
95
102
  },
96
-
103
+
97
104
  /** = Description
98
105
  * Setter for the server.
99
- *
106
+ *
100
107
  * Just as +self.set+, but doesn't re-notify the server about the change.
101
108
  **/
102
109
  s: function(_value){
103
110
  this.value = _value;
104
111
  this.refresh();
105
112
  },
106
-
113
+
107
114
  /** = Description
108
115
  * Return the data, returns the +self.value+ instance variable
109
116
  *
@@ -113,12 +120,12 @@ HValue = HClass.extend({
113
120
  get: function(){
114
121
  return this.value;
115
122
  },
116
-
123
+
117
124
  /** = Description
118
125
  * Bind a responder to the value, use to attach HValues to responders derived from HControl.
119
126
  *
120
127
  * = Parameters
121
- * +_responder+:: Any responder that is derived from HControl or any other
128
+ * +_responder+:: Any responder that is derived from HControl or any other
122
129
  * class instance that implements HValueResponder or has
123
130
  * compatible typing.
124
131
  **/
@@ -131,12 +138,12 @@ HValue = HClass.extend({
131
138
  _responder.setValueObj( this );
132
139
  }
133
140
  },
134
-
141
+
135
142
  /** = Description
136
143
  * Release a responder bound to the HValue instance itself.
137
144
  *
138
145
  * = Parameters
139
- * +_responder+:: Any responder that is derived from HControl or any other
146
+ * +_responder+:: Any responder that is derived from HControl or any other
140
147
  * class instance that implements HValueResponder or has
141
148
  * compatible typing.
142
149
  **/
@@ -155,7 +162,7 @@ HValue = HClass.extend({
155
162
  release: function(_responder){
156
163
  return this.unbind(_responder);
157
164
  },
158
-
165
+
159
166
  /** Calls the setValue method all responders bound to this HValue.
160
167
  **/
161
168
  refresh: function(){
@@ -170,7 +177,7 @@ HValue = HClass.extend({
170
177
  }
171
178
  }
172
179
  }
173
-
180
+
174
181
  });
175
182
 
176
183