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); }
/** * Upload started for {@link Upload} variant. * * @see com.vaadin.ui.Upload.StartedListener#uploadStarted(com.vaadin.ui.Upload.StartedEvent) */ @Override public void uploadStarted(final StartedEvent event) { uploadInterrupted = false; selectedSwForUpload = null; final Optional<Long> selectedBaseSwModuleId = artifactUploadState.getSelectedBaseSwModuleId(); if (selectedBaseSwModuleId.isPresent()) { selectedSwForUpload = softwareModuleManagement.get(selectedBaseSwModuleId.get()).orElse(null); } if (selectedSwForUpload != null && view.checkIfSoftwareModuleIsSelected() && !view.checkIfFileIsDuplicate(event.getFilename(), selectedSwForUpload)) { LOG.debug("Upload started for file :{}", event.getFilename()); eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_STARTED, new UploadFileStatus(event.getFilename(), 0, 0, selectedSwForUpload))); } else { failureReason = i18n.getMessage("message.upload.failed"); upload.interruptUpload(); // actual interrupt will happen a bit late so setting the below // flag uploadInterrupted = true; } }
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); }
@Override public void uploadStarted(final StartedEvent event) { this.progressBar.setValue(0f); this.progressBar.setVisible(true); this.bytesProcessed.setVisible(true); this.file.setValue(event.getFilename()); this.cancelButton.setVisible(true); }
@Override public void uploadStarted(final StartedEvent event) { // this method gets called immediately after upload is started progressBar.setValue(0f); progressBar.setVisible(true); UI.getCurrent().setPollInterval(500); textualProgress.setVisible(true); // updates to client state.setValue("Cargando"); fileName.setValue(event.getFilename()); cancelButton.setVisible(true); }
@Override public void uploadStarted(final StartedEvent event) { if (!event.getFilename().endsWith(".csv")) { new HawkbitErrorNotificationMessage(SPUILabelDefinitions.SP_NOTIFICATION_ERROR_MESSAGE_STYLE, null, i18n.getMessage("bulk.targets.upload"), true).show(Page.getCurrent()); LOG.error("Wrong file format for file {}", event.getFilename()); upload.interruptUpload(); } else { eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.BULK_TARGET_UPLOAD_STARTED)); } }
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); } }
public void uploadStarted(StartedEvent event) { super.uploadStarted(event); long l = event.getContentLength(); if(l < getMaxContentLength()) { stream.reset(); jImage.createImage(); } }
public void uploadStarted(StartedEvent event) { pi.setVisible(true); upload.setVisible(false); long l = event.getContentLength(); if(l > maxContentLength) { interruptUpload(); } }
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 uploadStarted(StartedEvent event) { checkFileSize(event.getContentLength()); if (!interrupted) { // upload can be interrupted by invalid file size checkMimeType(event.getMIMEType()); } }
@Override public void uploadStarted(StartedEvent event) { progressBar.setValue(0.0f); setComponentsToVisible(true); //progressBar.setPollingInterval(100); }