Monday, April 27, 2015

Resources as Array


I have a ClientBundle with a few TextRources like these here:

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

  @Source("text1.txt")
  public TextResource text1();

  @Source("text2.txt")
  public TextResource text2();
}


Now I want to create an Array of the TextResource like this:

public class Sample {
 
   public static TextResource[] myTextRes = new TextResource[] {
       MyResources.INSTANCE.text1(),
   MyResources.INSTANCE.text1()
  };
}


But when I´m walking through the array with the following code I get an error message at runtime

for(int i=0; i < Samples.myTextRes .length; i++) {
        TextResource tr = Sample.myTextRes[i];                   
 }


Uncaught ReferenceError: Lcom_google_gwt_resources_client_TextResource_2_classLit_0_g$ is not defined

What I´m doing wrong  ?


--
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/d/optout.

No comments:

Post a Comment