How about doing your setName like this:

  public void setFirstName(String firstName) {
    String old = getFirstName();
    setFirstNameImpl(firstName);
    changes.firePropertyChange("firstName", old, firstName);
  }
  private final native void setFirstNameImpl(String fn)/*-{ this.firstName =
fn; }-*/;

?  Yes, it take an extra method to jump into the JSNI, but the compiler will
erase that indirection anyway when it builds the JavaScript.  Your only
penalty is the slightly longer code to write for each bound property method.


On Tue, Dec 2, 2008 at 09:45, Miroslav Genov <[EMAIL PROTECTED]> wrote:

>
> Hello guys,
>  Currently I'm trying to use JSON  mashups in my application, but I'm
> falling on an issue with the binding and validation of the data objects.
> In another web project I was used simple POJO objects and the binding
> was implemented in this way:
>
> public void setFirstName(String firstName) {
>    String old = this.firstName;
>    this.firstName = firstName;
>    changes.firePropertyChange("firstName", old, firstName);
> }
>
>
> And here is the question, how can I do this with JavaScriptObjects when
> my method stubs are looking like:
>  public final native String getName() /*-{ return this.name; }-*/;
>  public final native void setName(String name) /*-{ this.name = name;
> }-*/;
>
>
> Probably I have to use some JSNI magic :).
>
> Does anyone have an idea how to do this ?. Or some better solution for
> binding and validation of such an objects.
>
> Thanks in advance
>
>
> Regards,
>  Miroslav
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to