Implementation of a single uploader panel with a submit button.
When the user selects a file, the button changes its style so the she could realize that she has to push the button.
100101102103104105106107108109110111112113
* manually. * * @return an uploader with event handler */ private Widget makeUploader() { SingleUploader singleUploader = new SingleUploader(); singleUploader.setServletPath(UPLOADER_SERVLET_PATH); singleUploader .addOnFinishUploadHandler(new IUploader.OnFinishUploaderHandler() { @Override public void onFinish(IUploader uploader) { if (uploader.getStatus() == Status.SUCCESS) { presenter.songUploaded();
131132133134135136137138139140141142143144
return clone; } @Override public Widget cloneDisplay(Map<String, Object> formData) { SingleUploader uploader = new SingleUploader(); uploader.setServletPath("upload"); populate(uploader); if (getOutput() != null && getOutput().getName() != null) { uploader.getFileInput().setName(getOutput().getName()); } super.populateActions(((FileUpload) uploader.getFileInput()).getElement()); return uploader; }