I have made a tree that traverses the server’s files very well using vaadin example of File browser(
File Browser Example vaadin ). But it shows the entire path for each leaf. How can I get it to only show a folder or file name,folder Icon without showing the full path?
it show as below example Eg:
:rolleyes:
foldername
|
|_fileone
| filetwo etc…
Thanks in advance
please give response with respective above example( vaddin program ) :rolleyes:
Thanks for quick response…1).file browser giving out put as >____
|>
|> with out any name for the file paths(But i need file (or) folder name),i used the below code [quote]
filesystem.setItemCaptionPropertyId(“Name”);
[/quote]
2) filesystem.setItemIconPropertyId("Icon"); Icon is giving run time error..please provide the solution with respective vaadin example code [url=http://dev.vaadin.com/browser/svn/versions/6.0/src/com/vaadin/tests/TreeFilesystem.java]
Specific to your problem
At line # 86 of your sample code
final String path = files[x]
.getName();
since file.getCanonicalPath() return complete path
I was proposing a generic solution in my last post.
remove setIcon , since you are using File object directly. which does not have any ICON associated with it.
Hi,
Alexander V Pchelintsev ,I tried above code String path = files
.getName().toString(); its giving Null pointer Exception at line populateNode(event.getItemId().toString(), event.getItemId()); because we have to pass file path as parameter for populateNode not a fileName please tell some solution for this
private void populateNode(String file, Object parent) {
final File subdir = new File(file);
final File[] files = subdir.listFiles();
for (int x = 0; x < files.length; x++) {
try { }
catch(Exception e)
Populate the nodes the same way (but instead referring to the Tree - operate with the fsContainer). Also, for every added Item (that has a path as an id) you have to specify the name property.
Hi,
I achieved this by using code file
.getName().toString,by concatenating parent path to its children files…so on at the end i got result from
By using Eg code ,
but i got this idea by your advice ( to use file.getName())