@bobv, please double check me here.
This will work, although I don't know if it will work in gwt/current or even
gwt/canary yet:
<ui:style src='colors.css'>
.foo { color: yellow; }
</ui:style>
A ui:style element can have any number of css source files (space
separated). They'll be concatenated, and the body text appended to them. But
the ability for ui:style to have both a source css file and body text was a
fairly recent change. I doubt it's in gwt/current, and I'm not even sure
that it's in the long delayed gwt/canary.
@bobv, will anything pathological happen to the generated code if lots of
ui.xml files all do this? Remember that each ui.xml defines its own
ClientBundle.
On Tue, Nov 17, 2009 at 8:11 AM, Joel Webber <[email protected]> wrote:
> [...@rjrjr, bobv: There's a way to reference Java constants from CSS, right?]
>
>
> On Mon, Nov 9, 2009 at 10:21 AM, Thomas Broyer <[email protected]> wrote:
>
>>
>> Hi all,
>>
>> We're starting using UiBinder quite intensively and one thing we
>> haven't been able to do is to declare some constants in a CssResource
>> and reuse them in our ui.xml (I believe this is unrelated to UiBinder
>> actually, as I don't know how it could be made to work with plain old
>> CssResources only).
>>
>> Our use case is I believe very common: declare constants for common
>> colors to be shared thoughout the app (namely some kind of orange and
>> grays for use with borders, fore color and back color). I suspect we
>> might have the need for font sizes too.
>>
>> As a last resort, I tried the following (which forces me to have the
>> common CSS file in the same package as my ui.xml file):
>> <!-- mystyle.css has @def yellow red -->
>> <!-- and MyStyle has a String yellow() method -->
>> <ui:style field='common' src='mystyle.css'
>> type='com.my.app.client.MyStyle' />
>> <ui:style>
>> @def yellow value('common.yellow');
>> .foo { color: yellow; }
>> </ui:style>
>>
>> but it fails with:
>> Scanning for additional dependencies: ...\gen\com\my\app\client
>> \Test_MyBinderImpl.java
>> Computing all possible rebind results for
>> 'com.my.app.client.Test_MyBinderImpl_GenBundle'
>> Rebinding com.my.app.client.Test_MyBinderImpl_GenBundle
>> Invoking <generate-with
>>
>> class='com.google.gwt.resources.rebind.context.InlineClientBundleGenerator'/
>> >
>> Creating assignment for style()
>> Performing substitution in node color : .....
>> ;
>>
>> [ERROR] Could not find no-arg method named yellow
>> in type com.my.app.client.Test_MyBinderImpl_GenCss_common
>>
>>
>> Is there a way to reuse @def-s in other CssResource-s? (in other
>> ClientBundle-s!) and which one?
>> --~--~---------~--~----~------------~-------~--~----~
>> http://groups.google.com/group/Google-Web-Toolkit-Contributors
>> -~----------~----~----~----~------~----~------~--~---
>>
>>
>
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors