diff options
author | Aleksi Hietanen <aleksi@vaadin.com> | 2017-05-18 09:48:10 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-05-18 09:48:10 +0300 |
commit | c93b842947d5aab1d7eca1ff7f1426fe17432467 (patch) | |
tree | 67deb5352e2c413a569db150bbd7b0a58a448271 /documentation/datamodel/datamodel-hierarchical.asciidoc | |
parent | 7fa0e96cbc068f1c4e1b49312275bac85cff5260 (diff) | |
download | vaadin-framework-c93b842947d5aab1d7eca1ff7f1426fe17432467.tar.gz vaadin-framework-c93b842947d5aab1d7eca1ff7f1426fe17432467.zip |
Clarify TreeData and TreeDataProvider javadocs, improve documentation (#9349)
Diffstat (limited to 'documentation/datamodel/datamodel-hierarchical.asciidoc')
-rw-r--r-- | documentation/datamodel/datamodel-hierarchical.asciidoc | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/documentation/datamodel/datamodel-hierarchical.asciidoc b/documentation/datamodel/datamodel-hierarchical.asciidoc index f405bc775f..24605adc53 100644 --- a/documentation/datamodel/datamodel-hierarchical.asciidoc +++ b/documentation/datamodel/datamodel-hierarchical.asciidoc @@ -27,7 +27,7 @@ Collection<Project> projects = service.getProjects(); TreeData<Project> data = new TreeData<>(); // add root level items -data.addItems(null, projects); +data.addItems(null, Project::getSubProjects); // add children for the root level items projects.forEach(project -> data.addItems(project, project.getChildren())); @@ -42,7 +42,7 @@ When adding or removing items from the [classname]#TreeData#, you need to always [source, java] ---- -TreeData<Project> data = dataProvider.getData(); +TreeData<Project> data = dataProvider.getTreeData(); data.addItem(null, newProject); data.addItems(newProject, newProject.getChildren()); @@ -93,8 +93,9 @@ The following code snippet shows a simple example on how to building a lazy hier [source, java] ---- -class FileSystemDataProvider - extends AbstractHierarchicalDataProvider<File, FilenameFilter> { +class FileSystemDataProvider extends + AbstractBackEndHierarchicalDataProvider<File, FilenameFilter> { + private final File root; public FileSystemDataProvider(File root) { @@ -108,7 +109,7 @@ class FileSystemDataProvider } @Override - public Stream<File> fetchChildren( + public Stream<File> fetchChildrenFromBackEnd( HierarchicalQuery<File, FilenameFilter> query) { final File parent = query.getParentOptional().orElse(root); return query.getFilter() @@ -121,11 +122,6 @@ class FileSystemDataProvider public boolean hasChildren(File item) { return item.list() != null && item.list().length > 0; } - - @Override - public boolean isInMemory() { - return false; - } } ---- |