mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-02 18:33:54 +00:00
moved the regatta selection to the tractrac management panel
This commit is contained in:
1 parent
1e274ad4df
commit
d7086190df
2 files changed
+48
-48
No files matched your search
+48
-5
@@ -75,7 +75,9 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
private final ListBox previousConfigurationsComboBox;
|
||||
private final Grid grid;
|
||||
private final List<TracTracRaceRecordDTO> availableTracTracRaces;
|
||||
|
||||
private Iterable<RegattaDTO> allRegattas;
|
||||
private final ListBox regattaListBox;
|
||||
|
||||
public TracTracEventManagementPanel(final SailingServiceAsync sailingService, ErrorReporter errorReporter,
|
||||
RegattaRefresher regattaRefresher, StringMessages stringConstants) {
|
||||
super(sailingService, regattaRefresher, errorReporter, new RaceSelectionModel(), stringConstants);
|
||||
@@ -273,6 +275,18 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
trackedRacesCaptionPanel.setStyleName("bold");
|
||||
|
||||
// text box for filtering the cell table
|
||||
// the regatta selection for a tracked race
|
||||
HorizontalPanel regattaPanel = new HorizontalPanel();
|
||||
racesPanel.add(regattaPanel);
|
||||
Label lblRegattas = new Label("Regatta used for the tracked race:");
|
||||
lblRegattas.setWordWrap(false);
|
||||
regattaPanel.setCellVerticalAlignment(lblRegattas, HasVerticalAlignment.ALIGN_MIDDLE);
|
||||
regattaPanel.setSpacing(5);
|
||||
regattaPanel.add(lblRegattas);
|
||||
regattaListBox = new ListBox();
|
||||
regattaPanel.add(regattaListBox);
|
||||
regattaPanel.setCellVerticalAlignment(regattaListBox, HasVerticalAlignment.ALIGN_MIDDLE);
|
||||
|
||||
HorizontalPanel filterPanel = new HorizontalPanel();
|
||||
filterPanel.setSpacing(5);
|
||||
racesPanel.add(filterPanel);
|
||||
@@ -455,7 +469,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
private void trackSelectedRaces(boolean trackWind, boolean correctWindByDeclination) {
|
||||
String liveURI = liveURIBox.getValue();
|
||||
String storedURI = storedURIBox.getValue();
|
||||
RegattaDTO selectedRegatta = trackedRacesListComposite.getSelectedRegatta();
|
||||
RegattaDTO selectedRegatta = getSelectedRegatta();
|
||||
RegattaIdentifier regattaIdentifier = null;
|
||||
if(selectedRegatta != null) {
|
||||
regattaIdentifier = new RegattaName(selectedRegatta.name);
|
||||
@@ -494,10 +508,39 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillRegattas(List<RegattaDTO> result) {
|
||||
trackedRacesListComposite.fillRegattas(result);
|
||||
public void fillRegattas(List<RegattaDTO> regattas) {
|
||||
trackedRacesListComposite.fillRegattas(regattas);
|
||||
|
||||
RegattaDTO oldRegattaSelection = getSelectedRegatta();
|
||||
regattaListBox.clear();
|
||||
regattaListBox.addItem("No regatta");
|
||||
if (!regattas.isEmpty()) {
|
||||
regattaListBox.addItem("No regatta");
|
||||
for (RegattaDTO regatta : regattas) {
|
||||
regattaListBox.addItem(regatta.name);
|
||||
if(oldRegattaSelection != null && oldRegattaSelection.name.equals(regatta.name)) {
|
||||
regattaListBox.setSelectedIndex(regattaListBox.getItemCount()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
allRegattas = new ArrayList<RegattaDTO>(regattas);
|
||||
}
|
||||
|
||||
|
||||
public RegattaDTO getSelectedRegatta() {
|
||||
RegattaDTO result = null;
|
||||
int selIndex = regattaListBox.getSelectedIndex();
|
||||
if(selIndex > 0) { // the zero index represents the 'no selection' text
|
||||
String itemText = regattaListBox.getItemText(selIndex);
|
||||
for(RegattaDTO regattaDTO: allRegattas) {
|
||||
if(regattaDTO.name.equals(itemText)) {
|
||||
result = regattaDTO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void fillRaceListFromAvailableRacesApplyingFilter(String text) {
|
||||
List<String> wordsToFilter = Arrays.asList(text.split(" "));
|
||||
raceList.getList().clear();
|
||||
|
||||
-43
@@ -33,7 +33,6 @@ import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.HasVerticalAlignment;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.google.gwt.user.client.ui.TextBox;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
@@ -82,10 +81,6 @@ public class TrackedRacesListComposite extends SimplePanel implements Component<
|
||||
private ListDataProvider<RaceDTO> raceList;
|
||||
|
||||
private Iterable<RaceDTO> allRaces;
|
||||
|
||||
private Iterable<RegattaDTO> allRegattas;
|
||||
|
||||
private ListBox regattaListBox;
|
||||
|
||||
private final VerticalPanel panel;
|
||||
|
||||
@@ -144,18 +139,6 @@ public class TrackedRacesListComposite extends SimplePanel implements Component<
|
||||
panel = new VerticalPanel();
|
||||
setWidget(panel);
|
||||
|
||||
// the regatta selection for a tracked race
|
||||
HorizontalPanel regattaPanel = new HorizontalPanel();
|
||||
panel.add(regattaPanel);
|
||||
Label lblRegattas = new Label("Regatta used for the tracked race:");
|
||||
lblRegattas.setWordWrap(false);
|
||||
regattaPanel.setCellVerticalAlignment(lblRegattas, HasVerticalAlignment.ALIGN_MIDDLE);
|
||||
regattaPanel.setSpacing(5);
|
||||
regattaPanel.add(lblRegattas);
|
||||
regattaListBox = new ListBox();
|
||||
regattaPanel.add(regattaListBox);
|
||||
regattaPanel.setCellVerticalAlignment(regattaListBox, HasVerticalAlignment.ALIGN_MIDDLE);
|
||||
|
||||
HorizontalPanel filterPanel = new HorizontalPanel();
|
||||
panel.add(filterPanel);
|
||||
Label lblFilterRaces = new Label(stringMessages.filterRacesByName() + ":");
|
||||
@@ -454,10 +437,7 @@ public class TrackedRacesListComposite extends SimplePanel implements Component<
|
||||
|
||||
@Override
|
||||
public void fillRegattas(List<RegattaDTO> regattas) {
|
||||
RegattaDTO oldRegattaSelection = getSelectedRegatta();
|
||||
regattaListBox.clear();
|
||||
if (regattas.isEmpty()) {
|
||||
regattaListBox.addItem("No regatta");
|
||||
raceTable.setVisible(false);
|
||||
btnUntrack.setVisible(false);
|
||||
btnRemoveRace.setVisible(false);
|
||||
@@ -471,13 +451,6 @@ public class TrackedRacesListComposite extends SimplePanel implements Component<
|
||||
btnRemoveRace.setEnabled(false);
|
||||
noTrackedRacesLabel.setVisible(false);
|
||||
btnSetDelayToLive.setVisible(true);
|
||||
regattaListBox.addItem("No regatta");
|
||||
for (RegattaDTO regatta : regattas) {
|
||||
regattaListBox.addItem(regatta.name);
|
||||
if(oldRegattaSelection != null && oldRegattaSelection.name.equals(regatta.name)) {
|
||||
regattaListBox.setSelectedIndex(regattaListBox.getItemCount()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<RaceDTO> newAllRaces = new ArrayList<RaceDTO>();
|
||||
List<RegattaDTO> newAllRegattas = new ArrayList<RegattaDTO>();
|
||||
@@ -492,7 +465,6 @@ public class TrackedRacesListComposite extends SimplePanel implements Component<
|
||||
}
|
||||
}
|
||||
allRaces = newAllRaces;
|
||||
allRegattas = newAllRegattas;
|
||||
fillRaceListFromAvailableRacesApplyingFilter();
|
||||
raceSelectionProvider.setAllRaces(newAllRaceIdentifiers); // have this object be notified; triggers onRaceSelectionChange
|
||||
}
|
||||
@@ -544,21 +516,6 @@ public class TrackedRacesListComposite extends SimplePanel implements Component<
|
||||
});
|
||||
}
|
||||
|
||||
public RegattaDTO getSelectedRegatta() {
|
||||
RegattaDTO result = null;
|
||||
int selIndex = regattaListBox.getSelectedIndex();
|
||||
if(selIndex > 0) { // the zero index represents the 'no selection' text
|
||||
String itemText = regattaListBox.getItemText(selIndex);
|
||||
for(RegattaDTO regattaDTO: allRegattas) {
|
||||
if(regattaDTO.name.equals(itemText)) {
|
||||
result = regattaDTO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void fillRaceListFromAvailableRacesApplyingFilter() {
|
||||
String text = filterRacesTextbox.getText();
|
||||
List<String> wordsToFilter = Arrays.asList(text.split(" "));
|
||||
|
||||
Reference in new issue
Block a user