public ReleasesView() { setSizeFull(); setMargin(false); ButtonBar buttonBar = new ButtonBar(); addButton = buttonBar.addButton("Add", FontAwesome.PLUS, e -> add()); editButton = buttonBar.addButton("Edit", FontAwesome.EDIT, e -> edit()); exportButton = buttonBar.addButton("Export", FontAwesome.DOWNLOAD, e -> export()); archiveButton = buttonBar.addButton("Archive", FontAwesome.ARCHIVE, e -> archive()); // TODO add support for the archive button archiveButton.setVisible(false); finalizeButton = buttonBar.addButton("Finalize", FontAwesome.CUBE, e -> finalize()); addComponent(buttonBar); enableDisableButtonsForSelectionSize(0); grid = new Grid(); grid.setSizeFull(); grid.setSelectionMode(SelectionMode.MULTI); grid.addItemClickListener(e->rowClicked(e)); grid.addSelectionListener((e) -> rowSelected(e)); container = new BeanItemContainer<>(ReleasePackage.class); grid.setContainerDataSource(container); grid.setColumns("name", "versionLabel", "releaseDate", "released"); grid.sort("releaseDate", SortDirection.DESCENDING); addComponent(grid); setExpandRatio(grid, 1); progressBar = new ProgressBar(0.0f); }
public ProgressIndicatorWindow() { center(); setVisible(true); setResizable(false); setDraggable(false); setImmediate(true); setModal(true); setClosable(false); setCaption("Loading"); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setWidth("100%"); this.currentStatus = new Label(); this.currentStatus.addStyleName(StyleConstants.TEXT_ALIGN_CENTER); this.currentStatus.setSizeFull(); this.currentStatus.setImmediate(true); ProgressBar progressBar = new ProgressBar(); progressBar.setSizeFull(); progressBar.setIndeterminate(true); progressBar.setImmediate(true); progressBar.setVisible(true); layout.addComponent(progressBar); layout.addComponent(this.currentStatus); layout.setComponentAlignment(this.currentStatus, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER); setContent(layout); }
protected UIWorkProgressTracker(final AbstractPrototypeComponent parent) { super(parent, new HorizontalLayout()); this.progressor = new ProgressBar(); this.status = new Label(); setSizeFull(); defineWithin(super.layout); SimpleEventManager.getInstance().attach(new JobProgressHandler(JobHasProgressedEvent.class)); SimpleEventManager.getInstance().attach(new JobJustStartedHandler(JobJustStartedEvent.class)); SimpleEventManager.getInstance().attach(new JobDoneHandler(JobDoneEvent.class)); }
private void initView() { this.loadingSign = new ProgressBar(); this.loadingSign.setIndeterminate(true); this.loadingSign.setId("loadingSign"); Label title = new Label("Available models"); title.setId("label_availableModels"); addComponent(title); this.availableModelsTree = new Tree(); this.availableModelsTree.setId("tree_availableModels"); this.availableModelsTree.setWidth(30, Unit.EM); Tree tree = availableModelsTree; tree.addContainerProperty(CAPTION_PROPERTY, String.class, ""); tree.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY); tree.setItemCaptionPropertyId(CAPTION_PROPERTY); this.buttonStartSession = new Button("Start"); this.buttonStartSession.setId("button_start"); this.buttonStartSession.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { String selectedModelPath = (String) tree.getValue(); if(selectedModelPath.endsWith(".wtspec4m")) { startSession(selectedModelPath); } } }); addComponent(this.buttonStartSession); addComponent(this.loadingSign); Panel treeViewContainer = new Panel(); treeViewContainer.setId("panel_treeViewContainer"); treeViewContainer.setContent(this.availableModelsTree); addComponent(treeViewContainer); }
@Override public OutputStream receiveUpload(String filename, String mimeType) { importLayout.removeAllComponents(); ProgressBar bar = new ProgressBar(); bar.setIndeterminate(true); importLayout.addComponent(bar); importLayout.setComponentAlignment(bar, Alignment.MIDDLE_CENTER); return os; }
protected void refreshDetails(final Trigger trigger, final IDb db, final Settings settings) { final HorizontalLayout executingLayout = new HorizontalLayout(); executingLayout.setSizeFull(); final ProgressBar p = new ProgressBar(); p.setIndeterminate(true); executingLayout.addComponent(p); tabSheet.addTab(executingLayout, "Details", FontAwesome.SPINNER, 0); tabSheet.setSelectedTab(executingLayout); TriggerTableLayout triggerTable = new TriggerTableLayout(trigger, settings, new Refresher() { public void refresh() { tabSheet.removeTab(tabSheet.getTab(0)); refreshDetails(trigger, db, settings); } }); boolean select = tabSheet.getSelectedTab().equals(executingLayout); tabSheet.removeComponent(executingLayout); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSizeFull(); layout.addComponent(triggerTable); tabSheet.addTab(layout, "Details", null, 0); if (select) { tabSheet.setSelectedTab(layout); } }
public UploadComponent(String buttonCaption, String sessionId, int maxSize, String folderPath) { upload = new Upload(); this.addComponent(upload); this.maxSize = maxSize; upload.setReceiver( this); this.directory = folderPath; upload.setButtonCaption(buttonCaption); upload.addSucceededListener((Upload.SucceededListener) this); upload.addFailedListener((Upload.FailedListener) this); upload.addProgressListener((Upload.ProgressListener) this); upload.addFinishedListener((Upload.FinishedListener) this); processingLayout = new HorizontalLayout(); processingLayout.setSpacing(true); processingLayout.setVisible(false); this.addComponent(processingLayout); progressBar = new ProgressBar(); processingLayout.addComponent(progressBar); cancelProcessing = new Button("cancel", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { cancelled = true; upload.interruptUpload(); } }); processingLayout.addComponent(cancelProcessing); }
public ProgressBarIndicator() { super("progressBar"); this.progressIndicator = new ProgressBar(); this.progressIndicator.setWidth("100%"); this.progressStatusLabel = new Label(); this.progressStatusLabel.setWidth("100%"); this.progressStatusLabel.setHeight("100%"); this.addComponent(this.progressIndicator, "progressbar-container"); this.addComponent(this.progressStatusLabel, "progressbar-status"); }
/** * Create new lazy loading indicator with given message * @param message Message shown to user */ public LazyLoadingIndicator(String message) { addStyleName("lazy-loading"); progressBar = new ProgressBar(); progressBar.addStyleName("lazy-loading-pbar"); progressBar.setIndeterminate(true); addComponent(progressBar); messageLabel = new Label(message != null ? message : DEFAULT_MESSAGE); messageLabel.addStyleName("lazy-loading-message"); addComponent(messageLabel); }
protected void startProcessor() { final ProgressBar progressBar = new ProgressBar(); progressBar.setWidth(400, Unit.PIXELS); final Window progressWindow = new Window("Progress", progressBar); progressWindow.setClosable(false); progressWindow.setResizable(false); progressWindow.center(); new Thread(new Runnable() { @Override public void run() { new Processor(new ProgressListener() { @Override public void onProgress(final long progress) { UI.getCurrent().access(new Runnable() { @Override public void run() { // 0 .. 1 final float progressBarValue = (float) progress / Processor.MAX_PROGRESS; progressBar.setValue(progressBarValue); if (progress == Processor.MAX_PROGRESS) { UI.getCurrent().setPollInterval(-1); UI.getCurrent().removeWindow(progressWindow); } } }); } }).run(); } }).start(); UI.getCurrent().setPollInterval(250); UI.getCurrent().addWindow(progressWindow); }
public HorizontalLayout getToolbar() { if (toolbarLayout == null) { toolbarLayout = new HorizontalLayout(); toolbarLayout.addComponent(super.createRefreshButton(this)); Label spaceEater = new Label(" "); toolbarLayout.addComponent(spaceEater); toolbarLayout.setExpandRatio(spaceEater, 1); diskUsageBar = new ProgressBar(0f); diskUsageBar.setCaption(DISK_USAGE_BAR_CAPTION); diskUsageBar.setStyleName("big"); diskUsageBar.setWidth(300, Unit.PIXELS); toolbarLayout.addComponent(diskUsageBar); toolbarLayout.setExpandRatio(diskUsageBar, 1); toolbarLayout.addComponent(super.getApp().getTitle()); toolbarLayout.setWidth("100%"); toolbarLayout.setStyleName("toolbar"); } return toolbarLayout; }
public ImportSelectFile(final ImportWizardView importView) { this.progressBar = new ProgressBar(); this.progressBar.setCaption("Progress"); this.progressBar.setWidth("100%"); this.progressBar.setHeight(100.0f, Unit.POINTS); }
private static ProgressBar creatreProgressBar() { final ProgressBar progressBarIndicator = new ProgressBar(0F); progressBarIndicator.addStyleName("bulk-upload-label"); progressBarIndicator.setSizeFull(); return progressBarIndicator; }
/** * @return the progressBar */ public ProgressBar getProgressBar() { return progressBar; }
public InProgressDialog(String caption, InProgressWorker<T> worker, BackgroundRefresherService backgroundService, String failureMessage) { this.backgroundService = backgroundService; this.worker = worker; this.failureMessage = failureMessage; setWidth(300, Unit.PIXELS); setHeight(150, Unit.PIXELS); setCaption("Working..."); setModal(true); VerticalLayout content = new VerticalLayout(); setContent(content); HorizontalLayout middle = new HorizontalLayout(); middle.setSpacing(true); middle.setMargin(true); ProgressBar pg = new ProgressBar(); pg.setIndeterminate(true); middle.addComponent(pg); if (isNotBlank(caption)) { Label label = new Label(caption); middle.addComponent(label); } content.addComponent(middle); content.setExpandRatio(middle, 1); HorizontalLayout buttonBar = new HorizontalLayout(); buttonBar.setWidth(100, Unit.PERCENTAGE); buttonBar.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); Button dismiss = new Button("Dismiss"); dismiss.addStyleName(ValoTheme.BUTTON_PRIMARY); dismiss.setClickShortcut(KeyCode.ENTER); dismiss.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { InProgressDialog.this.close(); } }); buttonBar.addComponent(dismiss); buttonBar.setComponentAlignment(dismiss, Alignment.MIDDLE_RIGHT); content.addComponent(buttonBar); }
private void buildProgress() { exportProgressBar = new ProgressBar(); exportProgressBar.setCaption(Messages.getString("Caption.Label.ExportProgress")); exportProgressBar.setWidth("200px"); }
/** * Display the Working Dialog with a Cancel Button. If the user clicks the * Cancel button the listener will be sent a cancel button. The setWorker * method does not support being cancelled. * * @param caption * @param message * @param listener * @param refresher */ public WorkingDialog(String caption, String message, CancelListener listener) { super(caption); ui = UI.getCurrent(); this.setModal(true); this.setClosable(false); this.setResizable(false); content = new VerticalLayout(); this.setWidth("500px"); this.setHeight("150px"); content.setSizeFull(); content.setMargin(true); content.setSpacing(true); this.cancelListener = listener; layout = new VerticalLayout(); layout.setSpacing(true); layout.setSizeFull(); HorizontalLayout progressArea = new HorizontalLayout(); progressArea.setSizeFull(); ProgressBar progress = new ProgressBar(); progressArea.addComponent(progress); progress.setIndeterminate(true); messageLabel = new Label(message); messageLabel.setContentMode(ContentMode.HTML); messageLabel.setSizeFull(); progressArea.addComponent(messageLabel); progressArea.setExpandRatio(messageLabel, 1); layout.addComponent(progressArea); content.addComponent(layout); if (listener != null) { cancel = new Button("Cancel"); cancel.addClickListener(new ClickEventLogged.ClickListener() { private static final long serialVersionUID = 1L; @Override public void clicked(ClickEvent event) { WorkingDialog.this.cancelListener.cancel(); WorkingDialog.this.close(); } }); content.addComponent(cancel); content.setComponentAlignment(cancel, Alignment.BOTTOM_RIGHT); } this.setContent(content); this.center(); }
public ProgressBar getProggressIndicator() { progressBar.setWidth(100, Unit.PERCENTAGE); return progressBar; }
@Override public Component getContent() { this.count = 0; final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); this.progressDescription = new Label("Imported: " + this.count + " records"); layout.addComponent(this.progressDescription); this.indicator = new ProgressBar(new Float(0.0)); this.indicator.setWidth("100%"); layout.addComponent(this.indicator); final Label errorLabel = new Label("Errors are displayed below."); layout.addComponent(errorLabel); this.progressTable = new PoJoTable<>(ImportItemStatus.class, new String[] { "Row", "Exception" }); this.progressTable.setColumnExpandRatio("Exception", 1); this.progressTable.setSizeFull(); layout.addComponent(this.progressTable); layout.setExpandRatio(this.progressTable, 1); final Button errorExport = new Button("Export Errors"); layout.addComponent(errorExport); layout.setComponentAlignment(errorExport, Alignment.BOTTOM_RIGHT); errorExport.addClickListener(new ClickEventLogged.ClickListener() { private static final long serialVersionUID = 1L; @Override public void clicked(final ClickEvent event) { CsvExport csvExport; csvExport = new CsvExport(ImportShowProgress.this.progressTable); csvExport.setDisplayTotals(false); csvExport.setDoubleDataFormat("0"); csvExport.excludeCollapsedColumns(); csvExport.setReportTitle("Document title"); csvExport.setExportFileName("Nome_file_example.csv"); csvExport.export(); } }); // Set polling frequency to 0.5 seconds. final File tempFile = this.importView.getFile().getTempFile(); final Class<? extends Importable> clazz = this.importView.getType().getEntityClass(); ImportTask importTask = new ImportTask(this, tempFile, this.importView.getFile().getSelectedFile(), clazz, this.importView.getMatch().getFieldMap()); final ProgressBarWorker<ImportItemStatus> worker = new ProgressBarWorker<>(importTask); worker.start(); return layout; }
@Override public Component getContent() { final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); this.progressTable = new PoJoTable<>(EmailTransmission.class, new String[] { "ContactName", "Recipient", "Exception" }); this.progressTable.setColumnWidth("Recipient", 80); this.progressTable.setColumnExpandRatio("Exception", 1); this.progressTable.setSizeFull(); this.progressDescription = new Label(); layout.addComponent(this.progressDescription); layout.setMargin(true); this.indicator = new ProgressBar(new Float(0.0)); this.indicator.setHeight("30px"); this.indicator.setIndeterminate(false); this.indicator.setImmediate(true); this.indicator.setSizeFull(); layout.addComponent(this.indicator); layout.addComponent(this.progressTable); layout.setExpandRatio(this.progressTable, 1); final ArrayList<Contact> recipients = this.messagingWizardView.getRecipientStep().getRecipients(); final StepEnterDetails details = this.messagingWizardView.getDetails(); final ArrayList<EmailTransmission> transmissions = new ArrayList<>(); final HashSet<String> dedupList = new HashSet<>(); for (final Contact contact : recipients) { // Find if the contact has a mobile. // Check the primary field first. String email = contact.getHomeEmail(); if (email != null && email.length() > 0) { queueTransmission(details, transmissions, dedupList, contact, email); continue; } email = contact.getWorkEmail(); if (email != null && email.length() > 0) { queueTransmission(details, transmissions, dedupList, contact, email); continue; } // No email address found final EmailTransmission transmission = new EmailTransmission(contact, details.getMessage(), new RecipientException("No email address on contact.", contact)); StepShowProgress.this.progressTable.addRow(transmission); this.rejected.setValue(this.rejected.intValue() + 1); } if (transmissions.size() == 0) { Notification.show("None of the selected contacts have an Email address", Type.ERROR_MESSAGE); } else { this.queued.setValue(transmissions.size()); this.progressDescription.setValue(this.queued.intValue() + " messages queued."); final User user = SMSession.INSTANCE.getLoggedInUser(); final SendEmailTask task = new SendEmailTask(this, user, details.getMessage(), transmissions, this.messagingWizardView.getDetails().getAttachedFiles()); this.workDialog = new WorkingDialog("Sending Emails", "Sending...", task); final ProgressBarWorker<EmailTransmission> worker = new ProgressBarWorker<EmailTransmission>(task); worker.start(); UI.getCurrent().addWindow(this.workDialog); } return layout; }
/** * Sets the value of this progress bar. The value is a <code>float</code> * between 0 and 1 where 0 represents no progress at all and 1 represents * fully completed. * * @param newValue * the current progress value * @return this for method chaining * @see ProgressBar#setValue(float) */ @SuppressWarnings("unchecked") public default THIS withValue(float newValue) { ((ProgressBar) this).setValue(newValue); return (THIS) this; }
/** * Sets whether or not this progress indicator is indeterminate. In * indeterminate mode there is an animation indicating that the task is * running but without providing any information about the current progress. * * @param indeterminate * <code>true</code> to set to indeterminate mode; otherwise * <code>false</code> * @return this for method chaining * @see ProgressBar#setIndeterminate(boolean) */ @SuppressWarnings("unchecked") public default THIS withIndeterminate(boolean indeterminate) { ((ProgressBar) this).setIndeterminate(indeterminate); return (THIS) this; }
/** * Access ProgressBar of indicator component * @return */ public ProgressBar getProgressBar() { return progressBar; }