diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/leaderboard/LeaderboardSettingsPanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/leaderboard/LeaderboardSettingsPanel.java deleted file mode 100755 index 0f72c6031c4..00000000000 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/leaderboard/LeaderboardSettingsPanel.java +++ /dev/null @@ -1,192 +0,0 @@ -package com.sap.sailing.gwt.ui.leaderboard; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.CheckBox; -import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.LongBox; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; -import com.sap.sailing.gwt.ui.client.DataEntryDialog; -import com.sap.sailing.gwt.ui.client.DetailTypeFormatter; -import com.sap.sailing.gwt.ui.client.StringConstants; -import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettingsPanel.Result; -import com.sap.sailing.server.api.DetailType; - -public class LeaderboardSettingsPanel extends DataEntryDialog { - private final List raceColumnSelection; - private final List raceAllRaceColumns; - private final List maneuverDetailSelection; - private final List legDetailSelection; - private final List raceDetailSelection; - private final Map raceColumnCheckboxes; - private final Map maneuverDetailCheckboxes; - private final Map legDetailCheckboxes; - private final Map raceDetailCheckboxes; - private final StringConstants stringConstants; - private final LongBox delayBetweenAutoAdvancesInSecondsBox; - private final LongBox delayInSecondsBox; - - public static class Result { - private final List raceColumnsToShow; - private final List maneuverDetailsToShow; - private final List legDetailsToShow; - private final List raceDetailsToShow; - private final long delayBetweenAutoAdvancesInMilliseconds; - private final long delayInMilliseconds; - - public Result(List meneuverDetailsToShow, List legDetailsToShow, - List raceDetailsToShow, List raceColumnsToShow, - long delayBetweenAutoAdvancesInMilliseconds, long delayInMilliseconds) { - this.legDetailsToShow = legDetailsToShow; - this.raceDetailsToShow = raceDetailsToShow; - this.raceColumnsToShow = raceColumnsToShow; - this.delayBetweenAutoAdvancesInMilliseconds = delayBetweenAutoAdvancesInMilliseconds; - this.delayInMilliseconds = delayInMilliseconds; - this.maneuverDetailsToShow = meneuverDetailsToShow; - } - - public List getManeuverDetailsToShow() { - return maneuverDetailsToShow; - } - - public List getLegDetailsToShow() { - return legDetailsToShow; - } - - public List getRaceDetailsToShow() { - return raceDetailsToShow; - } - - public List getRaceColumnsToShow(){ - return raceColumnsToShow; - } - - public long getDelayBetweenAutoAdvancesInMilliseconds() { - return delayBetweenAutoAdvancesInMilliseconds; - } - - public long getDelayInMilliseconds() { - return delayInMilliseconds; - } - } - - public LeaderboardSettingsPanel(List maneuverDetailSelection, List legDetailSelection, - List raceDetailSelection, List raceAllRaceColumns, List raceColumnSelection, - long delayBetweenAutoAdvancesInMilliseconds, String title, String message, String okButtonName, - String cancelButtonName, com.sap.sailing.gwt.ui.client.DataEntryDialog.Validator validator, - AsyncCallback callback, StringConstants stringConstants, long delayInMilliseconds) { - super(title, message, okButtonName, cancelButtonName, validator, callback); - this.maneuverDetailSelection = maneuverDetailSelection; - this.raceColumnSelection = raceColumnSelection; - this.raceAllRaceColumns = raceAllRaceColumns; - this.legDetailSelection = legDetailSelection; - this.raceDetailSelection = raceDetailSelection; - this.stringConstants = stringConstants; - raceColumnCheckboxes = new LinkedHashMap(); - maneuverDetailCheckboxes = new LinkedHashMap(); - legDetailCheckboxes = new LinkedHashMap(); - raceDetailCheckboxes = new LinkedHashMap(); - delayBetweenAutoAdvancesInSecondsBox = createLongBox(delayBetweenAutoAdvancesInMilliseconds/1000l, 4); - delayInSecondsBox = createLongBox(delayInMilliseconds/1000l, 4); - } - - @Override - protected Widget getAdditionalWidget() { - HorizontalPanel hp = new HorizontalPanel(); - VerticalPanel vpMeneuvers = new VerticalPanel(); - vpMeneuvers.setSpacing(5); - vpMeneuvers.add(new Label(stringConstants.maneuverTypes())); - List currentMeneuverDetailSelection = maneuverDetailSelection; - for (DetailType detailType : ManeuverCountRaceColumn.getAvailableManeuverDetailColumnTypes()) { - CheckBox checkbox = createCheckbox(DetailTypeFormatter.format(detailType, stringConstants)); - checkbox.setValue(currentMeneuverDetailSelection.contains(detailType)); - maneuverDetailCheckboxes.put(detailType, checkbox); - vpMeneuvers.add(checkbox); - } - hp.add(vpMeneuvers); - VerticalPanel vpLeft = new VerticalPanel(); - vpLeft.setSpacing(5); - VerticalPanel vpRight = new VerticalPanel(); - vpRight.setSpacing(5); - vpLeft.add(new Label(stringConstants.timing())); - Label delayLabel = new Label(stringConstants.delayInSeconds()); - vpLeft.add(delayLabel); - vpLeft.add(delayInSecondsBox); - Label delayBetweenAutoAdvancesLabel = new Label(stringConstants.delayBetweenAutoAdvances()); - vpLeft.add(delayBetweenAutoAdvancesLabel); - vpLeft.add(delayBetweenAutoAdvancesInSecondsBox); - vpLeft.add(new Label(stringConstants.raceDetailsToShow())); - List currentRaceDetailSelection = raceDetailSelection; - for (DetailType type : LeaderboardPanel.getAvailableRaceDetailColumnTypes()) { - CheckBox checkbox = createCheckbox(DetailTypeFormatter.format(type, stringConstants)); - checkbox.setValue(currentRaceDetailSelection.contains(type)); - raceDetailCheckboxes.put(type, checkbox); - vpLeft.add(checkbox); - } - vpLeft.add(new Label(stringConstants.legDetailsToShow())); - List currentLegDetailSelection = legDetailSelection; - for (DetailType type : LegColumn.getAvailableLegDetailColumnTypes()) { - CheckBox checkbox = createCheckbox(DetailTypeFormatter.format(type, stringConstants)); - checkbox.setValue(currentLegDetailSelection.contains(type)); - legDetailCheckboxes.put(type, checkbox); - vpLeft.add(checkbox); - } - hp.add(vpLeft); - - vpRight.add(new Label(stringConstants.selectedRaces())); - List allColumns = raceAllRaceColumns; - for (String expandableSortableColumn : allColumns) { - CheckBox checkbox = createCheckbox(expandableSortableColumn); - checkbox.setValue(raceColumnSelection.contains(expandableSortableColumn)); - raceColumnCheckboxes.put(expandableSortableColumn, checkbox); - vpRight.add(checkbox); - } - hp.add(vpRight); - return hp; - } - - @Override - protected Result getResult() { - List maneuverDetailsToShow = new ArrayList(); - for (Map.Entry entry : maneuverDetailCheckboxes.entrySet()) { - if (entry.getValue().getValue()) { - maneuverDetailsToShow.add(entry.getKey()); - } - } - List raceDetailsToShow = new ArrayList(); - for (Map.Entry entry : raceDetailCheckboxes.entrySet()) { - if (entry.getValue().getValue()) { - raceDetailsToShow.add(entry.getKey()); - } - } - List legDetailsToShow = new ArrayList(); - for (Map.Entry entry : legDetailCheckboxes.entrySet()) { - if (entry.getValue().getValue()) { - legDetailsToShow.add(entry.getKey()); - } - } - List raceColumnsToShow = new ArrayList(); - for (Map.Entry entry : raceColumnCheckboxes.entrySet()) { - if(entry.getValue().getValue()){ - raceColumnsToShow.add(entry.getKey()); - } - } - Long delayBetweenAutoAdvancesValue = delayBetweenAutoAdvancesInSecondsBox.getValue(); - Long delayInSecondsValue = delayInSecondsBox.getValue(); - return new Result(maneuverDetailsToShow, legDetailsToShow, raceDetailsToShow, raceColumnsToShow, 1000l*(delayBetweenAutoAdvancesValue==null?0l:delayBetweenAutoAdvancesValue.longValue()), - 1000*(delayInSecondsValue==null?0:delayInSecondsValue.longValue())); - } - - @Override - public void show() { - super.show(); - delayInSecondsBox.setFocus(true); - } - -}