예제 #1
0
        public void onSuccess(List<PacketUserData> result) {
          clear();
          add(html);
          HorizontalPanel horizontalPanel = new HorizontalPanel();
          for (PacketUserData data : result) {
            final VerticalPanel panel = new VerticalPanel();
            panel.setHorizontalAlignment(ALIGN_CENTER);

            final Image image = new Image(Constant.ICON_URL_PREFIX + data.imageFileName);
            image.setPixelSize(Constant.ICON_SIZE_BIG, Constant.ICON_SIZE_BIG);
            panel.add(image);

            final Label label = new Label(data.playerName);
            panel.add(label);

            horizontalPanel.add(panel);

            if (horizontalPanel.getWidgetCount() == 8) {
              add(horizontalPanel);
              horizontalPanel = new HorizontalPanel();
            }
          }

          if (horizontalPanel.getWidgetCount() != 0) {
            add(horizontalPanel);
          }
        }
예제 #2
0
  /**
   * Add in a collection of buttons assembled as a ToolbarGroup
   *
   * @param group ToolbarGroup to add.
   */
  public void add(ToolbarGroup group) {

    // check to see if there's already a separator added before this group
    if (!(bar.getWidget(bar.getWidgetCount() - 1) instanceof Image)) {
      bar.add(group.getLeadingSeparator());
      bar.setCellVerticalAlignment(group.getLeadingSeparator(), ALIGN_MIDDLE);
    }

    // if the group has a label tag, add it before the buttons
    if (group.getLabel() != null) {
      bar.add(group.getGroupLabel());
      bar.setCellVerticalAlignment(group.getGroupLabel(), ALIGN_MIDDLE);
    }

    // add the buttons to the bar and buttons collection
    for (ToolbarButton btn : group.getButtons()) {
      bar.add(btn.getPushButton());
    }
    bar.add(group.getTrailingSeparator());
    bar.setCellVerticalAlignment(group.getTrailingSeparator(), ALIGN_MIDDLE);
    groups.add(group);
  }
예제 #3
0
 public void setSubtitles(List<String> artistList) {
   subtitlePanel.clear();
   for (String artistId : artistList) {
     final Hyperlink artistLink = new Hyperlink();
     Label commaLabel = new Label(",");
     commaLabel.getElement().addClassName(style.space());
     Cache<String, ArtistInfo> artistCache = Controller.INSTANCE.getModel().getArtistCache();
     artistCache.addHandler(
         artistId,
         new CacheHandler<String, ArtistInfo>() {
           @Override
           public void onCacheUpdated(String k, ArtistInfo v) {
             artistLink.setText(v.getName());
             artistLink.setTargetHistoryToken(v.getTargetHistoryToken());
           }
         });
     artistCache.obtain(artistId);
     subtitlePanel.add(artistLink);
     subtitlePanel.add(commaLabel);
   }
   subtitlePanel.remove(subtitlePanel.getWidgetCount() - 1);
   subtitlePanel.setVisible(true);
 }
예제 #4
0
 private void removeAllWidgets(HorizontalPanel panel) {
   for (int i = panel.getWidgetCount() - 1; i >= 0; i--) panel.remove(i);
 }