@Inject public ManagableFileTreePresenter( IManagableFileTreeView view, IFileTreeView.Presenter fileTreePresenter, IFileServiceAsync fileService, MessageView.Presenter messagePresenter, ITextInputView.Presenter textInputPresenter, ICreateSemanticMarkupFilesDialogView.Presenter createSemanticMarkupFilesDialogPresenter) { this.fileService = fileService; this.view = view; this.view.setPresenter(this); this.fileTreePresenter = fileTreePresenter; fileTreePresenter.addSelectionListener(this); this.messagePresenter = messagePresenter; this.textInputPresenter = textInputPresenter; this.createSemanticMarkupFilesDialogPresenter = createSemanticMarkupFilesDialogPresenter; this.defaultServletPath = view.getUploader().getServletPath() + "?username="******"&sessionID=" + Authentication.getInstance().getSessionID(); view.getUploader().setServletPath(defaultServletPath); view.getUploader().addOnFinishUploadHandler(new OnFinishUploadHandler()); view.getUploader().addOnStartUploadHandler(new OnStartUploadHandler()); view.getUploader().setI18Constants(new MyUploaderConstants()); IUploadStatus statusWidget = new BaseUploadStatus(); statusWidget.setCancelConfiguration(IUploadStatus.DEFAULT_CANCEL_CFG); // show uploading constantly, instead of the files /*display.getUploader().addOnStatusChangedHandler(new OnStatusChangedHandler() { @Override public void onStatusChanged(IUploader uploader) { uploader.getStatusWidget().setFileName("Uploading..."); } }); display.getUploader().addOnChangeUploadHandler(new OnChangeUploaderHandler() { @Override public void onChange(IUploader uploader) { System.out.println("on change"); } });*/ view.getUploader().setStatusWidget(statusWidget); view.setStatusWidget(statusWidget.getWidget()); view.getUploader().setFileInput(new MyFileInput(view.getAddButton())); initActions(); }
/** * This constructor allows to use an existing form panel. * * @param type file input to use * @param status Customized status widget to use * @param submitButton Customized button which submits the form * @param form Customized form panel */ public SingleUploader( FileInputType type, IUploadStatus status, Widget submitButton, FormPanel form) { super(type, form); final Uploader thisInstance = this; if (status == null) { status = new BaseUploadStatus(); super.add(status.getWidget()); } super.setStatusWidget(status); this.button = submitButton; if (submitButton != null) { submitButton.addStyleName("submit"); if (submitButton instanceof HasClickHandlers) { ((HasClickHandlers) submitButton) .addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { thisInstance.submit(); } }); } if (submitButton instanceof HasText) { ((HasText) submitButton).setText(I18N_CONSTANTS.uploaderSend()); } // The user could have attached the button anywhere in the page. if (!submitButton.isAttached()) { super.add(submitButton); } } }
/** Create new instance of this uploader */ private void createInstance() { embedded = null; statusBar = null; embedded = new Uploader(); embedded.addOnFinishUploadHandler(this); embedded.addOnStartUploadHandler(this); statusBar = new BaseUploadStatus(); statusBar.addCancelHandler(this); embedded.setStatusWidget(statusBar); }