mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-16 17:21:00 +00:00
Show message also for RegattaManagementPanel. Adjusted structure of method in both classes-
This commit is contained in:
1 parent
f663bd8f63
commit
8e11bc3517
6 files changed
+46
-9
No files matched your search
+8
-2
@@ -153,17 +153,23 @@ public class EventListComposite extends Composite implements EventsRefresher, Le
|
||||
removeEventsButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
boolean deleteEvents = false;
|
||||
|
||||
if(refreshableEventSelectionModel.itemIsSelectedButNotVisible(eventTable.getVisibleItems())){
|
||||
final String eventNames = refreshableEventSelectionModel.getSelectedSet().stream().map(e -> e.getName()).collect(Collectors.joining("\n"));
|
||||
if (Window.confirm(stringMessages.doYouReallyWantToRemoveNonVisibleEvents(eventNames))) {
|
||||
removeEvents(refreshableEventSelectionModel.getSelectedSet());
|
||||
deleteEvents = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(Window.confirm(stringMessages.doYouReallyWantToRemoveEvents())) {
|
||||
removeEvents(refreshableEventSelectionModel.getSelectedSet());
|
||||
deleteEvents = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(deleteEvents){
|
||||
removeEvents(refreshableEventSelectionModel.getSelectedSet());
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
+7
@@ -222,6 +222,7 @@ public class RegattaListComposite extends Composite implements RegattasDisplayer
|
||||
if (RegattaConfigImagesBarCell.ACTION_EDIT.equals(value)) {
|
||||
editRegatta(regatta);
|
||||
} else if (RegattaConfigImagesBarCell.ACTION_REMOVE.equals(value)) {
|
||||
|
||||
if (Window.confirm(stringMessages.doYouReallyWantToRemoveRegatta(regatta.getName()))) {
|
||||
removeRegatta(regatta);
|
||||
}
|
||||
@@ -358,4 +359,10 @@ public class RegattaListComposite extends Composite implements RegattasDisplayer
|
||||
public RefreshableMultiSelectionModel<RegattaDTO> getRefreshableMultiSelectionModel() {
|
||||
return refreshableRegattaMultiSelectionModel;
|
||||
}
|
||||
|
||||
public CellTable<RegattaDTO> getRegattaTable() {
|
||||
return regattaTable;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+28
-7
@@ -5,6 +5,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
@@ -86,17 +87,28 @@ public class RegattaManagementPanel extends SimplePanel implements RegattasDispl
|
||||
removeRegattaButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
if (Window.confirm("Do you really want to remove the regattas? This will also remove all leaderboards for the regattas!")) {
|
||||
//Creating a new Collection, because getSelectedRegattas returns an
|
||||
//unmodifiable collection, which can't be sent to the server.
|
||||
Collection<RegattaIdentifier> regattas = new HashSet<RegattaIdentifier>();
|
||||
for (RegattaDTO regatta : refreshableRegattaMultiSelectionModel.getSelectedSet()) {
|
||||
regattas.add(regatta.getRegattaIdentifier());
|
||||
boolean deleteRegattas = false;
|
||||
|
||||
if (refreshableRegattaMultiSelectionModel.itemIsSelectedButNotVisible(regattaListComposite.getRegattaTable().getVisibleItems())) {
|
||||
final String regattaNames = refreshableRegattaMultiSelectionModel.getSelectedSet().stream().map(e -> e.getName()).collect(Collectors.joining("\n"));
|
||||
if (Window.confirm(stringMessages.doYouReallyWantToRemoveNonVisibleRegattas(regattaNames))) {
|
||||
deleteRegattas = true;
|
||||
}
|
||||
} else {
|
||||
if (Window.confirm("Do you really want to remove the regattas? This will also remove all leaderboards for the regattas!")) {
|
||||
deleteRegattas = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(deleteRegattas){
|
||||
// Creating a new Collection, because getSelectedRegattas returns an
|
||||
// unmodifiable collection, which can't be sent to the server.
|
||||
Collection<RegattaIdentifier> regattas = createModifiableCollection();
|
||||
removeRegattas(regattas);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
regattaManagementControlsPanel.add(removeRegattaButton);
|
||||
regattasContentPanel.add(regattaManagementControlsPanel);
|
||||
regattaListComposite = new RegattaListComposite(sailingService, regattaRefresher, errorReporter, stringMessages);
|
||||
@@ -123,6 +135,7 @@ public class RegattaManagementPanel extends SimplePanel implements RegattasDispl
|
||||
regattaDetailsComposite.setVisible(false);
|
||||
}
|
||||
removeRegattaButton.setEnabled(!selectedRegattas.isEmpty());
|
||||
removeRegattaButton.setText(selectedRegattas.size() <= 1 ? stringMessages.remove() : stringMessages.removeAndShowCount(selectedRegattas.size()));
|
||||
}
|
||||
});
|
||||
regattasContentPanel.add(regattaListComposite);
|
||||
@@ -175,4 +188,12 @@ public class RegattaManagementPanel extends SimplePanel implements RegattasDispl
|
||||
public void fillRegattas(Iterable<RegattaDTO> regattas) {
|
||||
regattaListComposite.fillRegattas(regattas);
|
||||
}
|
||||
|
||||
private Collection<RegattaIdentifier> createModifiableCollection() {
|
||||
Collection<RegattaIdentifier> regattas = new HashSet<RegattaIdentifier>();
|
||||
for (RegattaDTO regatta : refreshableRegattaMultiSelectionModel.getSelectedSet()) {
|
||||
regattas.add(regatta.getRegattaIdentifier());
|
||||
}
|
||||
return regattas;
|
||||
}
|
||||
}
|
||||
+1
@@ -361,6 +361,7 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages,
|
||||
String pleaseSelectARegatta();
|
||||
String addFleet();
|
||||
String doYouReallyWantToRemoveRegatta(String name);
|
||||
String doYouReallyWantToRemoveNonVisibleRegattas(String regattaNames);
|
||||
String errorLoadingScoreCorrectionProviders(String message);
|
||||
String selectResultListToImportFrom();
|
||||
String of();
|
||||
|
||||
+1
@@ -373,6 +373,7 @@ noColor=No color
|
||||
pleaseSelectARegatta=Please select a regatta.
|
||||
addFleet=Add fleet
|
||||
doYouReallyWantToRemoveRegatta=Do you really want to remove the regatta "{0}"? This will also remove all leaderboards for this regatta!
|
||||
doYouReallyWantToRemoveNonVisiblsRegattas=You are also deleting regattas that are currently not visible while filtering. The following regattas will be removed. Do you want to continue?\n\n{0}
|
||||
errorLoadingScoreCorrectionProviders=Error loading score correction providers: {0}
|
||||
selectResultListToImportFrom=Select result list to import from
|
||||
of=of
|
||||
|
||||
+1
@@ -374,6 +374,7 @@ noColor=Keine Farbe
|
||||
pleaseSelectARegatta=Bitte wählen Sie eine Regatta aus.
|
||||
addFleet=Gruppe hinzufügen
|
||||
doYouReallyWantToRemoveRegatta=Möchten Sie wirklich Regatta "{0}" löschen? Alle Regatta-Ranglisten werden dadurch ebenfalls gelöscht.
|
||||
doYouReallyWantToRemoveNonVisibleRegattas=Sie entfernen auch Regatten, die während des Filterns nicht angezeigt werden. Die folgenden Regatten werden entfernt. Möchten Sie fortfahren?\n\n{0}
|
||||
errorLoadingScoreCorrectionProviders=Fehler beim Laden der offiziellen Ergebnis-Dienste: {0}
|
||||
selectResultListToImportFrom=Rangliste auswählen
|
||||
of=von
|
||||
|
||||
Reference in new issue
Block a user