Esempio n. 1
0
 protected void displayThanks() {
   clear();
   SmartTable box = new SmartTable(0, 10);
   box.setText(0, 0, _msgs.configThanks());
   box.setWidget(
       1, 0, MsoyUI.createButton(MsoyUI.MEDIUM_THIN, _msgs.configGoBack(), NaviUtil.onGoBack()));
   box.getFlexCellFormatter().setHorizontalAlignment(1, 0, HasAlignment.ALIGN_CENTER);
   add(box);
 }
Esempio n. 2
0
  protected void init(final ArcadeData data) {
    clear();
    add(_header = new FBGameHeaderPanel());
    _header.initWithCards(data.allGames);

    // top games
    FlowPanel topGames = MsoyUI.createFlowPanel("TopGames");
    topGames.add(MsoyUI.createLabel("Top 10 Games", "title"));
    add(topGames);
    DOM.setStyleAttribute(topGames.getElement(), "position", "absolute");
    int ii;
    for (ii = 0; ii < data.topGames.size(); ii++) {
      topGames.add(createTopGameWidget(ii + 1, data.topGames.get(ii)));
    }

    // pad out for testing
    if (data.topGames.size() > 0) {
      for (; ii < 10; ++ii) {
        int rnd = (int) (Math.random() * data.topGames.size());
        topGames.add(createTopGameWidget(ii + 1, data.topGames.get(rnd)));
      }
    }

    // featured games
    // add(new FBFeaturedGamePanel(data.featuredGames));
    add(new FBMochiGamePanel(data.mochiGames));

    // game wall
    AbsolutePanel gameWall = new AbsolutePanel();
    gameWall.setStyleName("GameWall");
    gameWall.add(MsoyUI.createLabel("Featured Games", "title"));
    SmartTable grid = new SmartTable("Grid", 0, 0);
    gameWall.add(grid);
    int cell = 1;
    for (GameCard wallGame : data.gameWall) {
      grid.setWidget(cell / 3, cell % 3, createWallGameWidget(wallGame), 1, "WallCell");
      cell++;
    }

    // pad out for testing
    if (data.topGames.size() > 0) {
      for (; cell <= 20; cell++) {
        int rnd = (int) (Math.random() * data.topGames.size());
        grid.setWidget(
            cell / 3, cell % 3, createWallGameWidget(data.topGames.get(rnd)), 1, "WallCell");
      }
    }

    add(gameWall);
  }
Esempio 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);
   }
 }
Esempio n. 4
0
  public RoomsPanel() {
    setStyleName("roomsPanel");

    SmartTable header = new SmartTable("Info", 0, 0);
    header.setWidget(0, 0, new Marquee(null, _msgs.roomsMarquee()), 1);
    header.getFlexCellFormatter().setVerticalAlignment(0, 0, HasAlignment.ALIGN_TOP);
    header.setText(1, 0, _msgs.roomsIntro(), 1, "Intro");

    Widget button =
        MsoyUI.createImageButton(
            "TourButton",
            new ClickHandler() {
              public void onClick(ClickEvent event) {
                if (FlashClients.clientExists()) {
                  FlashClients.startTour();
                } else {
                  Link.go(Pages.WORLD, "tour");
                }
              }
            });
    header.setWidget(0, 1, button, 1, "Tour");
    header.getFlexCellFormatter().setRowSpan(0, 1, 2);
    header.getFlexCellFormatter().setHorizontalAlignment(0, 1, HasAlignment.ALIGN_CENTER);

    add(header);

    _worldsvc.loadOverview(
        new InfoCallback<WebRoomService.OverviewResult>() {
          public void onSuccess(WebRoomService.OverviewResult overview) {
            init(overview);
          }
        });
  }
Esempio n. 5
0
  protected void init(final GameData data) {
    clear();

    SmartTable header = new SmartTable("Header", 0, 10);
    header.setText(0, 0, data.info.name, 1, "Title");
    header.setWidget(0, 1, MsoyUI.createHTML(_msgs.egTip(), null), 1, "Tip");
    Button delete = new Button(_msgs.egDelete());
    header.setWidget(0, 2, delete);
    header.getFlexCellFormatter().setHorizontalAlignment(0, 2, HasAlignment.ALIGN_RIGHT);
    add(header);

    // wire up the delete button
    new ClickCallback<Void>(delete, _msgs.egDeleteConfirm()) {
      @Override
      protected boolean callService() {
        _gamesvc.deleteGame(data.info.gameId, this);
        return true;
      }

      @Override
      protected boolean gotResult(Void result) {
        Link.go(Pages.EDGAMES, "m");
        return true;
      }
    };

    // add our giant tab list of doom
    add(
        _tabs =
            new NaviTabPanel(Pages.EDGAMES) {
              protected Args getTabArgs(int tabIdx) {
                return Args.compose("e", _gameId, tabIdx);
              }
            });

    _tabs.add(
        new LazyPanel() {
          protected Widget createWidget() {
            return new InfoEditorPanel(data);
          }
        },
        _msgs.egTabInfo());
    _tabs.add(
        new LazyPanel() {
          protected Widget createWidget() {
            return new CodeEditorPanel(data.info, data.devCode);
          }
        },
        _msgs.egTabCode());
    _tabs.add(
        new LazyPanel() {
          protected Widget createWidget() {
            return new PublishPanel(data);
          }

          @Override
          public void setVisible(boolean visible) {
            if (!visible) {
              setWidget(null); // clear out our panel when we change tabs
            }
            super.setVisible(visible);
          }
        },
        _msgs.egTabPublish());
    _tabs.add(
        new LazyPanel() {
          protected Widget createWidget() {
            return new FacebookGameInfoEditorPanel(data.facebook);
          }
        },
        _msgs.egTabFacebook());
    // NOTE: if you add a tab here, you have to adjust StuffPage.PRE_ITEM_TABS

    for (final MsoyItemType type : GameItem.TYPES) {
      _tabs.add(
          new LazyPanel() {
            protected Widget createWidget() {
              return new GameItemEditorPanel(data.info.gameId, type);
            }
          },
          _dmsgs.xlateItemsType(type));
    }
  }
Esempio n. 6
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, "&nbsp;", 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, "&nbsp;", 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));
  }
Esempio n. 7
0
 /** Creates a widget displaying a top game. */
 protected SmartTable createTopGameWidget(int index, GameCard game) {
   SmartTable table = new SmartTable("TopGameWidget", 0, 0);
   table.setText(0, 0, index + "", 1, "Number");
   addGame(table, 0, 1, game);
   return table;
 }