On Jul 22, 2:15 am, David Vree <[email protected]> wrote:
> In this case, it is the page header, so I know its a singleton, even
> though I can appreciate that GWT has no idea about my intentions.
>
> I wanted to set the ID so I could reference it from within my CSS.  I
> suppose I could just put the CSS directly into the UIBinder, but I
> didn't want to have that stuff spread out all over the place.
>
> Is there a way to set a home brew CSS class name from within UIBinder
> and reference that from within my CSS file...should work just fine I
> would guess!?!

UiBinder's <ui:style> is just a CssResource, so you can use @external
in it. It also defaults to field="style", so you can use, say,
addStyleNames="{style.myCssClass}" and it'll output the obfuscated CSS
class for your .myCssClass.

>
> On Jul 21, 7:10 pm, Thomas Broyer <[email protected]> wrote:
>
>
>
>
>
>
>
> > 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