https://javafx-jira.kenai.com/browse/RT-32390
- Martin On Fri, Aug 16, 2013 at 10:02 AM, Martin Klähn <[email protected]> wrote: > Okay, will do. > Thx > > - Martin > Am 16.08.2013 10:00 schrieb "Jonathan Giles" <[email protected]>: > > No, I've not had a chance to think more about it. The best thing to do >> is file a Jira tweak request. >> >> -- Jonathan >> Sent from a touch device. Please excuse my brevity. >> >> "Martin Klähn" <[email protected]> wrote: >>> >>> Hi, >>> >>> Sorry to be pestering you with it but have you had a chance to think >>> some more about this. It it will help I could put into code what I'm trying >>> to do and I perceive to be the limitation. >>> I could put that back on the list to get back from these backwater >>> personal discussions ;-) >>> >>> - Martin >>> Am 15.08.2013 12:16 schrieb "Martin Klähn" <[email protected]>: >>> >>>> I can. However it wouldn't do much good. The entire collection would >>>> still be copied from my source to parent children collection. >>>> >>>> Going with the example in the javadoc, if you had a folder with tens of >>>> thousands of files/folders in it then as soon as you expand the TreeItem >>>> for that folder a TreeItem would be created for every single files in that >>>> folder and not only for the files that can be displayed on the screen. >>>> >>>> So if instead of the described method buildChildren(TreeItem<File> >>>> TreeItem) you had >>>> >>>> private static class FilesOL extends ObservableListBase<TreeItem<File>> >>>> { >>>> >>>> private final File[] files; >>>> >>>> public FilesOL(File[] files) { >>>> this.files = files; >>>> } >>>> >>>> @Override >>>> public TreeItem<File> get(int index) { >>>> // lazy create >>>> // posibly add caching >>>> return createNode(files[i]); >>>> } >>>> >>>> @Override >>>> public int size() { >>>> return files.length; >>>> } >>>> } >>>> >>>> private ObservableList<TreeItem<File>> buildChildren(TreeItem<File> >>>> TreeItem) { >>>> File f = TreeItem.getValue(); >>>> if (f != null && f.isDirectory()) { >>>> File[] files = f.listFiles(); >>>> if (files != null) { >>>> return new FilesOL(files); >>>> } >>>> } >>>> >>>> return FXCollections.emptyObservableList(); >>>> } >>>> >>>> FilesOL.get(int) would be triggered for each and every entry it has in >>>> all three previously stated ways to set the children. >>>> >>>> >>>> >>>> >>>> On Thu, Aug 15, 2013 at 11:44 AM, Jonathan Giles < >>>> [email protected]> wrote: >>>> >>>>> As in the example I linked to, can't you override the getChildren() to >>>>> do this? >>>>> >>>>> -- Jonathan >>>>> Sent from a touch device. Please excuse my brevity. >>>>> >>>>> "Martin Klähn" <[email protected]> wrote: >>>>>> >>>>>> Thanks for the quick response. >>>>>> >>>>>> Yes, lazy determination children list is possible and I've been there. >>>>>> >>>>>> Say I have an implementation of ObservableList<TreeItem<T>> >>>>>> lazyChildren that is capable of lazy creation of TreeItems. That >>>>>> list will get triggered for all entries by >>>>>> a) Bindings.bindContent(super.getChildren(), lazyChildren) >>>>>> b) super.getChildren().addAll(lazyChildren) >>>>>> c) super.getChildren().setAll(lazychildren) >>>>>> >>>>>> What I'm missing is a constructor in TreeItem where I can give it the >>>>>> ObservableList to use as children. Similiar to >>>>>> http://docs.oracle.com/javafx/2/api/javafx/scene/control/TableView.html#TableView%28javafx.collections.ObservableList%29 >>>>>> . >>>>>> >>>>>> - Martin >>>>>> >>>>>> >>>>>> On Thu, Aug 15, 2013 at 10:57 AM, Jonathan Giles < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> In on my phone, so I'll keep this really brief. I have one suggested >>>>>>> approach in the TreeItem javadoc here: >>>>>>> >>>>>>> >>>>>>> http://docs.oracle.com/javafx/2/api/javafx/scene/control/TreeItem.html >>>>>>> >>>>>>> Perhaps this will help. I can look into it deep power tomorrow if >>>>>>> necessary. >>>>>>> >>>>>>> -- Jonathan >>>>>>> Sent from a touch device. Please excuse my brevity. >>>>>>> >>>>>>> >>>>>>> "Martin Klähn" <[email protected]> wrote: >>>>>>>> >>>>>>>> Hi guys, >>>>>>>> >>>>>>>> I've now worked with TreeView and TreeTableView to some extent. >>>>>>>> >>>>>>>> TableView as well as TreeTabelView are designed to visualize an >>>>>>>> unlimited >>>>>>>> number of rows of data, broken out into columns". >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> For TableView I can understand that concept as i can pass the >>>>>>>> TableView the >>>>>>>> ObservableList containing the data. The Implementation of that >>>>>>>> ObservableList can do lazy loading of the available data although it >>>>>>>> has to >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> know how many dataset there are. So far so good. >>>>>>>> >>>>>>>> However for TreeTableView and by extension TreeView (no comment about >>>>>>>> unlimited number of rows of data there) I do not agree with that >>>>>>>> statement >>>>>>>> with my current understanding of the API. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> The only way I can set the children of an TreeItem is by >>>>>>>> a) adding the child items to the ObservableList retrieved from >>>>>>>> TreeItem.getChildren() where have to create all children elements and >>>>>>>> add >>>>>>>> them (not LAZY) or >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> b) bind a ObservableList to TreeItem.getChildren() but that essentially >>>>>>>> first copies all items from the bound list to that of >>>>>>>> TreeItem.getChildren() (not LAZY). >>>>>>>> >>>>>>>> So in order to visualize an unlimited number of rows of data with >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> TreeTableView and I'm not missing something I have to fully initialize >>>>>>>> an >>>>>>>> unlimited amount of data. >>>>>>>> >>>>>>>> Please tell me I've missed something! >>>>>>>> >>>>>>>> >>>>>>>> - Martin >>>>>>>> >>>>>>>> >>>>>> >>>>
