Ejemplo n.º 1
0
    public TrophyDetail(Trophy trophy) {
      setCellSpacing(0);
      setCellPadding(0);
      setStyleName("trophyDetail");

      if (trophy != null) {
        setWidget(
            0, 0, MediaUtil.createMediaView(trophy.trophyMedia, MediaDescSize.THUMBNAIL_SIZE));
        setText(0, 1, trophy.name);
        if (trophy.description == null) {
          setText(1, 0, _msgs.gameTrophySecret());
          getFlexCellFormatter().setStyleName(1, 0, "Italic");
        } else {
          setText(1, 0, trophy.description);
        }
        if (trophy.whenEarned != null) {
          Date date = new Date(trophy.whenEarned.longValue());
          setText(2, 0, _msgs.gameTrophyEarnedOn(DateUtil.formatDate(date, false)));
          getFlexCellFormatter().setStyleName(2, 0, "Earned");
        }
      }

      getFlexCellFormatter().setStyleName(0, 0, "Image");
      getFlexCellFormatter().setStyleName(0, 1, "Name");
      getFlexCellFormatter().setVerticalAlignment(1, 0, HasAlignment.ALIGN_TOP);
      getFlexCellFormatter().setRowSpan(0, 0, getRowCount());
    }
Ejemplo n.º 2
0
  protected void displaySearchResults(final List<VizMemberName> members) {
    if (_medals == null) {
      // we need _medals to be valid before we can proceed with this operation.
      _medalsValidCommand =
          new Command() {
            public void execute() {
              displaySearchResults(members);
            }
          };
      return;
    }

    if (members.size() == 0) {
      MsoyUI.info(_msgs.awardMedalsNoMembersFound());
      return;
    }

    for (final VizMemberName member : members) {
      HorizontalPanel row = new HorizontalPanel();
      row.setSpacing(10);
      row.add(MediaUtil.createMediaView(member.getPhoto(), MediaDescSize.HALF_THUMBNAIL_SIZE));
      row.add(Link.create(member.toString(), Pages.PEOPLE, "" + member.getId()));
      // TODO: this will be really inefficient for groups that have a ton of Medals.  This
      // UI should contain only one drop down if at all possible.
      final ListBox awardDrop = createDropDown();
      row.add(awardDrop);
      row.add(
          new Button(
              _msgs.awardMedalsAward(),
              new ClickHandler() {
                public void onClick(ClickEvent event) {
                  int selected = Math.max(0, awardDrop.getSelectedIndex());
                  Medal medal =
                      awardDrop.getItemCount() < 0
                          ? null
                          : _medalMap.get(awardDrop.getValue(selected));
                  grantMedal(member, medal);
                }
              }));
      add(row);
    }
  }