Search in sources :

Example 1 with ProgressBar

use of com.vaadin.ui.ProgressBar in project VaadinUtils by rlsutton1.

the class ShowProgressStep method getContent.

@Override
public Component getContent() {
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    progressTable = new PoJoTable<JasperTransmission>(JasperTransmission.class, new String[] { "Description", "RecipientEmailAddress", "Exception" });
    progressTable.setColumnWidth("Description", 80);
    progressTable.setColumnWidth("RecipientEmailAddress", 100);
    progressTable.setColumnExpandRatio("Exception", 1);
    progressTable.setSizeFull();
    progressDescription = new Label();
    layout.addComponent(progressDescription);
    layout.setMargin(true);
    indicator = new ProgressBar(new Float(0.0));
    indicator.setHeight("30px");
    indicator.setIndeterminate(false);
    indicator.setImmediate(true);
    indicator.setSizeFull();
    layout.addComponent(indicator);
    layout.addComponent(this.progressTable);
    layout.setExpandRatio(progressTable, 1);
    Collection<?> recipients = wizardView.getRecipientStep().getRecipientIds();
    ArrayList<JasperTransmission> transmissions = new ArrayList<JasperTransmission>();
    HashSet<String> dedupList = new HashSet<String>();
    JasperProxy proxy;
    try {
        proxy = wizardView.getJasperProxy();
    } catch (JRException e) {
        logger.error(e, e);
        VUNotification.show(e, Type.ERROR_MESSAGE);
        throw new RuntimeException(e);
    }
    for (Object recipientId : recipients) {
        Recipient recipient = this.wizardView.getRecipient((Long) recipientId);
        // Find if the recipient has ane email address
        String email = recipient.getEmailAddress();
        if (email != null && email.length() > 0) {
            queueTransmission(transmissions, dedupList, recipient, email, proxy);
            continue;
        }
        // No email address found
        JasperTransmission transmission = new JasperTransmission(recipient, proxy, new RecipientException("No email address on recipient.", recipient));
        ShowProgressStep.this.progressTable.addRow(transmission);
        rejected.setValue(rejected.intValue() + 1);
    }
    if (transmissions.size() == 0) {
        Notification.show("None of the selected recipients have an Email address", Type.ERROR_MESSAGE);
    } else {
        queued.setValue(transmissions.size());
        progressDescription.setValue(queued.intValue() + " messages queued.");
        SendEmailTask task = new SendEmailTask(this, proxy, transmissions);
        workDialog = new WorkingDialog("Sending Emails", "Sending...", task);
        ProgressBarWorker<JasperTransmission> worker = new ProgressBarWorker<JasperTransmission>(task);
        worker.start();
        UI.getCurrent().addWindow(workDialog);
    }
    return layout;
}
Also used : JRException(net.sf.jasperreports.engine.JRException) Label(com.vaadin.ui.Label) ArrayList(java.util.ArrayList) WorkingDialog(au.com.vaadinutils.ui.WorkingDialog) ProgressBarWorker(au.com.vaadinutils.util.ProgressBarWorker) VerticalLayout(com.vaadin.ui.VerticalLayout) ProgressBar(com.vaadin.ui.ProgressBar) HashSet(java.util.HashSet)

Example 2 with ProgressBar

use of com.vaadin.ui.ProgressBar in project vaadin-tips by marcushellberg.

the class AsyncOrdersView method addLoadingNotification.

private void addLoadingNotification() {
    progressBar = new ProgressBar();
    progressBar.setIndeterminate(true);
    loadingNotificaton = new HorizontalLayout();
    loadingNotificaton.setSpacing(true);
    loadingNotificaton.addComponents(progressBar, new Label("Hang on, fetching orders..."));
    addComponents(loadingNotificaton);
    setComponentAlignment(loadingNotificaton, Alignment.TOP_CENTER);
}
Also used : Label(com.vaadin.ui.Label) ProgressBar(com.vaadin.ui.ProgressBar) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 3 with ProgressBar

use of com.vaadin.ui.ProgressBar in project ANNIS by korpling.

the class DocBrowserController method openDocVis.

public void openDocVis(String corpus, String doc, Visualizer visConfig, Button btn) {
    final String canonicalTitle = corpus + " > " + doc + " - " + "Visualizer: " + visConfig.getDisplayName();
    final String tabCaption = StringUtils.substring(canonicalTitle, 0, 15) + "...";
    if (visibleVisHolder.containsKey(canonicalTitle)) {
        Panel visHolder = visibleVisHolder.get(canonicalTitle);
        ui.getSearchView().getTabSheet().setSelectedTab(visHolder);
        return;
    }
    Panel visHolder = new Panel();
    visHolder.setSizeFull();
    visHolder.addDetachListener(new ClientConnector.DetachListener() {

        @Override
        public void detach(ClientConnector.DetachEvent event) {
            visibleVisHolder.remove(canonicalTitle);
        }
    });
    // first set loading indicator
    ProgressBar progressBar = new ProgressBar(1.0f);
    progressBar.setIndeterminate(true);
    progressBar.setSizeFull();
    VerticalLayout layoutProgress = new VerticalLayout(progressBar);
    layoutProgress.setSizeFull();
    layoutProgress.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER);
    visHolder.setContent(layoutProgress);
    Tab visTab = ui.getSearchView().getTabSheet().addTab(visHolder, tabCaption);
    visTab.setDescription(canonicalTitle);
    visTab.setIcon(EYE_ICON);
    visTab.setClosable(true);
    ui.getSearchView().getTabSheet().setSelectedTab(visTab);
    // register visible visHolder
    this.visibleVisHolder.put(canonicalTitle, visHolder);
    Background.run(new DocVisualizerFetcher(corpus, doc, canonicalTitle, visConfig.getType(), visHolder, visConfig, btn, UI.getCurrent()));
}
Also used : Panel(com.vaadin.ui.Panel) Tab(com.vaadin.ui.TabSheet.Tab) VerticalLayout(com.vaadin.ui.VerticalLayout) ClientConnector(com.vaadin.server.ClientConnector) ProgressBar(com.vaadin.ui.ProgressBar)

Example 4 with ProgressBar

use of com.vaadin.ui.ProgressBar in project ANNIS by korpling.

the class SingleResultPanel method showReloadingProgress.

private void showReloadingProgress() {
    // remove the old visualizer
    for (VisualizerPanel v : visualizers) {
        this.removeComponent(v);
    }
    // first set loading indicator
    reloadVisualizer = new ProgressBar(1.0f);
    reloadVisualizer.setIndeterminate(true);
    reloadVisualizer.setSizeFull();
    reloadVisualizer.setHeight(150, Unit.PIXELS);
    addComponent(reloadVisualizer);
}
Also used : ProgressBar(com.vaadin.ui.ProgressBar)

Aggregations

ProgressBar (com.vaadin.ui.ProgressBar)4 Label (com.vaadin.ui.Label)2 VerticalLayout (com.vaadin.ui.VerticalLayout)2 WorkingDialog (au.com.vaadinutils.ui.WorkingDialog)1 ProgressBarWorker (au.com.vaadinutils.util.ProgressBarWorker)1 ClientConnector (com.vaadin.server.ClientConnector)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 Panel (com.vaadin.ui.Panel)1 Tab (com.vaadin.ui.TabSheet.Tab)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 JRException (net.sf.jasperreports.engine.JRException)1