On Jul 22, 12:19 am, David Vree <[email protected]> wrote:
> New to GWT here....   I have a UIBinder file with some nested HTML
> within a panel within a layout.  I cannot find how to set the ID of
> the HTML from within the XML file.  Does this have to be done via Java
> code when the instance of the UIBinder is created?  Is so, can anyone
> provide a snippet of the code....Thanks.

May I ask why you'd want to set an ID? The issue is that if you
instantiate your UiBinder (or more likely your owner class) twice,
you'll have a duplicate ID in your web page, leading to unexpected
behaviors. For some specific cases, there are solutions:
 - to get a reference to an HTML element, put an ui:field attribute on
it and an @UiField in your owner class, just like with a widget
 - to add identifiers for debugging purpose, such as selenium tests,
you can use a debugId attribute on widgets (not HTML elements, only
widgets) which will map to an ensureDebugId call in Java code.
If you really need an ID on an element, then get a reference to it and
set the ID from your Java code: 
https://wave.google.com/wave/waveref/googlewave.com/w+EI8yh67GA
(this was initially discussed here, or maybe on GWT-Contributors, if
you can find the thread in the archives)

-- 
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