private HorizontalPanel createScoreRow() { HorizontalPanel scorePanel = Spelstegen.createStandardHorizontalPanel(); TextBox p1Score = new TextBox(); player1Score.add(p1Score); scorePanel.add(p1Score); scorePanel.add(new Label(" - ")); TextBox p2Score = new TextBox(); player2Score.add(p2Score); scorePanel.add(p2Score); return scorePanel; }
private void populatePanel() { player1Box = new ListBox(false); populatePlayerBox(player1Box); Label vsLabel = new Label(" spelade mot "); player2Box = new ListBox(false); populatePlayerBox(player2Box); HorizontalPanel playerPanel = Spelstegen.createStandardHorizontalPanel(); playerPanel.add(player1Box); playerPanel.add(vsLabel); playerPanel.add(player2Box); sportBox = new ListBox(false); if (league.getSports().size() > 1) { sportBox.addItem("Välj sport"); for (Sport sport : league.getSports()) { sportBox.addItem(sport.getName()); } } else { sportBox.addItem(league.getSports().get(0).getName()); sportBox.setEnabled(false); } HorizontalPanel sportPanel = Spelstegen.createStandardHorizontalPanel(); sportPanel.add(new Label("i:")); sportPanel.add(sportBox); Label setLabel = new Label("Spel om bäst av"); oneSet = new RadioButton("setSelection", "1"); threeSet = new RadioButton("setSelection", "3"); fiveSet = new RadioButton("setSelection", "5"); oneSet.setValue(true); SetClickHandler setClickHandler = new SetClickHandler(); oneSet.addClickHandler(setClickHandler); threeSet.addClickHandler(setClickHandler); fiveSet.addClickHandler(setClickHandler); Label setLabel2 = new Label(" set"); HorizontalPanel setPanel = Spelstegen.createStandardHorizontalPanel(); setPanel.add(setLabel); setPanel.add(oneSet); setPanel.add(threeSet); setPanel.add(fiveSet); setPanel.add(setLabel2); player1Score = new ArrayList<TextBox>(5); player2Score = new ArrayList<TextBox>(5); scorePanel = new VerticalPanel(); scorePanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); setScoreBoxes(1); saveButton = new PushButton("Spara"); if (loggedInPlayer != null) { saveButton.setEnabled(loggedInPlayer.isLeagueAdmin(league.getId())); } saveButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { submitMatch(); } }); HorizontalPanel buttonPanel = Spelstegen.createStandardHorizontalPanel(); buttonPanel.add(saveButton); mainPanel.add(playerPanel); mainPanel.add(sportPanel); mainPanel.add(setPanel); mainPanel.add(scorePanel); mainPanel.add(buttonPanel); }