View Full Version : Representation file system tree in TreeGrid

26 Jan 2012, 9:31 AM
i have a webapp - REST web service
there is a folder with content there, for example:
and so on

and i need to represent that tree in TreeGrid in another gxt webapp.

perhaps, i can do on my ress webapp something like


final Collection<File> all = new ArrayList<File>();
addFilesRecursively(new File("path_to_folder/folder"), all);

//send Collection<File> all to gxt webapp

private static void addFilesRecursively(File file, Collection<File> all) {
final File[] children = file.listFiles();
if (children != null) {
for (File child : children) {
addFilesRecursively(child, all);

and i can't to invent an algorithm to represent
Collection<File> all in TreeGrid
any ideas?
or some another problem solution?


27 Jan 2012, 3:24 AM
Hi Vokunya,

I think your problem is related Basic TreeGrid example. You must look over the sample codes carefully.


(http://www.sencha.com/examples/explorer.html#basictreegrid)Especially examine the following lines:

Folder model = TestData.getTreeModel();

TreeStore<ModelData> store = new TreeStore<ModelData>();
store.add(model.getChildren(), true);

You also must look TestData and Folder classes which are coming with GXT source code.

I hope you can solve your problem,
Best Regards,