mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-16 10:48:47 +00:00
bug6239: small fix of AbstractFilterablePanel.java and reamove all the clear()'s in panels touched by global remove buttons
This commit is contained in:
-1
@@ -178,7 +178,6 @@ public class EventListComposite extends Composite {
|
||||
final Button remove = buttonPanel.addRemoveAction(stringMessages.remove(), refreshableEventSelectionModel, true,
|
||||
() -> {
|
||||
final List<EventDTO> selected = new ArrayList<>(refreshableEventSelectionModel.getSelectedSet());
|
||||
refreshableEventSelectionModel.clear();
|
||||
removeEvents(selected);
|
||||
});
|
||||
remove.ensureDebugId("RemoveEventsButton");
|
||||
|
||||
-2
@@ -189,7 +189,6 @@ public class IgtimiDevicesPanel extends FlowPanel implements FilterablePanelProv
|
||||
if (refreshableDevicesSelectionModel.getSelectedSet().size() > 0) {
|
||||
if (Window.confirm(stringMessages.doYouReallyWantToRemoveTheSelectedIgtimiDevices())) {
|
||||
final List<IgtimiDeviceWithSecurityDTO> selected = new ArrayList<>(refreshableDevicesSelectionModel.getSelectedSet());
|
||||
refreshableDevicesSelectionModel.clear();
|
||||
for (IgtimiDeviceWithSecurityDTO device : selected) {
|
||||
removeDevice(device, filteredDevices);
|
||||
}
|
||||
@@ -237,7 +236,6 @@ public class IgtimiDevicesPanel extends FlowPanel implements FilterablePanelProv
|
||||
if (refreshableDataAccessWindowsSelectionModel.getSelectedSet().size() > 0) {
|
||||
if (Window.confirm(stringMessages.doYouReallyWantToRemoveTheSelectedIgtimiDataAccessWindows())) {
|
||||
final List<IgtimiDataAccessWindowWithSecurityDTO> selected = new ArrayList<>(refreshableDataAccessWindowsSelectionModel.getSelectedSet());
|
||||
refreshableDataAccessWindowsSelectionModel.clear();
|
||||
for (IgtimiDataAccessWindowWithSecurityDTO daw : selected) {
|
||||
removeDataAccessWindow(daw, filteredDAWs);
|
||||
}
|
||||
|
||||
-1
@@ -170,7 +170,6 @@ public class LeaderboardConfigPanel extends AbstractLeaderboardConfigPanel
|
||||
leaderboardRemoveButton = buttonPanel.addRemoveAction(stringMessages.remove(), leaderboardSelectionModel, true,
|
||||
() -> {
|
||||
final List<StrippedLeaderboardDTO> selectedLeaderboards = new ArrayList<>(leaderboardSelectionModel.getSelectedSet());
|
||||
leaderboardSelectionModel.clear();
|
||||
removeLeaderboards(selectedLeaderboards);
|
||||
});
|
||||
leaderboardRemoveButton.ensureDebugId("LeaderboardsRemoveButton");
|
||||
|
||||
-1
@@ -612,7 +612,6 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel
|
||||
removeButton = buttonPanel.addRemoveAction(stringMessages.remove(), refreshableGroupsSelectionModel, true,
|
||||
() -> {
|
||||
final List<LeaderboardGroupDTO> selectedGroups = new ArrayList<>(refreshableGroupsSelectionModel.getSelectedSet());
|
||||
refreshableGroupsSelectionModel.clear();
|
||||
removeLeaderboardGroups(selectedGroups);
|
||||
});
|
||||
removeButton.ensureDebugId("RemoveLeaderboardButton");
|
||||
|
||||
-1
@@ -197,7 +197,6 @@ public class MediaPanel extends FlowPanel implements FilterablePanelProvider<Med
|
||||
@Override
|
||||
public void execute() {
|
||||
final List<MediaTrackWithSecurityDTO> selected = new ArrayList<>(refreshableSelectionModel.getSelectedSet());
|
||||
refreshableSelectionModel.clear();
|
||||
for (final MediaTrackWithSecurityDTO track : selected) {
|
||||
removeMediaTrack(track);
|
||||
}
|
||||
|
||||
-1
@@ -81,7 +81,6 @@ public class RegattaManagementPanel extends SimplePanel implements FilterablePan
|
||||
refreshableRegattaMultiSelectionModel, true, () -> {
|
||||
// unmodifiable collection can't be sent to the server.
|
||||
final Collection<RegattaIdentifier> regattas = createModifiableCollection();
|
||||
refreshableRegattaMultiSelectionModel.clear();
|
||||
removeRegattas(regattas);
|
||||
});
|
||||
buttonPanel.addUnsecuredWidget(new HelpButton(HelpButtonResources.INSTANCE,
|
||||
|
||||
-1
@@ -59,7 +59,6 @@ public class ResultImportUrlsListComposite extends Composite {
|
||||
final Button remove = buttonPanel.addRemoveAction(stringMessages.remove(), table.getSelectionModel(),
|
||||
/* withConfirmation */ true, () -> {
|
||||
final Set<UrlDTO> selected = new HashSet<>(table.getSelectionModel().getSelectedSet());
|
||||
table.getSelectionModel().clear();
|
||||
removeUrls(selected);
|
||||
});
|
||||
remove.ensureDebugId("RemoveUrlButton");
|
||||
|
||||
-1
@@ -101,7 +101,6 @@ public class CourseTemplatePanel extends FlowPanel implements FilterablePanelPro
|
||||
() -> openEditCourseTemplateDialog(new CourseTemplateDTO(), userService, true));
|
||||
buttonAndFilterPanel.addRemoveAction(stringMessages.remove(), refreshableSelectionModel, true,
|
||||
() -> {final List<UUID> uuids = refreshableSelectionModel.getSelectedSet().stream().map(courseTemplateDTO -> courseTemplateDTO.getUuid()).collect(Collectors.toList());
|
||||
refreshableSelectionModel.clear();
|
||||
removeCourseTemplates(uuids);
|
||||
});
|
||||
buttonAndFilterPanel.addUnsecuredWidget(lblFilterRaces);
|
||||
|
||||
-1
@@ -111,7 +111,6 @@ public class MarkPropertiesPanel extends FlowPanel implements FilterablePanelPro
|
||||
() -> openEditMarkPropertiesDialog(new MarkPropertiesDTO()));
|
||||
buttonAndFilterPanel.addRemoveAction(stringMessages.remove(), refreshableSelectionModel, true,
|
||||
() -> { final List<UUID> uuids = refreshableSelectionModel.getSelectedSet().stream().map(markPropertiesDTO -> markPropertiesDTO.getUuid()).collect(Collectors.toList());
|
||||
refreshableSelectionModel.clear();
|
||||
removeMarkProperties(uuids);
|
||||
});
|
||||
buttonAndFilterPanel.addUnsecuredWidget(lblFilterRaces);
|
||||
|
||||
+4
-21
@@ -1,6 +1,5 @@
|
||||
package com.sap.sse.gwt.client.celltable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
@@ -134,26 +133,10 @@ public class RefreshableMultiSelectionModel<T> extends MultiSelectionModelWithSe
|
||||
setSelected(it, true); // this updates matching elements in the selection model
|
||||
}
|
||||
}
|
||||
// Deselect items that are no longer present in newObjects (e.g. because they were deleted).
|
||||
// newObjects comes from getAllListDataProvider() (the unfiltered list), so absence here means
|
||||
// true deletion, not just a filter hiding the item.
|
||||
// Snapshot first to avoid ConcurrentModificationException while calling super.setSelected below.
|
||||
final List<T> selectedSnapshot = new ArrayList<>();
|
||||
for (final T s : getSelectedElements()) {
|
||||
selectedSnapshot.add(s);
|
||||
}
|
||||
for (final T selected : selectedSnapshot) {
|
||||
boolean foundInNew = false;
|
||||
for (final T candidate : newObjects) {
|
||||
if (comp != null ? comp.representSameEntity(selected, candidate) : selected.equals(candidate)) {
|
||||
foundInNew = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!foundInNew) {
|
||||
super.setSelected(selected, false);
|
||||
}
|
||||
}
|
||||
// elements that were selected before and that don't have a corresponding element in newObjects
|
||||
// will just be left alone; they will probably remain in selectedSet, and they were probably not in
|
||||
// newObjects because a filter removed them. But when they re-appear, e.g., because the filter is
|
||||
// removed, the elements will naturally be selected again.electionChangeEvent.fire(this);
|
||||
SelectionChangeEvent.fire(this);
|
||||
}
|
||||
} finally {
|
||||
|
||||
+2
-8
@@ -212,25 +212,19 @@ public class SelectionCheckboxColumn<T> extends AbstractSortableColumnWithMinMax
|
||||
private EventTranslator<T> createSelectionEventTranslator() {
|
||||
return new EventTranslator<T>() {
|
||||
/**
|
||||
* Don't clear the selection when the user has clicked on the checkbox column or
|
||||
* on an actions column (ImagesBarColumn): action icon clicks must not disturb
|
||||
* the multi-selection state.
|
||||
* Don't clear the selection when the user has clicked on the checkbox column
|
||||
*/
|
||||
@Override
|
||||
public boolean clearCurrentSelection(CellPreviewEvent<T> event) {
|
||||
NativeEvent nativeEvent = event.getNativeEvent();
|
||||
boolean ctrlOrMeta = nativeEvent.getCtrlKey() || nativeEvent.getMetaKey();
|
||||
return !isSelectionCheckboxColumn(event) && !isImagesBarColumn(event) && !ctrlOrMeta;
|
||||
return !isSelectionCheckboxColumn(event) && !ctrlOrMeta;
|
||||
}
|
||||
|
||||
private boolean isSelectionCheckboxColumn(CellPreviewEvent<T> event) {
|
||||
Column<?, ?> column = getColumn(event);
|
||||
return column == SelectionCheckboxColumn.this;
|
||||
}
|
||||
|
||||
private boolean isImagesBarColumn(CellPreviewEvent<T> event) {
|
||||
return getColumn(event) instanceof ImagesBarColumn;
|
||||
}
|
||||
|
||||
private Column<?, ?> getColumn(CellPreviewEvent<T> event) {
|
||||
CellTable<T> table = (CellTable<T>) event.getDisplay();
|
||||
|
||||
@@ -199,6 +199,9 @@ public abstract class AbstractFilterablePanel<T> extends HorizontalPanel {
|
||||
}
|
||||
|
||||
private void setAll(Iterable<? extends T> all) {
|
||||
if (getCellTable() != null) {
|
||||
deselectAll();
|
||||
}
|
||||
this.all.getList().clear();
|
||||
if (all != null) {
|
||||
for (T t : all) {
|
||||
|
||||
-1
@@ -112,7 +112,6 @@ public class RoleDefinitionsPanel extends VerticalPanel {
|
||||
final Button removeButton = buttonPanel.addRemoveAction(stringMessages.remove(), roleSelectionModel, true,
|
||||
() -> {
|
||||
final Set<RoleDefinitionDTO> selectedRoles = new HashSet<>(getSelectedRoleDefinitions());
|
||||
refreshableRoleDefinitionMultiSelectionModel.clear();
|
||||
filterablePanelRoleDefinitions.removeAll(selectedRoles);
|
||||
});
|
||||
removeButton.ensureDebugId("RemoveRoleButton");
|
||||
|
||||
-1
@@ -111,7 +111,6 @@ public class UserGroupDetailPanel extends Composite
|
||||
Window.alert(stringMessages.youHaveToSelectAUserGroup());
|
||||
return;
|
||||
}
|
||||
tenantUsersTable.getSelectionModel().clear();
|
||||
for (StrippedUserDTO user : users) {
|
||||
final String username = user.getName();
|
||||
userManagementService.removeUserFromUserGroup(selectedUserGroup.getId().toString(), username,
|
||||
|
||||
Reference in New Issue
Block a user