GWT 2.7.0

com.google.gwt.resources.client
Annotation Type CssResource.Import


@Documented
@Retention(value=RUNTIME)
@Target(value=METHOD)
public static @interface CssResource.Import

Makes class selectors from other CssResource types available in the raw source of a CssResource. String accessor methods can be referred to using the value of the imported type's CssResource.ImportedWithPrefix value.

This is an example of creating a descendant selector with two unrelated types:

@ImportedWithPrefix("some-prefix")
 interface ToImport extends CssResource {
   String widget();
 }
 
@ImportedWithPrefix("other-import")
 interface OtherImport extends CssResource {
   String widget();
 }
 
 interface Resources extends ClientBundle {
  @Import(value = {ToImport.class, OtherImport.class})
  @Source("my.css")
   CssResource usesImports();
 }
 
 my.css:
 // Now I can refer to these classes defined elsewhere with no 
 // fear of name collisions
 .some-prefix-widget .other-import-widget {...}
 
If the imported CssResource type is lacking an CssResource.ImportedWithPrefix annotation, the simple name of the type will be used instead. In the above example, without the annotation on ToImport, the class selector would have been .ToImport-widget. Notice also that both interfaces defined a method called widget(), which would prevent meaningful composition of the original interfaces.

It is an error to import multiple classes with the same prefix into one CssResource.


Required Element Summary
 java.lang.Class<? extends CssResource>[] value
           
 

Element Detail

value

public abstract java.lang.Class<? extends CssResource>[] value

GWT 2.7.0