rsence-pre 2.3.0.18 → 2.3.0.19

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.
@@ -1230,8 +1230,8 @@ HView = UtilMethods.extend({
1230
1230
  *
1231
1231
  **/
1232
1232
  setStyleOfPart: function(_partName, _name, _value, _force) {
1233
- if (!this['markupElemIds']){
1234
- !this.isProduction && console.log('Warning, setStyleOfPart: no markupElemIds');
1233
+ if (!this.markupElemIds){
1234
+ !this.isProduction && console.log('Warning, setStyleOfPart('+_partName+','+_name+','+_value+') in a '+this.componentName+': no markupElemIds');
1235
1235
  }
1236
1236
  else if (this.markupElemIds[_partName]===undefined) {
1237
1237
  !this.isProduction && console.log('Warning, setStyleOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
@@ -1255,8 +1255,8 @@ HView = UtilMethods.extend({
1255
1255
  *
1256
1256
  **/
1257
1257
  styleOfPart: function(_partName, _name, _force) {
1258
- if (!this['markupElemIds']){
1259
- !this.isProduction && console.log('Warning, styleOfPart: no markupElemIds');
1258
+ if (!this.markupElemIds){
1259
+ !this.isProduction && console.log('Warning, styleOfPart('+_partName+','+_name+') in a '+this.componentName+': no markupElemIds');
1260
1260
  }
1261
1261
  else if (this.markupElemIds[_partName]===undefined) {
1262
1262
  !this.isProduction && console.log('Warning, styleOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
@@ -1278,8 +1278,8 @@ HView = UtilMethods.extend({
1278
1278
  *
1279
1279
  **/
1280
1280
  setMarkupOfPart: function( _partName, _value ) {
1281
- if (!this['markupElemIds']){
1282
- !this.isProduction && console.log('Warning, setMarkupOfPart: no markupElemIds');
1281
+ if (!this.markupElemIds){
1282
+ !this.isProduction && console.log('Warning, setMarkupOfPart('+_partName+') in a '+this.componentName+': no markupElemIds');
1283
1283
  }
1284
1284
  else if (this.markupElemIds[_partName]===undefined) {
1285
1285
  !this.isProduction && console.log('Warning, setMarkupOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
@@ -1302,8 +1302,8 @@ HView = UtilMethods.extend({
1302
1302
  *
1303
1303
  **/
1304
1304
  markupOfPart: function(_partName) {
1305
- if (!this['markupElemIds']){
1306
- !this.isProduction && console.log('Warning, markupOfPart: no markupElemIds');
1305
+ if (!this.markupElemIds){
1306
+ !this.isProduction && console.log('Warning, markupOfPart('+_partName+') in a '+this.componentName+': no markupElemIds');
1307
1307
  }
1308
1308
  else if (this.markupElemIds[_partName]===undefined) {
1309
1309
  !this.isProduction && console.log('Warning, markupOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
@@ -33,7 +33,7 @@ HPropertyList = HControl.extend({
33
33
  clickY = y-this.contentView.pageY(),
34
34
  itemNum = Math.floor(clickY/this.options.rowHeight);
35
35
  if((clickY < 0) || (itemNum > this.valueTokens.length-1)){
36
- this.editor.hide();
36
+ this.editor && this.editor.hide();
37
37
  return;
38
38
  }
39
39
  this.editItem( itemNum );
@@ -355,7 +355,7 @@ HPropertyList = HControl.extend({
355
355
 
356
356
  // Returns type of item
357
357
  itemType: function( item ){
358
- return COMM.Values.type( item );
358
+ return this.typeChr( item );
359
359
  },
360
360
 
361
361
  // Translation from type code to type name
@@ -502,7 +502,7 @@ HPropertyList = HControl.extend({
502
502
  }
503
503
 
504
504
  this.selectedItem = itemNum;
505
- this.editorValue.set( COMM.Values.clone(this.valueTokens[itemNum]) );
505
+ this.editorValue.set( this.cloneObject(this.valueTokens[itemNum]) );
506
506
  this.editor.show();
507
507
  EVENT.changeActiveControl(this.editor);
508
508
  this.editor.offsetTo( 0, targetY );
@@ -511,7 +511,7 @@ HPropertyList = HControl.extend({
511
511
 
512
512
  // Starts tokenizing, when the value is changed.
513
513
  refreshValue: function(){
514
- if(this['propertyItems']===undefined){
514
+ if(this.propertyItems === undefined){
515
515
  return;
516
516
  }
517
517
  this.valueTokens = [];
@@ -531,7 +531,7 @@ HPropertyList = HControl.extend({
531
531
  }
532
532
 
533
533
  var i, token;
534
- if(this['propertyItems'] === undefined){
534
+ if(this.propertyItems === undefined){
535
535
  this.propertyItems = [];
536
536
  }
537
537
  var colHeight = 0, colId = 0;
@@ -155,7 +155,7 @@ HRadioButtonList = HListItemControl.extend({
155
155
 
156
156
  refreshValue: function(){
157
157
  var _value = this.value;
158
- if ( this.listItems && this.listItems.length !== 0 && this['valueMatrix'] !== undefined ) {
158
+ if ( this.listItems && this.listItems.length !== 0 && this.valueMatrix !== undefined ) {
159
159
  if ( this.radioButtonResponder === false ){
160
160
  this.radioButtonIndexValue = HValue.nu( false, 0 );
161
161
  this.radioButtonIndexValue.bind( this.valueMatrix );
@@ -39,7 +39,7 @@ HMiniMenu = HRadioButtonList.extend({
39
39
  if(y < 0){
40
40
  y = this.subComponentHeight%y;
41
41
  }
42
- if(this.options['menuItemGeom']){
42
+ if(this.options.menuItemGeom){
43
43
  if(this.options.menuItemGeom.width){
44
44
  w += this.options.menuItemGeom.width;
45
45
  }
@@ -59,7 +59,7 @@ HMiniMenu = HRadioButtonList.extend({
59
59
 
60
60
  refreshValue: function(){
61
61
  this.base();
62
- if(this.listItems && this.listItems.length !== 0 && this['valueMatrix'] !== undefined ) {
62
+ if(this.listItems && this.listItems.length !== 0 && this.valueMatrix !== undefined ) {
63
63
  for(var i=0;i<this.listItems.length;i++){
64
64
  if(this.listItems[i][0]===this.value){
65
65
  this.setLabel( this.listItems[i][1] );
@@ -1,16 +1,24 @@
1
1
  HTable = HControl.extend
2
2
  componentName: 'table'
3
- markupElemNames: [ 'header', 'subview' ]
3
+ markupElemNames: [ 'header', 'subview', 'grid' ]
4
4
  defaultEvents:
5
5
  resize: true
6
6
  controlDefaults: HControlDefaults.extend
7
- tableType: 'rows'
8
- constructor: (_opt)->
9
- @headerCols = false unless @headerCols?
10
- @sortDescending = [] unless @sortDescending?
11
- @colWidths = [] unless @colWidths?
12
- @colOptions = {} unless @colOptions?
13
- sortCol: 0
7
+ tableType: 'rows' # 'cols' not supported yet
8
+ constructor: (_view)->
9
+ @headerCols = false unless @headerCols? # array of strings
10
+ @sortDescending = [] unless @sortDescending? # column sorting by index; true for descending; false for ascending
11
+ @colWidths = [] unless @colWidths? # widths by column index; default 'auto'
12
+ @colClasses = {} unless @colClasses? # class by column index
13
+ @defaultColOptions = {} unless @defaultColOptions? # fallback default column options
14
+ @colOptions = {} unless @colOptions? # column class constructor options by column index
15
+ @defaultColClass = HStringView unless @defaultColClass? # fallback default column class
16
+ sortCol: 0 # the default sort column
17
+ useCellGrid: false # whether to use colored cells or not
18
+ cellBgColor: '#eee' # the average bg color
19
+ cellBgColorDiff: '#080808' # color to add/subtract for even/odd col/row
20
+ cellBorderWidth: 1 # cell border width in pixels
21
+ cellBorderColor: '#fff' # cell border color
14
22
  _destroyHeader: ->
15
23
  if @headerCols?
16
24
  _table = @
@@ -36,6 +44,65 @@ HTable = HControl.extend
36
44
  # _colView.rect.setLeft(_size[0])
37
45
  # _colView.rect.setWidth(_size[1])
38
46
  # _colView.drawRect()
47
+ _initCellBgColors: ->
48
+ _color1 = @options.cellBgColor
49
+ _colorDiff = @options.cellBgColorDiff
50
+ if _color1 == 'transparent'
51
+ @_cellBgColors = [ 'transparent', 'transparent', 'transparent' ]
52
+ return
53
+ else if not _colorDiff
54
+ @_cellBgColors = [ _color1, _color1, _color1 ]
55
+ return
56
+ _color0 = @hexColorSubtract( _color1, _colorDiff )
57
+ _color2 = @hexColorAdd( _color1, _colorDiff )
58
+ @_cellBgColors = [ _color0, _color1, _color2 ]
59
+ _cellBgColorOf: (_row, _col)->
60
+ _colorIndex = (_row%2) + (1-_col%2)
61
+ @_cellBgColors[_colorIndex]
62
+ _drawCellStyles: ->
63
+ if @_bgCells?
64
+ for _bgCellId in @_bgCells
65
+ ELEM.del( _bgCellId )
66
+ delete @_bgCells
67
+ return unless @colViews?
68
+ # the border width offset calculations are fubar; refactor when time available
69
+ @_bgCells = []
70
+ _parent = @markupElemIds.grid
71
+ _leftOffset = @headerSizes[0][0]
72
+ @_initCellBgColors()
73
+ _borderSize = @options.cellBorderWidth
74
+ _borderColor = @options.cellBorderColor
75
+ _borderStyle = _borderSize+'px solid '+_borderColor
76
+ _heightOffset = _borderSize
77
+ _height = 24-_heightOffset
78
+ _topAdd = 24
79
+ _halfBorderWidth = Math.floor(_borderSize*0.5)
80
+ _widthOffset = 6-_borderSize-_halfBorderWidth
81
+ _borderLeftOffset = 0-_halfBorderWidth
82
+ for _colView, _colNum in @colViews
83
+ [ _left, _width ] = @headerSizes[_colNum]
84
+ if _colNum == 0
85
+ _left = _borderLeftOffset
86
+ _width += _leftOffset+_borderLeftOffset
87
+ _width -= _halfBorderWidth if _borderSize % 2 == 1
88
+ else
89
+ _left += _borderLeftOffset-_widthOffset
90
+ _left -= _borderSize if _borderSize > 1
91
+ _width += _widthOffset
92
+ _width += _halfBorderWidth
93
+ _top = _borderLeftOffset
94
+ for _row, _rowNum in @_rows
95
+ @_bgCells << ELEM.make(
96
+ _parent, 'div',
97
+ styles:
98
+ backgroundColor: @_cellBgColorOf(_rowNum,_colNum)
99
+ border: _borderStyle
100
+ top: _top+'px'
101
+ left: _left+'px'
102
+ width: _width+'px'
103
+ height: _height+'px'
104
+ )
105
+ _top += _topAdd
39
106
  drawHeader: ->
40
107
  _elemIds = []
41
108
  _sizes = []
@@ -104,6 +171,7 @@ HTable = HControl.extend
104
171
  @colViews[_colNum].rect.offsetTo( _left, 0 )
105
172
  @colViews[_colNum].rect.setWidth( _width )
106
173
  @colViews[_colNum].drawRect()
174
+ @_drawCellStyles()
107
175
  drawSubviews: ->
108
176
  if @options.headerCols
109
177
  @drawHeader()
@@ -120,16 +188,15 @@ HTable = HControl.extend
120
188
  if @options.colOptions[_colNum]?
121
189
  _colOption = @options.colOptions[_colNum]
122
190
  else
123
- _colOption = {}
191
+ _colOption = @cloneObject( @options.defaultColOptions )
124
192
  if @options.colClasses[_colNum]?
125
193
  _colClass = @options.colClasses[_colNum]
126
194
  if typeof _colClass == 'function' and _colClass.hasAncestor? and _colClass.hasAncestor( HControl )
127
195
  return [ _colClass, _colOption ]
128
196
  else if _colClass instanceof Object and not _colClass.hasAncestor?
129
197
  for _className of _colClass
130
- if typeof _className == 'string'
131
- return [ @_findClassInNameSpace( _className ), _colClass[_className] ]
132
- else if typeof _colClass == 'string'
198
+ return [ @_findClassInNameSpace( _className ), _colClass[_className] ] if @typeChr(_className) == 's'
199
+ else if @typeChr(_colClass) == 's'
133
200
  return [ @_findClassInNameSpace( _colClass ), _colOption ]
134
201
  return [ @_findClassInNameSpace( @options.defaultColClass ), _colOption ]
135
202
  _destroyRows: ->
@@ -150,9 +217,9 @@ HTable = HControl.extend
150
217
  for _row, i in @_rows
151
218
  _rowSort.push( [ @value[i], _row ] )
152
219
  _nextCols = []
153
- if @options.sortOrder[_col]?
154
- if @options.sortOrder[_col] instanceof Array
155
- _nextCols = HVM.clone( @options.sortOrder[_col] )
220
+ if @options.sortOrder? and @options.sortOrder[_col]?
221
+ if @typeChr( @options.sortOrder[_col] ) == 'a'
222
+ _nextCols = @cloneObject( @options.sortOrder[_col] )
156
223
  else
157
224
  _nextCols = [ @options.sortOrder[_col] ]
158
225
  else
@@ -182,7 +249,7 @@ HTable = HControl.extend
182
249
  _col.hide()
183
250
  else
184
251
  _rowsVisible += 1
185
- for _col in _row
252
+ for _col, _colNum in _row
186
253
  _col.show()
187
254
  _col.rect.offsetTo( 0, _top )
188
255
  _col.drawRect()
@@ -206,7 +273,8 @@ HTable = HControl.extend
206
273
  else if @_rowsDrawn and _newData and @_rows.length == @value.length
207
274
  for _row, _rowNum in @value
208
275
  for _col, _colNum in _row
209
- @_rows[_rowNum][_colNum].setValue( _col )
276
+ _ctrl = @_rows[_rowNum][_colNum]
277
+ _ctrl.setValue( _col )
210
278
  @sortTableRows()
211
279
  else
212
280
  if @_rowsDrawn
@@ -219,11 +287,12 @@ HTable = HControl.extend
219
287
  _colOpts.value = _col
220
288
  _colOpts.tableRow = _rowNum
221
289
  _colOpts.tableCol = _colNum
222
- _rows[_rowNum][_colNum] = _colClass.new(
290
+ _ctrl = _colClass.new(
223
291
  [ 0, _top, null, _rowHeight, 0, null ],
224
292
  @colViews[_colNum],
225
293
  _colOpts
226
294
  )
295
+ _rows[_rowNum][_colNum] = _ctrl
227
296
  _top += _rowHeight
228
297
  for _colView in _colViews
229
298
  _colView.rect.setHeight(_top)
@@ -237,7 +306,9 @@ HTable = HControl.extend
237
306
  if @options.tableType == 'rows'
238
307
  @refreshTableRows(_newData)
239
308
  else if @options.tableType == 'cols'
309
+ console.log('ERROR; refreshTable: tableType \'cols\' not supported!')
240
310
  @refreshTableCols(_newData)
311
+ @_drawCellStyles() if @options.useCellGrid and _newData
241
312
  refreshValue: ->
242
313
  if @value instanceof Array
243
314
  @refreshTable( true )
@@ -23,3 +23,9 @@
23
23
  position: absolute; top: 24px; left: 0; right: 0; bottom: 0;
24
24
  overflow: auto; overflow-x: hidden;
25
25
  }
26
+ .default > .table_body > .table_grid {
27
+ position: absolute; top: 0; left: 0; overflow: visible;
28
+ }
29
+ .default > .table_body > .table_grid > div {
30
+ position: absolute; height: 24px;
31
+ }
@@ -1,2 +1,4 @@
1
1
  <div id="header#{_ID}" class="table_header"></div>
2
- <div id="subview#{_ID}" class="table_body"></div>
2
+ <div id="subview#{_ID}" class="table_body">
3
+ <div id="grid#{_ID}" class="table_grid"></div>
4
+ </div>
@@ -141,7 +141,12 @@ module RSence
141
141
  # loop through un-validated values and validate them
142
142
  check_ids = session_values[:check]
143
143
  check_ids.clone.each do |check_id|
144
- session_values[:by_id][check_id].tell( msg )
144
+ value = session_values[:by_id][check_id]
145
+ if value.nil?
146
+ warn "ses_id: #{msg.ses_id} nil value of value_id: #{check_id.inspect}"
147
+ else
148
+ value.tell( msg )
149
+ end
145
150
  end
146
151
 
147
152
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsence-pre
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0.18
4
+ version: 2.3.0.19
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-02-21 00:00:00.000000000 Z
13
+ date: 2013-02-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rsence-deps