Update of /cvsroot/qooxdoo/qooxdoo/source/script/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23721/source/script/gui
Modified Files:
Tag: renderer
QxWidget.js
Log Message:
Made _htmlProperties and _htmlAttributes hash tables optional
Index: QxWidget.js
===================================================================
RCS file: /cvsroot/qooxdoo/qooxdoo/source/script/gui/Attic/QxWidget.js,v
retrieving revision 1.1.2.52
retrieving revision 1.1.2.53
diff -u -d -r1.1.2.52 -r1.1.2.53
--- QxWidget.js 24 Jan 2006 16:48:54 -0000 1.1.2.52
+++ QxWidget.js 25 Jan 2006 08:25:38 -0000 1.1.2.53
@@ -55,8 +55,10 @@
// Allows the user to setup styles and attributes without a
// need to have the target element created already.
+ /*
this._htmlProperties = { className : this.classname };
this._htmlAttributes = { qxhashcode : this._hashCode };
+ */
this._styleProperties = { position : QxConst.CORE_ABSOLUTE, fontSize : 0 };
this.setStyleProperty(QxWidget.BOX_SIZING_PROPERTY, QxWidget.BOX_SIZING_VALUE);
@@ -3319,6 +3321,10 @@
proto.setHtmlProperty = function(propName, propValue)
{
+ if (!this._htmlProperties) {
+ this._htmlProperties = {};
+ };
+
this._htmlProperties[propName] = propValue;
if (this._isCreated) {
@@ -3332,6 +3338,10 @@
{
proto.removeHtmlProperty = function(propName)
{
+ if (!this._htmlProperties) {
+ return;
+ };
+
delete this._htmlProperties[propName];
if (this._isCreated) {
@@ -3345,6 +3355,10 @@
{
proto.removeHtmlProperty = function(propName)
{
+ if (!this._htmlProperties) {
+ return;
+ };
+
delete this._htmlProperties[propName];
if (this._isCreated)
@@ -3357,17 +3371,28 @@
};
};
-proto.getHtmlProperty = function(propName) {
+proto.getHtmlProperty = function(propName)
+{
+ if (!this._htmlProperties) {
+ return QxConst.CORE_EMPTY;
+ };
+
return this._htmlProperties[propName] || QxConst.CORE_EMPTY;
};
proto._applyHtmlProperties = function(vElement)
{
var vProperties = this._htmlProperties;
- var propName;
-
- for (propName in vProperties) {
- vElement[propName] = vProperties[propName];
+
+ if (vProperties)
+ {
+ // this.debug("HTML-Properties: " + QxUtil.getObjectLength(vProperties));
+
+ var propName;
+
+ for (propName in vProperties) {
+ vElement[propName] = vProperties[propName];
+ };
};
};
@@ -3384,6 +3409,10 @@
proto.setHtmlAttribute = function(propName, propValue)
{
+ if (!this._htmlAttributes) {
+ this._htmlAttributes = {};
+ };
+
this._htmlAttributes[propName] = propValue;
if (this._isCreated) {
@@ -3395,6 +3424,10 @@
proto.removeHtmlAttribute = function(propName)
{
+ if (!this._htmlAttributes) {
+ return;
+ };
+
delete this._htmlAttributes[propName];
if (this._isCreated) {
@@ -3404,16 +3437,28 @@
return true;
};
-proto.getHtmlAttribute = function(propName) {
+proto.getHtmlAttribute = function(propName)
+{
+ if (!this._htmlAttributes) {
+ return QxConst.CORE_EMPTY;
+ };
+
return this._htmlAttributes[propName] || QxConst.CORE_EMPTY;
};
-proto._applyHtmlAttributes = function(el)
+proto._applyHtmlAttributes = function(vElement)
{
- var a=this._htmlAttributes, i;
-
- for (i in a) {
- el.setAttribute(i, a[i]);
+ var vAttributes = this._htmlAttributes;
+
+ if (vAttributes)
+ {
+ // this.debug("HTML-Attributes: " + QxUtil.getObjectLength(vAttributes));
+
+ var propName;
+
+ for (propName in vAttributes) {
+ vElement.setAttribute(propName, vAttributes[i]);
+ };
};
};
|