1

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!.

RAS
  • 8,100
  • 16
  • 64
  • 86
Karthik207
  • 493
  • 9
  • 27

1 Answers1

2

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

PVR
  • 2,534
  • 18
  • 38
  • Strongly encourage adding a CssResource subtype with actual methods declared in it, and show using those methods rather than using "myClassName" in Java. Also, it looks like you forgot to declare the ownersManual method in your bundle. – Colin Alworth Jun 09 '14 at 14:28