@Override public void onFinish(IUploader uploader) { String serverResponse = uploader.getServerInfo().message; if (serverResponse != null && !serverResponse.isEmpty()) { serverResponse = serverResponse.replaceAll("\n", "<br>"); messagePresenter.showMessage("File Manager", serverResponse); } if (uploader.getStatus() == Status.SUCCESS) { uploader.getStatusWidget().setFileName("Done uploading."); fileTreePresenter.refresh(fileFilter); } // only needed when MultiUploader is used instead of SingleUploader. There somewhat of a new // instance of MultiUploader // is created for each additional upload. // try to avoid MultiUploader, it will create a new HTML element for each uploader making it // complex to style // also MultiUploader is not needed, in comparison to SingleUploader it only allows to append // additional uploads once // a previous upload is still running. It doesn't mean multiple files, this can also be done // with SingleUploader /*IFileInput ctrl = display.getUploader().getFileInput(); DOM.setElementProperty(((UIObject) ctrl).getElement(), "multiple", "multiple");*/ uploader.setServletPath(defaultServletPath); enableManagement(); }
@Override public void onStart(final IUploader uploader) { uploader.getStatusWidget().setFileName("Uploading, please wait..."); final FileImageLabelTreeItem selection = fileTreePresenter.getSelectedItem(); if (selection.getFileInfo().getFileType().equals(FileTypeEnum.DIRECTORY)) { uploader.setServletPath( uploader.getServletPath() + "&target=" + selection.getFileInfo().getFilePath()); } else { String newFilePath = getParent(selection); uploader.setServletPath(uploader.getServletPath() + "&target=" + newFilePath); } // only needed when MultiUploader is used instead of SingleUploader // display.setStatusWidget(display.getUploader().getStatusWidget().getWidget()); /* * Creation of directories directly inside of the upload target should not be possible (possible name clash) * Rename of target and files directly inside of target should not be possible (target no longer available, name clash) * Delete of target should not be possible (target no longer available) */ // for now, just disable all of the others: disableManagement(); }