Thank you for your ideas and sharing code samples.
Sorry If I was unclear in my description.
Here is some code to put my problem in perspective:
private static class Folder { // a Folder, has a Name, zero or many
child Folders, zero or many Files
private final String name;
private final List<Folder> folders = new ArrayList<Folder>();
private final List<File> files = new ArrayList<File>();
}
now in : getNodeInfo method
if (value instanceof Folder) { // if Node is of Type Folder
ListDataProvider<Folder> dataProvider = new
ListDataProvider<Folder>(((Folder)value).getFolders()); // [***] read
below for comments on this
Cell<Folder> cell = new AbstractCell<Folder>(){
@Override
public void render(Folder value, Object key, SafeHtmlBuilder sb)
{
if(value!=null){
sb.appendEscaped(value.getName());
}
}
};
return new DefaultNodeInfo<Folder>(dataProvider, cell);
}
[***]
look carefully at DataProvider here: when Node is of type Folder: I
fetch its "Child Folders" with the code below:
ListDataProvider<Folder> dataProvider = new
ListDataProvider<Folder>(((Folder)value).getFolders());
but when Node is type Folder, I also need to fetch its "Files"
ListDataProvider<File> dataProvider = new
ListDataProvider<File>(((Folder)value).getFiles());
but with
return new DefaultNodeInfo<Folder>(dataProvider, cell);
I can only return either Child Folders, or Files, not buth
return new DefaultNodeInfo<Folder>(dataProvider, cell);
or
return new DefaultNodeInfo<File>(dataProvider, cell);
I want to return BOTH, because each Folder, contains FOLDERS and
FILES,
FolderX
FolderY
FileY1
FileY2
FolderQ
FolderT
FileW
FileZ
basically Folder X, contains several child Folders: FolderY, FolderQ,
Folder T
in addition, also contains FileW and FileZ.
for Node Type "Folder", I can only return "one" type, either "Folders"
OR "Files".
I want to return FOLDERS_AND_FILES.