diff options
author | Aleksi Hietanen <aleksi@vaadin.com> | 2017-05-12 09:44:55 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-05-16 15:35:17 +0300 |
commit | 9c58a56ffe102082afcee9c55825612711b2530b (patch) | |
tree | bdaea235b450abdd19844991c6b40d030f390097 /uitest | |
parent | 16b37b6011395b50710078d4693d58d1ce58f173 (diff) | |
download | vaadin-framework-9c58a56ffe102082afcee9c55825612711b2530b.tar.gz vaadin-framework-9c58a56ffe102082afcee9c55825612711b2530b.zip |
Add BackEndHierarchicalDataProvider and an abstract base class
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/treegrid/LazyHierarchicalDataProvider.java | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/treegrid/LazyHierarchicalDataProvider.java b/uitest/src/main/java/com/vaadin/tests/components/treegrid/LazyHierarchicalDataProvider.java index 1fe7202d8a..a468f34d29 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/treegrid/LazyHierarchicalDataProvider.java +++ b/uitest/src/main/java/com/vaadin/tests/components/treegrid/LazyHierarchicalDataProvider.java @@ -5,12 +5,12 @@ import java.util.List; import java.util.Optional; import java.util.stream.Stream; -import com.vaadin.data.provider.AbstractHierarchicalDataProvider; +import com.vaadin.data.provider.AbstractBackEndHierarchicalDataProvider; import com.vaadin.data.provider.HierarchicalQuery; import com.vaadin.tests.data.bean.HierarchicalTestBean; -public class LazyHierarchicalDataProvider - extends AbstractHierarchicalDataProvider<HierarchicalTestBean, Void> { +public class LazyHierarchicalDataProvider extends + AbstractBackEndHierarchicalDataProvider<HierarchicalTestBean, Void> { private final int nodesPerLevel; private final int depth; @@ -32,7 +32,16 @@ public class LazyHierarchicalDataProvider } @Override - public Stream<HierarchicalTestBean> fetchChildren( + public boolean hasChildren(HierarchicalTestBean item) { + return internalHasChildren(item); + } + + private boolean internalHasChildren(HierarchicalTestBean node) { + return node.getDepth() < depth; + } + + @Override + protected Stream<HierarchicalTestBean> fetchChildrenFromBackEnd( HierarchicalQuery<HierarchicalTestBean, Void> query) { final int depth = query.getParentOptional().isPresent() ? query.getParent().getDepth() + 1 : 0; @@ -46,18 +55,4 @@ public class LazyHierarchicalDataProvider } return list.stream(); } - - @Override - public boolean hasChildren(HierarchicalTestBean item) { - return internalHasChildren(item); - } - - private boolean internalHasChildren(HierarchicalTestBean node) { - return node.getDepth() < depth; - } - - @Override - public boolean isInMemory() { - return false; - } } |