Java Code Examples for com.google.gwt.user.client.ui.Panel#addStyleName()

The following examples show how to use com.google.gwt.user.client.ui.Panel#addStyleName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GalleryPage.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Helper method called by constructor to initialize the app's title section
 * @param container   The container that title resides
 */
private void initAppTitle(Panel container) {
  if (newOrUpdateApp()) {
    // GUI for editable title container
    if (editStatus==NEWAPP) {
      // If it's new app, give a textual hint telling user this is title
      titleText.setText(app.getTitle());
    } else if (editStatus==UPDATEAPP) {
      // If it's not new, just set whatever's in the data field already
      titleText.setText(app.getTitle());
    }
    titleText.addValueChangeHandler(new ValueChangeHandler<String>() {
      @Override
      public void onValueChange(ValueChangeEvent<String> event) {
        app.setTitle(titleText.getText());
      }
    });
    titleText.addStyleName("app-desc-textarea");
    container.add(titleText);
    container.addStyleName("app-title-container");
  } else {
    Label title = new Label(app.getTitle());
    title.addStyleName("app-title");
    container.add(title);
  }
}
 
Example 2
Source File: GalleryPage.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Helper method called by constructor to initialize the app's description
 * @param c1   The container that description resides (editable state)
 * @param c2   The container that description resides (public state)
 */
private void initAppDesc(Panel c1, Panel c2) {
  desc.getElement().setPropertyString("placeholder", MESSAGES.galleryDescriptionHint());
  if (newOrUpdateApp()) {
    desc.addValueChangeHandler(new ValueChangeHandler<String>() {
      @Override
      public void onValueChange(ValueChangeEvent<String> event) {
        app.setDescription(desc.getText());
      }
    });
    if(editStatus==UPDATEAPP){
      desc.setText(app.getDescription());
    }
    desc.addStyleName("app-desc-textarea");
    c1.add(desc);
  } else {
    Label description = new Label(app.getDescription());
    c2.add(description);
    c2.addStyleName("app-description");
  }
}
 
Example 3
Source File: GalleryPage.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method called by constructor to initialize the app's stats fields
 * @param container   The container that stats fields reside
 */
private void initAppStats(Panel container) {
  // Images for stats data
  Image numDownloads = new Image();
  numDownloads.setUrl(DOWNLOAD_ICON_URL);
  Image numLikes = new Image();
  numLikes.setUrl(HOLLOW_HEART_ICON_URL);

  // Add stats data
  container.addStyleName("app-stats");
  container.add(numDownloads);
  container.add(new Label(Integer.toString(app.getDownloads())));
  // Adds dynamic like
  initLikeSection(container);
  // Adds dynamic feature
  initFeatureSection(container);
  // Adds dynamic tutorial
  initTutorialSection(container);
  // Adds dynamic salvage
  initSalvageSection(container);

  // We are not using views and comments at initial launch
  /*
  Image numViews = new Image();
  numViews.setUrl(NUM_VIEW_ICON_URL);
  Image numComments = new Image();
  numComments.setUrl(NUM_COMMENT_ICON_URL);
  container.add(numViews);
  container.add(new Label(Integer.toString(app.getViews())));
  container.add(numComments);
  container.add(new Label(Integer.toString(app.getComments())));
  */
}