Ejemplo n.º 1
0
  public ConfigAccountPanel() {
    if (CShell.isGuest()
        || CShell.isPermaguest()
        || !MemberMailUtil.isPlaceholderAddress(CShell.creds.accountName)) {
      SmartTable box = new SmartTable(0, 10);
      box.setText(0, 0, _msgs.configNotYou());
      box.setWidget(0, 1, Link.create(_msgs.configHere(), Pages.ACCOUNT, "edit"));
      add(box);
      return;
    }

    int row = 0;
    SmartTable table = new SmartTable(0, 10);
    table.setText(row++, 0, _msgs.configIntro(), 3);
    table.setHTML(row++, 0, " ", 3);

    table.setText(row, 0, _msgs.editEmail(), 1, "rightLabel");
    _email = MsoyUI.createTextBox("", MemberName.MAX_EMAIL_LENGTH, -1);
    table.setWidget(row++, 1, _email);
    TextBoxUtil.addTypingListener(_email, _validator);

    table.setText(row, 0, _msgs.configPassword(), 1, "rightLabel");
    table.setWidget(row++, 1, _password = new PasswordTextBox());
    TextBoxUtil.addTypingListener(_password, _validator);

    table.setText(row, 0, _msgs.editConfirm(), 1, "rightLabel");
    table.setWidget(row++, 1, _confirm = new PasswordTextBox());
    TextBoxUtil.addTypingListener(_confirm, _validator);

    table.setHTML(row++, 0, " ", 3);
    table.setText(row++, 0, _msgs.configAuthTip(), 3);

    table.setWidget(
        row++,
        2,
        _submit =
            MsoyUI.createButton(
                MsoyUI.MEDIUM_THIN,
                _msgs.configSubmit(),
                new ClickHandler() {
                  public void onClick(ClickEvent event) {
                    updateAccount();
                  }
                }));
    _submit.setEnabled(false);

    // we use a blank tongue box for formatting consistency with the edit page
    add(new TongueBox(null, table));
  }
Ejemplo n.º 2
0
  protected void setFilteredBy(String text) {
    if (text == null) {
      String blurb = _dmsgs.xlateCatalogIntro(_query.itemType);
      _listings.setText(0, 0, blurb, 1, "Blurb");

    } else {
      FlowPanel filter = new FlowPanel();
      filter.add(new InlineLabel(text, false, false, true));
      CatalogQuery query = new CatalogQuery();
      query.itemType = _query.itemType;
      query.sortBy = _query.sortBy;
      filter.add(
          Link.create(_msgs.catalogClearFilter(), Pages.SHOP, ShopUtil.composeArgs(query, 0)));
      _listings.setWidget(0, 0, filter, 1, "Blurb");
    }
  }
Ejemplo n.º 3
0
 protected void addGame(SmartTable table, int row, int startCol, GameCard game) {
   table.setWidget(
       row,
       startCol,
       new ThumbBox(
           game.thumbMedia, MediaDescSize.HALF_THUMBNAIL_SIZE, Pages.GAMES, "d", game.gameId));
   Widget link = Link.createBlock(game.name, "Name", Pages.GAMES, "d", game.gameId);
   if (game.playersOnline == 0) {
     table.setWidget(row, startCol + 1, link, 1, "Info");
   } else {
     FlowPanel bits = new FlowPanel();
     bits.add(link);
     bits.add(MsoyUI.createLabel(_msgs.featuredOnline("" + game.playersOnline), "tipLabel"));
     table.setWidget(row, startCol + 1, bits);
   }
 }
Ejemplo n.º 4
0
 protected void createUploadInterface() {
   _upload = new AbsolutePanel();
   _upload.setStyleName("GetStuff");
   _upload.add(MsoyUI.createLabel(_msgs.getStuffTitle(), "GetStuffTitle"), 60, 10);
   _upload.add(MsoyUI.createHTML(_dmsgs.xlateGetStuffBuy(_type), "GetStuffBuy"), 165, 85);
   _upload.add(MsoyUI.createHTML(_dmsgs.xlateGetStuffCreate(_type), "GetStuffCreate"), 360, 85);
   _upload.add(
       new StretchButton(
           StretchButton.BLUE_THICK,
           _msgs.getStuffShop(),
           Link.createHandler(Pages.SHOP, _type + "")),
       10,
       90);
   _upload.add(
       MsoyUI.createButton(
           MsoyUI.MEDIUM_THICK, _msgs.getStuffUpload(), NaviUtil.onCreateItem(_type, 0)),
       535,
       90);
 }
Ejemplo n.º 5
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);
    }
  }
Ejemplo n.º 6
0
  public void setGameDetail(final GameDetail detail) {
    final GameInfo info = detail.info;
    CShell.frame.setTitle(info.name);

    // keep our requested game id around
    _gameId = detail.gameId;

    VerticalPanel shot = new VerticalPanel();
    shot.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
    shot.add(new ThumbBox(info.shotMedia, MediaDescSize.GAME_SHOT_SIZE));
    shot.add(WidgetUtil.makeShim(5, 5));
    Rating rating =
        new Rating(
            info.rating,
            info.ratingCount,
            detail.memberRating,
            false,
            new RateService() {
              public void handleRate(byte newRating, InfoCallback<RatingResult> callback) {
                _gamesvc.rateGame(_gameId, newRating, callback);
              }
            },
            null);

    shot.add(rating);
    HorizontalPanel mbits = new HorizontalPanel();
    mbits.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
    mbits.add(
        MsoyUI.makeShareButton(
            Pages.GAMES,
            Args.compose("d", _gameId),
            _msgs.gdpGame(),
            info.name,
            info.description,
            info.shotMedia));
    shot.add(mbits);
    setWidget(0, 0, shot);
    getFlexCellFormatter().setRowSpan(0, 0, 2);
    getFlexCellFormatter().setVerticalAlignment(0, 0, HasAlignment.ALIGN_TOP);

    setWidget(0, 1, new GameNamePanel(info.name, info.genre, info.creator, info.description), 2);

    setWidget(1, 0, new GameBitsPanel(detail));

    FlowPanel play = new FlowPanel();
    play.setStyleName("playPanel");
    play.add(PlayButton.createLarge(_gameId));
    if (info.playersOnline > 0) {
      play.add(MsoyUI.createLabel(_msgs.featuredOnline("" + info.playersOnline), "Online"));
    }
    if (!info.integrated) {
      play.add(MsoyUI.createLabel(_msgs.gdpNoCoins(), null));
    }
    setWidget(1, 1, play, 1, "Play");
    getFlexCellFormatter().setHorizontalAlignment(1, 1, HasAlignment.ALIGN_CENTER);

    // add "Discussions" (if appropriate) and "Shop" button
    Widget buttons = null;
    if (info.groupId > 0) {
      ClickHandler onClick = Link.createHandler(Pages.GROUPS, "f", info.groupId);
      buttons = MsoyUI.createButton(MsoyUI.LONG_THIN, _msgs.gdpDiscuss(), onClick);
    }
    ClickHandler onShop = Link.createHandler(Pages.SHOP, "g", Math.abs(_gameId));
    PushButton shop = MsoyUI.createButton(MsoyUI.MEDIUM_THIN, _msgs.gdpShop(), onShop);
    buttons = (buttons == null) ? shop : MsoyUI.createButtonPair(buttons, shop);
    setWidget(2, 0, buttons);
    getFlexCellFormatter().setRowSpan(0, 0, 3);
    getFlexCellFormatter().setRowSpan(1, 1, 2);

    setWidget(
        3,
        0,
        _tabs =
            new NaviTabPanel(Pages.GAMES) {
              protected Args getTabArgs(int tabIdx) {
                return getTabCode(tabIdx).args(_gameId);
              }
            },
        3);

    // add the about/instructions tab
    addTab(GameDetails.INSTRUCTIONS, _msgs.tabInstructions(), new InstructionsPanel(detail));

    // add comments tab
    addTab(
        GameDetails.COMMENTS,
        _msgs.tabComments(),
        new LazyPanel() {
          protected Widget createWidget() {
            CommentsPanel comments = new CommentsPanel(CommentType.GAME, info.gameId, true);
            comments.expand();
            return comments;
          }
        });

    // add trophies tab, passing in the potentially negative gameId
    addTab(
        GameDetails.TROPHIES,
        _msgs.tabTrophies(),
        new LazyPanel() {
          protected Widget createWidget() {
            return new GameTrophyPanel(_gameId);
          }
        });

    // add top rankings tabs
    if (!CShell.isGuest()) {
      addTab(
          GameDetails.MYRANKINGS,
          _msgs.tabMyRankings(),
          new LazyPanel() {
            protected Widget createWidget() {
              return new TopRankingPanel(info.gameId, true);
            }
          });
    }
    addTab(
        GameDetails.TOPRANKINGS,
        _msgs.tabTopRankings(),
        new LazyPanel() {
          protected Widget createWidget() {
            return new TopRankingPanel(info.gameId, false);
          }
        });

    // if we're the creator of the game or support, add the metrics and logs tabs
    if (info.isCreator(CShell.getMemberId()) || CShell.isSupport()) {
      // addTab(GameDetails.METRICS, _msgs.tabMetrics(), new LazyPanel() {
      //     protected Widget createWidget () {
      //         return new GameMetricsPanel(detail);
      //     }
      // });
      addTab(
          GameDetails.LOGS,
          _msgs.tabLogs(),
          new LazyPanel() {
            protected Widget createWidget() {
              return new GameLogsPanel(info.gameId);
            }
          });
      addTab(
          GameDetails.DEV_LOGS,
          _msgs.tabDevLogs(),
          new LazyPanel() {
            protected Widget createWidget() {
              return new GameLogsPanel(GameInfo.toDevId(info.gameId));
            }
          });
    }
  }
Ejemplo n.º 7
0
 // from interface TagCloud.TagListener
 public void tagClicked(String tag) {
   Link.go(Pages.SHOP, ShopUtil.composeArgs(_query, tag, null, 0));
 }