66 this.contentElement = document.createElement("div"); |
66 this.contentElement = document.createElement("div"); |
67 this.controlElement.appendChild(this.contentElement); |
67 this.controlElement.appendChild(this.contentElement); |
68 |
68 |
69 // set the text |
69 // set the text |
70 this.setText(text); |
70 this.setText(text); |
71 } |
71 }; |
72 |
72 |
73 // Returns the enabled state for the control. |
73 // Returns the enabled state for the control. |
74 Label.prototype.isEnabled = function() { |
74 Label.prototype.isEnabled = function() { |
75 return true; |
75 return true; |
76 } |
76 }; |
77 |
77 |
78 // Returns the focusable state for the control. |
78 // Returns the focusable state for the control. |
79 Label.prototype.isFocusable = function() { |
79 Label.prototype.isFocusable = function() { |
80 return false; |
80 return false; |
81 } |
81 }; |
82 |
82 |
83 // Returns the control text. |
83 // Returns the control text. |
84 Label.prototype.getText = function() { |
84 Label.prototype.getText = function() { |
85 return this.contentElement.innerHTML; |
85 return this.contentElement.innerHTML; |
86 } |
86 }; |
87 |
87 |
88 // Sets the text for the control. |
88 // Sets the text for the control. |
89 Label.prototype.setText = function(text) { |
89 Label.prototype.setText = function(text) { |
90 uiLogger.debug("Label.setText(" + text + ")"); |
90 uiLogger.debug("Label.setText(" + text + ")"); |
91 this.contentElement.innerHTML = (text == null) ? "" : text; |
91 this.contentElement.innerHTML = (text == null) ? "" : text; |
92 this.updateStyleFromState(); |
92 this.updateStyleFromState(); |
93 } |
93 }; |
94 |
94 |
95 // Updates the style of the control to reflects the state of the control. |
95 // Updates the style of the control to reflects the state of the control. |
96 Label.prototype.updateStyleFromState = function() { |
96 Label.prototype.updateStyleFromState = function() { |
97 uiLogger.debug("Label.updateStyleFromState()"); |
97 uiLogger.debug("Label.updateStyleFromState()"); |
98 |
98 |
100 this.setClassName(this.rootElement, "Control"); |
100 this.setClassName(this.rootElement, "Control"); |
101 this.setClassName(this.assemblyElement, "ControlAssembly ControlAssemblyNormal"); |
101 this.setClassName(this.assemblyElement, "ControlAssembly ControlAssemblyNormal"); |
102 this.setClassName(this.captionElement, "ControlCaption ControlCaptionNormal"); |
102 this.setClassName(this.captionElement, "ControlCaption ControlCaptionNormal"); |
103 this.setClassName(this.controlElement, "ControlElement"); |
103 this.setClassName(this.controlElement, "ControlElement"); |
104 this.setClassName(this.contentElement, "LabelText"); |
104 this.setClassName(this.contentElement, "LabelText"); |
105 } |
105 }; |