rsence-pre 3.0.0.5 → 3.0.0.6

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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/client/conf/client_pkg.yaml +8 -8
  4. data/client/js/chat/speech_bubble/themes/default/speech_bubble.css +3 -3
  5. data/client/js/controls/button/button.coffee +45 -0
  6. data/client/js/controls/button/themes/default/button.css +39 -72
  7. data/client/js/controls/button/themes/default/button.html +14 -4
  8. data/client/js/controls/checkbox/checkbox.js +9 -8
  9. data/client/js/controls/checkbox/themes/default/checkbox.css +1 -1
  10. data/client/js/controls/checkbox/themes/default/checkbox.html +1 -0
  11. data/client/js/controls/clickbutton/clickbutton.coffee +44 -0
  12. data/client/js/controls/onoffbutton/themes/default/onoffbutton.css +20 -19
  13. data/client/js/controls/onoffbutton/themes/default/onoffbutton.html +1 -4
  14. data/client/js/controls/radiobutton/themes/default/radiobutton.css +1 -1
  15. data/client/js/controls/radiobutton/themes/default/radiobutton.html +1 -0
  16. data/client/js/controls/searchfield/searchfield.coffee +1 -1
  17. data/client/js/controls/searchfield/themes/default/searchfield.css +1 -1
  18. data/client/js/controls/stringview/themes/default/stringview.css +1 -1
  19. data/client/js/controls/tab/tab.js +17 -17
  20. data/client/js/controls/tab/themes/default/tab.css +16 -16
  21. data/client/js/controls/tab/themes/default/tab.html +1 -1
  22. data/client/js/controls/textarea/textarea.js +1 -1
  23. data/client/js/controls/textarea/themes/default/textarea.css +1 -1
  24. data/client/js/controls/textcontrol/themes/default/textcontrol.css +1 -2
  25. data/client/js/controls/uploader/themes/default/uploader.css +10 -62
  26. data/client/js/controls/uploader/themes/default/uploader.html +31 -25
  27. data/client/js/controls/uploader/uploader.coffee +10 -7
  28. data/client/js/controls/window/themes/default/window.css +2 -4
  29. data/client/js/core/elem/elem.coffee +4 -4
  30. data/client/js/core/event/event.js +11 -11
  31. data/client/js/datetime/calendar/themes/default/calendar.css +3 -3
  32. data/client/js/foundation/eventmanager/eventmanager.coffee +44 -1
  33. data/client/js/foundation/thememanager/thememanager.coffee +30 -17
  34. data/client/js/foundation/view/view.js +194 -192
  35. data/client/js/menus/menuitem/themes/default/menuitem.css +1 -1
  36. data/client/js/menus/minimenu/themes/default/minimenu.css +1 -1
  37. data/client/js/menus/minimenuitem/themes/default/minimenuitem.css +1 -1
  38. data/client/js/menus/popupmenu/themes/default/popupmenu.css +1 -1
  39. data/plugins/client_pkg/lib/client_pkg_build.rb +54 -53
  40. data/plugins/main/tmpl/index.html +1 -1
  41. metadata +4 -5
  42. data/client/js/controls/button/button.js +0 -78
  43. data/client/js/controls/button/themes/default/button_parts1.png +0 -0
  44. data/client/js/foundation/view/markupview/markupview.js +0 -95
@@ -3,7 +3,7 @@
3
3
  ** HView is the foundation class for all views. HView is useful for
4
4
  ** any type of view and control grouping. It is designed for easy extension
5
5
  ** and it's the foundation for HControl and all other controls.
6
- **
6
+ **
7
7
  ** The major differences between HView and HControl is that HView handles
8
8
  ** only visual representation and structurization. In addition to HView's
9
9
  ** features, HControl handles labels, values, events, states and such.
@@ -26,36 +26,36 @@ HView = UtilMethods.extend({
26
26
 
27
27
  isView: true, // attribute to check if the object is a view
28
28
  isCtrl: false, // attribute to check for if the object is a control
29
-
29
+
30
30
  /** Component specific theme path.
31
31
  **/
32
32
  themePath: null,
33
-
33
+
34
34
  /** True, if the component using absolute positioning.
35
35
  * False, if the component is using relative positioning.
36
36
  **/
37
37
  isAbsolute: true,
38
-
38
+
39
39
  /** The display mode to use.
40
40
  * Defaults to 'block'.
41
41
  * The other sane alternative is 'inline'.
42
42
  **/
43
43
  displayMode: 'block',
44
-
44
+
45
45
  /** The visual value of a component, usually a String.
46
46
  * See +#setLabel+.
47
47
  **/
48
48
  label: null,
49
-
49
+
50
50
  /** When true, calls the +refreshLabel+ method whenever
51
51
  * +self.label+ is changed.
52
52
  **/
53
53
  refreshOnLabelChange: true,
54
-
54
+
55
55
  /** Escapes HTML in the label when true.
56
56
  **/
57
57
  escapeLabelHTML: false,
58
-
58
+
59
59
  /** True, if the coordinates are right-aligned.
60
60
  * False, if the coordinates are left-aligned.
61
61
  * Uses flexRightOffset if true. Defined with 6-item arrays
@@ -63,7 +63,7 @@ HView = UtilMethods.extend({
63
63
  * Can be set directly using the setFlexRight method.
64
64
  **/
65
65
  flexRight: false,
66
-
66
+
67
67
  /** True, if the coordinates are left-aligned.
68
68
  * False, if the coordinates are right-aligned.
69
69
  * Uses the X-coordinate of rect, if true.
@@ -72,7 +72,7 @@ HView = UtilMethods.extend({
72
72
  * Can be set directly using the setFlexLeft method.
73
73
  **/
74
74
  flexLeft: true,
75
-
75
+
76
76
  /** True, if the coordinates are top-aligned.
77
77
  * False, if the coordinates are bottom-aligned.
78
78
  * Uses the Y-coordinate of rect, if true.
@@ -81,7 +81,7 @@ HView = UtilMethods.extend({
81
81
  * Can be set directly using the setFlexTop method.
82
82
  **/
83
83
  flexTop: true,
84
-
84
+
85
85
  /** True, if the coordinates are bottom-aligned.
86
86
  * False, if the coordinates are top-aligned.
87
87
  * Uses flexBottomOffset if true. Defined with 6-item arrays
@@ -89,61 +89,61 @@ HView = UtilMethods.extend({
89
89
  * Can be set directly using the setFlexRight method.
90
90
  **/
91
91
  flexBottom: false,
92
-
92
+
93
93
  /** The amount of pixels to offset from the right edge when
94
94
  * flexRight is true. Defined with 6-item arrays
95
95
  * for the _rect parameter of setRect or the constructor.
96
96
  * Can be set directly using the setFlexRight method.
97
97
  **/
98
98
  flexRightOffset: 0,
99
-
99
+
100
100
  /** The amount of pixels to offset from the bottom edge when
101
101
  * flexBottom is true.Defined with 6-item arrays
102
102
  * for the _rect parameter of setRect or the constructor.
103
103
  * Can be set directly using the setFlexBottom method.
104
104
  **/
105
105
  flexBottomOffset: 0,
106
-
106
+
107
107
  /** The drawn flag is false before the component is visually
108
108
  * drawn, it's true after it's drawn.
109
109
  **/
110
110
  drawn: false,
111
-
111
+
112
112
  /** The theme the component is constructed with. By default,
113
113
  * uses the HThemeManager.currentTheme specified at the time
114
114
  * of construction.
115
115
  **/
116
116
  theme: null,
117
-
117
+
118
118
  /** The preserveTheme flag prevents the view from being redrawn
119
119
  * if HThemeManager.currentTheme is changed after the view
120
120
  * has been drawn. Is true, if theme has been set.
121
121
  **/
122
122
  preserveTheme: false,
123
-
123
+
124
124
  /** The optimizeWidthOnRefresh flag, when enabled, allows
125
125
  * automatic width calculation for components that support
126
126
  * that feature.
127
127
  **/
128
- optimizeWidthOnRefresh: true,
129
-
128
+ optimizeWidthOnRefresh: false,
129
+
130
130
  /** The parent is the +_parent+ supplied to the constructor.
131
131
  * This is a complete object reference to the parent's name-space.
132
132
  **/
133
133
  parent: null,
134
-
134
+
135
135
  /** The parents is an array containing parent instances up to
136
136
  * the root controller level. The root controller is almost
137
137
  * always an instance of HApplication.
138
138
  **/
139
139
  parents: null,
140
-
140
+
141
141
  /** The viewId is the unique ID (serial number) of this view.
142
142
  * This means the view can be looked up globally based on its
143
143
  * id by using the +HSystem.views+ array.
144
144
  **/
145
145
  viewId: null,
146
-
146
+
147
147
  /** The appId is the unique ID (serial number) of the app process
148
148
  * acting as the root controller of the view tree of which this
149
149
  * view is a member.
@@ -151,47 +151,47 @@ HView = UtilMethods.extend({
151
151
  * id by using the +HSystem.apps+ array.
152
152
  **/
153
153
  appId: null,
154
-
154
+
155
155
  /** The app is the reference of the app process acting as
156
156
  * the root controller of the view tree of which this view is a
157
157
  * member.
158
158
  * This is a complete object reference to the app's name-space.
159
159
  **/
160
160
  app: null,
161
-
161
+
162
162
  /** The views array contains a list of sub-views of this view
163
163
  * by id. To access the object reference, use the +HSystem.views+
164
164
  * array with the id.
165
165
  **/
166
166
  views: null,
167
-
167
+
168
168
  /** The viewsZOrder array contains a list of sub-views ordered by
169
169
  * zIndex. To change the order, use the bringToFront,
170
170
  * sendToBack, bringForwards, sendBackwards, bringToFrontOf and
171
171
  * sentToBackOf methods.
172
172
  **/
173
173
  viewsZOrder: null,
174
-
174
+
175
175
  /** The isHidden flog reflects the visibility of the view.
176
176
  **/
177
177
  isHidden: false,
178
-
178
+
179
179
  /** The +HRect+ instance bound to +self+ using the +constructor+ or +setRect+.
180
180
  **/
181
181
  rect: null,
182
-
182
+
183
183
  /** An reference to the options block given as the constructor
184
184
  * parameter _options.
185
185
  **/
186
186
  options: null,
187
-
187
+
188
188
  /** The viewDefaults is a HViewDefaults object that is extended
189
189
  * in the constructor with the options block given. The format of
190
190
  * it is an Object.
191
191
  * It's only used when not extended via HControl, see HControl#controlDefaults.
192
192
  **/
193
193
  viewDefaults: HViewDefaults,
194
-
194
+
195
195
  /** = Description
196
196
  * Constructs the logic part of a HView.
197
197
  * The view still needs to be drawn on screen. To do that, call draw after
@@ -215,7 +215,7 @@ HView = UtilMethods.extend({
215
215
  * points, like: +( left, top, right, bottom )+.
216
216
  * Arrays with 6 items are a bit more complex (and powerful) as they can specify
217
217
  * the flexible offsets too.
218
- *
218
+ *
219
219
  * === The array indexes for a +_rect+ configured as an 4-item array:
220
220
  * Always left/top aligned, all items must be specified.
221
221
  * Index:: Description
@@ -300,10 +300,10 @@ HView = UtilMethods.extend({
300
300
  if(!this.isinherited){
301
301
  _options = (this.viewDefaults.extend(_options)).nu(this);
302
302
  }
303
-
303
+
304
304
  this.options = _options;
305
305
  this.label = _options.label;
306
-
306
+
307
307
  // Moved these to the top to ensure safe theming operation
308
308
  if( _options.theme ){
309
309
  this.theme = _options.theme;
@@ -316,41 +316,41 @@ HView = UtilMethods.extend({
316
316
  else {
317
317
  this.preserveTheme = true;
318
318
  }
319
-
319
+
320
320
  if(_options.visible === false) {
321
321
  this.isHidden = true;
322
322
  }
323
-
323
+
324
324
  // adds the parentClass as a "super" object
325
325
  this.parent = _parent;
326
-
326
+
327
327
  this.viewId = this.parent.addView(this);
328
328
  // the parent addView method adds this.parents
329
-
329
+
330
330
  this.appId = this.parent.appId;
331
331
  this.app = HSystem.apps[this.appId];
332
-
332
+
333
333
  // sub-view ids, index of HView-derived objects that are found in HSystem.views[viewId]
334
334
  this.views = [];
335
-
335
+
336
336
  // Sub-views in Z order.
337
337
  this.viewsZOrder = [];
338
-
338
+
339
339
  // Keep the view (and its sub-views) hidden until its drawn.
340
340
  this._createElement();
341
-
341
+
342
342
  // Set the geometry
343
343
  this.setRect(_rect);
344
-
344
+
345
345
  // Additional DOM element bindings are saved into this array so they can be
346
346
  // deleted from the element manager when the view gets destroyed.
347
347
  this._domElementBindings = [];
348
-
348
+
349
349
  if(!this.isinherited) {
350
350
  this.draw();
351
351
  }
352
352
  },
353
-
353
+
354
354
  /** = Description
355
355
  * When the +_flag+ is true, the view will be aligned to the right.
356
356
  * The +_px+ offset defines how many pixels from the parent's right
@@ -375,7 +375,7 @@ HView = UtilMethods.extend({
375
375
  this.flexRightOffset = _px;
376
376
  return this;
377
377
  },
378
-
378
+
379
379
  /** = Description
380
380
  * When the +_flag+ is true, the view will be aligned to the left (default).
381
381
  * The +_px+ offset defines how many pixels from the parent's left
@@ -401,7 +401,7 @@ HView = UtilMethods.extend({
401
401
  }
402
402
  return this;
403
403
  },
404
-
404
+
405
405
  /** = Description
406
406
  * When the +_flag+ is true, the view will be aligned to the top (default).
407
407
  * The +_px+ offset defines how many pixels from the parent's top
@@ -427,7 +427,7 @@ HView = UtilMethods.extend({
427
427
  }
428
428
  return this;
429
429
  },
430
-
430
+
431
431
  /** = Description
432
432
  * When the +_flag+ is true, the view will be aligned to the bottom.
433
433
  * The +_px+ offset defines how many pixels from the parent's bottom
@@ -452,10 +452,10 @@ HView = UtilMethods.extend({
452
452
  this.flexBottomOffset = _px;
453
453
  return this;
454
454
  },
455
-
455
+
456
456
  /** = Description
457
457
  * The +_flag+ enables or disables the absolute positioning mode.
458
- * (It's enabled by default). If absolute positioning mode is
458
+ * (It's enabled by default). If absolute positioning mode is
459
459
  * off, the coordinate system has little or no effect.
460
460
  *
461
461
  * = Parameters
@@ -471,10 +471,10 @@ HView = UtilMethods.extend({
471
471
  this.isAbsolute = _flag;
472
472
  return this;
473
473
  },
474
-
474
+
475
475
  /** = Description
476
476
  * The +_flag+ enables or disables the relative positioning mode.
477
- * (It's disabled by default). If relative positioning mode is
477
+ * (It's disabled by default). If relative positioning mode is
478
478
  * on, the coordinate system has little or no effect.
479
479
  *
480
480
  * = Parameters
@@ -490,7 +490,7 @@ HView = UtilMethods.extend({
490
490
  this.isAbsolute = (!_flag);
491
491
  return this;
492
492
  },
493
-
493
+
494
494
  /** = Description
495
495
  * Used by html theme templates to get the theme-specific full image path.
496
496
  *
@@ -507,7 +507,7 @@ HView = UtilMethods.extend({
507
507
  // return HThemeManager._componentGfxPath( _themeName, this.componentName, this.themePath );
508
508
  return HThemeManager.themePaths[_themeName];
509
509
  },
510
-
510
+
511
511
  /** = Description
512
512
  * Used by html theme templates to get the theme-specific full path
513
513
  * of the _fileName given.
@@ -524,7 +524,7 @@ HView = UtilMethods.extend({
524
524
  // return HThemeManager._componentGfxFile( _themeName, this.componentName, this.themePath, _fileName );
525
525
  return HThemeManager._buildThemePath( _fileName, _themeName );
526
526
  },
527
-
527
+
528
528
  /** --
529
529
  * = Description
530
530
  * The _makeElem method does the ELEM.make call to create
@@ -538,7 +538,7 @@ HView = UtilMethods.extend({
538
538
  ELEM.setAttr( this.elemId, 'view_id', this.viewId, true );
539
539
  ELEM.setAttr( this.elemId, 'elem_id', this.elemId, true );
540
540
  },
541
-
541
+
542
542
  /** --
543
543
  * = Description
544
544
  * The _setCSS method does the initial styling of the element.
@@ -556,7 +556,7 @@ HView = UtilMethods.extend({
556
556
  _cssStyle += _additional;
557
557
  ELEM.setCSS(this.elemId,_cssStyle);
558
558
  },
559
-
559
+
560
560
  /** --
561
561
  * = Description
562
562
  * The _getParentElemId method returns the ELEM ID of the parent.
@@ -566,7 +566,7 @@ HView = UtilMethods.extend({
566
566
  var _parent = this.parent;
567
567
  return ((_parent.elemId === undefined)?0:((_parent._getSubviewId===undefined)?0:_parent._getSubviewId()));
568
568
  },
569
-
569
+
570
570
  _getSubviewId: function(){
571
571
  if(this.markupElemIds&&this.markupElemIds.subview!==undefined){
572
572
  return this.markupElemIds.subview;
@@ -596,7 +596,7 @@ HView = UtilMethods.extend({
596
596
  this.textSelectable = !!_flag;
597
597
  this.updateTextSelectable();
598
598
  },
599
-
599
+
600
600
  /** --
601
601
  * = Description
602
602
  * The _createElement method calls the methods required to initialize the
@@ -605,10 +605,10 @@ HView = UtilMethods.extend({
605
605
  **/
606
606
  _createElement: function() {
607
607
  if(!this.elemId) {
608
-
608
+
609
609
  this._makeElem(this._getParentElemId());
610
610
  this._setCSS('');
611
-
611
+
612
612
  // Theme name == CSS class name
613
613
  if(this.preserveTheme){
614
614
  ELEM.addClassName( this.elemId, this.theme );
@@ -622,7 +622,7 @@ HView = UtilMethods.extend({
622
622
  this.updateTextSelectable();
623
623
  }
624
624
  },
625
-
625
+
626
626
  /** = Description
627
627
  * The +drawRect+ method refreshes the dimensions of the view.
628
628
  * It needs to be called to affect changes in the rect.
@@ -678,12 +678,15 @@ HView = UtilMethods.extend({
678
678
  if(this.drawn === false){
679
679
  _this._updateZIndex();
680
680
  }
681
-
681
+
682
682
  _this.drawn = true;
683
+ if( _this.themeStyle !== undefined ){
684
+ _this.themeStyle.call(_this);
685
+ }
683
686
  }
684
687
  return this;
685
688
  },
686
-
689
+
687
690
  /** --
688
691
  * This method updates the z-index property of the children of self.
689
692
  * It's essentially a wrapper for HSystem.updateZIndexOfChildren passed
@@ -693,7 +696,7 @@ HView = UtilMethods.extend({
693
696
  _updateZIndex: function() {
694
697
  HSystem.updateZIndexOfChildren(this.viewId);
695
698
  },
696
-
699
+
697
700
  /** --
698
701
  * This method updates the z-index property of the siblings of self.
699
702
  * It's essentially a wrapper for HSystem.updateZIndexOfChildren passed
@@ -703,11 +706,11 @@ HView = UtilMethods.extend({
703
706
  _updateZIndexAllSiblings: function() {
704
707
  HSystem.updateZIndexOfChildren(this.parent.viewId);
705
708
  },
706
-
709
+
707
710
  /** = Description
708
711
  * The higher level draw wrapper for drawRect, drawMarkup and drawSubviews.
709
712
  * Finally calls refresh.
710
- *
713
+ *
711
714
  * = Returns
712
715
  * +self+
713
716
  *
@@ -757,7 +760,7 @@ HView = UtilMethods.extend({
757
760
  this.refresh();
758
761
  return this;
759
762
  },
760
-
763
+
761
764
  /** = Description
762
765
  * Called once, before the layout of the view is initially drawn.
763
766
  * Doesn't do anything by itself, but provides an extension point.
@@ -765,7 +768,7 @@ HView = UtilMethods.extend({
765
768
  **/
766
769
  firstDraw: function(){
767
770
  },
768
-
771
+
769
772
  /** = Description
770
773
  * Called once, when the layout of the view is initially drawn.
771
774
  * Doesn't do anything by itself, but provides an extension point for making
@@ -774,32 +777,7 @@ HView = UtilMethods.extend({
774
777
  **/
775
778
  drawSubviews: function(){
776
779
  },
777
-
778
- /** --
779
- * Loads the markup from theme manager. If this.preserveTheme is set to true,
780
- * the this.theme is used for loading the markup. Otherwise the currently
781
- * active theme is used.
782
- * ++
783
- **/
784
- // _loadMarkup: function() {
785
- // var _themeName, _themeData, _markup, _markupFns;
786
- // if (this.preserveTheme) {
787
- // _themeName = this.theme;
788
- // }
789
- // else {
790
- // _themeName = HThemeManager.currentTheme;
791
- // }
792
- // _themeData = HThemeManager.getMarkup( _themeName, this.componentName, this.themePath );
793
- // if(_themeData === false && !this.isProduction){
794
- // console.log('Warning: Markup template for "'+this.componentName+'" using theme "'+_themeName+'" not loaded.');
795
- // }
796
- // _markup = _themeData[0];
797
- // _markupFns = _themeData[1];
798
- // this.markup = _markup;
799
- // this.markupFns = _markupFns;
800
- // return (_markup !== false);
801
- // },
802
-
780
+
803
781
  /** = Description
804
782
  * Replaces the contents of the view's DOM element with html from the theme specific html file.
805
783
  *
@@ -808,12 +786,6 @@ HView = UtilMethods.extend({
808
786
  **/
809
787
  markupElemNames: ['bg', 'label', 'state', 'control', 'value', 'subview'],
810
788
  drawMarkup: function() {
811
- // ELEM.setStyle(this.elemId, 'display', 'none', true);
812
-
813
- // continue processing from here on:
814
- // var _markupStatus = this._loadMarkup();
815
-
816
- // this.bindMarkupVariables();
817
789
  var _themeName, _markup;
818
790
  if (this.preserveTheme) {
819
791
  _themeName = this.theme;
@@ -828,17 +800,45 @@ HView = UtilMethods.extend({
828
800
  for(var i=0; i < this.markupElemNames.length; i++ ) {
829
801
  var _partName = this.markupElemNames[ i ],
830
802
  _elemName = _partName + this.elemId,
831
- _htmlIdMatch = ' id="' + _elemName + '"';
803
+ _htmlIdMatch = 'id="' + _elemName + '"';
832
804
  if( ~_markup.indexOf( _htmlIdMatch ) ) {
833
805
  this.markupElemIds[ _partName ] = this.bindDomElement( _elemName );
834
806
  }
835
807
  }
808
+ if( this.themeStyle !== undefined ){
809
+ this.themeStyle.call(this);
810
+ }
811
+ }
812
+ return this;
813
+ },
814
+
815
+ /** = Description
816
+ * Sets or unsets the _cssClass into a DOM element that goes by the ID
817
+ * _elementId.
818
+ *
819
+ * = Parameters
820
+ * +_elementId+:: ID of the DOM element, or the element itself, to be
821
+ * modified.
822
+ * +_cssClass+:: Name of the CSS class to be added or removed.
823
+ * +_setOn+:: Boolean value that tells should the CSS class be added or
824
+ * removed.
825
+ *
826
+ * = Returns
827
+ * +self+
828
+ *
829
+ **/
830
+ toggleCSSClass: function(_elementId, _cssClass, _setOn) {
831
+ if(_elementId) {
832
+ if (_setOn) {
833
+ ELEM.addClassName(_elementId, _cssClass);
834
+ }
835
+ else {
836
+ ELEM.delClassName(_elementId, _cssClass);
837
+ }
836
838
  }
837
-
838
- // ELEM.setStyle(this.elemId, 'display', this.displayMode );
839
839
  return this;
840
840
  },
841
-
841
+
842
842
  /** = Description
843
843
  * Replaces the contents of the view's DOM element with custom html.
844
844
  *
@@ -853,7 +853,7 @@ HView = UtilMethods.extend({
853
853
  ELEM.setHTML( this.elemId, _html );
854
854
  return this;
855
855
  },
856
-
856
+
857
857
  /** = Description
858
858
  * Wrapper for setHTML, sets escaped html, if tags and such are present.
859
859
  *
@@ -866,7 +866,7 @@ HView = UtilMethods.extend({
866
866
  setText: function( _text ) {
867
867
  return this.setHTML( this.escapeHTML( _text ) );
868
868
  },
869
-
869
+
870
870
  /** = Description
871
871
  * Method to escape HTML from text.
872
872
  *
@@ -895,7 +895,7 @@ HView = UtilMethods.extend({
895
895
  [ new RegExp( /</gmi ), '&lt;' ],
896
896
  [ new RegExp( /\n/gmi ), '<br>' ]
897
897
  ],
898
-
898
+
899
899
  /** = Description
900
900
  *
901
901
  * This method should be extended in order to redraw only specific parts. The
@@ -912,15 +912,18 @@ HView = UtilMethods.extend({
912
912
  // constructor when setRect() is initially called.
913
913
  this.drawRect();
914
914
  }
915
- if(this.optimizeWidthOnRefresh) {
916
- this.optimizeWidth();
917
- }
918
915
  if(this.refreshOnLabelChange){
919
916
  this.refreshLabel();
920
917
  }
918
+ if( this.themeStyle !== undefined && typeof this.themeStyle === 'function' ){
919
+ this.themeStyle.call(this);
920
+ }
921
+ if(this.optimizeWidthOnRefresh && this.options.pack) {
922
+ this.optimizeWidth();
923
+ }
921
924
  return this;
922
925
  },
923
-
926
+
924
927
  /** Gets the size of the parent. If the parent is the document body, uses the browser window size.
925
928
  **/
926
929
  parentSize: function(){
@@ -958,14 +961,14 @@ HView = UtilMethods.extend({
958
961
  return [ _width, _height ];
959
962
  }
960
963
  },
961
-
964
+
962
965
  /** Returns the maximum rect using the #parentSize.
963
966
  **/
964
967
  maxRect: function(){
965
968
  var _parentSize = this.parentSize();
966
969
  return [ 0, 0, _parentSize[0], _parentSize[1] ];
967
970
  },
968
-
971
+
969
972
  minWidth: 0,
970
973
  setMinWidth: function(_minWidth){
971
974
  if( typeof _minWidth === 'number' ){
@@ -986,7 +989,7 @@ HView = UtilMethods.extend({
986
989
  console.log('warning: setMinHeight( '+(typeof _minHeight)+' '+_minHeight+' ) should be a number; value ignored!');
987
990
  }
988
991
  },
989
-
992
+
990
993
  /** = Description
991
994
  * Replaces the rect of the component with a new HRect instance and
992
995
  * then refreshes the display.
@@ -1033,7 +1036,7 @@ HView = UtilMethods.extend({
1033
1036
  _parentWidth = _parentSize[0];
1034
1037
  _parentHeight = _parentSize[1];
1035
1038
  }
1036
-
1039
+
1037
1040
  if( !this.isProduction ){
1038
1041
  if( (!_validLeftOffset && !_validRightOffset) ||
1039
1042
  (!_validTopOffset && !_validBottomOffset) ){
@@ -1044,7 +1047,7 @@ HView = UtilMethods.extend({
1044
1047
  console.log(_throwPrefix + 'the (height or width) must be specified unless both (left and top) or (top and bottom) are specified.');
1045
1048
  }
1046
1049
  }
1047
-
1050
+
1048
1051
  if(_validLeftOffset && _validWidth && !_validRightOffset){
1049
1052
  _right = _leftOffset + _width;
1050
1053
  }
@@ -1083,7 +1086,7 @@ HView = UtilMethods.extend({
1083
1086
  _right = _leftOffset;
1084
1087
  }
1085
1088
  }
1086
-
1089
+
1087
1090
  if(_validTopOffset && _validHeight && !_validBottomOffset){
1088
1091
  _bottom = _topOffset + _height;
1089
1092
  }
@@ -1142,7 +1145,7 @@ HView = UtilMethods.extend({
1142
1145
  console.log(' rect array:', _rect );
1143
1146
  console.log('---------------------------------------------');
1144
1147
  }
1145
-
1148
+
1146
1149
  }
1147
1150
  else if (!this.isProduction){
1148
1151
  console.log(_throwPrefix + 'the length has to be either 4 or 6.');
@@ -1155,7 +1158,7 @@ HView = UtilMethods.extend({
1155
1158
  this.refresh();
1156
1159
  return this;
1157
1160
  },
1158
-
1161
+
1159
1162
  /** = Description
1160
1163
  * Sets any arbitrary style of the main DOM element of the component.
1161
1164
  * Utilizes Element Manager's drawing queue / cache to perform the action.
@@ -1175,7 +1178,7 @@ HView = UtilMethods.extend({
1175
1178
  }
1176
1179
  return this;
1177
1180
  },
1178
-
1181
+
1179
1182
  setStyles: function(_styles){
1180
1183
  var _stylesObjType = this.typeChr(_styles);
1181
1184
  if(_stylesObjType==='a'){
@@ -1189,7 +1192,7 @@ HView = UtilMethods.extend({
1189
1192
  }
1190
1193
  return this;
1191
1194
  },
1192
-
1195
+
1193
1196
  setStylesArray: function(_styles){
1194
1197
  var
1195
1198
  _styleItem, _styleKey, _styleValue, i = 0;
@@ -1201,7 +1204,7 @@ HView = UtilMethods.extend({
1201
1204
  }
1202
1205
  return this;
1203
1206
  },
1204
-
1207
+
1205
1208
  setStylesHash: function(_styles){
1206
1209
  var
1207
1210
  _styleKey, _styleValue;
@@ -1211,7 +1214,7 @@ HView = UtilMethods.extend({
1211
1214
  }
1212
1215
  return this;
1213
1216
  },
1214
-
1217
+
1215
1218
  /** = Description
1216
1219
  * Returns a style of the main DOM element of the component.
1217
1220
  * Utilizes +ELEM+ cache to perform the action.
@@ -1229,7 +1232,7 @@ HView = UtilMethods.extend({
1229
1232
  }
1230
1233
  return '';
1231
1234
  },
1232
-
1235
+
1233
1236
  /** = Description
1234
1237
  * Sets a style for a specified markup element that has been bound to this
1235
1238
  * view.
@@ -1255,7 +1258,7 @@ HView = UtilMethods.extend({
1255
1258
  }
1256
1259
  return this;
1257
1260
  },
1258
-
1261
+
1259
1262
  /** = Description
1260
1263
  * Returns a style of a specified markup element that has been bound to this
1261
1264
  * view.
@@ -1278,7 +1281,7 @@ HView = UtilMethods.extend({
1278
1281
  }
1279
1282
  return ELEM.getStyle(this.markupElemIds[_partName], _name, _force);
1280
1283
  },
1281
-
1284
+
1282
1285
  /** = Description
1283
1286
  * Sets a style of a specified markup element that has been bound to this
1284
1287
  * view.
@@ -1303,7 +1306,7 @@ HView = UtilMethods.extend({
1303
1306
  }
1304
1307
  return this;
1305
1308
  },
1306
-
1309
+
1307
1310
  /** = Description
1308
1311
  * Returns a style of a specified markup element that has been bound to this
1309
1312
  * view.
@@ -1325,7 +1328,7 @@ HView = UtilMethods.extend({
1325
1328
  }
1326
1329
  return ELEM.getHTML(this.markupElemIds[_partName]);
1327
1330
  },
1328
-
1331
+
1329
1332
  /** = Description
1330
1333
  * Sets a element attribute of the view's cell.
1331
1334
  *
@@ -1381,7 +1384,7 @@ HView = UtilMethods.extend({
1381
1384
  }
1382
1385
  return this;
1383
1386
  },
1384
-
1387
+
1385
1388
  /** = Description
1386
1389
  * Returns a element attribute of a specified markup element that has been bound to this
1387
1390
  * view.
@@ -1438,7 +1441,7 @@ HView = UtilMethods.extend({
1438
1441
  this.isHidden = true;
1439
1442
  return this;
1440
1443
  },
1441
-
1444
+
1442
1445
  /** = Description
1443
1446
  * Restores the visibility of the component's main DOM element (and its children).
1444
1447
  *
@@ -1452,7 +1455,7 @@ HView = UtilMethods.extend({
1452
1455
  this.isHidden = false;
1453
1456
  return this;
1454
1457
  },
1455
-
1458
+
1456
1459
  /** = Description
1457
1460
  * Toggles between hide and show.
1458
1461
  *
@@ -1468,7 +1471,7 @@ HView = UtilMethods.extend({
1468
1471
  }
1469
1472
  return this;
1470
1473
  },
1471
-
1474
+
1472
1475
  /** = Description
1473
1476
  * Call this if you need to remove a component from its parent's views array without
1474
1477
  * destroying the DOM element itself, making it in effect a view without parent.
@@ -1480,10 +1483,10 @@ HView = UtilMethods.extend({
1480
1483
  **/
1481
1484
  remove: function() {
1482
1485
  if( this.parent ) {
1483
-
1486
+
1484
1487
  var _viewZIdx = this.parent.viewsZOrder.indexOf(this.viewId),
1485
1488
  _viewPIdx = this.parent.views.indexOf(this.viewId);
1486
-
1489
+
1487
1490
  this.parent.views.splice(_viewPIdx,1);
1488
1491
  HSystem.delView(this.viewId);
1489
1492
  this.parent.viewsZOrder.splice( _viewZIdx, 1 );
@@ -1491,14 +1494,14 @@ HView = UtilMethods.extend({
1491
1494
  if(~_sysUpdateZIndexOfChildrenBufferIndex){
1492
1495
  HSystem._updateZIndexOfChildrenBuffer.splice( _sysUpdateZIndexOfChildrenBufferIndex, 1 );
1493
1496
  }
1494
-
1497
+
1495
1498
  this._updateZIndexAllSiblings();
1496
1499
  this.parent = null;
1497
1500
  this.parents = [];
1498
1501
  }
1499
1502
  return this;
1500
1503
  },
1501
-
1504
+
1502
1505
  /** = Description
1503
1506
  * Deletes the component and all its children.
1504
1507
  * Should normally be called from the parent.
@@ -1527,7 +1530,7 @@ HView = UtilMethods.extend({
1527
1530
  }
1528
1531
  // this._domElementBindings = [];
1529
1532
  }
1530
-
1533
+
1531
1534
  if( this._ieNoThrough !== null ){
1532
1535
  ELEM.del( this._ieNoThrough );
1533
1536
  }
@@ -1551,7 +1554,7 @@ HView = UtilMethods.extend({
1551
1554
  var _this = this;
1552
1555
  setTimeout(function(){_this.die();},10);
1553
1556
  },
1554
-
1557
+
1555
1558
  /** Recursive idle poller. Should be extended if functionality is desired.
1556
1559
  **/
1557
1560
  // onIdle: function() {
@@ -1559,7 +1562,7 @@ HView = UtilMethods.extend({
1559
1562
  // HSystem.views[this.views[i]].onIdle();
1560
1563
  // }
1561
1564
  //},
1562
-
1565
+
1563
1566
  /** Used by addView to build a parents array of parent classes.
1564
1567
  **/
1565
1568
  buildParents: function(_viewId){
@@ -1571,12 +1574,12 @@ HView = UtilMethods.extend({
1571
1574
  }
1572
1575
  _view.parents.push(this);
1573
1576
  },
1574
-
1577
+
1575
1578
  /** = Description
1576
- * Adds a sub-view / component to the view. Called from inside the
1577
- * HView#constructor and should be automatic for all components that accept
1578
- * the 'parent' parameter, usually the second argument, after the HRect. May
1579
- * also be used to attach a freely floating component (removed with remove)
1579
+ * Adds a sub-view / component to the view. Called from inside the
1580
+ * HView#constructor and should be automatic for all components that accept
1581
+ * the 'parent' parameter, usually the second argument, after the HRect. May
1582
+ * also be used to attach a freely floating component (removed with remove)
1580
1583
  * to another component.
1581
1584
  *
1582
1585
  * = Parameter
@@ -1589,13 +1592,13 @@ HView = UtilMethods.extend({
1589
1592
  addView: function(_view) {
1590
1593
  var _viewId = HSystem.addView(_view);
1591
1594
  this.views.push(_viewId);
1592
-
1595
+
1593
1596
  this.buildParents(_viewId);
1594
1597
  this.viewsZOrder.push(_viewId);
1595
-
1598
+
1596
1599
  return _viewId;
1597
1600
  },
1598
-
1601
+
1599
1602
  /** = Description
1600
1603
  * Call this if you need to remove a child view from this view without
1601
1604
  * destroying its element, making it in effect a view without parent.
@@ -1612,7 +1615,7 @@ HView = UtilMethods.extend({
1612
1615
  this.app.removeView( _viewId ); // no reason to duplicate this functionality here
1613
1616
  return this;
1614
1617
  },
1615
-
1618
+
1616
1619
  /** = Description
1617
1620
  * Call this if you need to remove a child view from this view, destroying its
1618
1621
  * child elements recursively and removing all DOM elements too.
@@ -1627,7 +1630,7 @@ HView = UtilMethods.extend({
1627
1630
  HSystem.views[_viewId].die();
1628
1631
  return this;
1629
1632
  },
1630
-
1633
+
1631
1634
  /** = Description
1632
1635
  * Returns bounds rectangle that defines the size and coordinate system
1633
1636
  * of the component. This should be identical to the rectangle used in
@@ -1640,13 +1643,13 @@ HView = UtilMethods.extend({
1640
1643
  bounds: function() {
1641
1644
  // Could be cached.
1642
1645
  var _bounds = new HRect(this.rect);
1643
-
1646
+
1644
1647
  _bounds.offsetTo(0,0);
1645
-
1648
+
1646
1649
  return _bounds;
1647
1650
  },
1648
-
1649
-
1651
+
1652
+
1650
1653
  /** = Description
1651
1654
  * This method resizes the view, without moving its left and top sides.
1652
1655
  * It adds horizontal coordinate units to the width and vertical units to
@@ -1706,7 +1709,7 @@ HView = UtilMethods.extend({
1706
1709
  },
1707
1710
 
1708
1711
  /** = Description
1709
- * This method moves the view to a new coordinate. It adjusts the
1712
+ * This method moves the view to a new coordinate. It adjusts the
1710
1713
  * left and top components of the frame rectangle accordingly.
1711
1714
  * Since a View's frame rectangle must be aligned on screen pixels, only
1712
1715
  * integral values should be passed to this method. Values with
@@ -1731,10 +1734,10 @@ HView = UtilMethods.extend({
1731
1734
  this.drawRect();
1732
1735
  return this;
1733
1736
  },
1734
-
1737
+
1735
1738
  /** = Description
1736
1739
  * Alias method for offsetTo.
1737
- *
1740
+ *
1738
1741
  * = Returns
1739
1742
  * +self+
1740
1743
  *
@@ -1743,7 +1746,7 @@ HView = UtilMethods.extend({
1743
1746
  this.offsetTo.apply(this, arguments);
1744
1747
  return this;
1745
1748
  },
1746
-
1749
+
1747
1750
  /** = Description
1748
1751
  * This method re-positions the view without changing its size.
1749
1752
  * It adds horizontal coordinate units to the x coordinate and vertical
@@ -1769,7 +1772,7 @@ HView = UtilMethods.extend({
1769
1772
  this.drawRect();
1770
1773
  return this;
1771
1774
  },
1772
-
1775
+
1773
1776
  /** = Description
1774
1777
  * Alias method for offsetBy.
1775
1778
  *
@@ -1798,7 +1801,7 @@ HView = UtilMethods.extend({
1798
1801
  }
1799
1802
  return this;
1800
1803
  },
1801
-
1804
+
1802
1805
  /** = Description
1803
1806
  * Brings itself to the front of the given view by changing its Z-Index.
1804
1807
  * Only works on sibling views.
@@ -1818,7 +1821,7 @@ HView = UtilMethods.extend({
1818
1821
  }
1819
1822
  return this;
1820
1823
  },
1821
-
1824
+
1822
1825
  /** = Description
1823
1826
  * Sends itself to the back of the given view by changing its Z-Index.
1824
1827
  * Only works on sibling views.
@@ -1838,7 +1841,7 @@ HView = UtilMethods.extend({
1838
1841
  }
1839
1842
  return this;
1840
1843
  },
1841
-
1844
+
1842
1845
  /** = Description
1843
1846
  * Sends itself one step backward by changing its Z-Index.
1844
1847
  *
@@ -1855,7 +1858,7 @@ HView = UtilMethods.extend({
1855
1858
  }
1856
1859
  return this;
1857
1860
  },
1858
-
1861
+
1859
1862
  /** = Description
1860
1863
  * Brings itself one step forward by changing its Z-Index.
1861
1864
  *
@@ -1872,7 +1875,7 @@ HView = UtilMethods.extend({
1872
1875
  }
1873
1876
  return this;
1874
1877
  },
1875
-
1878
+
1876
1879
 
1877
1880
  /** = Description
1878
1881
  * Sends the view to the back by changing its Z-Index.
@@ -1905,7 +1908,7 @@ HView = UtilMethods.extend({
1905
1908
  // Returns the z-order of this item as seen by the parent.
1906
1909
  return this.parent.viewsZOrder.indexOf(this.viewId);
1907
1910
  },
1908
-
1911
+
1909
1912
  /** = Description
1910
1913
  * Measures the characters encoded in length bytes of the string - or,
1911
1914
  * if no length is specified, the entire string up to the null character,
@@ -1938,44 +1941,44 @@ HView = UtilMethods.extend({
1938
1941
  if (!_wrap){
1939
1942
  _extraCss += 'white-space:nowrap;';
1940
1943
  }
1941
-
1942
1944
  var
1943
1945
  _stringParent = ELEM.make(_elemId,'div'),
1944
1946
  _stringElem = ELEM.make(_stringParent,'span');
1945
1947
  ELEM.setCSS(_stringElem, "visibility:hidden;"+_extraCss);
1946
1948
  ELEM.setHTML(_stringElem, _string);
1949
+ ELEM.flushLoop();
1947
1950
  var _visibleSize=ELEM.getSize(_stringElem);
1948
1951
  ELEM.del(_stringElem); ELEM.del(_stringParent);
1949
1952
  return [_visibleSize[0]+_visibleSize[0]%2,_visibleSize[1]+_visibleSize[1]%2];
1950
1953
  },
1951
-
1954
+
1952
1955
  /** Returns the string width
1953
1956
  **/
1954
1957
  stringWidth: function(_string, _length, _elemId, _extraCss){
1955
1958
  return this.stringSize(_string, _length, _elemId, false, _extraCss)[0];
1956
1959
  },
1957
-
1960
+
1958
1961
  /** Returns the string height.
1959
1962
  **/
1960
1963
  stringHeight: function(_string, _length, _elemId, _extraCss){
1961
1964
  return this.stringSize(_string, _length, _elemId, true, _extraCss)[1];
1962
1965
  },
1963
-
1966
+
1964
1967
  /** Returns the X coordinate that has the scrolled position calculated.
1965
1968
  **/
1966
1969
  pageX: function() {
1967
1970
  return ELEM._getVisibleLeftPosition( this.elemId );
1968
1971
  },
1969
-
1972
+
1970
1973
  /** Returns the Y coordinate that has the scrolled position calculated.
1971
1974
  **/
1972
1975
  pageY: function() {
1973
1976
  return ELEM._getVisibleTopPosition( this.elemId );
1974
1977
  },
1975
-
1978
+
1976
1979
  /** = Description
1977
- * Sets the label on a control component: the text that's displayed in
1978
- * HControl extensions. Visual functionality is implemented in component
1980
+ * Sets the label on a control component: the text that's displayed in
1981
+ * HControl extensions. Visual functionality is implemented in component
1979
1982
  * theme templates and refreshLabel method extensions.
1980
1983
  *
1981
1984
  * Avoid extending directly, extend +refreshLabel+ instead.
@@ -2000,7 +2003,7 @@ HView = UtilMethods.extend({
2000
2003
  }
2001
2004
  return this;
2002
2005
  },
2003
-
2006
+
2004
2007
  /** = Description
2005
2008
  * Called when the +self.label+ has been changed. By default
2006
2009
  * tries to update the label element defined in the theme of
@@ -2019,13 +2022,13 @@ HView = UtilMethods.extend({
2019
2022
  }
2020
2023
  return this;
2021
2024
  },
2022
-
2025
+
2023
2026
  /** Returns the HPoint that has the scrolled position calculated.
2024
2027
  **/
2025
2028
  pageLocation: function() {
2026
2029
  return new HPoint(this.pageX(), this.pageY());
2027
2030
  },
2028
-
2031
+
2029
2032
  /** = Description
2030
2033
  * An abstract method that derived classes may implement, if they are able to
2031
2034
  * resize themselves so that their content fits nicely inside.
@@ -2035,20 +2038,20 @@ HView = UtilMethods.extend({
2035
2038
  optimizeWidth: function() {
2036
2039
 
2037
2040
  },
2038
-
2039
-
2041
+
2042
+
2040
2043
  /** = Description
2041
2044
  * Binds a DOM element to the +ELEM+ cache. This is a wrapper for
2042
2045
  * the ELEM#elem_bind that keeps track of the bound elements and
2043
2046
  * frees them from the element manager when the view is destroyed.
2044
- *
2047
+ *
2045
2048
  * = Parameters
2046
2049
  * +_domElementId+:: The value of the DOM element's id attribute that is
2047
2050
  * to be bound to the element cache.
2048
- *
2051
+ *
2049
2052
  * = Returns
2050
2053
  * The element index id of the bound element.
2051
- *
2054
+ *
2052
2055
  **/
2053
2056
  bindDomElement: function(_domElementId) {
2054
2057
  var _cacheId = ELEM.bindId(_domElementId);
@@ -2057,17 +2060,17 @@ HView = UtilMethods.extend({
2057
2060
  }
2058
2061
  return _cacheId;
2059
2062
  },
2060
-
2061
-
2063
+
2064
+
2062
2065
  /** = Description
2063
2066
  * Removes a DOM element from the +ELEM+ cache. This is a wrapper
2064
2067
  * for the ELEM#elem_del. This is used for safely removing DOM
2065
2068
  * nodes from the cache.
2066
- *
2069
+ *
2067
2070
  * = Parameters
2068
- * +_elementId+:: The id of the element in the element manager's cache
2071
+ * +_elementId+:: The id of the element in the element manager's cache
2069
2072
  * that is to be removed from the cache.
2070
- *
2073
+ *
2071
2074
  **/
2072
2075
  unbindDomElement: function(_elementId) {
2073
2076
  var _indexOfElementId = this._domElementBindings.indexOf(_elementId);
@@ -2076,8 +2079,8 @@ HView = UtilMethods.extend({
2076
2079
  this._domElementBindings.splice(_indexOfElementId, 1);
2077
2080
  }
2078
2081
  },
2079
-
2080
-
2082
+
2083
+
2081
2084
  /** = Description
2082
2085
  * Finds a string from the locale of the component.
2083
2086
  * The attrPath is a string or array to find an object.
@@ -2088,7 +2091,7 @@ HView = UtilMethods.extend({
2088
2091
  * otherLabel: 'Other Label',
2089
2092
  * }
2090
2093
  * };
2091
- *
2094
+ *
2092
2095
  * To get the defaultLabel, call getLocaleString like this:
2093
2096
  * this.getLocaleString( 'FooComponent', 'strings.defaultLabel' );
2094
2097
  * ..or:
@@ -2100,7 +2103,7 @@ HView = UtilMethods.extend({
2100
2103
  * +_componentClassName+:: The name of the item in HLocale.components
2101
2104
  * +_attrPath+:: The object path to the string. String or Array.
2102
2105
  * +_default+:: The default object to return if nothing matched.
2103
- *
2106
+ *
2104
2107
  **/
2105
2108
  getLocaleString: function( _componentClassName, _attrPath, _default ){
2106
2109
  if( _default === undefined ){
@@ -2179,10 +2182,9 @@ HView = UtilMethods.extend({
2179
2182
  }
2180
2183
  return false;
2181
2184
  }
2182
-
2183
-
2185
+
2186
+
2184
2187
  });
2185
2188
 
2186
- HView.implement(HMarkupView);
2187
2189
  HView.implement(HMorphAnimation);
2188
2190