public RegisterResultPanel() {
    ServiceManager.getInstance().addLeagueUpdateListener(this);
    ServiceManager.getInstance().addLoginListener(this);

    mainPanel = new VerticalPanel();
    mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.setSpacing(Spelstegen.VERTICAL_SPACING);
    panelIsVisible = false;
    initWidget(mainPanel);
  }
  private void submitMatch() {
    Match m =
        new Match(
            league.getId(),
            new Date(),
            league.getSports().get(sportBox.getSelectedIndex()),
            league.getPlayers().get(player1Box.getSelectedIndex() - 1),
            league.getPlayers().get(player2Box.getSelectedIndex() - 1));
    for (int i = 0; i < player1Score.size(); i++) {
      try {
        if (!player1Score.get(i).getText().equals("")
            && !player2Score.get(i).getText().equals("")) {
          m.addSet(
              new Set(
                  m.getSport(),
                  Integer.parseInt(player1Score.get(i).getText()),
                  Integer.parseInt(player2Score.get(i).getText())));
        }
      } catch (NumberFormatException e) {
        Window.alert("Failed to parse number: " + e.getMessage());
      }
    }
    AsyncCallback<Void> callback =
        new AsyncCallback<Void>() {
          public void onFailure(Throwable caught) {
            Window.alert("Failed to save match.");
          }

          public void onSuccess(Void arg) {
            Spelstegen.showMessage("Match sparad.", false);
            resetPanel();
          }
        };
    ServiceManager.getInstance().saveMatch(m, loggedInPlayer, league, callback);
  }