Might it be an idea if the @ClassName annotation allows for an array of String value's (currently not possible)?This could solve the problems described above I think. Example:public interface WidgetStyle extends CssResource {@ClassName({"Bla", "General"})String bla(); {}
// BaseWidgetCSSResource.java package com.testbed.client.resources; import com.google.gwt.resources.client.CssResource; public interface BaseWidgetCssResource extends CssResource { String baseWidget(); }
// BlueWidgetCSSResource.java package com.testbed.client.resources; public interface BlueWidgetCssResource extends BaseWidgetCssResource { String blueWidget(); }
// baseWidget.css div.baseWidget { background-color: red; border: 1px solid darkred; border-radius: 10px; padding: 20px; height: 45px; width: 100px; margin:10px; text-align:center; vertical-align:middle; font-size: 2em; float: left; }
// blueWidget.css div.baseWidget.blueWidget { /* same as regular widget, but with a few changes */ background-color: blue; border: 5px dashed orange; color: white; }
// WidgetResources.java package com.testbed.client.resources; import com.google.gwt.resources.client.ClientBundle; import com.google.gwt.resources.client.CssResource.Import; public interface WidgetResources extends ClientBundle { // base widget @Source("css/baseWidget.css") BaseWidgetCssResource baseCss(); // pulls in both files, overriding one with the other @Import(BaseWidgetCssResource.class) @Source({ "css/blueWidget.css", "css/baseWidget.css" }) BlueWidgetCssResource blueCss(); }
// Testbed.java package com.testbed.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.ui.RootPanel; import com.testbed.client.resources.WidgetResources; public class TestBed implements EntryPoint { WidgetResources resources = GWT.create(WidgetResources.class); public void onModuleLoad() { // make sure the CSS is here resources.blueCss().ensureInjected(); Element baseWidget = RootPanel.get("baseWidget").getElement(); baseWidget.addClassName(resources.blueCss().baseWidget()); Element blueWidget = RootPanel.get("blueWidget").getElement(); blueWidget.addClassName(resources.blueCss().baseWidget()); blueWidget.addClassName(resources.blueCss().blueWidget()); } }
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/644IQ3b_2zYJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
How do you format the code?
// BaseWidgetCSSResource.java package com.testbed.client.resources; import com.google.gwt.resources.client.CssResource; public interface BaseWidgetCssResource extends CssResource { String baseWidget(); }
How do you format the code?@Juan: what do you mean?
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
How show formatted text inside the body's mail?
How show formatted text inside the body's mail? like this:
could automatically have ".parent.child" concatenated for you to "parent child" to be returned when you ask for the class name. However,
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/bUNS9VK5n1QJ.
could automatically have ".parent.child" concatenated for you to "parent child" to be returned when you ask for the class name. However,@Joseph: that's not even such a bad idea. Indeed you could use a Delegator class that implements that Widget style interface that forwards the call to the correct CssResource interface. In case you want to add an extra styl, you just concatenate two style method calls.It's not ideal, but possible.I think a good solution would be that GWT integrates with the closure-stylesheets project. GWT could not have to worry about the css programming like the current browser-style-dependent conditions. This is done by the closure-stylesheet project. New features/updated added to the closure-stylesheets project would automatically be available I think.