I'm playing around with the showcase example. I created a class
similar to all the others which extent ContentWidget. It is working
fine as long as I don't use Annotations like @ShowcaseSource. Then I
get errors. Why?


package com.google.gwt.sample.showcase.client.content.ep;

import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.i18n.client.Constants;
import com.google.gwt.sample.showcase.client.ContentWidget;
import
com.google.gwt.sample.showcase.client.ShowcaseAnnotations.ShowcaseData;
import
com.google.gwt.sample.showcase.client.ShowcaseAnnotations.ShowcaseSource;
import
com.google.gwt.sample.showcase.client.ShowcaseAnnotations.ShowcaseStyle;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Widget;

/**
 * Example file.
 */
@ShowcaseStyle(".gwt-German-Punkt")
public class EpGermanPunkt extends ContentWidget {

          /**
           * The constants used in this Content Widget.
           */
  @ShowcaseSource
  public static interface CwConstants extends Constants {
    String cwEpGermanPunktClickMessage();
    String cwEpGermanPunktDescription();
    String cwEpGermanPunktDisabled();
    String cwEpGermanPunktName();
    String cwEpGermanPunktNormal();
  }

  /**
   * An instance of the constants.
   */
  @ShowcaseData
  private final CwConstants constants;

  /**
   * Constructor.
   *
   * @param constants the constants
   */
  public EpGermanPunkt(CwConstants constants) {
    super(constants.cwEpGermanPunktName(), constants
        .cwEpGermanPunktDescription(), true);
    this.constants = constants;
  }


  /**
   * Initialize this example.
   */
  @ShowcaseSource
  @Override
  public Widget onInitialize() {

    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setSpacing(10);

      // Add a normal button
      Button normalButton = new Button(
          constants.cwEpGermanPunktNormal(), new ClickHandler() {
            public void onClick(ClickEvent event) {
              Window.alert(constants.cwEpGermanPunktClickMessage());
            }
          });
      normalButton.ensureDebugId("cwEpGermanPunkt-normal");
      hPanel.add(normalButton);

    // Return the panel
    return hPanel;
  }


    @Override
    protected void asyncOnInitialize(final AsyncCallback<Widget>
callback) {
      // TODO Auto-generated method stub
        GWT.runAsync(EpGermanPunkt.class, new RunAsyncCallback() {

            public void onFailure(Throwable caught) {
              callback.onFailure(caught);
            }

            public void onSuccess() {
              callback.onSuccess(onInitialize());
            }
          });
    }
}











-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to