If you are looking for a two lines solution, this is the wrong place...
But still what you want to do its possible.. take a look at the UiBinder
generator code and make your own binder

2010/5/25 Artem <nikulche...@gmail.com>

> Hi!
>
> I am really enjoin using of UIBinder! But still some of my code looks
> a bit strange and unpleasant in comparison with what I would like to
> see... I'll explain in details:
>
> Imagine I have a UIBinder component with some Label inside:
> ...
> <g:Label ui:field="label">
> ...
>
> In that case I can set a value to this label in java code like this:
>
> @UiField
> Label l;
> ...
> l.setText("....");
> ...
>
> Imagine I want to bind this panel to some object. As a result if this
> data object has a lot of properties I end up with huge list of
> @UiField declarations and setText methods, and after a while it get's
> really hard to find out what property where should be displayed.
>
> I would another approach that allows me to bind to some properties
> inside the UI directly:
>
> <ui:with field='dataContext' type='com.toi.client.DataObject'/>
> ...
> <g:Label text={dataContext.getValue}>
>
> Now this code looks already better, because now I can clearly see
> where and what properties are displayed. I also don't need so many
> setText methods in java class any more... But this approach solves
> only one problem - bind UI to data object when UI control is
> created...
>
> What else do I need from it?
>
> 1. First, I would like to have a refresh method, so when I want to
> display another object in the same control I will simple use
> this.dataObject = newDataObject; refreshUI(); and trigger all
> connected labels, textboxes etc. to call setText and other methods
> again (In that case I won't need to re-create UI when new object comes
> - only reloaded properties...)
>
> 2. Second. I also would like to have bi-directional link. Which means
> - if I say <g:TextBox text={dataContext.Value}> not only text from
> dataobject is loaded into textbox during initialization, BUT also data
> object value is changed when somebody edits TextBox.
>
> Maybe somebody could help me with this problem? Maybe somebody knows
> some framework or workaround that could be used in that case?
>
> Or maybe somebody could show me the way to somehow catch events from
> my UIBinder object, so I can bind them manually to properties on base
> class implementation?
>
> Thanks!
>
> Artem
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to