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.
- data/VERSION +1 -1
- data/js/chat/chat_panel/chat_panel.coffee +2 -2
- data/js/comm/queue/queue.js +19 -0
- data/js/comm/transporter/transporter.js +29 -20
- data/js/comm/values/values.js +11 -319
- data/js/controls/button/themes/default/button_parts1.png +0 -0
- data/js/controls/dialogs/alert_sheet/alert_sheet.js +1 -0
- data/js/controls/onoffbutton/onoffbutton.coffee +1 -1
- data/js/core/elem/elem.coffee +3 -1
- data/js/core/util/util_methods/util_methods.coffee +271 -93
- data/js/datetime/calendar/calendar.coffee +1 -1
- data/js/datetime/timesheet/timesheet.js +3 -3
- data/js/foundation/control/control.js +1 -1
- data/js/foundation/control/valueaction/valueaction.js +2 -2
- data/js/foundation/control/valueresponder/valueresponder.js +4 -4
- data/js/foundation/json_renderer/json_renderer.js +42 -42
- data/js/foundation/view/view.js +8 -8
- data/js/lists/propertylist/propertylist.js +5 -5
- data/js/lists/radiobuttonlist/radiobuttonlist.js +1 -1
- data/js/menus/minimenu/minimenu.js +2 -2
- data/js/tables/table/table.coffee +89 -18
- data/js/tables/table/themes/default/table.css +6 -0
- data/js/tables/table/themes/default/table.html +3 -1
- data/lib/rsence/valuemanager.rb +6 -1
- metadata +2 -2
@@ -1,103 +1,281 @@
|
|
1
|
-
UtilMethods =
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
UtilMethods = (->
|
2
|
+
_classBase =
|
3
|
+
arrIncludes: (_arr,_what)->
|
4
|
+
_arr.indexOf(_what) != -1
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
# List of primitive object type's chars
|
7
|
+
_builtinTypeChr: [
|
8
|
+
'b' # boolean
|
9
|
+
'n' # number
|
10
|
+
's' # string
|
11
|
+
]
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
getValueById: (_id)->
|
14
|
+
COMM.Values.values[_id]
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
16
|
+
###
|
17
|
+
# Returns object type as a single-char string.
|
18
|
+
# Use this method to detect the type of the object given.
|
19
|
+
#
|
20
|
+
# Returns the type of the object given as a character code. Returns false,
|
21
|
+
# if unknown or unsupported objcet type.
|
22
|
+
#
|
23
|
+
# Returns:
|
24
|
+
# _One of the following:_
|
25
|
+
# - 'a': Array
|
26
|
+
# - 'h': Hash (Generic Object)
|
27
|
+
# - 'd': Date
|
28
|
+
# - 'b': Boolean (true/false)
|
29
|
+
# - 'n': Number (integers and floats)
|
30
|
+
# - 's': String
|
31
|
+
# - '~': Null
|
32
|
+
# - '-': Undefined
|
33
|
+
# - false: unknown
|
34
|
+
###
|
35
|
+
typeChr: (_obj)->
|
36
|
+
return '~' if _obj == null
|
37
|
+
return '-' unless _obj?
|
38
|
+
_typeChr = (typeof _obj).slice(0,1)
|
39
|
+
return _typeChr if @arrIncludes(@_builtinTypeChr,_typeChr)
|
40
|
+
if _typeChr == 'o'
|
41
|
+
return 'a' if _obj.constructor == Array
|
42
|
+
return 'h' if _obj.constructor == Object
|
43
|
+
return 'd' if _obj.constructor == Date
|
44
|
+
return false
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
baseStrToNum: (_str, _base)->
|
47
|
+
return null if 's' != @typeChr(_str)
|
48
|
+
_base = 10 unless _base?
|
49
|
+
parseInt(_str, _base)
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
baseNumToStr: (_num, _base)->
|
52
|
+
return null if 'n' != @typeChr(_num)
|
53
|
+
_base = 10 unless _base?
|
54
|
+
_num.toString(_base)
|
55
55
|
|
56
|
-
|
57
|
-
|
56
|
+
hexToNum: (_hex)->
|
57
|
+
@baseStrToNum(_hex,16)
|
58
58
|
|
59
|
-
|
60
|
-
|
59
|
+
numToHex: (_int)->
|
60
|
+
@baseNumToStr(_int,16)
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
62
|
+
base36ToNum: (_base36)->
|
63
|
+
@baseStrToNum(_base36,36)
|
64
|
+
|
65
|
+
numToBase36: (_num)->
|
66
|
+
@baseIntToStr(_num,36)
|
67
|
+
|
68
|
+
_hexColorLengths: [3,4,6,7]
|
69
|
+
_hexCharacters: ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f']
|
70
|
+
_hex3To6Ratio: 4097 # parseInt('1001',16)
|
71
|
+
_normalizeHexColorToNum: (_color)->
|
72
|
+
return null if @typeChr(_color) != 's'
|
73
|
+
_hexLen = _color.length
|
74
|
+
return null unless @arrIncludes(@_hexColorLengths,_hexLen)
|
75
|
+
_color = _color.toLowerCase()
|
76
|
+
_str = ''
|
77
|
+
for _chr, i in _color.split('')
|
78
|
+
continue if i == 0 and _chr == '#' and ( _hexLen == 4 or _hexLen == 7 )
|
79
|
+
return null unless @arrIncludes( @_hexCharacters, _chr )
|
80
|
+
_str += _chr
|
81
|
+
_num = @hexToNum( _str )
|
82
|
+
_num = 0 if _num < 0
|
83
|
+
_num = 16777215 if _num > 16777215
|
84
|
+
_num = _num*@_hex3To6Ratio if _hexLen < 6
|
85
|
+
return _num
|
86
|
+
_normalizeNumToHexColor: (_num)->
|
87
|
+
_num = 0 if _num < 0
|
88
|
+
_num = 16777215 if _num > 16777215
|
89
|
+
_str = @numToHex(_num)
|
90
|
+
_str = '0'+_str until _str.length == 6
|
91
|
+
if _str[0] == _str[1] and _str[2] == _str[3] and _str[4] == _str[5]
|
92
|
+
_str = _str[0]+_str[2]+_str[4]
|
93
|
+
return '#'+_str
|
92
94
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
95
|
+
hexColorAdd: (_hex1,_hex2)->
|
96
|
+
@_normalizeNumToHexColor(
|
97
|
+
@_normalizeHexColorToNum(_hex1) +
|
98
|
+
@_normalizeHexColorToNum(_hex2)
|
99
|
+
)
|
98
100
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
101
|
+
hexColorSubtract: (_hex1,_hex2)->
|
102
|
+
@_normalizeNumToHexColor(
|
103
|
+
@_normalizeHexColorToNum(_hex1) -
|
104
|
+
@_normalizeHexColorToNum(_hex2)
|
105
|
+
)
|
106
|
+
|
107
|
+
# Regular expression match/replace pairs for string escaping.
|
108
|
+
_stringSubstitutions: [
|
109
|
+
[(/\\/g), '\\\\'],
|
110
|
+
#[(/\b/g), '\\b'],
|
111
|
+
[(/\t/g), '\\t'],
|
112
|
+
[(/\n/g), '\\n'],
|
113
|
+
[(/\f/g), '\\f'],
|
114
|
+
[(/\r/g), '\\r'],
|
115
|
+
[(/"/g), '\\"']
|
116
|
+
]
|
117
|
+
# Returns a quoted string (escapes quotation marks and places quotes within)
|
118
|
+
_quoteString: (_str)->
|
119
|
+
for _substitution in @_stringSubstritutions
|
120
|
+
[ _substFrom, _substTo ] = _substitution
|
121
|
+
_str = _str.replace( _substFrom, _substTo )
|
122
|
+
'"'+_str+'"'
|
123
|
+
# (Deprecated/shouldfix): Encodes the native character set to url-encoded unicode.
|
124
|
+
_encodeString: (_str)->
|
125
|
+
console.log 'WARNING: '+'_'+'encodeString shouldn\'t be called, but was called with: '+_str
|
126
|
+
unescape( encodeURIComponent( _str ) )
|
127
|
+
# (Deprecated/shouldfix): Decodes the url-encoded unicode _str to the native character set.
|
128
|
+
_decodeString: (_str)->
|
129
|
+
console.log 'WARNING: '+'_'+'decodeString shouldn\'t be called, but was called with: '+_str
|
130
|
+
try
|
131
|
+
return decodeURIComponent( escape( _str ) )
|
132
|
+
catch e
|
133
|
+
console.log('_'+'decodeString failed for _'+'str: ',_str)
|
134
|
+
return _str
|
135
|
+
# Returns a decoded Array with the decoded content of Array _arr
|
136
|
+
_decodeArr: (_arr)->
|
137
|
+
_output = []
|
138
|
+
for _item in _arr
|
139
|
+
_output.push @decodeObject(_item)
|
140
|
+
_output
|
141
|
+
# Returns a decoded Object of the Object _hash
|
142
|
+
_decodeHash: (_hash)->
|
143
|
+
_output = {}
|
144
|
+
for _key, _value of _hash
|
145
|
+
_output[@decodeObject(_key)] = @decodeObject(_value)
|
146
|
+
_output
|
147
|
+
## = Description
|
148
|
+
# Decodes a JSON object. Decodes the url-encoded strings within.
|
149
|
+
#
|
150
|
+
# = Parameters
|
151
|
+
# +_ibj+:: A raw object with special characters contained.
|
152
|
+
#
|
153
|
+
# = Returns
|
154
|
+
# A version of the object with the contained strings decoded to unicode.
|
155
|
+
#
|
156
|
+
##
|
157
|
+
decodeObject: (_obj)->
|
158
|
+
return null unless _obj?
|
159
|
+
_type = @typeChr(_obj)
|
160
|
+
unless _type
|
161
|
+
console.log 'WARNING: decode of '+(typeof _obj)+' not possible'
|
162
|
+
return null
|
163
|
+
# return @_decodeString(_obj) if _type == 's'
|
164
|
+
return @_decodeArr(_obj) if _type == 'a'
|
165
|
+
return @_decodeHash(_obj) if _type == 'h'
|
166
|
+
_obj
|
167
|
+
if window.JSON?
|
168
|
+
_JSON = window.JSON
|
169
|
+
_fun = 'function'
|
170
|
+
_hasJSON = ( typeof _JSON['parse'] == _fun and typeof _JSON['stringify'] == _fun )
|
171
|
+
else
|
172
|
+
_hasJSON = false
|
173
|
+
if _hasJSON
|
174
|
+
_encodeDecodeMethods =
|
175
|
+
encodeObject: (_obj)->
|
176
|
+
try
|
177
|
+
return JSON.stringify( _obj )
|
178
|
+
catch e
|
179
|
+
console.log('invalid json:',_obj)
|
180
|
+
return "{}"
|
181
|
+
|
182
|
+
# decodeObject: (_obj)->
|
183
|
+
# return null unless _obj?
|
184
|
+
# _type = @typeChr(_obj)
|
185
|
+
# unless _type
|
186
|
+
# console.log 'WARNING: decode of '+(typeof _obj)+' not possible'
|
187
|
+
# return null
|
188
|
+
# return @_decodeString(_obj) if _type == 's'
|
189
|
+
# if _type == 'a' or _type == 'h'
|
190
|
+
# try
|
191
|
+
# return JSON.parse(_obj)
|
192
|
+
# catch e
|
193
|
+
# console.log e, _obj
|
194
|
+
# _obj
|
195
|
+
|
196
|
+
cloneObject: ( _obj )->
|
197
|
+
unless _obj?
|
198
|
+
console.log 'WARNING: clone of undefined returns null.' if _obj == undefined
|
199
|
+
return null
|
200
|
+
_type = @typeChr(_obj)
|
201
|
+
return null unless _type
|
202
|
+
return JSON.parse( JSON.stringify(_obj) ) if _type == 'a' or _type == 'h'
|
203
|
+
_obj
|
204
|
+
else
|
205
|
+
_encodeDecodeMethods =
|
206
|
+
# Returns the Array _arr as an encoded string
|
207
|
+
_encodeArr: (_arr)->
|
208
|
+
_output = []
|
209
|
+
for _item in _arr
|
210
|
+
_output.push @encodeObject(_item)
|
211
|
+
'['+_output.join(',')+']'
|
212
|
+
# Returns the Object _hash as an encoded string
|
213
|
+
_encodeHash: (_hash)->
|
214
|
+
_output = []
|
215
|
+
for _key, _value of _hash
|
216
|
+
_output.push @encodeObject(_key)+':'+@encodeObject(_value)
|
217
|
+
'{'+_output.join(',')+'}'
|
218
|
+
## = Description
|
219
|
+
# Encodes any object into an ASCII string. Special characters are url-encoded.
|
220
|
+
#
|
221
|
+
# = Parameters
|
222
|
+
# +_obj+:: Any object (including primary types)
|
223
|
+
#
|
224
|
+
# = Returns
|
225
|
+
# A +String+ representation of +_obj+
|
226
|
+
##
|
227
|
+
encodeObject: (_obj)->
|
228
|
+
return 'null' unless _obj?
|
229
|
+
_type = @typeChr(_obj)
|
230
|
+
unless _obj
|
231
|
+
console.log 'WARNING: encode of '+(typeof _obj)+' not possible'
|
232
|
+
return 'null'
|
233
|
+
return String(_obj) if _type == 'b' or _type == 'n'
|
234
|
+
return @_quoteString(_obj) if _type == 's'
|
235
|
+
# The above with uri-encoding, disabled for now:
|
236
|
+
# return @_quoteString( @_encodeString( _obj ) )
|
237
|
+
return @_encodeArr(_obj) if _type == 'a'
|
238
|
+
return @_encodeHash(_obj) if _type == 'h'
|
239
|
+
return '"@'+String(_obj.getTime()/1000)+'"' if _type == 'd'
|
240
|
+
'null'
|
241
|
+
## = Description
|
242
|
+
# Makes a deep copy of the object.
|
243
|
+
#
|
244
|
+
# When you use assignment of a js object, only primitive object
|
245
|
+
# types (strings, numbers and booleans) are copied. This method
|
246
|
+
# makes a deep (nested) clone of the input object.
|
247
|
+
#
|
248
|
+
# = Parameters
|
249
|
+
# +_obj+:: Any object
|
250
|
+
#
|
251
|
+
# = Returns
|
252
|
+
# A copy of the object
|
253
|
+
##
|
254
|
+
cloneObject: (_obj,_shallow)->
|
255
|
+
unless _obj?
|
256
|
+
console.log 'WARNING: clone of undefined returns null.' if _obj == undefined
|
257
|
+
return null
|
258
|
+
_type = @typeChr(_obj)
|
259
|
+
if _type == 'a'
|
260
|
+
_cloned = []
|
261
|
+
if _shallow
|
262
|
+
for _item, i in _obj
|
263
|
+
_cloned[i] = _item
|
264
|
+
else
|
265
|
+
for _item, i in _obj
|
266
|
+
_cloned[i] = @cloneObject( _item )
|
267
|
+
return _cloned
|
268
|
+
else if _type == 'h'
|
269
|
+
_cloned = {}
|
270
|
+
if _shallow
|
271
|
+
for _key, _value of _obj
|
272
|
+
_cloned[_key] = _value
|
273
|
+
else
|
274
|
+
for _key, _value of _obj
|
275
|
+
_cloned[_key] = @cloneObject( _item )
|
276
|
+
return _cloned
|
277
|
+
_obj
|
278
|
+
for _methodName, _methodValue of _encodeDecodeMethods
|
279
|
+
_classBase[_methodName] = _methodValue
|
280
|
+
return HClass.extend(_classBase)
|
281
|
+
)()
|
@@ -99,7 +99,7 @@ HCalendar = HControl.extend
|
|
99
99
|
## See HLocale for more details
|
100
100
|
localizedDays: ->
|
101
101
|
_str = HLocale.dateTime.strings
|
102
|
-
_arr =
|
102
|
+
_arr = @cloneObject( _str.weekDaysShort )
|
103
103
|
_arr.push( _arr.shift() )
|
104
104
|
_arr.unshift( _str.weekShort )
|
105
105
|
_arr
|
@@ -291,7 +291,7 @@ HTimeSheet = HControl.extend({
|
|
291
291
|
this.dragPreview.bringToFront();
|
292
292
|
this.dragPreview.show();
|
293
293
|
if( this.activateEditor( this.dragPreview ) ){
|
294
|
-
this.editor.createItem(
|
294
|
+
this.editor.createItem( this.cloneObject( this.dragPreview.value ) );
|
295
295
|
}
|
296
296
|
else {
|
297
297
|
this.dragPreview.hide();
|
@@ -375,7 +375,7 @@ HTimeSheet = HControl.extend({
|
|
375
375
|
if( this.activateEditor( this.dragPreview ) ){
|
376
376
|
// console.log('drag create');
|
377
377
|
this.dragCreated = true;
|
378
|
-
this.editor.createItem(
|
378
|
+
this.editor.createItem( this.cloneObject( this.dragPreview.value ) );
|
379
379
|
return true;
|
380
380
|
}
|
381
381
|
}
|
@@ -837,7 +837,7 @@ but not used and not guaranteed to be preserved:
|
|
837
837
|
|
838
838
|
// optimization that ensures the rect and previous value are different before redrawing
|
839
839
|
var
|
840
|
-
_valueStr =
|
840
|
+
_valueStr = this.encodeObject( this.value ),
|
841
841
|
_rectStr = this.rect.toString(),
|
842
842
|
_timeRangeStr = this.options.timeStart+':'+this.options.timeEnd,
|
843
843
|
_shaSum = this._sha.strSHA1( _valueStr+_rectStr+_timeRangeStr );
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
var
|
3
|
-
HValueAction =
|
3
|
+
HValueAction = UtilMethods.extend({
|
4
4
|
constructor: function( _rect, _parent, _options ){
|
5
5
|
if( _rect && _rect.hasAncestor && _rect.hasAncestor( HClass ) ){
|
6
6
|
_options = _parent;
|
@@ -17,7 +17,7 @@ HValueAction = HClass.extend({
|
|
17
17
|
if( _options.bind ){
|
18
18
|
var _valueObj = _options.bind;
|
19
19
|
if( typeof _valueObj == 'string' ){
|
20
|
-
_valueObj =
|
20
|
+
_valueObj = this.getValueById( _valueObj );
|
21
21
|
}
|
22
22
|
_valueObj.bind( this );
|
23
23
|
}
|
@@ -4,7 +4,7 @@
|
|
4
4
|
** It's implemented by default by +HControl+.
|
5
5
|
***/
|
6
6
|
var//RSence.Foundation
|
7
|
-
HValueResponder =
|
7
|
+
HValueResponder = UtilMethods.extend({
|
8
8
|
|
9
9
|
/** = Description
|
10
10
|
* Binds an HValue compatible instance to the component's valueObj. Also
|
@@ -35,7 +35,7 @@ HValueResponder = HClass.extend({
|
|
35
35
|
*
|
36
36
|
**/
|
37
37
|
valueDiffers: function(_value){
|
38
|
-
return (
|
38
|
+
return (this.encodeObject(_value) !== this.encodeObject(this.value));
|
39
39
|
},
|
40
40
|
|
41
41
|
/** = Description
|
@@ -53,7 +53,7 @@ HValueResponder = HClass.extend({
|
|
53
53
|
*
|
54
54
|
**/
|
55
55
|
setValue: function(_value) {
|
56
|
-
if(_value !== undefined && this
|
56
|
+
if(_value !== undefined && this.valueObj && this.valueDiffers(_value)) {
|
57
57
|
var _valueManager = COMM.Values;
|
58
58
|
this.value = _value;
|
59
59
|
if( !~_valueManager._builtinTypeChr.indexOf( _valueManager.type(_value) ) ){
|
@@ -62,7 +62,7 @@ HValueResponder = HClass.extend({
|
|
62
62
|
else {
|
63
63
|
this.valueObj.set( _value );
|
64
64
|
}
|
65
|
-
(this
|
65
|
+
(this.refresh !== undefined) && (typeof this.refresh === 'function') && this.refresh();
|
66
66
|
}
|
67
67
|
return this;
|
68
68
|
}
|
@@ -14,7 +14,7 @@
|
|
14
14
|
** features and documentation as it matures.
|
15
15
|
***/
|
16
16
|
//var//RSence.Foundation
|
17
|
-
COMM.JSONRenderer =
|
17
|
+
COMM.JSONRenderer = UtilMethods.extend({
|
18
18
|
|
19
19
|
version: 1.0,
|
20
20
|
|
@@ -26,7 +26,7 @@ COMM.JSONRenderer = HClass.extend({
|
|
26
26
|
* +_parent+: The parent view (or app) (Optional)
|
27
27
|
**/
|
28
28
|
constructor: function(_data, _parent){
|
29
|
-
if((_data
|
29
|
+
if((_data.type === 'GUITree') && (this.version >= _data.version)){
|
30
30
|
this.data = _data;
|
31
31
|
this.parent = _parent;
|
32
32
|
this.byId = {};
|
@@ -226,22 +226,22 @@ COMM.JSONRenderer = HClass.extend({
|
|
226
226
|
|
227
227
|
_class = this.findInScope( _className );
|
228
228
|
|
229
|
-
if (_class
|
229
|
+
if (_class.hasAncestor !== undefined){
|
230
230
|
_isAppClass = _class.hasAncestor( HApplication );
|
231
231
|
_isViewClass = _class.hasAncestor( HView );
|
232
232
|
}
|
233
233
|
|
234
|
-
_hasId = ( _dataNode
|
235
|
-
_hasName = ( _dataNode
|
234
|
+
_hasId = ( _dataNode.id !== undefined ) && ( typeof _dataNode.id === 'string' );
|
235
|
+
_hasName = ( _dataNode.name !== undefined ) && ( typeof _dataNode.name === 'string' );
|
236
236
|
|
237
237
|
if( _straightParams ){
|
238
238
|
_instance = this.initStraight( _class, _dataNode );
|
239
239
|
}
|
240
|
-
else if( _dataNode
|
241
|
-
_instance = this.initStraight( _class, _dataNode
|
240
|
+
else if( _dataNode.args !== undefined ){
|
241
|
+
_instance = this.initStraight( _class, _dataNode.args );
|
242
242
|
}
|
243
|
-
else if( _origNode && _origNode
|
244
|
-
_instance = this.initStraight( _class, _origNode
|
243
|
+
else if( _origNode && _origNode.args !== undefined ){
|
244
|
+
_instance = this.initStraight( _class, _origNode.args );
|
245
245
|
}
|
246
246
|
if( _instance ){
|
247
247
|
if( _hasId ){
|
@@ -255,11 +255,11 @@ COMM.JSONRenderer = HClass.extend({
|
|
255
255
|
|
256
256
|
// Currently only HView -derived classes are supported, so
|
257
257
|
// the rect is mandatory.
|
258
|
-
_rect = _dataNode
|
258
|
+
_rect = _dataNode.rect;
|
259
259
|
_hasRect = (_rect !== undefined) && (_rect instanceof Array || typeof _rect === 'string');
|
260
260
|
if( !_hasRect && _origNode){
|
261
|
-
_hasRect = _origNode
|
262
|
-
_rect = _hasRect?_origNode
|
261
|
+
_hasRect = _origNode.rect !== undefined;
|
262
|
+
_rect = _hasRect?_origNode.rect:null;
|
263
263
|
}
|
264
264
|
if( !_isViewClass ){
|
265
265
|
if( _hasRect ){
|
@@ -268,19 +268,19 @@ COMM.JSONRenderer = HClass.extend({
|
|
268
268
|
}
|
269
269
|
|
270
270
|
// Checks, if any sub-views are defined.
|
271
|
-
_hasSubviews = _dataNode
|
272
|
-
_subViews = _hasSubviews?_dataNode
|
271
|
+
_hasSubviews = _dataNode.subviews !== undefined;
|
272
|
+
_subViews = _hasSubviews?_dataNode.subviews:null;
|
273
273
|
if( !_hasSubviews && _origNode){
|
274
|
-
_hasSubviews = _origNode
|
275
|
-
_subViews = _hasSubviews?_origNode
|
274
|
+
_hasSubviews = _origNode.subviews !== undefined;
|
275
|
+
_subViews = _hasSubviews?_origNode.subviews:null;
|
276
276
|
}
|
277
277
|
|
278
278
|
// Checks, if any options are defined.
|
279
|
-
_hasOptions = _dataNode
|
280
|
-
_options = _hasOptions?_dataNode
|
279
|
+
_hasOptions = _dataNode.options !== undefined;
|
280
|
+
_options = _hasOptions?_dataNode.options:null;
|
281
281
|
if( !_hasOptions && _origNode){
|
282
|
-
_hasOptions = _origNode
|
283
|
-
_options = _hasOptions?_origNode
|
282
|
+
_hasOptions = _origNode.options !== undefined;
|
283
|
+
_options = _hasOptions?_origNode.options:null;
|
284
284
|
}
|
285
285
|
for( i=0; i < _autoOptionItems.length; i++ ){
|
286
286
|
_autoOptionItem = _autoOptionItems[i];
|
@@ -294,34 +294,34 @@ COMM.JSONRenderer = HClass.extend({
|
|
294
294
|
}
|
295
295
|
|
296
296
|
// JS Extension block
|
297
|
-
_hasExtension = _dataNode
|
298
|
-
_extension = _hasExtension?_dataNode
|
297
|
+
_hasExtension = _dataNode.extend !== undefined;
|
298
|
+
_extension = _hasExtension?_dataNode.extend:null;
|
299
299
|
if( !_hasExtension && _origNode){
|
300
|
-
_hasExtension = _origNode
|
301
|
-
_extension = _hasExtension?_origNode
|
300
|
+
_hasExtension = _origNode.extend !== undefined;
|
301
|
+
_extension = _hasExtension?_origNode.extend:null;
|
302
302
|
}
|
303
303
|
|
304
304
|
// JS Extension block
|
305
|
-
_hasBind = _dataNode
|
306
|
-
_bind = _hasBind?_dataNode
|
305
|
+
_hasBind = _dataNode.bind !== undefined;
|
306
|
+
_bind = _hasBind?_dataNode.bind:null;
|
307
307
|
if( !_hasBind && _origNode){
|
308
|
-
_hasBind = _origNode
|
309
|
-
_bind = _hasBind?_origNode
|
308
|
+
_hasBind = _origNode.bind !== undefined;
|
309
|
+
_bind = _hasBind?_origNode.bind:null;
|
310
310
|
}
|
311
311
|
|
312
|
-
_hasCall = _dataNode
|
312
|
+
_hasCall = _dataNode.call !== undefined;
|
313
313
|
if( _hasCall ){
|
314
|
-
_call = _dataNode
|
314
|
+
_call = _dataNode.call;
|
315
315
|
}
|
316
316
|
|
317
317
|
// JS Definition block
|
318
|
-
_hasDefinition = _dataNode
|
319
|
-
_definitions = _hasDefinition?_dataNode
|
318
|
+
_hasDefinition = _dataNode.define !== undefined;
|
319
|
+
_definitions = _hasDefinition?_dataNode.define:null;
|
320
320
|
if( !_hasDefinition && _origNode){
|
321
|
-
_hasDefinition = _origNode
|
322
|
-
_definitions = _hasDefinition?_origNode
|
321
|
+
_hasDefinition = _origNode.define !== undefined;
|
322
|
+
_definitions = _hasDefinition?_origNode.define:null;
|
323
323
|
}
|
324
|
-
if( _rect === null && _class
|
324
|
+
if( _rect === null && _class.hasAncestor && _class.hasAncestor( HView ) ) {
|
325
325
|
console.log( 'Ancestors include HView, but no rect defined!' );
|
326
326
|
}
|
327
327
|
|
@@ -365,16 +365,16 @@ COMM.JSONRenderer = HClass.extend({
|
|
365
365
|
if( _bind instanceof HValue ){
|
366
366
|
_options.valueObj = _bind;
|
367
367
|
}
|
368
|
-
else if(
|
369
|
-
_options.valueObj =
|
368
|
+
else if( this.getValueById(_bind) !== undefined ){
|
369
|
+
_options.valueObj = this.getValueById(_bind);
|
370
370
|
}
|
371
371
|
else {
|
372
372
|
console.log('renderNode warning; No such valueId:'+_bind);
|
373
373
|
}
|
374
374
|
}
|
375
375
|
else{
|
376
|
-
if(_options
|
377
|
-
_options.valueObj =
|
376
|
+
if(_options.valueObjId !== undefined){
|
377
|
+
_options.valueObj = this.getValueById(_options.valueObjId);
|
378
378
|
}
|
379
379
|
}
|
380
380
|
}
|
@@ -413,11 +413,11 @@ COMM.JSONRenderer = HClass.extend({
|
|
413
413
|
if( _bind instanceof HValue ){
|
414
414
|
_bind.bind( _instance );
|
415
415
|
}
|
416
|
-
else if(
|
417
|
-
|
416
|
+
else if( this.getValueById(_bind) !== undefined ){
|
417
|
+
this.getValueById(_bind).bind(_instance);
|
418
418
|
}
|
419
419
|
else {
|
420
|
-
console.log('renderNode warning; No such valueId:'
|
420
|
+
console.log('renderNode warning; No such valueId:',_bind);
|
421
421
|
}
|
422
422
|
}
|
423
423
|
}
|