Beispiel #1
0
    public EnterGameForm(String id, IModel model) {
      super(id, model);

      Game game = (Game) getModelObject();
      Week week = game.getWeek();
      // LeagueType leagueType = week.getLeagueType();
      // List<Team> teams = teamManager.getTeamsByLeagueType(leagueType);
      List<Team> teams = teamManager.getUnenteredTeamsForWeek(week);
      final DropDownChoice fav =
          new DropDownChoice("fav", teams, new ChoiceRenderer("fullTeamName", "id"));
      fav.setRequired(true);
      add(fav);

      final DropDownChoice dog =
          new DropDownChoice("dog", teams, new ChoiceRenderer("fullTeamName", "id"));
      dog.setRequired(true);
      add(dog);

      RequiredTextField spread = new RequiredTextField("spread", Double.class);
      add(spread);

      CheckBox favHome = new CheckBox("favHome");
      add(favHome);

      add(new DateTimeField("gameStart"));

      add(new Button("submit"));
    }
Beispiel #2
0
    @Override
    protected void onSubmit() {
      Game game = (Game) getModelObject();
      Week week = game.getWeek();
      //			gameManager.insertGame(game);
      gameManager.createUpdateGame(game);

      Game newGame = new Game();
      newGame.setWeek(week);
      //			setModelObject(new CompoundPropertyModel(newGame));

      List<Team> teams = teamManager.getUnenteredTeamsForWeek(week);
      DropDownChoice fav = (DropDownChoice) get("fav");
      fav.setChoices(teams);

      DropDownChoice dog = (DropDownChoice) get("dog");
      dog.setChoices(teams);

      getModel().detach();
    }