repositoryTree.setHeight("100%");
return repositoryTree;
}
private Widget buildToolbar(String title) {
ToolBar toolbar = new ToolBar();
toolbar.add(new Label(title, false));
IconButton reloadImageButton = new IconButton(null, false, BaseImageBundle.images.refresh_16(), BaseImageBundle.images.refresh_16(),
BaseImageBundle.images.refresh_16(), BaseImageBundle.images.refresh_disabled_16());
reloadImageButton.setTitle("Refresh File Manager");
reloadImageButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
repositoryTree.fetchRepositoryTree(FileManagerPanel.this);
}
});
toolbar.add(reloadImageButton);
final IconButton sortImageButton = new IconButton(null, false, BaseImageBundle.images.sort(), BaseImageBundle.images.sort(), BaseImageBundle.images.sort(),
BaseImageBundle.images.sort());
sortImageButton.setTitle("Sort Files by Name");
sortImageButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
repositoryTree.setAnimationEnabled(false);
repositoryTree.setSortAToZ(!repositoryTree.isSortAToZ(), FileManagerPanel.this);
repositoryTree.setAnimationEnabled(true);
}
});
toolbar.add(sortImageButton);
final IconButton toggleHiddenFilesImageButton = new IconButton(null, false, BaseImageBundle.images.showHide16(), BaseImageBundle.images.showHide16(),
BaseImageBundle.images.showHide16(), BaseImageBundle.images.showHide16());
toggleHiddenFilesImageButton.setTitle("Show/Hide Hidden Files");
toggleHiddenFilesImageButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
repositoryTree.setAnimationEnabled(false);
repositoryTree.setShowHiddenFiles(!repositoryTree.isShowHiddenFiles(), FileManagerPanel.this);
repositoryTree.setAnimationEnabled(true);
}
});
toolbar.add(toggleHiddenFilesImageButton);
propertiesImageButton.setEnabled(false);
propertiesImageButton.setTitle("Properties");
propertiesImageButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
ManageObjectPropertiesCommand cmd = new ManageObjectPropertiesCommand((PermissibleObject) repositoryTree.getLastItem().getUserObject());
cmd.execute();
}
});
toolbar.add(propertiesImageButton);
newFolderImageButton.setEnabled(false);
newFolderImageButton.setTitle("Create New Folder");
newFolderImageButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
CreateNewFolderCommand cmd = new CreateNewFolderCommand(repositoryTree, FileManagerPanel.this);
cmd.execute();
}
});
toolbar.add(newFolderImageButton);
renameImageButton.setEnabled(false);
renameImageButton.setTitle("Rename");
renameImageButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
RenameObjectCommand cmd = new RenameObjectCommand((PermissibleObject) repositoryTree.getLastItem().getUserObject(), FileManagerPanel.this);
cmd.execute();
}
});
toolbar.add(renameImageButton);
deleteImageButton.setEnabled(false);
deleteImageButton.setTitle("Delete");
deleteImageButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
DeleteObjectCommand cmd = new DeleteObjectCommand((PermissibleObject) repositoryTree.getLastItem().getUserObject(), FileManagerPanel.this);
cmd.execute();
}
});
toolbar.add(deleteImageButton);
openImageButton.setEnabled(false);
openImageButton.setTitle("Open File");
openImageButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
OpenFileCommand cmd = new OpenFileCommand((File) repositoryTree.getLastItem().getUserObject(), false);
cmd.execute();
}
});
toolbar.add(openImageButton);
uploadFileButton.setEnabled(false);
uploadFileButton.setTitle("Upload File to Selected Folder");
uploadFileButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
UploadFileCommand cmd = new UploadFileCommand((PermissibleObject) repositoryTree.getLastItem().getUserObject(), FileManagerPanel.this);
cmd.execute();
}
});
toolbar.add(uploadFileButton);
downloadImageButton.setEnabled(false);
downloadImageButton.setTitle("Download File");
downloadImageButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
DownloadFileCommand cmd = new DownloadFileCommand((File) repositoryTree.getLastItem().getUserObject());
cmd.execute();
}
});
toolbar.add(downloadImageButton);
Label spacer = new Label();
toolbar.add(spacer);
toolbar.setCellWidth(spacer, "100%");
return toolbar;
}