On 22 juil, 17:43, Sekhar <[email protected]> wrote:
> Yes, separate out the common stuff into a CSS (or more, as necessary)
> and put as much of the specific CSS as possible into the XML file.
> Below is an example that shows this setup and its power. Note that
> each UiBinder XML treats the definitions in the common file (color1
> and .roundCorners in this case) as if they're local. In fact, even
> auto-complete works to identify .roundCorners even though it isn't
> defined locally - very cool.
>
> E.g., here's the common file.
>
> Project.css:
> ...
> @def color1 #333333;
> ...
> .roundCorners {
>    ...
>
> }
>
> Then, in each custom UiBinder XML, do this:
>
> <ui:style src="Project.css">
>    .input {
>       color: color1;
>    }
> </ui:style>
> ...
> ... styleName="{style.input}" ...
> ... styleName="{style.roundCorners}" ...
> ...

It should be noted that the "roundedCorner" here will then be
different thatn a roundedCorner from the same CSS but in another
CssResource/ui:style.
That's why we have a constants.css with only @def constants, and keep
our global styles in a global ClientBundle+CssResource, that we then
"import" using <ui:with> in the UiBinder where we need them. This
allows us to *share* the global styles throughout the app.

<ui:with field="globalBundle"
class="example.client.resources.GlobalBundle" />
<ui:style src="../../resources/constants.css">
  .localClassName {
    border-color: constantDefinedInTheReferencedCssFile;
  }
</ui:style>
... addStyleNames="{globalBundle.globalStyle.globalClassName}
{style.localClassName}" ...

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