public ApplianceUploader() { this.upload = new Upload(); this.upload.setButtonCaption(null); this.upload.setReceiver(this); this.upload.addFailedListener(this); this.upload.setImmediate(false); final UploadInfoWindow uploadInfoWindow = new UploadInfoWindow(this.upload); this.upload.addStartedListener(new StartedListener() { @Override public void uploadStarted(final StartedEvent event) { if (uploadInfoWindow.getParent() == null) { ViewUtil.addWindow(uploadInfoWindow); } } }); this.verLayout.setSpacing(true); this.verLayout.addStyleName(StyleConstants.COMPONENT_SPACING); this.verLayout.addComponent(this.upload); this.panel.setWidth("100%"); this.panel.setContent(this.verLayout); setCompositionRoot(this.panel); }
protected void createUpload() { this.upload = new Upload(); this.upload.setButtonCaption(getString(MAINTENANCE_SSLCONFIGURATION_UPLOAD)); this.upload.setReceiver(this); this.upload.addFailedListener(this); this.upload.addSucceededListener(this); this.upload.setImmediate(false); final UploadInfoWindow uploadInfoWindow = new UploadInfoWindow(this.upload); this.upload.addStartedListener((StartedListener) event -> { if (uploadInfoWindow.getParent() == null) { ViewUtil.addWindow(uploadInfoWindow); } }); }
public PluginUploader(ServerApi server) { this.server = server; this.upload = new Upload(); this.upload.setButtonCaption("Upload"); this.upload.setReceiver(this); this.upload.addFailedListener(this); this.upload.addSucceededListener(this); this.upload.setImmediate(false); final UploadInfoWindow uploadInfoWindow = new UploadInfoWindow(this.upload); this.upload.addStartedListener(new StartedListener() { @Override public void uploadStarted(final StartedEvent event) { if (uploadInfoWindow.getParent() == null) { ViewUtil.addWindow(uploadInfoWindow); } } }); this.verLayout.setSpacing(true); this.verLayout.addStyleName(StyleConstants.COMPONENT_SPACING); this.verLayout.addComponent(this.upload); this.panel.setWidth("100%"); this.panel.setContent(this.verLayout); setCompositionRoot(this.panel); }
public DbRestorer(RestoreServiceApi restoreService, ServerApi server, ValidationApi validator) { this.restoreService = restoreService; this.server = server; this.validator = validator; this.upload = new Upload(); this.upload.setButtonCaption(VmidcMessages.getString(VmidcMessages_.UPLOAD_RESTORE)); this.upload.setReceiver(this); this.upload.addFailedListener(this); this.upload.addSucceededListener(this); this.upload.setImmediate(false); final UploadInfoWindow uploadInfoWindow = new UploadInfoWindow(this.upload); this.upload.addStartedListener(new StartedListener() { @Override public void uploadStarted(final StartedEvent event) { if (uploadInfoWindow.getParent() == null) { ViewUtil.addWindow(uploadInfoWindow); } } }); this.verLayout.setSpacing(true); this.panel.setWidth("100%"); this.panel.setContent(this.verLayout); this.verLayout.addComponent(this.upload); this.verLayout.addStyleName(StyleConstants.COMPONENT_SPACING); setCompositionRoot(this.panel); }
protected void addUpload() { this.upload = new Upload(null, receiver); upload.setButtonCaption(i18nManager.getMessage(Messages.UPLOAD_SELECT)); upload.setImmediate(true); addComponent(upload); setComponentAlignment(upload, Alignment.MIDDLE_CENTER); // register ourselves as listener for upload events upload.addListener((StartedListener) this); upload.addListener((FailedListener) this); upload.addListener((FinishedListener) this); upload.addListener((ProgressListener) this); }
public void uploadStarted(StartedEvent event) { removeAllComponents(); // Visible components are replaced by a progress bar this.progressIndicator = new ProgressIndicator(); progressIndicator.setPollingInterval(500); addComponent(progressIndicator); setComponentAlignment(progressIndicator, Alignment.MIDDLE_CENTER); for (StartedListener startedListener : startedListeners) { startedListener.uploadStarted(event); } }
/** * @param upload The component that will serve this receiver * @param maxFileSize The maximum size of files that will be accepted (in bytes). -1 in case of no limit. */ public InMemoryUploadReceiver(Upload upload, long maxFileSize) { this.upload = upload; this.maxFileSize = maxFileSize; this.notificationManager = ExplorerApp.get().getNotificationManager(); upload.setReceiver(this); upload.addListener((StartedListener) this); upload.addListener((ProgressListener) this); }
private void startListener() { this.upload.addStartedListener(new StartedListener() { private static final long serialVersionUID = 1L; @Override public void uploadStarted(final StartedEvent event) { ImportSelectFile.this.uploadStarted = true; ImportSelectFile.this.uploadComplete = false; } }); }
public void addStartedListener(StartedListener startedListener) { startedListeners.add(startedListener); }
public void addStartedListener(StartedListener startedListener) { uploadComponent.addStartedListener(startedListener); }
/** * Adds the upload started event listener. * * @param listener * the Listener to be added, not null * @return this for method chaining * @see Upload#addStartedListener(StartedListener) */ @SuppressWarnings("unchecked") public default THIS withStartedListener(StartedListener listener) { ((Upload) this).addStartedListener(listener); return (THIS) this; }