I would say you need to use JSNI - do a search for how to change CSS
file using JavaScript and then implement something similar wrapped in
a JSNI method.
You can then call that method to change the style sheet, either
programmatically by just calling it, or if you want to harness the
bootstrapping use Deferred Binding on user type to select a subclass
that calls your method with the appropriate style name, i.e.
public class Basic{
private native void changeStyleSheet(String styleSheetName)/*-{
// some javascript code to activate and use styleSheetName as the
style sheet
}-*/
public setStyle(){
changeStyleSheet("first.css");
}
}
public class Admin extends Basic{
changeStyleSheet("second.css");
}
then in your module XML have something like
<replace-with class "Admin">
<when-type-is class"Basic"/>
<when-property-is name"user.type" value"admin"/>
</replace-with>
<define-property name="user.type" values="basic,admin"/>
You'd have to think of a secure way to ensure people can't just
pretend to be "admin". An unsecure-ish way would be to use a property
provider to read the value from your HTML meta properties in the same
way GWT does for i18n selection. As Bunsen&Beaker (http://
code.google.com/p/bunsenandbeaker/wiki/DevGuideSpecifyingLocale) says:
"A property provider is specified in the module XML file as a
JavaScript fragment that will return the value for the named property
at runtime. In this case, you would want to define the locale property
using a property provider. To see examples of <property-provider>
definitions in action, see the files I18N.gwt.xml and
UserAgent.gwt.xml in the GWT source code. "
//Adam
and a new property provider
//Adam
>
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...
>
> Regards,
> Kamlesh