Tuesday, December 24, 2013

Re: organizing modules and CSS resources

Create a css file for your library and add <stylesheet src="mylib.css"/> to your mylib.gwt.xml. Make sure to use a good naming scheme for your CSS classes so you don't run into css class name clashes accidentally. 

Alternatively make your library widgets use their own ClientBundle, e.g.

class TittleBar {

 public  interface Resources extends ClientBundle {

    public interface Css extends CssResource {
       String titleBar();
    }

    @Source("titleBar.css")
    Css css();

  }

  public TitleBar() {
    this(GWT.<Resources>create(Resources.class));
  }

  public TitleBar(Resources resources) {
     this.resources = resources;
     this.resources.css().ensureInjected();
     setStyleName(resources.css().titleBar());
  }

}

-- J.

--
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+unsubscribe@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.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment