aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Smart and Fast Tree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Smart and Fast Tree" Watch "Smart and Fast Tree" New topic
Author

Smart and Fast Tree

Kriss Reddy
Ranch Hand

Joined: Mar 29, 2005
Posts: 54
Hi,

I would like to create a tree which would load as shown below:

C:\
------>Folder-1
------>Folder-2
------>Folder-3

When Folder-1 is selected I want to display as shown below:
C:\
------>Folder-1
|----------->Folder-1.1
|----------->Folder-1.2
|----------->File1.1

and when Folder-1.1 is selected, I want to display as shown below:

C:\
------>Folder-1
|-------->Folder-1.1
|-------->Folder-1.1.1
|-------->File-1.1.1

and I do not want to load children in any other folders other than selected because it takes a lot of time to load the tree.

Please let me know the approach that I should take to implement this functionality.

Thanks in advance.
Kriss


Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

In the other thread which you had hijacked Rob gave some tips on how do lazy load a tree with caching. Did you try it out?
What have you got so far, and were exactly are you stuck?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Kriss Reddy
Ranch Hand

Joined: Mar 29, 2005
Posts: 54
Hi,
I do not know how to lazy load and cache. Please help.

Thanks.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18651
    
    8

I went to the API documentation for JTree and started searching for the word "listener". Pretty soon I came to a method called "addTreeExpansionListener" whose short description says
Adds a listener for TreeExpansion events.
Kriss Reddy
Ranch Hand

Joined: Mar 29, 2005
Posts: 54
Hi Paul,

Thanks for your pointer, I noticed that. How does a JTree load its children by default? ie what is the default way of loading its children, what conditions determine this behaviour?

Please point to some easy to understand 'basics' tutorial of JTree, some sun's tutorials are too complicated for me.

Thanks.
Kriss
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Smart and Fast Tree