Hello List, Hello Sebastian (who is maybe deepest inside the object 
property implementation),

In my application I need to add some properties to the whole widget 
hierarchie (maybe bad style, but anyway). So I do the following:

qx.ui.core.Widget.prototype._x_path = null;
qx.ui.core.Widget.prototype.getXpath = function() {
  return this._x_path;
};
qx.ui.core.Widget.prototype.setXpath = function(value) {
  return this._x_path = value;
};

For setting this property (and a few other) properties I'm usualy 
calling the set method of the instance

widgetInstance.set({xpath:'bla', foo:'blu', bar:'blo'});

The definition of the set method is in qx.core.Object.prototype:

qx.Proto.set = function(propertyValues)
{
  if (typeof propertyValues !== "object") {
    throw new Error("Please use a valid hash of property key-values 
pairs.");
  }

  for (var prop in propertyValues)
  {
    try
    {
      this[qx.OO.setter[prop]](propertyValues[prop]);
    }
    catch(ex)
    {
      this.error("Setter of property " + prop + " returned with an 
error", ex);
    }
  }

  return this;
}

Because the method relies on the existence of the setter and getter in 
qx.OO.setter this fails as self defined setters and getters are nevver 
assigned to qx.OO.setter. This also seems to happen if we have a fast 
property added through addFastProperty. As a side effect FF 2.0 freezes 
on the massive exception fireing in the try catch block (at least for my 
application which has a big widget stack).

The solution would be to not rely on qx.OO.setter and to assemble the 
setter call through a string concatenation:

      this['set'+qx.lang.String.toFirstUp(prop)](propertyValues[prop]);

In this case all setters and getters are catched.

Maybe this can eliminate the setter hash completely?

Any Ideas on this?

Thank you.

Best regards.


-- 
Mit freundlichen Grüßen
Dietrich Streifert
Visionet GmbH


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to