List of usage examples for com.vaadin.ui ProgressBar ProgressBar
public ProgressBar()
From source file:info.magnolia.ui.form.field.upload.basic.BasicUploadProgressIndicator.java
License:Open Source License
public BasicUploadProgressIndicator(String inProgressCaption, String inProgressRatioCaption, SimpleTranslator i18n) {//w ww . j a v a 2 s . c om this.inProgressCaption = inProgressCaption; this.inProgressRatioCaption = inProgressRatioCaption; this.i18n = i18n; uploadFileLocation = new Label(""); uploadFileLocation.setSizeUndefined(); uploadFileLocation.addStyleName("uploading-file"); uploadFileRatio = new Label(""); uploadFileRatio.setSizeUndefined(); uploadFileRatio.addStyleName("uploaded-file"); uploadFileProgress = new Label(""); uploadFileProgress.setSizeUndefined(); uploadFileProgress.addStyleName("uploading-file-progress"); progressIndicator = new ProgressBar(); progressIndicator.setVisible(false); progressIndicator.setWidth("100%"); mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.addComponent(uploadFileLocation); CssLayout progressLayout = new CssLayout(); progressLayout.addStyleName("progress-layout"); progressLayout.addComponent(progressIndicator); progressLayout.addComponent(uploadFileProgress); progressLayout.setWidth("100%"); mainLayout.addComponent(progressLayout); mainLayout.addComponent(uploadFileRatio); Iterator<Component> it = mainLayout.iterator(); while (it.hasNext()) { Component c = it.next(); mainLayout.setComponentAlignment(c, Alignment.MIDDLE_CENTER); } mainLayout.setMargin(new MarginInfo(false, true, false, true)); setCompositionRoot(mainLayout); addStyleName("uploading-progress-indicator"); }
From source file:net.pkhsolutions.pecsapp.ui.components.PictureLayout.java
License:Open Source License
public PictureLayout(@NotNull PictureModel model) { this.model = model; setSpacing(true);//from w ww. jav a 2s .c o m infoLabel = new Label("Drag och slpp en bild hr"); infoLabel.setSizeUndefined(); dropPane = new VerticalLayout(); dropPane.setSizeFull(); dropPane.addComponent(infoLabel); dropPane.setComponentAlignment(infoLabel, Alignment.MIDDLE_CENTER); image = new Image(); image.setSizeUndefined(); dropPane.addComponent(image); dropPane.setComponentAlignment(image, Alignment.MIDDLE_CENTER); progressBar = new ProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); dropPane.addComponent(progressBar); dropPane.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER); DragAndDropWrapper dragAndDropWrapper = new DragAndDropWrapper(dropPane); dragAndDropWrapper.setDropHandler(this); dragAndDropWrapper.setSizeFull(); addComponent(dragAndDropWrapper); setExpandRatio(dragAndDropWrapper, 1f); title = new TextField(); title.setInputPrompt("Skriv namnet hr"); title.setWidth("100%"); title.setImmediate(true); addComponent(title); setComponentAlignment(title, Alignment.BOTTOM_LEFT); imageChanged(null); }
From source file:org.adho.dhconvalidator.ui.ConverterPanel.java
/** Setup GUI. */ private void initComponents() { setMargin(true);/*from w w w. j a v a 2s.c o m*/ setSizeFull(); setSpacing(true); HeaderPanel headerPanel = new HeaderPanel(null); addComponent(headerPanel); Label title = new Label(Messages.getString("ConverterPanel.title")); title.addStyleName("title-caption"); addComponent(title); setComponentAlignment(title, Alignment.TOP_LEFT); Label info = new Label(Messages.getString("ConverterPanel.info"), ContentMode.HTML); addComponent(info); HorizontalLayout inputPanel = new HorizontalLayout(); inputPanel.setSpacing(true); addComponent(inputPanel); upload = new Upload(Messages.getString("ConverterPanel.uploadCaption"), new Receiver() { @Override public OutputStream receiveUpload(String filename, String mimeType) { // we store the uploaded content in the panel instance ConverterPanel.this.filename = filename; ConverterPanel.this.uploadContent = new ByteArrayOutputStream(); return ConverterPanel.this.uploadContent; } }); inputPanel.addComponent(upload); progressBar = new ProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); inputPanel.addComponent(progressBar); inputPanel.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER); progressBar.addStyleName("converterpanel-progressbar"); resultCaption = new Label(Messages.getString("ConverterPanel.previewTitle2")); resultCaption.setWidth("100%"); resultCaption.addStyleName("converterpanel-resultcaption"); addComponent(resultCaption); setComponentAlignment(resultCaption, Alignment.MIDDLE_CENTER); resultPanel = new HorizontalSplitPanel(); addComponent(resultPanel); resultPanel.setSizeFull(); setExpandRatio(resultPanel, 1.0f); preview = new Label("", ContentMode.HTML); preview.addStyleName("tei-preview"); resultPanel.addComponent(preview); VerticalLayout rightPanel = new VerticalLayout(); rightPanel.setMargin(new MarginInfo(false, false, true, true)); rightPanel.setSpacing(true); resultPanel.addComponent(rightPanel); logArea = new Label("", ContentMode.HTML); logArea.setSizeFull(); logArea.setReadOnly(true); rightPanel.addComponent(logArea); downloadInfo = new Label(Messages.getString("ConverterPanel.downloadMsg")); rightPanel.addComponent(downloadInfo); downloadInfo.setVisible(false); btDownloadResult = new Button(Messages.getString("ConverterPanel.downloadBtCaption")); btDownloadResult.setVisible(false); rightPanel.addComponent(btDownloadResult); rightPanel.setComponentAlignment(btDownloadResult, Alignment.BOTTOM_CENTER); btDownloadResult.setHeight("50px"); rightPanel.addComponent(new Label(Messages.getString("ConverterPanel.exampleMsg"))); Button btExample = new Button(Messages.getString("ConverterPanel.exampleButtonCaption")); btExample.setStyleName(BaseTheme.BUTTON_LINK); btExample.addStyleName("plain-link"); rightPanel.addComponent(btExample); confToolLabel = new Label( Messages.getString("ConverterPanel.gotoConfToolMsg", PropertyKey.conftool_login_url.getValue()), ContentMode.HTML); confToolLabel.setVisible(false); confToolLabel.addStyleName("postDownloadInfoRedAndBold"); rightPanel.addComponent(confToolLabel); new BrowserWindowOpener(DHConvalidatorExample.class).extend(btExample); }
From source file:org.ikasan.dashboard.ui.framework.window.ProgressBarWindow.java
License:BSD License
protected void init() { this.setModal(true); this.setWidth("15%"); this.setHeight("15%"); ProgressBar progressBar = new ProgressBar(); progressBar.setIndeterminate(true);/*from w w w . java 2s .c o m*/ progressBar.setEnabled(true); VerticalLayout layout = new VerticalLayout(); layout.addComponent(progressBar); layout.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER); this.setContent(layout); }
From source file:org.jumpmind.vaadin.ui.sqlexplorer.TableInfoPanel.java
License:Open Source License
protected void refreshData(final org.jumpmind.db.model.Table table, final String user, final IDb db, final Settings settings, boolean isInit) { if (!isInit) { tabSheet.removeTab(tabSheet.getTab(1)); }/*from w w w . ja v a 2 s. c o m*/ IDatabasePlatform platform = db.getPlatform(); DmlStatement dml = platform.createDmlStatement(DmlType.SELECT_ALL, table, null); final HorizontalLayout executingLayout = new HorizontalLayout(); executingLayout.setSizeFull(); final ProgressBar p = new ProgressBar(); p.setIndeterminate(true); final int oldPollInterval = UI.getCurrent().getPollInterval(); UI.getCurrent().setPollInterval(100); executingLayout.addComponent(p); executingLayout.setData(isInit); tabSheet.addTab(executingLayout, "Data", isInit ? null : FontAwesome.SPINNER, 1); if (!isInit) { tabSheet.setSelectedTab(executingLayout); } SqlRunner runner = new SqlRunner(dml.getSql(), false, user, db, settings, explorer, new ISqlRunnerListener() { private static final long serialVersionUID = 1L; @Override public void writeSql(String sql) { explorer.openQueryWindow(db).appendSql(sql); } @Override public void reExecute(String sql) { refreshData(table, user, db, settings, false); } @Override public void finished(final FontAwesome icon, final List<Component> results, long executionTimeInMs, boolean transactionStarted, boolean transactionEnded) { VaadinSession.getCurrent().access(new Runnable() { @Override public void run() { tabSheet.removeComponent(executingLayout); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSizeFull(); if (results.size() > 0) { layout.addComponent(results.get(0)); } tabSheet.addTab(layout, "Data", null, 1); UI.getCurrent().setPollInterval(oldPollInterval); tabSheet.setSelectedTab(layout); } }); } }); runner.setShowSqlOnResults(false); runner.setLogAtDebug(true); if (!isInit) { runner.start(); } }
From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.ProgressBarPresentation.java
License:Open Source License
/** * {@inheritDoc}//from ww w . j av a2 s.co m */ @Override public Component doCreateWidget(Object parent) { if (componentBase == null) { componentBase = new CssLayout(); componentBase.addStyleName(CSS_CLASS_CONTROL_BASE); if (modelAccess.isCssIdValid()) { componentBase.setId(modelAccess.getCssID()); } else { componentBase.setId(getEditpart().getId()); } associateWidget(componentBase, modelAccess.yProgressBar); progressBar = new ProgressBar(); progressBar.addStyleName(CSS_CLASS_CONTROL); progressBar.setImmediate(true); associateWidget(progressBar, modelAccess.yProgressBar); property = new ObjectProperty<Float>(0f, Float.class); progressBar.setPropertyDataSource(property); // creates the binding for the field createBindings(modelAccess.yProgressBar, progressBar); componentBase.addComponent(progressBar); if (modelAccess.isCssClassValid()) { progressBar.addStyleName(modelAccess.getCssClass()); } applyCaptions(); initializeField(progressBar); } return componentBase; }
From source file:org.opennms.features.topology.netutils.internal.ping.PingWindow.java
License:Open Source License
/** * Creates the PingWindow to make ping requests. * * @param locations All available locations to ping from. Must not be null. * @param defaultLocation The location to pre-select from the locations. Ensure <code>defaultLocation</code> is also available in the <code>locations</code> list. * @param ipAddresses All available ipAddresses. Must not be null or empty. * @param defaultIp The default ip to pre-select from the ip addresses. Ensure <code>defaultIp</code> is also available in the <code>ipAddresses</code> list. * @param pingClient The LocationAwarePingClient to ping. Must not be null. *//*from ww w . ja va 2 s.c o m*/ public PingWindow(LocationAwarePingClient pingClient, List<String> locations, List<InetAddress> ipAddresses, String defaultLocation, InetAddress defaultIp, String caption) { Objects.requireNonNull(pingClient); Objects.requireNonNull(ipAddresses); Objects.requireNonNull(defaultIp); Objects.requireNonNull(locations); Objects.requireNonNull(defaultLocation); Objects.requireNonNull(caption); // Remember initial poll interval, as we poll as soon as we start pinging final int initialPollInterval = UI.getCurrent().getPollInterval(); // Ping Form pingForm = new PingForm(locations, defaultLocation, ipAddresses, defaultIp); // Result final TextArea resultArea = new TextArea(); resultArea.setRows(15); resultArea.setSizeFull(); // Progress Indicator progressIndicator = new ProgressBar(); progressIndicator.setIndeterminate(true); // Buttons cancelButton = new Button("Cancel"); cancelButton.addClickListener((event) -> { cancel(pingFuture); resultArea.setValue(resultArea.getValue() + "\n" + "Ping cancelled by user"); getUI().setPollInterval(initialPollInterval); setRunning(false); }); pingButton = new Button("Ping"); pingButton.addClickListener((event) -> { try { final PingRequest pingRequest = pingForm.getPingRequest(); resultArea.setValue(""); // Clear setRunning(true); getUI().setPollInterval(POLL_INTERVAL); pingFuture = pingClient.ping(pingRequest.getInetAddress()).withRetries(pingRequest.getRetries()) .withPacketSize(pingRequest.getPacketSize()) .withTimeout(pingRequest.getTimeout(), TimeUnit.MILLISECONDS) .withLocation(pingRequest.getLocation()) .withNumberOfRequests(pingRequest.getNumberRequests()) .withProgressCallback((newSequence, summary) -> { getUI().accessSynchronously(() -> { if (pingFuture != null && !pingFuture.isCancelled()) { setRunning(!summary.isComplete()); resultArea.setValue(PingStringUtils.renderAll(summary)); if (summary.isComplete()) { getUI().setPollInterval(initialPollInterval); } } }); }).execute(); } catch (FieldGroup.CommitException e) { Notification.show("Validation errors", "Please correct them. Make sure all required fields are set.", Notification.Type.ERROR_MESSAGE); } }); // Button Layout final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.addComponent(pingButton); buttonLayout.addComponent(cancelButton); buttonLayout.addComponent(progressIndicator); // Root Layout final VerticalLayout rootLayout = new VerticalLayout(); rootLayout.setSpacing(true); rootLayout.setMargin(true); rootLayout.addComponent(pingForm); rootLayout.addComponent(buttonLayout); rootLayout.addComponent(new Label("<b>Results</b>", ContentMode.HTML)); rootLayout.addComponent(resultArea); rootLayout.setExpandRatio(resultArea, 1.0f); // Window Config setCaption(caption); setResizable(false); setModal(true); setWidth(800, Unit.PIXELS); setHeight(600, Unit.PIXELS); setContent(rootLayout); center(); setRunning(false); // Set back to default, when closing addCloseListener((CloseListener) e -> { cancel(pingFuture); getUI().setPollInterval(initialPollInterval); }); }
From source file:org.opennms.features.topology.netutils.internal.PingWindow.java
License:Open Source License
/** * Creates the PingWindow to make ping requests. * * @param vertex The vertex which IP Address is pinged. * It is expected that the IP Address os not null and parseable. * @param pingService The {@link PingService} to actually make the ping request. *///w ww . j av a2s .c o m public PingWindow(Vertex vertex, PingService pingService) { Objects.requireNonNull(vertex); Objects.requireNonNull(pingService); // Remember initial poll interval, as we poll as soon as we start pinging final int initialPollInterval = UI.getCurrent().getPollInterval(); // Ping Form pingForm = new PingForm(InetAddressUtils.getInetAddress(vertex.getIpAddress())); // Result final TextArea resultArea = new TextArea(); resultArea.setRows(15); resultArea.setSizeFull(); // Progress Indicator progressIndicator = new ProgressBar(); progressIndicator.setIndeterminate(true); // Buttons cancelButton = new Button("Cancel"); cancelButton.addClickListener((event) -> { pingService.cancel(); resultArea.setValue(resultArea.getValue() + "\n" + "Ping cancelled by user"); getUI().setPollInterval(initialPollInterval); setRunning(false); }); pingButton = new Button("Ping"); pingButton.addClickListener((event) -> { try { final PingRequest pingRequest = pingForm.getPingRequest(); setRunning(true); getUI().setPollInterval(POLL_INTERVAL); resultArea.setValue(""); // Clear pingService.ping(pingRequest, (result) -> { setRunning(!result.isComplete()); resultArea.setValue(result.toDetailString()); if (result.isComplete()) { getUI().setPollInterval(initialPollInterval); } }); } catch (FieldGroup.CommitException e) { Notification.show("Validation errors", "Please correct them. Make sure all required fields are set.", Notification.Type.ERROR_MESSAGE); } }); // Button Layout final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.addComponent(pingButton); buttonLayout.addComponent(cancelButton); buttonLayout.addComponent(progressIndicator); // Root Layout final VerticalLayout rootLayout = new VerticalLayout(); rootLayout.setSpacing(true); rootLayout.setMargin(true); rootLayout.addComponent(pingForm); rootLayout.addComponent(buttonLayout); rootLayout.addComponent(new Label("<b>Results</b>", ContentMode.HTML)); rootLayout.addComponent(resultArea); rootLayout.setExpandRatio(resultArea, 1.0f); // Window Config setCaption(String.format("Ping - %s (%s)", vertex.getLabel(), vertex.getIpAddress())); setResizable(false); setModal(true); setWidth(800, Unit.PIXELS); setHeight(550, Unit.PIXELS); setContent(rootLayout); center(); setRunning(false); // Set back to default, when closing addCloseListener((CloseListener) e -> { pingService.cancel(); getUI().setPollInterval(initialPollInterval); }); }
From source file:org.vaadin.easyuploads.MultiFileUploadExt.java
License:Open Source License
private ProgressBar createProgressIndicator() { ProgressBar progressIndicator = new ProgressBar(); progressIndicator.setValue(0f); return progressIndicator; }
From source file:org.vaadin.easyuploads.MultiFileUploadExt.java
License:Open Source License
@Override public void drop(DragAndDropEvent event) { DragAndDropWrapper.WrapperTransferable transferable = (DragAndDropWrapper.WrapperTransferable) event .getTransferable();/*from w w w .ja va 2 s. c o m*/ Html5File[] files = transferable.getFiles(); for (final Html5File html5File : files) { final ProgressBar pi = new ProgressBar(); pi.setCaption(html5File.getFileName()); progressBars.addComponent(pi); final FileBuffer receiver = createReceiver(); html5File.setStreamVariable(new StreamVariable() { private static final long serialVersionUID = 1L; private String name; private String mime; @Override public OutputStream getOutputStream() { return receiver.receiveUpload(name, mime); } @Override public boolean listenProgress() { return true; } @Override public void onProgress(StreamVariable.StreamingProgressEvent event) { float p = (float) event.getBytesReceived() / (float) event.getContentLength(); pi.setValue(p); } @Override public void streamingStarted(StreamVariable.StreamingStartEvent event) { name = event.getFileName(); mime = event.getMimeType(); UI.getCurrent().setPollInterval(300); } @Override public void streamingFinished(StreamVariable.StreamingEndEvent event) { progressBars.removeComponent(pi); handleFile(receiver.getFile(), html5File.getFileName(), html5File.getType(), html5File.getFileSize()); receiver.setValue(null); } @Override public void streamingFailed(StreamVariable.StreamingErrorEvent event) { progressBars.removeComponent(pi); } @Override public boolean isInterrupted() { return false; } }); } }