mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-16 17:21:00 +00:00
Moved method itemIsSelectedButNotVisible(List<T> visibleItemList) to class RefreshableMultiSelectionModel.
This commit is contained in:
1 parent
e66eb99482
commit
f663bd8f63
2 files changed
+19
-11
No files matched your search
+1
-10
@@ -153,7 +153,7 @@ public class EventListComposite extends Composite implements EventsRefresher, Le
|
||||
removeEventsButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
if(eventIsSelectedThatIsNotDisplayedCurrently()){
|
||||
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());
|
||||
@@ -768,15 +768,6 @@ public class EventListComposite extends Composite implements EventsRefresher, Le
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean eventIsSelectedThatIsNotDisplayedCurrently() {
|
||||
for(EventDTO eventDTO : refreshableEventSelectionModel.getSelectedSet()){
|
||||
if(!eventTable.getVisibleItems().contains(eventDTO)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<EventDTO> getAllEvents() {
|
||||
return allEvents;
|
||||
|
||||
+18
-1
@@ -15,7 +15,7 @@ import com.google.gwt.view.client.SelectionChangeEvent;
|
||||
* register it self as a display on the {@link ListDataProvider} and reacts on the changes of {@link ListDataProvider}.
|
||||
* When the {@link ListDataProvider} is changed this {@link RefreshableMultiSelectionModel selection model} will refresh
|
||||
* the selection according to the {@link ListDataProvider} changes. To make this class work correct it is very important
|
||||
* to set the {@link ListDataProvider}, otherwise it won´t work.
|
||||
* to set the {@link ListDataProvider}, otherwise it won't work.
|
||||
* <p>
|
||||
* For more details on the update process read the {@link RefreshableSelectionModel} Javadoc and see the methods
|
||||
* {@link RefreshableMultiSelectionModel#refreshSelectionModel(Iterable)} and
|
||||
@@ -62,6 +62,23 @@ public class RefreshableMultiSelectionModel<T> extends MultiSelectionModel<T>
|
||||
public EntityIdentityComparator<T> getEntityIdentityComparator() {
|
||||
return comp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if all items that are currently selected also appear in the visible items list.
|
||||
*
|
||||
* @param visibleItemList
|
||||
* can be obtained by calling {@link com.google.gwt.user.cellview.client.CellTable#getVisibleItems()}
|
||||
* method.
|
||||
* @return <code>true</code> if the list of does not contain every item of the current selected item set.
|
||||
*/
|
||||
public boolean itemIsSelectedButNotVisible(List<T> visibleItemList) {
|
||||
for (T item : getSelectedSet()) {
|
||||
if (!visibleItemList.contains(item)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the old selection state of the object. If it was selected before, the old version will be replaced with
|
||||
|
||||
Reference in new issue
Block a user