コード例 #1
0
  @Override
  public void onDownload() {
    final FileImageLabelTreeItem selection = fileTreePresenter.getSelectedItem();
    if (selection != null) {
      final String selectionPath = selection.getFileInfo().getFilePath();
      if (selectionPath != null) {
        fileService.getDownloadPath(
            Authentication.getInstance().getToken(),
            selectionPath,
            new RPCCallback<String>() {
              @Override
              public void onResult(String result) {
                // target=" + result.getData() + "&directory=yes
                Window.Location.replace(
                    URL.encode(
                        "/etcsite/download/?target="
                            + result
                            + "&username="******"&"
                            + "sessionID="
                            + Authentication.getInstance().getSessionID()));

                /*Window.open("/etcsite/download/?target=" + result.getData() + "&username="******"&" +
                "sessionID=" + Authentication.getInstance().getSessionID()
                , "download", "resizable=yes,scrollbars=yes,menubar=yes,location=yes,status=yes"); */
              }
            });
      } else {
        messagePresenter.showMessage("File Manager", "Not downloadable");
      }
    } else {
      messagePresenter.showMessage("File Manager", "Please select a file to download");
    }
  }
コード例 #2
0
 @Override
 public void onDelete() {
   FileImageLabelTreeItem selection = fileTreePresenter.getSelectedItem();
   if (selection != null && !selection.getFileInfo().isSystemFile()) {
     fileService.deleteFile(
         Authentication.getInstance().getToken(),
         selection.getFileInfo().getFilePath(),
         new RPCCallback<Void>() {
           @Override
           public void onResult(Void result) {
             ManagableFileTreePresenter.this.initActions();
             fileTreePresenter.clearSelection();
             fileTreePresenter.refresh(fileFilter);
           }
         });
   } else {
     messagePresenter.showMessage(
         "File Manager", "Please select a valid file or directory to delete");
   }
 }