Hi Lars,
This might not be the best way, but off the top of my head you could use 
a semaphore and explicitly call setX setY from your pixel property...

Something like this: (untested)

====================================================================

properties :
{
   x :
   {
     apply : "_applyX",
     init : null
   },
   y :
   {
     apply : "_applyY",
     init : null
   },
   pixel :
   {
     check : "Array"
     apply : "_applyGroup",
     init : null
   }
},
members :
{
   __action : null,
   _applyX : function(value)
   {
     if (this.__action == null)
     {
       this.__action = "applyY";
       // manually update the group property
       this.setPixel([value, this.getY()]);
       this._drawPixel();
       this.__action = null;
     }
   },

   _applyY : function(value)
   {
     if (this.__action == null)
     {
       this.__action = "applyY";
       // manually update the group property
       this.setPixel([this.getX(), value]);
       this._drawPixel();
       this.__action = null;
     }
   },

   _applyGroup : function(value)
   {
     if (this.__action == null)
     {
       this.__action = "applyGroup";
       this.setX(value[0]);
       this.setY(value[0]);
       this._drawPixel();
       this.__action = null;
     }
   }
}

====================================================================

As I said, it's untested so there might be some bugs/typos but hopefully 
that should give you somethign to work with.

Matt


Lars Martin wrote:
> Hi,
> 
> I newly subscribed the list because I'm currently developing a RAP 
> custom widget and I do have some problems with the JavaScript 
> counterpart of my Java implementation. This question is regarding 
> qooxdoos property system. I'm sure I missed some important points.
> 
> My RAP widget passes an int[] named "pixel" to qooxdoo and the property 
> system automatically call "setX" and "setY" to set the members from 
> incoming int[] as below:
> 
> properties : {
>               
>       x : {
>               apply : "_drawPixel",
>               init : null
>       },
> 
>       y : {
>               apply : "_drawPixel",
>               init : null
>       },
>               
>       pixel : {
>               check : "Array",
>               group : [ "x", "y" ]
>       }
> },
> 
> members : {
>       _drawPixel : function(value, old) {
>               // draw a pixel at [x,y]
>       },
> ...
> }
> 
> My question is: how can I ensure a single or atomic setter for grouped 
> properties? If I want to draw a point at [x,y] how can I ensure that the 
> _drawPixel method is called only once. Better said: is called only when 
> property x AND y is initialized? Is there something like?
> 
>       pixel : {
>               check : "Array",
>               group : [ "x", "y" ],
>               apply : "_drawPixel"
>       }
> 
> Any help is appreciated. Kindest regards, Lars
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to