Cached Object Properties
Cached properties are the light version of real (user-side) qooxdoo properties. They are used for simple caching and invalidation of single values.
For example the computedBoxWidth is a cached property. At any time the environment or the values of the widget changes the cache will be invalidated and will be recomputed the next time needed. There are many parts in qooxdoo which needs a feature like this, so we have lately seen that it’s the best to generate the needed function pairs also automated. The only public method here is the getter. That mean for example in the application you can do a getCachedBoxWidth() , but you should never call any other function (all marked as private, with the typical “_” at the beginning of the function name).
Cached properties use a nearly similar syntax compared to the real properties. They are limited in features to make them really fast. There is no type detection or check. There is no modifier called. There is no event fired on change of the value.
Here comes a example how to use this feature:
qx.OO.addCachedProperty({ name : "boxWidth", defaultValue : null }); // optional method (but most time is make no sense without) proto._computeBoxWidth = function() { // some algorithmus to execute to compute the new value return foo * this.getBar() + 3; }; // if you need to do something on update, define it here. // will only be called if _recomputeCachedBoxWidth() will be used proto._changeBoxWidth(vNewValue, vOldValue) { // your code to handle this change };
