Permalink
Browse files

Update to GWT FileBrowser to shorten the delay when opening

read-restricted directories and correctly display
translatable "Loading..." text in long directories.
  • Loading branch information...
1 parent 7e824e6 commit 007cfa4bd1dd73ebef7184e3af0765705a92c14a @DaemonF DaemonF committed May 10, 2012
@@ -36,10 +36,6 @@
private PopupPanel popup;
private Queue<FileTreeItem> openItems;
-
-
- // Will be appended to directories for display
- static final String DIRECTORY_IDENTIFIER = " [...]";
public FileBrowser(String session, boolean directoryOk, final AsyncCallback<String> callback) {
this.session = session;
@@ -133,12 +129,12 @@ private void growTree(final HasTreeItems root, String filePath) {
fileSystem = OneSwarmRPCClient.getService();
}
- root.removeItems();
-
if(root instanceof FileTreeItem)
if(((FileTreeItem) root).fileStatus() == FileInfo.FileStatusFlag.NO_READ_PERMISSION){
+ root.removeItems();
root.addItem(new FileTreeItem(msg.file_browser_label_unreadable_directory()));
((FileTreeItem) root).setState(true);
+ return;
}
fileSystem.listFiles(session, filePath, new AsyncCallback<FileInfo[]>() {
@@ -147,6 +143,7 @@ public void onFailure(Throwable caught) {
}
public void onSuccess(FileInfo[] result) {
+ root.removeItems();
if (result != null) {
if(result.length == 0)
root.addItem(new FileTreeItem(msg.file_browser_label_empty_directory()));

0 comments on commit 007cfa4

Please sign in to comment.