Re: Get value of GWT property at runtime
On Tue, Mar 15, 2011 at 2:54 PM, Paul Robinson <ukcueman@gmail.com> wrote:
> Possibly not as simple as you wanted, but you can do something like this:
> (1) Create base class com.foo.ThemeInfo and subclasses ThemeInfoOne and
> ThemeInfoTwo
> (2) Add this to your gwt.xml:
> <replace-with class="com.foo.ThemeInfoOne">
> <when-type-is class="com.foo.ThemeInfo"/>
> <when-property-is name="theme" value="theme1"/>
> </replace-with>
>
> <replace-with class="com.foo.ThemeInfoTwo">
> <when-type-is class="com.foo.ThemeInfo"/>
> <when-property-is name="theme" value="theme2"/>
> </replace-with>
>
> (3) In your client-side code:
> ThemeInfo info = GWT.create(ThemeInfo.class);
>
> and you'll get an instance of ThemeInfoOne when using theme1 and
> ThemeInfoTwo when using theme2 and an instance of the ThemeInfo base class
> otherwise
>
> This should let you do what you want, and also move the "if using theme#1"
> test to compile time.
Hi Paul,
I think that helps a lot. I initially thought about something similar,
but was not sure if it's the best idea. It involves a lot of overhead
imho. But - it's better than all other possibilities I can think of
now...
Thanks :)
Best,
Raphael
>
> HTH
> Paul
>
> On 15/03/11 12:46, Raphael André Bauer wrote:
>>
>> Hi,
>>
>>
>> is there a simple way to get a gwt-property when the GWT app is running?
>>
>> e.g. I have:
>> <define-property name="theme"/ values="theme1, theme2"/>
>>
>> Then at compile time I get nice permutations for theme1 and theme2. Cool
>> so far.
>>
>>
>> For some agile flexible fine-tuning it would be nice to get the value
>> of "theme".
>> Something like GWT.getPermutationProperty("theme")
>>
>> Is this possible - or plain stupid because that's what compile time
>> permutations are for... (I know that, but nevertheless...) ?
>>
>>
>> Thanks!
>>
>>
>> Raphael
>>
>
> --
> 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-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscribe@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-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home