I agree with Timothy that GWT as a
framework makes almost impossible to create "runtime themeable"
application. While doing with plain js is pretty straight forward,
here is what we did:
in the index.html <link id="vt0" href="" rel="stylesheet" type="text/css" title="STANDARD"/> <link id="vt1" href="" rel="alternate stylesheet" type="text/css" title="CUSTOM"/> then in code: eventBus.addHandler(SelectViewTypeEvent.TYPE, new SelectViewTypeEvent.Handler() { @Override public void onViewTypeChanged(SelectViewTypeEvent event) { final int viewTypeOrdinal = event.getViewType().ordinal(); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { Document doc = Document.get(); for(ViewType vt : ViewType.values()) { LinkElement link = doc.getElementById("vt" + vt.ordinal()).cast(); link.setDisabled(vt.ordinal() != viewTypeOrdinal); } } }); } }); to properly work on IE browsers, before render anything: private void disableAllStylesheetsForIE() { final Document doc = Document.get(); for(ViewType vt : ViewType.values()) { LinkElement link = doc.getElementById("vt" + vt.ordinal()).cast(); link.setDisabled(true); } LinkElement link = doc.getElementById("vt0").cast(); link.setDisabled(false); } My wish is that some day, I'll would be able to use all GWT-CSS goodies like image bundles/sprites and css class hashing, etc for this kind of apps. IMHO css should be orthogonal to the actual html generated. Although, in the current times of HTML5 apps, css is part of the behavior of widgets, so in widgets based frameworks we have a tension between how a widget should look (web designer job) and its behavior that is some cases also partly implemented in css (mostly because css is hardware accelerated, like css3 transformation or animations, and plain js doesn't). Regards, -- Bauna On 05/16/2013 06:00 AM, Thomas Broyer wrote:
-- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out. |