rsence-pre 2.1.0.4.pre → 2.1.0.6.pre

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.0.4.pre
1
+ 2.1.0.6.pre
@@ -288,6 +288,9 @@
288
288
  - checkboxlist # HCheckboxList
289
289
  - radiobuttonlist # HRadiobuttonList
290
290
  - propertylist # HPropertyList
291
+ - propertylisteditor # HPropertyEditor
292
+ - minimenu # HMiniMenu
293
+ - minimenuitem # HMiniMenuItem
291
294
 
292
295
  # Special packages that include other packages (not used currently)
293
296
  :compound_packages:
@@ -841,22 +841,28 @@ EVENT = {
841
841
  **/
842
842
  keyDown: function(e) {
843
843
  var _this = EVENT,
844
- _theKeyCode = e.keyCode;
844
+ _theKeyCode = e.keyCode,
845
+ _keyDownStateForActiveControl = _this.activeControl?_this.focusOptions[_this.activeControl.elemId].keyDown:false,
846
+ _repeat = (_keyDownStateForActiveControl === 'repeat'),
847
+ _stopEvent = false;
845
848
  _this._modifiers(e);
846
849
  if(!_this.status[_this.cmdKeyDown] && _this._detectCmdKey(e.keyCode)){
847
850
  _this.status[_this.cmdKeyDown] = true;
848
851
  }
849
- if (_this.activeControl && _this.focusOptions[_this.activeControl.elemId].keyDown === true) {
850
- Event.stop(e);
851
- // Workaround for msie rapid fire keydown
852
- if (_this._lastKeyDown !== _theKeyCode) {
853
- _this.activeControl.keyDown(_theKeyCode);
852
+ if (_this.activeControl && _keyDownStateForActiveControl) {
853
+ if ((_this._lastKeyDown !== _theKeyCode) || _repeat) {
854
+ if(_this.activeControl.keyDown(_theKeyCode)){
855
+ _stopEvent = true;
856
+ }
854
857
  }
855
858
  }
856
859
  // Insert key to the realtime array, remove in keyUp
857
860
  if (_this.status[_this.keysDown].indexOf(_theKeyCode) === -1) {
858
861
  _this.status[_this.keysDown].push(_theKeyCode);
859
862
  }
863
+ if (!_this.status[_this.cmdKeyDown] && _stopEvent){
864
+ Event.stop(e);
865
+ }
860
866
  _this._lastKeyDown = _theKeyCode;
861
867
  },
862
868
 
@@ -873,20 +879,28 @@ EVENT = {
873
879
  _theKeyCode = e.keyCode,
874
880
  _keyCodeIndex,
875
881
  i = 0,
882
+ _stopEvent = false,
876
883
  _ctrlId,
877
884
  _ctrl;
878
885
  _this._modifiers(e);
879
886
  _this._lastKeyDown = null;
880
887
  if (_this.activeControl && _this.focusOptions[_this.activeControl.elemId].keyUp === true) {
881
- _this.activeControl.keyUp(_theKeyCode);
888
+ if(_this.activeControl.keyUp(_theKeyCode)){
889
+ _stopEvent = true;
890
+ }
882
891
  }
883
892
  for (; i < _this.textEnterCtrls.length; i++) {
884
893
  _ctrlId = _this.textEnterCtrls[i];
885
894
  _ctrl = HSystem.views[_ctrlId];
886
895
  if (_ctrl.textEnter) {
887
- _ctrl.textEnter();
896
+ if(_ctrl.textEnter()){
897
+ _stopEvent = true;
898
+ }
888
899
  }
889
900
  }
901
+ if (!_this.status[_this.cmdKeyDown] && _stopEvent){
902
+ Event.stop(e);
903
+ }
890
904
  if(_this.status[_this.cmdKeyDown] && _this._detectCmdKey(e.keyCode)){
891
905
  _this.status[_this.cmdKeyDown] = false;
892
906
  }
@@ -897,12 +911,10 @@ EVENT = {
897
911
  }
898
912
  },
899
913
 
900
- /* Prevents the onKeyPress event (key being hold down; we don't need that event) */
914
+ /* Using keyPress as an alias for the keyDown event */
901
915
  keyPress: function(e) {
902
916
  var _this = EVENT;
903
- if (_this.activeControl && _this.focusOptions[_this.activeControl.elemId].keyDown === true) {
904
- Event.stop(e);
905
- }
917
+ _this.keyDown(e);
906
918
  },
907
919
 
908
920
 
@@ -756,7 +756,7 @@ HView = HClass.extend({
756
756
  **/
757
757
  markupElemNames: ['bg', 'label', 'state', 'control', 'value', 'subview'],
758
758
  drawMarkup: function() {
759
- ELEM.setStyle(this.elemId, 'display', 'none', true);
759
+ // ELEM.setStyle(this.elemId, 'display', 'none', true);
760
760
 
761
761
  // continue processing from here on:
762
762
  var _markupStatus = this._loadMarkup();
@@ -774,7 +774,7 @@ HView = HClass.extend({
774
774
  }
775
775
  }
776
776
 
777
- ELEM.setStyle(this.elemId, 'display', this.displayMode );
777
+ // ELEM.setStyle(this.elemId, 'display', this.displayMode );
778
778
  return this;
779
779
  },
780
780
 
@@ -20,7 +20,7 @@
20
20
  ## be unique.
21
21
  ##
22
22
  ## == Important
23
- ** The parent object of a HListItem needs to be a compatible hash, like HRadiobuttonList.
23
+ ** The parent object of a HListItem needs to be a compatible component, like HRadioButtonList.
24
24
  ##
25
25
  ***/
26
26
  var//RSence.Lists
@@ -16,67 +16,172 @@
16
16
  ***/
17
17
  var//RSence.Lists
18
18
  HPropertyList = HControl.extend({
19
- keyColumnWidth: 100,
20
- rowHeight: 15,
21
- keyIndent: 8,
19
+
20
+ defaultEvents: {
21
+ click: true
22
+ },
23
+
24
+ controlDefaults: (HControlDefaults.extend({
25
+ keyColumnWidth: 100,
26
+ hideTypeColumn: false,
27
+ useEditor: false,
28
+ rowHeight: 15,
29
+ keyIndent: 8
30
+ })),
31
+
32
+ click: function(x,y){
33
+ if(this.options.useEditor){
34
+ var
35
+ clickY = y-this.contentView.pageY(),
36
+ itemNum = Math.floor(clickY/this.options.rowHeight);
37
+ if((clickY < 0) || (itemNum > this.valueTokens.length-1)){
38
+ this.editor.hide();
39
+ return;
40
+ }
41
+ this.editItem( itemNum );
42
+ }
43
+ },
44
+
45
+ keyColumnRight: function(){
46
+ return this.options.keyColumnWidth;
47
+ },
48
+ typeColumnLeft: function(){
49
+ return this.keyColumnRight();
50
+ },
51
+ typeColumnRight: function(){
52
+ return this.options.keyColumnWidth + 60;
53
+ },
54
+
55
+ valueColumnLeft: function(){
56
+ if(this.options.hideTypeColumn){
57
+ return this.keyColumnRight();
58
+ }
59
+ else {
60
+ return this.typeColumnRight();
61
+ }
62
+ },
63
+
22
64
  drawSubviews: function(){
23
- this.propertyItems = [];
24
- this.keyRowStyle += 'height:'+this.rowHeight+'px;';
25
- this.typeRowStyle += 'height:'+this.rowHeight+'px;';
26
- this.valueRowStyle += 'height:'+this.rowHeight+'px;';
27
- this.rowSeparatorStyle += 'height:'+this.rowHeight+'px;';
28
- this.setStyle('font-size','11px');
29
- this.setStyle('overflow-y','auto');
30
- this.keyColumn = HView.nu(
31
- [ 0, 0, this.keyColumnWidth, 24 ],
65
+
66
+ var borderAndBg = ELEM.make(this.elemId);
67
+ ELEM.setCSS(borderAndBg,'position:absolute;left:0;top:0;right:0;bottom:0;background-color:#e6e6e6;border:1px solid #999;');
68
+
69
+ this.markupElemIds = {
70
+ bg: borderAndBg
71
+ };
72
+
73
+ this.contentView = HScrollView.extend({
74
+ click: function(x,y){
75
+ this.parent.click(x,y);
76
+ return true;
77
+ }
78
+ }).nu(
79
+ [ 1, 25, null, null, 1, 1 ],
32
80
  this, {
33
- style: [ [ 'border-right', '1px solid #999' ] ]
81
+ scrollY: 'auto',
82
+ scrollX: false,
83
+ events: {
84
+ click: true
85
+ }
34
86
  }
35
87
  );
36
- this.typeColumn = HView.nu(
37
- [ this.keyColumnWidth, 0, 80, 24 ],
38
- this, {
88
+
89
+ var separatorParentElemId = ELEM.make(this.contentView.elemId);
90
+ ELEM.setCSS( separatorParentElemId, 'position:absolute;left:0;top:0;right:0;' );
91
+ this.separatortParentElemId = separatorParentElemId;
92
+
93
+ this.propertyItems = [];
94
+
95
+ // Editor initialization
96
+ if(this.options.useEditor){
97
+ this.editorValue = HValue.nu( false, [ 'test', 's', 'Test String' ] );
98
+ this.editor = HPropertyListEditor.nu(
99
+ [0,0,null,this.options.rowHeight+2,0,null],
100
+ this.contentView, {
101
+ propertyItems: this.propertyItems,
102
+ visible: false,
103
+ valueObj: this.editorValue
104
+ }
105
+ );
106
+ }
107
+
108
+ // Set row style heights from options
109
+ var rowHeightStyle = 'height:'+this.options.rowHeight+'px;';
110
+ this.keyRowStyle += rowHeightStyle;
111
+ this.typeRowStyle += rowHeightStyle;
112
+ this.valueRowStyle += rowHeightStyle;
113
+ this.rowSeparatorStyle += rowHeightStyle;
114
+
115
+ // Style common font style
116
+ this.contentView.setStyle('font-size','11px');
117
+
118
+ // Create the key column
119
+ this.keyColumn = HView.nu(
120
+ [ 0, 0, this.keyColumnRight(), 24 ],
121
+ this.contentView, {
39
122
  style: [ [ 'border-right', '1px solid #999' ] ]
40
123
  }
41
124
  );
125
+
126
+ // Create the type column
127
+ if(!this.options.hideTypeColumn){
128
+ this.typeColumn = HView.nu(
129
+ [ this.typeColumnLeft(), 0, 60, 24 ],
130
+ this.contentView, {
131
+ style: [ [ 'border-right', '1px solid #999' ] ]
132
+ }
133
+ );
134
+ }
135
+
136
+ // Create the value column
42
137
  this.valueColumn = HView.nu(
43
- [ this.keyColumnWidth + 80, 0, 0, 24, 0, null ],
44
- this
138
+ [ this.valueColumnLeft(), 0, 0, 24, 0, null ],
139
+ this.contentView
45
140
  );
141
+
142
+ // Create the column headers
46
143
  this.header = HView.extend({
47
144
  drawSubviews: function(){
48
145
  var
49
- keyColumnWidth = this.parent.keyColumnWidth;
50
- this.keyLabel = HStringView.nu(
51
- [ 0, 0, keyColumnWidth, 24 ],
146
+ keyColumnWidth = this.parent.options.keyColumnWidth;
147
+ this.keyLabel = HView.nu(
148
+ [ 0, 0, this.parent.keyColumnRight(), 24 ],
52
149
  this, {
53
- value: '<b>Key</b>',
150
+ html: '<b>Key</b>',
54
151
  style: [
55
152
  [ 'text-align', 'middle' ],
56
153
  [ 'text-indent', '16px' ],
57
- [ 'line-height', '24px' ]
58
- ]
59
- }
60
- );
61
- this.typeLabel = HStringView.nu(
62
- [ keyColumnWidth, 0, 80, 24 ],
63
- this, {
64
- value: '<b>Type</b>',
65
- style: [
66
- [ 'text-align', 'middle' ],
67
- [ 'text-indent', '8px' ],
68
- [ 'line-height', '24px' ]
154
+ [ 'line-height', '24px' ],
155
+ [ 'font-size', '13px' ],
156
+ [ 'border-right', '3px double #999' ]
69
157
  ]
70
158
  }
71
159
  );
72
- this.valueLabel = HStringView.nu(
73
- [ keyColumnWidth + 80, 0, 80, 24, 0, null ],
160
+ if(!this.parent.options.hideTypeColumn){
161
+ this.typeLabel = HView.nu(
162
+ [ this.parent.typeColumnLeft(), 0, 60, 24 ],
163
+ this, {
164
+ html: '<b>Type</b>',
165
+ style: [
166
+ [ 'text-align', 'middle' ],
167
+ [ 'text-indent', '8px' ],
168
+ [ 'line-height', '24px' ],
169
+ [ 'font-size', '13px' ],
170
+ [ 'padding-right', '1px' ],
171
+ [ 'border-right', '1px solid #999' ]
172
+ ]
173
+ }
174
+ );
175
+ }
176
+ this.valueLabel = HView.nu(
177
+ [ this.parent.valueColumnLeft(), 0, 80, 24, 0, null ],
74
178
  this, {
75
- value: '<b>Value</b>',
179
+ html: '<b>Value</b>',
76
180
  style: [
77
181
  [ 'text-align', 'middle' ],
78
182
  [ 'text-indent', '8px' ],
79
- [ 'line-height', '24px' ]
183
+ [ 'line-height', '24px' ],
184
+ [ 'font-size', '13px' ]
80
185
  ]
81
186
  }
82
187
  );
@@ -87,30 +192,75 @@ HPropertyList = HControl.extend({
87
192
  style: [ [ 'border-bottom', '1px solid #999' ] ]
88
193
  }
89
194
  );
195
+
196
+ // Create the resize control (invisible, just above the first column separator)
90
197
  this.resizeColumns = HControl.extend({
91
198
  drag: function(x,y){
92
199
  var
93
- parentX = x - this.parent.pageX(),
94
- keyColumnWidth = parentX-1,
95
- parentWidth = ELEM.getVisibleSize( this.parent.elemId )[0];
200
+ parent = this.parent,
201
+ options = parent.options,
202
+ keyColumnWidth = x - parent.pageX(),
203
+ parentWidth = parent.rect.width;
204
+
96
205
  if(keyColumnWidth < 80){
97
206
  keyColumnWidth = 80;
98
207
  }
99
- else if ( keyColumnWidth > parentWidth-160 ){
100
- keyColumnWidth = parentWidth - 160;
208
+ else if ( keyColumnWidth > parentWidth-140 ){
209
+ keyColumnWidth = parentWidth - 140;
210
+ }
211
+
212
+ // Set the dragger itself
213
+ this.rect.offsetTo( keyColumnWidth-1, 0 ); this.drawRect();
214
+
215
+ // Resize the key column
216
+ options.keyColumnWidth = keyColumnWidth;
217
+
218
+ var
219
+ keyColumn = parent.keyColumn,
220
+ keyLabel = parent.header.keyLabel,
221
+ keyRight = parent.keyColumnRight();
222
+ keyColumn.rect.setRight( keyRight );
223
+ keyLabel.rect.setRight( keyRight );
224
+
225
+ var
226
+ valueColumn = parent.valueColumn,
227
+ valueLabel = parent.header.valueLabel,
228
+ valueLeft = parent.valueColumnLeft();
229
+
230
+ valueColumn.rect.setLeft( valueLeft );
231
+ valueLabel.rect.setLeft( valueLeft );
232
+
233
+ // Redraw the rects
234
+ keyColumn.drawRect();
235
+ keyLabel.drawRect();
236
+ valueColumn.drawRect();
237
+ valueLabel.drawRect();
238
+
239
+ // Resize the type column
240
+ if(!options.hideTypeColumn){
241
+ var
242
+ typeColumn = parent.typeColumn,
243
+ typeLabel = parent.header.typeLabel,
244
+ typeLeft = parent.typeColumnLeft(),
245
+ typeRight = parent.typeColumnRight();
246
+
247
+ typeColumn.rect.setLeft( typeLeft );
248
+ typeColumn.rect.setRight( typeRight );
249
+
250
+ typeLabel.rect.setLeft( typeLeft, 0 );
251
+ typeLabel.rect.setRight( typeRight, 0 );
252
+
253
+ typeColumn.drawRect();
254
+ typeLabel.drawRect();
255
+ }
256
+
257
+ if(options.useEditor){
258
+ parent.editor.resizeKeyColumn();
101
259
  }
102
- selfX = keyColumnWidth - 2;
103
- this.rect.offsetTo( selfX, 0 ); this.drawRect();
104
- this.parent.keyColumn.rect.setRight( keyColumnWidth ); this.parent.keyColumn.drawRect();
105
- this.parent.header.keyLabel.rect.setWidth( keyColumnWidth ); this.parent.header.keyLabel.drawRect();
106
- this.parent.typeColumn.rect.offsetTo( keyColumnWidth, 0 ); this.parent.typeColumn.drawRect();
107
- this.parent.header.typeLabel.rect.offsetTo( keyColumnWidth, 0 ); this.parent.header.typeLabel.drawRect();
108
- this.parent.valueColumn.rect.setLeft( keyColumnWidth+80 ); this.parent.valueColumn.drawRect();
109
- this.parent.header.valueLabel.rect.setLeft( keyColumnWidth+80 ); this.parent.header.valueLabel.drawRect();
110
- this.parent.keyColumnWidth = keyColumnWidth;
260
+
111
261
  }
112
262
  }).nu(
113
- [ this.keyColumnWidth - 2, 0, 5, 25 ],
263
+ [ this.keyColumnRight(), 0, 5, 25 ],
114
264
  this, {
115
265
  events: { draggable: true },
116
266
  style: [
@@ -118,10 +268,13 @@ HPropertyList = HControl.extend({
118
268
  ]
119
269
  }
120
270
  );
271
+
121
272
  },
273
+
274
+ // Tokenize arrays
122
275
  arrayTokens: function( arr, name ){
123
276
  this.addToken( 'a', name, '('+arr.length+' items)' );
124
- this.nodeProperties.left += this.keyIndent;
277
+ this.nodeProperties.left += this.options.keyIndent;
125
278
  var i = 0, val, type;
126
279
  for( ; i < arr.length; i++ ){
127
280
  val = arr[i];
@@ -136,8 +289,10 @@ HPropertyList = HControl.extend({
136
289
  this.addToken( type, i, val );
137
290
  }
138
291
  }
139
- this.nodeProperties.left -= this.keyIndent;
292
+ this.nodeProperties.left -= this.options.keyIndent;
140
293
  },
294
+
295
+ // Get length of hash
141
296
  hashLen: function( hash ){
142
297
  var count = 0;
143
298
  for( var item in hash ){
@@ -145,6 +300,8 @@ HPropertyList = HControl.extend({
145
300
  }
146
301
  return count;
147
302
  },
303
+
304
+ // Sort hash keys
148
305
  hashSortedKeys: function( hash ){
149
306
  var
150
307
  keys = [],
@@ -154,9 +311,11 @@ HPropertyList = HControl.extend({
154
311
  }
155
312
  return keys.sort();
156
313
  },
314
+
315
+ // Tokenize hashes
157
316
  hashTokens: function( hash, name ){
158
317
  this.addToken( 'h', name, '('+this.hashLen( hash )+' items)' );
159
- this.nodeProperties.left += this.keyIndent;
318
+ this.nodeProperties.left += this.options.keyIndent;
160
319
  var key, val, type, i = 0, keys = this.hashSortedKeys( hash );
161
320
  for( ; i < keys.length; i++ ){
162
321
  key = keys[i];
@@ -172,8 +331,10 @@ HPropertyList = HControl.extend({
172
331
  this.addToken( type, key, val );
173
332
  }
174
333
  }
175
- this.nodeProperties.left -= this.keyIndent;
334
+ this.nodeProperties.left -= this.options.keyIndent;
176
335
  },
336
+
337
+ // Adds a taken
177
338
  addToken: function( type, name, value ){
178
339
  this.valueTokens.push( {
179
340
  top: this.nodeProperties.top,
@@ -182,11 +343,15 @@ HPropertyList = HControl.extend({
182
343
  name: name,
183
344
  value: value
184
345
  } );
185
- this.nodeProperties.top += this.rowHeight;
346
+ this.nodeProperties.top += this.options.rowHeight;
186
347
  },
348
+
349
+ // Returns type of item
187
350
  itemType: function( item ){
188
351
  return COMM.Values.type( item );
189
352
  },
353
+
354
+ // Translation from type code to type name
190
355
  typeNames: {
191
356
  h: 'Hash',
192
357
  a: 'Array',
@@ -196,7 +361,11 @@ HPropertyList = HControl.extend({
196
361
  '~': 'Null',
197
362
  '-': 'Undefined'
198
363
  },
199
- keyRowStyle: "position:absolute;z-index:1;right:0px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;",
364
+
365
+ // Style for the key rows
366
+ keyRowStyle: "position:absolute;padding-top:2px;right:0px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;",
367
+
368
+ // Creates row in key column
200
369
  addKeyColumnControl: function( token, i ){
201
370
  var elemId;
202
371
  if( i >= this.propertyItems.length ){
@@ -216,7 +385,11 @@ HPropertyList = HControl.extend({
216
385
  }
217
386
  ELEM.setHTML( elemId, token.name );
218
387
  },
219
- typeRowStyle: "position:absolute;z-index:1;left:8px;width:72px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;",
388
+
389
+ // Style for the type rows
390
+ typeRowStyle: "position:absolute;padding-top:2px;left:8px;width:72px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;",
391
+
392
+ // Creates row in the type column
220
393
  addTypeColumnControl: function( token, i ){
221
394
  var elemId;
222
395
  if( i >= this.propertyItems.length ){
@@ -229,7 +402,11 @@ HPropertyList = HControl.extend({
229
402
  }
230
403
  ELEM.setHTML( elemId, this.typeNames[token.type] );
231
404
  },
232
- valueRowStyle: "position:absolute;z-index:1;left:8px;right:0px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;",
405
+
406
+ // Style for the value rows
407
+ valueRowStyle: "position:absolute;padding-top:2px;left:8px;right:0px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;",
408
+
409
+ // Creates row in the value column
233
410
  addValueColumnControl: function( token, i ){
234
411
  var elemId, value;
235
412
  if( i >= this.propertyItems.length ){
@@ -261,14 +438,20 @@ HPropertyList = HControl.extend({
261
438
  }
262
439
  ELEM.setHTML( elemId, value );
263
440
  },
264
- rowSeparatorStyle: "position:absolute;z-index:0;left:0px;right:0px;font-size:0px;height:1px;border-bottom:1px solid #ccc;overflow:hidden;text-overflow:ellipsis;",
441
+
442
+ // Row separator style
443
+ rowSeparatorStyle: "position:absolute;left:1px;right:1px;font-size:0px;height:1px;overflow:hidden;border-bottom:1px solid #999;",
444
+
445
+ // Adds row separator
265
446
  addRowSeparator: function( token, i, even ){
266
447
  if( i >= this.propertyItems.length ){
267
- var elemId = ELEM.make( this.elemId );
448
+ var elemId = ELEM.make( this.separatortParentElemId );
268
449
  this.propertyItems.push( elemId );
269
- ELEM.setCSS( elemId, 'top:'+token.top+'px;'+this.rowSeparatorStyle+'background-color:'+(even?'#eee':'#ddd')+';' );
450
+ ELEM.setCSS( elemId, 'top:'+token.top+'px;'+this.rowSeparatorStyle+'background-color:'+(even?'#f6f6f6':'#e6e6e6')+';' );
270
451
  }
271
452
  },
453
+
454
+ // Destructor, deletes extra elements created
272
455
  die: function(){
273
456
  var
274
457
  i=0,
@@ -280,13 +463,53 @@ HPropertyList = HControl.extend({
280
463
  }
281
464
  this.base();
282
465
  },
466
+
467
+ // Currently selected item
468
+ selectedItem: 0,
469
+ editNextItem: function(){
470
+ this.editItem(this.selectedItem+1);
471
+ },
472
+ editPrevItem: function(){
473
+ this.editItem(this.selectedItem-1);
474
+ },
475
+ editItem: function(itemNum){
476
+
477
+ if(itemNum>this.valueTokens.length-1){
478
+ itemNum = this.valueTokens.length-1;
479
+ }
480
+ else if(itemNum < 0){
481
+ itemNum = 0;
482
+ }
483
+
484
+ var
485
+ targetY = (itemNum*this.options.rowHeight)-1,
486
+ elem = ELEM.get( this.contentView.elemId ),
487
+ scrollTop = elem.scrollTop,
488
+ contentHeight = this.contentView.rect.height;
489
+
490
+ if(targetY > (scrollTop+contentHeight-45)){
491
+ elem.scrollTop = scrollTop+45;
492
+ }
493
+ else if(targetY < scrollTop+45){
494
+ elem.scrollTop = scrollTop-45;
495
+ }
496
+
497
+ this.selectedItem = itemNum;
498
+ this.editorValue.set(this.valueTokens[itemNum]);
499
+ this.editor.show();
500
+ EVENT.changeActiveControl(this.editor);
501
+ this.editor.offsetTo( 0, targetY );
502
+ this.editor.bringToFront();
503
+ },
504
+
505
+ // Starts tokenizing, when the value is changed.
283
506
  refreshValue: function(){
284
507
  if(this['propertyItems']===undefined){
285
508
  return;
286
509
  }
287
510
  this.valueTokens = [];
288
511
  this.nodeProperties = {
289
- top: 28,
512
+ top: 0,
290
513
  left: 8
291
514
  };
292
515
  var rootType = this.itemType( this.value );
@@ -299,6 +522,7 @@ HPropertyList = HControl.extend({
299
522
  else {
300
523
  this.addToken( rootType, 'Root', this.value );
301
524
  }
525
+
302
526
  var i, token;
303
527
  if(this['propertyItems'] === undefined){
304
528
  this.propertyItems = [];
@@ -308,9 +532,11 @@ HPropertyList = HControl.extend({
308
532
  token = this.valueTokens[i];
309
533
  this.addRowSeparator( token, colId, (i%2===0) ); colId++;
310
534
  this.addKeyColumnControl( token, colId ); colId++;
311
- this.addTypeColumnControl( token, colId ); colId++;
535
+ if(!this.options.hideTypeColumn){
536
+ this.addTypeColumnControl( token, colId ); colId++;
537
+ }
312
538
  this.addValueColumnControl( token, colId ); colId++;
313
- colHeight = token.top+this.rowHeight;
539
+ colHeight = token.top+this.options.rowHeight;
314
540
  }
315
541
  var propItemsLen = this.propertyItems.length, elemId;
316
542
  for( i = colId; i < propItemsLen; i++ ){
@@ -318,11 +544,19 @@ HPropertyList = HControl.extend({
318
544
  ELEM.del( elemId );
319
545
  }
320
546
  this.keyColumn.bringToFront();
321
- this.typeColumn.bringToFront();
547
+ if(!this.options.hideTypeColumn){
548
+ this.typeColumn.bringToFront();
549
+ }
322
550
  this.valueColumn.bringToFront();
323
551
  this.resizeColumns.bringToFront();
324
- this.keyColumn.rect.setHeight( colHeight ); this.keyColumn.drawRect();
325
- this.typeColumn.rect.setHeight( colHeight ); this.typeColumn.drawRect();
326
- this.valueColumn.rect.setHeight( colHeight ); this.valueColumn.drawRect();
552
+ this.keyColumn.rect.setHeight( colHeight );
553
+ this.keyColumn.drawRect();
554
+ if(!this.options.hideTypeColumn){
555
+ this.typeColumn.rect.setHeight( colHeight );
556
+ this.typeColumn.drawRect();
557
+ }
558
+ this.valueColumn.rect.setHeight( colHeight );
559
+ this.valueColumn.drawRect();
560
+ ELEM.setStyle(this.separatortParentElemId,'height',(colHeight+25)+'px');
327
561
  }
328
562
  });
File without changes
@@ -0,0 +1,180 @@
1
+ /* RSence
2
+ * Copyright 2010 Riassence Inc.
3
+ * http://riassence.com/
4
+ *
5
+ * You should have received a copy of the GNU General Public License along
6
+ * with this software package. If not, contact licensing@riassence.com
7
+ */
8
+
9
+ /*** = Description
10
+ ** HPropertyListEditor is a subcomponent of HPropertyList that handles
11
+ ** editing of the selected row.
12
+ **
13
+ ***/
14
+ var//RSence.Lists
15
+ HPropertyListEditor = HControl.extend({
16
+
17
+ defaultEvents: {
18
+ keyDown: 'repeat'
19
+ },
20
+
21
+ keyDown: function(chr){
22
+ if(chr===38){
23
+ this.parent.parent.editPrevItem();
24
+ }
25
+ else if(chr===40){
26
+ this.parent.parent.editNextItem();
27
+ }
28
+ return true;
29
+ },
30
+
31
+ refreshValue: function(){
32
+
33
+ this.base();
34
+
35
+ this.nameEditor.setValue(this.value.name);
36
+
37
+ this.typeEditor && this.typeEditor.setValue( this.value.type );
38
+
39
+ if(this.value.type === 's'){
40
+ this.stringEditor.show();
41
+ this.stringEditor.setValue(this.value.value);
42
+ }
43
+ else{
44
+ this.stringEditor.hide();
45
+ }
46
+
47
+ if(this.value.type === 'n'){
48
+ this.numberEditor.show();
49
+ this.numberEditor.setValue(this.value.value);
50
+ }
51
+ else{
52
+ this.numberEditor.hide();
53
+ }
54
+
55
+ this.resizeKeyColumn();
56
+ },
57
+
58
+
59
+ resizeKeyColumn: function(){
60
+
61
+ var
62
+ parent = this.parent.parent,
63
+ nameEditor = this.nameEditor;
64
+
65
+ nameEditor.rect.setLeft( this.value.left+6 );
66
+ nameEditor.rect.setRight( parent.keyColumnRight()-3 );
67
+ nameEditor.refresh();
68
+
69
+ var
70
+ stringEditor = this.stringEditor;
71
+ numberEditor = this.numberEditor;
72
+
73
+ stringEditor.rect.setLeft( parent.valueColumnLeft()+5 );
74
+ numberEditor.rect.setLeft( parent.valueColumnLeft()+4 );
75
+
76
+ if(this['typeEditor']){
77
+ var
78
+ typeEditor = this.typeEditor;
79
+
80
+ typeEditor.rect.setLeft( parent.typeColumnLeft()+2 );
81
+ typeEditor.rect.setRight( parent.typeColumnRight()-1 );
82
+ typeEditor.drawRect();
83
+ }
84
+
85
+ stringEditor.drawRect();
86
+ numberEditor.drawRect();
87
+ },
88
+ nameEditor: null,
89
+ typeEditor: null,
90
+ valueEditor: null,
91
+ drawSubviews: function(){
92
+
93
+ this.setStyle('border-top','1px solid #999');
94
+ this.setStyle('border-bottom','1px solid #999');
95
+
96
+ var
97
+ _stateElemId = ELEM.make( this.elemId );
98
+ this.markupElemIds = { state: _stateElemId };
99
+ ELEM.setCSS( _stateElemId, 'position:absolute;left:0;top:0;right:0;bottom:0;background-color:#fff;' );
100
+ ELEM.setStyle( _stateElemId, 'opacity', 0.8 );
101
+
102
+ var
103
+ parent = this.parent.parent,
104
+ opts = parent.options;
105
+
106
+ this.nameEditor = HTextControl.extend({
107
+ boldTypes: ['a','h'],
108
+ refreshValue: function(){
109
+ if(this.drawn){
110
+ if(this.boldTypes.indexOf(this.parent.value.type)!==-1){
111
+ this.setStyle('font-weight','bold',true);
112
+ }
113
+ else{
114
+ this.setStyle('font-weight','normal',true);
115
+ }
116
+ }
117
+ this.base();
118
+ }
119
+ }).nu(
120
+ [0,-1,1,opts.rowHeight+4],
121
+ this, {
122
+ style: [
123
+ [ 'font-size', '11px' ],
124
+ [ 'text-indent', '1px' ]
125
+ ]
126
+ }
127
+ );
128
+
129
+ var
130
+ height = this.nameEditor.rect.height;
131
+
132
+ if(!opts.hideTypeColumn){
133
+ this.typeEditor = HMiniMenu.nu(
134
+ [0,1,1,height],
135
+ this, {
136
+ value: 'a',
137
+ menuItemGeom: {
138
+ width: 75,
139
+ left: -15
140
+ }
141
+ }
142
+ );
143
+
144
+ var _arrTypes = [];
145
+
146
+ for( var i in parent.typeNames ){
147
+ _arrTypes.push( [i, parent.typeNames[i]] );
148
+ }
149
+
150
+ this.typeEditor.setListItems( _arrTypes );
151
+
152
+ }
153
+
154
+ this.stringEditor = HTextArea.extend({
155
+ }).nu(
156
+ [0,-1,null,height,4,null],
157
+ this, {
158
+ style: [
159
+ [ 'font-size', '11px' ],
160
+ [ 'text-indent', '1px' ],
161
+ [ 'padding-top', '3px' ]
162
+ ]
163
+ }
164
+ );
165
+
166
+ this.numberEditor = HNumericTextControl.extend({
167
+ }).nu(
168
+ [0,-1,null,height,4,null],
169
+ this, {
170
+ style: [
171
+ [ 'font-size', '11px' ],
172
+ [ 'text-indent', '1px' ]
173
+ ]
174
+ }
175
+ );
176
+
177
+ this.resizeKeyColumn();
178
+
179
+ }
180
+ });
@@ -51,17 +51,21 @@ HRadioButtonList = HControl.extend({
51
51
  _listItem = _listItems[i];
52
52
  _value = _listItem[0];
53
53
  _label = _listItem[1];
54
- _radioButton = HRadiobutton.nu(
55
- [ 4, (i*23)+4, null, 23, 4, null ],
56
- this, {
57
- label: _label
58
- }
59
- );
60
- this.listItemViews[i] = _radioButton;
54
+ _component = this.createComponent( i, _label );
55
+ this.listItemViews[i] = _component;
61
56
  }
62
57
  this.refreshValue();
63
58
  },
64
59
 
60
+ createComponent: function( i, _label ){
61
+ return HRadiobutton.nu(
62
+ [ 4, (i*23)+4, null, 23, 4, null ],
63
+ this, {
64
+ label: _label
65
+ }
66
+ );
67
+ },
68
+
65
69
  /** = Description
66
70
  * Destructor. Sets listItems and listItemViews to null and initiates
67
71
  * destructor for radioButtonIndexValue.
@@ -91,6 +95,9 @@ HRadioButtonList = HControl.extend({
91
95
  }
92
96
  }
93
97
  }),
98
+
99
+
100
+
94
101
  refreshValue: function(){
95
102
  var _value = this.value;
96
103
  if ( this.listItems.length !== 0 && this['valueMatrix'] !== undefined ) {
File without changes
@@ -0,0 +1,115 @@
1
+ /* RSence
2
+ * Copyright 2010 Riassence Inc.
3
+ * http://riassence.com/
4
+ *
5
+ * You should have received a copy of the GNU General Public License along
6
+ * with this software package. If not, contact licensing@riassence.com
7
+ */
8
+
9
+
10
+ /*** = Description
11
+ ** Simple small menu component for selecting one value amongst several.
12
+ ** It's limited to 15px height by the default theme.
13
+ ***/
14
+ var//RSence.Menus
15
+ HMiniMenu = HRadioButtonList.extend({
16
+
17
+ componentName: 'minimenu',
18
+
19
+ defaultEvents: {
20
+ mouseDown: true,
21
+ mouseUp: true,
22
+ click: true
23
+ },
24
+
25
+ repositionMenuItems: function(){
26
+ var
27
+ x = this.pageX(),
28
+ y = this.pageY(),
29
+ w = this.rect.width,
30
+ h = this.listItems.length*15,
31
+ i = 0,
32
+ listItem = null;
33
+ for(;i<this.listItems.length && listItem === null;i++){
34
+ if(this.listItems[i][0]===this.value){
35
+ listItem = this.listItems[i];
36
+ }
37
+ }
38
+ y -= (i-1)*15;
39
+ if(y < 0){
40
+ y = y%15;
41
+ }
42
+ if(this.options['menuItemGeom']){
43
+ if(this.options.menuItemGeom.width){
44
+ w += this.options.menuItemGeom.width;
45
+ }
46
+ if(this.options.menuItemGeom.width){
47
+ x += this.options.menuItemGeom.left;
48
+ }
49
+ }
50
+ this.menuItemView.rect.set( x, y, x+w, y+h );
51
+ this.menuItemView.refresh();
52
+ },
53
+
54
+ click: function(){
55
+ this.mouseDown();
56
+ },
57
+
58
+ refreshValue: function(){
59
+ this.base();
60
+ for(var i=0;i<this.listItems.length;i++){
61
+ if(this.listItems[i][0]===this.value){
62
+ this.setLabel( this.listItems[i][1] );
63
+ break;
64
+ }
65
+ }
66
+ },
67
+
68
+ mouseDown: function(){
69
+ this.repositionMenuItems();
70
+ this.menuItemView.bringToFront();
71
+ this.menuItemView.show();
72
+ return true;
73
+ },
74
+
75
+ lostActiveStatus: function(newActive){
76
+ this.base(newActive);
77
+ if((newActive.parent !== this.menuItemView) && (newActive !== this.menuItemView)){
78
+ this.menuItemView.hide();
79
+ }
80
+ },
81
+
82
+ die: function(){
83
+ this.menuItemView.die();
84
+ this.base();
85
+ },
86
+
87
+ drawSubviews: function(){
88
+ this.menuItemView = HView.extend({
89
+ drawSubviews: function(){
90
+ this.setStyle( 'background-color','#f6f6f6' );
91
+ this.setStyle( 'border', '1px solid #999' );
92
+ }
93
+ }).nu(
94
+ [ this.rect.left, this.rect.top, this.rect.width, 500 ],
95
+ this.app, {
96
+ visible: false
97
+ }
98
+ );
99
+ },
100
+
101
+ setListItems: function(listItems){
102
+ this.base(listItems);
103
+ this.valueMatrix = this.menuItemView.valueMatrix;
104
+ },
105
+
106
+ createComponent: function( i, _label ){
107
+ return HMiniMenuItem.nu(
108
+ [ 0, (i*15), null, 15, 0, null ],
109
+ this.menuItemView, {
110
+ label: _label
111
+ }
112
+ );
113
+ }
114
+
115
+ });
File without changes
@@ -0,0 +1,33 @@
1
+ /* RSence
2
+ * Copyright 2010 Riassence Inc.
3
+ * http://riassence.com/
4
+ *
5
+ * You should have received a copy of the GNU General Public License along
6
+ * with this software package. If not, contact licensing@riassence.com
7
+ */
8
+
9
+
10
+ /*** = Description
11
+ ** Menu item for the HMiniMenu component.
12
+ ***/
13
+ var//RSence.Menus
14
+ HMiniMenuItem = HRadioButton.extend({
15
+
16
+ componentName: 'minimenuitem',
17
+
18
+ defaultEvents: {
19
+ click: true,
20
+ mouseUp: true
21
+ },
22
+
23
+ click: function(){
24
+ this.base();
25
+ this.parent.hide();
26
+ },
27
+
28
+ mouseUp: function(){
29
+ this.base();
30
+ this.click();
31
+ }
32
+
33
+ });
@@ -0,0 +1,45 @@
1
+
2
+ .minimenuitem_control,
3
+ .minimenuitem_label,
4
+ .minimenuitem_state {
5
+ position: absolute;
6
+ top: 0px; height: 15px;
7
+ }
8
+
9
+ .minimenuitem_control {
10
+ left: 0px; right: 0px;
11
+ cursor: pointer;
12
+ }
13
+ .minimenuitem_control:hover {
14
+ background-color: #fff;
15
+ }
16
+
17
+ .minimenuitem_state {
18
+ left: 0px; top: 1px; height: 12px; width: 12px;
19
+ background-image: #{this.getCssFilePath('minimenuitem_checkmark.png')};
20
+ }
21
+ .checked .minimenuitem_state {
22
+ visibility: inherit;
23
+ }
24
+ .unchecked .minimenuitem_state {
25
+ visibility: hidden;
26
+ }
27
+
28
+ .minimenuitem_label {
29
+ left: 14px; right: 11px; top: 0px;
30
+ height: 15px; line-height: 15px;
31
+ text-align: left;
32
+ text-overflow: ellipsis;
33
+ overflow: hidden;
34
+ white-space:nowrap;
35
+ vertical-align: middle;
36
+ font-family: Arial, sans-serif;
37
+ font-size: 11px;
38
+ color: #333;
39
+ }
40
+ .minimenuitem_control:hover > .minimenuitem_label {
41
+ color: #000;
42
+ }
43
+ .disabled .minimenuitem_control {
44
+ opacity: 0.8;
45
+ }
@@ -0,0 +1,4 @@
1
+ <div class="minimenuitem_control#{this.value?' checked':' unchecked'}" id="control#{_ID}">
2
+ <div class="minimenuitem_state" id="state#{_ID}"></div>
3
+ <div class="minimenuitem_label" id="label#{_ID}">#{this.label}</div>
4
+ </div>
@@ -0,0 +1,63 @@
1
+
2
+ .minimenu_control,
3
+ .minimenu_edge_left,
4
+ .minimenu_center,
5
+ .minimenu_edge_right,
6
+ .minimenu_label,
7
+ .minimenu_antiselect {
8
+ position: absolute;
9
+ top: 0px; height: 15px;
10
+ }
11
+
12
+ .minimenu_control {
13
+ left: 0px; right: 0px;
14
+ cursor: pointer;
15
+ }
16
+ .disabled .minimenu_control {
17
+ cursor: default;
18
+ }
19
+
20
+ .minimenu_edge_left,
21
+ .minimenu_center,
22
+ .minimenu_edge_right {
23
+ background-image: #{this.getCssFilePath('minimenu.png')};
24
+ }
25
+
26
+ .minimenu_edge_left {
27
+ left: 0px; width: 7px;
28
+ background-position: 0px 0px;
29
+ }
30
+
31
+ .minimenu_edge_right {
32
+ right: 0px; width: 13px;
33
+ background-position: -7px 0px;
34
+ }
35
+
36
+ .minimenu_center {
37
+ left: 7px; right: 13px;
38
+ background-position: 0px -15px;
39
+ background-repeat: repeat-x;
40
+ }
41
+
42
+ .minimenu_label {
43
+ left: 6px; right: 11px; top: 0px;
44
+ height: 15px; line-height: 15px;
45
+ text-align: left;
46
+ text-overflow: ellipsis;
47
+ overflow: hidden;
48
+ white-space:nowrap;
49
+ vertical-align: middle;
50
+ font-family: Arial, sans-serif;
51
+ font-size: 11px;
52
+ color: #333;
53
+ }
54
+ .minimenu_control:hover > .minimenu_label {
55
+ color: #000;
56
+ }
57
+ .disabled .minimenu_control {
58
+ opacity: 0.8;
59
+ }
60
+
61
+ .minimenu_antiselect {
62
+ left: 0px; right: 0px;
63
+ }
@@ -0,0 +1,7 @@
1
+ <div class="minimenu_control" id="control#{_ID}">
2
+ <div class="minimenu_edge_left"></div>
3
+ <div class="minimenu_center"></div>
4
+ <div class="minimenu_edge_right"></div>
5
+ <div class="minimenu_label" id="label#{_ID}">#{this.label}</div>
6
+ <div class="minimenu_antiselect"></div>
7
+ </div>
data/lib/daemon/daemon.rb CHANGED
@@ -269,9 +269,18 @@ module RSence
269
269
  # @private Simple process control, constructed here and called from Daemon::Controller
270
270
  class HTTPDaemon
271
271
 
272
+ def ps_name
273
+ config = RSence.config
274
+ url = "http://#{config[:http_server][:bind_address]}:#{config[:http_server][:port]}#{config[:base_url]}"
275
+ env_path = RSence.args[:env_path]
276
+ "RSence-#{RSence.version} on #{url} in #{env_path}"
277
+ end
278
+
272
279
  # RSence top-level run handler. Almost identical to start.
273
280
  def run
274
-
281
+
282
+ $0 = ps_name
283
+
275
284
  puts "Starting as a foreground process." if RSence.args[:verbose]
276
285
  puts "Press CTRL-C to terminate."
277
286
 
@@ -313,7 +322,9 @@ module RSence
313
322
 
314
323
  # Called by Controller#start, contains RSence-specific operations
315
324
  def start
316
-
325
+
326
+ $0 = ps_name
327
+
317
328
  @transporter = Transporter.new
318
329
 
319
330
  conf = RSence.config[:http_server]
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsence-pre
3
3
  version: !ruby/object:Gem::Version
4
- hash: 961916148
4
+ hash: 961916156
5
5
  prerelease: true
6
6
  segments:
7
7
  - 2
8
8
  - 1
9
9
  - 0
10
- - 4
10
+ - 6
11
11
  - pre
12
- version: 2.1.0.4.pre
12
+ version: 2.1.0.6.pre
13
13
  platform: ruby
14
14
  authors:
15
15
  - Riassence Inc.
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-09-05 00:00:00 +03:00
20
+ date: 2010-09-09 00:00:00 +03:00
21
21
  default_executable: rsence-pre
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -340,8 +340,20 @@ files:
340
340
  - js/lists/listitems/listitems.js
341
341
  - js/lists/propertylist/js.inc
342
342
  - js/lists/propertylist/propertylist.js
343
+ - js/lists/propertylist/propertylisteditor/js.inc
344
+ - js/lists/propertylist/propertylisteditor/propertylisteditor.js
343
345
  - js/lists/radiobuttonlist/js.inc
344
346
  - js/lists/radiobuttonlist/radiobuttonlist.js
347
+ - js/menus/minimenu/js.inc
348
+ - js/menus/minimenu/minimenu.js
349
+ - js/menus/minimenu/minimenuitem/js.inc
350
+ - js/menus/minimenu/minimenuitem/minimenuitem.js
351
+ - js/menus/minimenu/minimenuitem/themes/default/minimenuitem.css
352
+ - js/menus/minimenu/minimenuitem/themes/default/minimenuitem.html
353
+ - js/menus/minimenu/minimenuitem/themes/default/minimenuitem_checkmark.png
354
+ - js/menus/minimenu/themes/default/minimenu.css
355
+ - js/menus/minimenu/themes/default/minimenu.html
356
+ - js/menus/minimenu/themes/default/minimenu.png
345
357
  - js/util/reloadapp/js.inc
346
358
  - js/util/reloadapp/reloadapp.js
347
359
  - js/util/reloadapp/themes/default/reloadapp_warning-ie6.gif