Client bundle and Css resource in GWT

2.2k Views Asked by At

Can anyone deeply explain on how the collaboration of CSS resources,Client Bundle and UI binder works?. I went through the GWT documentation , but not clear on this CSS resources and how the interfaces are generated. Explanation with step by step will help. Thanks!.

1

There are 1 best solutions below

1
On

Here we go..

1. Define in gwt.xml utilization of Resources :

<inherits name="com.google.gwt.resources.Resources" />

2. Create your own Resources class which extends CientBundle :

public interface MyResources extends ClientBundle {
  public static final MyResources INSTANCE =  GWT.create(MyResources.class);

  @Source("my.css")
  public CssResource css();
}

3. Following is the utilizing the described css pattern from css in your java class file.

{MyResources.INSTANCE.css().ensureInjected();

  // Display the manual file in an iframe
  new Frame(MyResources.INSTANCE.ownersManual().getSafeUri().asString());}

The above is the basic implementation of the CSSResources using ClientBundle. The more you can find out from the below link.ClientBundle Utilization