summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2015-10-05 14:52:23 +0300
committerTeemu Suo-Anttila <teemusa@vaadin.com>2015-10-12 12:00:13 +0300
commit4f26b13c720c668a3c01e2c309fb2f99f150936f (patch)
tree16398eab1d0d34ae5353b6b051a35d1038794c9c /server
parent8a66300779e9dcc949d68ab1a66d445921e0d40b (diff)
downloadvaadin-framework-4f26b13c720c668a3c01e2c309fb2f99f150936f.tar.gz
vaadin-framework-4f26b13c720c668a3c01e2c309fb2f99f150936f.zip
Remove Guava dependency from Grid
This removes an external dependency to guava set helpers from the Grid class. Change-Id: I1d85b6c4090c0b5efa568135105933dab8f0b964
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/ui/Grid.java31
1 files changed, 22 insertions, 9 deletions
diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java
index f7832ece40..f98943c350 100644
--- a/server/src/com/vaadin/ui/Grid.java
+++ b/server/src/com/vaadin/ui/Grid.java
@@ -42,9 +42,6 @@ import org.jsoup.nodes.Attributes;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
-import com.google.gwt.thirdparty.guava.common.collect.Maps;
-import com.google.gwt.thirdparty.guava.common.collect.Sets;
-import com.google.gwt.thirdparty.guava.common.collect.Sets.SetView;
import com.vaadin.data.Container;
import com.vaadin.data.Container.Indexed;
import com.vaadin.data.Container.ItemSetChangeEvent;
@@ -322,8 +319,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
* client. Details components get destroyed once they scroll out of
* view.
*/
- private final Map<Object, Component> itemIdToDetailsComponent = Maps
- .newHashMap();
+ private final Map<Object, Component> itemIdToDetailsComponent = new HashMap<Object, Component>();
/**
* Set of item ids that got <code>null</code> from DetailsGenerator when
@@ -1810,16 +1806,16 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
boolean changed = false;
Set<Object> selectedRows = new HashSet<Object>(itemIds);
final Collection<Object> oldSelection = getSelectedRows();
- SetView<?> added = Sets.difference(selectedRows, selection);
+ Set<Object> added = getDifference(selectedRows, selection);
if (!added.isEmpty()) {
changed = true;
- selection.addAll(added.immutableCopy());
+ selection.addAll(added);
}
- SetView<?> removed = Sets.difference(selection, selectedRows);
+ Set<Object> removed = getDifference(selection, selectedRows);
if (!removed.isEmpty()) {
changed = true;
- selection.removeAll(removed.immutableCopy());
+ selection.removeAll(removed);
}
if (changed) {
@@ -1831,6 +1827,23 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
return changed;
}
+ /**
+ * Compares two sets and returns a set containing all values that are
+ * present in the first, but not in the second.
+ *
+ * @param set1
+ * first item set
+ * @param set2
+ * second item set
+ * @return all values from set1 which are not present in set2
+ */
+ private static Set<Object> getDifference(Set<Object> set1,
+ Set<Object> set2) {
+ Set<Object> diff = new HashSet<Object>(set1);
+ diff.removeAll(set2);
+ return diff;
+ }
+
@Override
public boolean setSelected(Object... itemIds)
throws IllegalArgumentException {