Comparison between old and new dynamic properties
This is a comparison between the old and new properties. It shows the differences between the two implementations. qooxdoo 0.7 removes some declarations that were too specific and adds some missing features.
Property definition
| qooxdoo 0.6.x | qooxdoo 0.7 |
Outside the class definition:qx.OO.addProperty({
name : "test"
}); | Part of the class definition:properties : {
test: {}
} |
Checking for pre-defined types
| qooxdoo 0.6.x | qooxdoo 0.7 |
qx.OO.addProperty(
{
name : "test",
type : "string"
}); | test: {
check : "String"
} |
qooxdoo 0.6 only supports the types available through the typeof operator in JavaScript: string, number, object, function, boolean.
qooxdoo 0.7 supports much more. The names of types are identical to the ones used in the API viewer:
Boolean, String, Number, Integer, Float, Double
Object, Array, Map
Class, Mixin, Interface, Theme
Error, RegExp, Function, Date, Node, Element, Document, Window, Event
Checking for instances
| qooxdoo 0.6.x | qooxdoo 0.7 |
qx.OO.addProperty(
{
name : "test",
instance : "qx.core.Object"
}); | test: {
check : "qx.core.Object"
} |
Checking for classname
Explicit check, if property value is a direct instance of a class given by its classname. Normally less useful than instance checks, where instances of all subclasses also match.
| qooxdoo 0.6.x | qooxdoo 0.7 |
qx.OO.addProperty(
{
name : "test",
classname: "qx.core.Object"
}); | Not supported. If this is needed, one could use an custom check function as listed below. |
Set of allowed values
| qooxdoo 0.6.x | qooxdoo 0.7 |
qx.OO.addProperty(
{
name : "test",
possibleValues : [ "red", "blue", "yellow" ]
}); | Given as an array of allowed values:test: {
check : [ "red", "blue", "yellow" ]
} |
Custom check method
| qooxdoo 0.6.x | qooxdoo 0.7 |
By naming convention. The name of the corresponding instance method needed to be _check followed by the capitalized property name.qx.OO.addProperty({
name : "test"
});
qx.Proto._checkTest = function(value) {
// do check...,
} | The custom check method can be placed right into the property declaration:test: {
check : function(value) {
// do check...,
}
} |
Nullable properties
| qooxdoo 0.6.x | qooxdoo 0.7 |
qx.OO.addProperty(
{
name : "test",
allowNull : true
}); | By default properties are not nullable.test: {
nullable : true
} |
Alias support for setter & getter
Support for aliases like isProperty for getProperty.
| qooxdoo 0.6.x | qooxdoo 0.7 |
qx.OO.addProperty(
{
name : "checked",
getAlias : "isChecked"
}); | not supported anymore |
Automatically add to queues
Support for widget specific queue handling.
| qooxdoo 0.6.x | qooxdoo 0.7 |
qx.OO.addProperty(
{
name : "test",
addToQueue: true
}); | not supported anymore |
Unit detection support
Support for widget specific unit detection.
| qooxdoo 0.6.x | qooxdoo 0.7 |
qx.OO.addProperty(
{
name : "test",
unitDetection : "pixelPercent"
}); | not supported anymore |
Modifying existing properties
| qooxdoo 0.6.x | qooxdoo 0.7 |
qx.OO.changeProperty(
{
name : "test",
defaultValue : "world",
type : "string",
[...]
}); | test: {
refine : true,
init : "world"
} |
The new properties do not allow other than init value modifications.
Defining name of event for property changes
| qooxdoo 0.6.x | qooxdoo 0.7 |
| Not possible. It was always “change” + name of the property | test: {
event : "testChanged"
} |
Apply method
| qooxdoo 0.6.x | qooxdoo 0.7 |
| By naming convention. The name of the corresponding instance method was “_modify” followed by the capitalized property name. | Explicit. A leading _apply is a preferred convention.test: {
apply: "_applyTest"
} |
Shared apply method
| qooxdoo 0.6.x | qooxdoo 0.7 |
qx.OO.addProperty(
{
name : "width",
impl : "dimension"
});
qx.OO.addProperty(
{
name : "height",
impl : "dimension"
}); | width: {
apply : "applyDimension"
},
height: {
apply : "applyDimension"
} |
Fallback to init value
| qooxdoo 0.6.x | qooxdoo 0.7 |
Not supported. User value overwrites init value. Reset call afterwards changes value to null. | Supported. Init value is recoverable using reset method. |
Distinct value for themes
| qooxdoo 0.6.x | qooxdoo 0.7 |
Not supported. Appearance value may overwrite user value. Especially affected were the state areas of appearance themes. | Supported. A themeable value is stored separately and has a lower priority than the user value. |
Apply of initial value
| qooxdoo 0.6.x | qooxdoo 0.7 |
| Not supported. Manual work to apply property stuff the same way the modifier would do it. | Supported. It is possible to initialize a property in the class constructor. |
Inheritance support
| qooxdoo 0.6.x | qooxdoo 0.7 |
| Not supported. Manual work is needed to copy values around. | Supported. It is possible to enable inheritance on property level. Supports overriding, too. |