Esempio n. 1
0
 @Override
 public void updateForMode() {
   view.updateForMode();
 }
Esempio n. 2
0
 @Override
 public void go(HasWidgets container) {
   container.clear();
   container.add(view.asWidget());
   refresh();
 }
Esempio n. 3
0
 @Override
 protected void refresh() {
   view.refresh();
 }
Esempio n. 4
0
  public PlayersPresenter(Presenter parentPresenter, PlayersView view) {
    super(parentPresenter);
    this.view = view;
    view.setPresenter(this);

    List<LabeledColumn<Player>> columns = new ArrayList<LabeledColumn<Player>>();

    columns.add(
        new LabeledColumn<Player>(
            new Column<Player, String>(new TextCell()) {

              @Override
              public String getValue(Player player) {
                return player.getNick();
              }
            },
            "Přezdívka"));

    columns.add(
        new LabeledColumn<Player>(
            new Column<Player, String>(new TextCell()) {

              @Override
              public String getValue(Player player) {
                return player.isActive() ? "Ano" : "Ne";
              }
            },
            "Aktivní"));

    view.setPlayersEditor(
        new AbstractPersistentEntityListEditor<Player>(
            "Nový hráč",
            playerEditor,
            new AbstractPersistentEntityListEditor.DataProvider<Player>() {

              @Override
              protected void getData(final AsyncCallback<List<Player>> callback) {
                ClientEntityManager.getInstance()
                    .list(
                        Player.class,
                        new AsyncCallback<List<Player>>() {

                          @Override
                          public void onFailure(Throwable caught) {
                            callback.onFailure(caught);
                          }

                          @Override
                          public void onSuccess(List<Player> players) {
                            Collections.sort(players, Comparators.PLAYERS_COMPARATOR);
                            callback.onSuccess(players);
                          }
                        });
              }
            },
            columns) {

          @Override
          protected Player getNewEntity() {
            return new Player();
          }
        });
  }