Example usage for com.vaadin.ui Notification setDelayMsec

List of usage examples for com.vaadin.ui Notification setDelayMsec

Introduction

In this page you can find the example usage for com.vaadin.ui Notification setDelayMsec.

Prototype

public void setDelayMsec(int delayMsec) 

Source Link

Document

Sets the delay before the notification disappears.

Usage

From source file:de.uni_tuebingen.qbic.qbicmainportlet.DatasetViewFilterGenerator.java

License:Open Source License

@Override
public void filterAdded(Object propertyId, Class<? extends Filter> filterType, Object value) {
    Notification n = new Notification("Filter added to: " + propertyId, Notification.Type.TRAY_NOTIFICATION);
    n.setDelayMsec(800);
    // n.show(Page.getCurrent());
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.PatientStatusComponent.java

License:Open Source License

public void updateUI(final ProjectBean currentBean) {
    BeanItemContainer<ExperimentStatusBean> experimentstatusBeans = datahandler
            .computeIvacPatientStatus(currentBean);

    int finishedExperiments = 0;
    status.removeAllComponents();//from   w w  w .  j ava  2  s. c om
    status.setWidth(100.0f, Unit.PERCENTAGE);

    // Generate button caption column
    final GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(experimentstatusBeans);
    gpc.addGeneratedProperty("started", new PropertyValueGenerator<String>() {

        @Override
        public Class<String> getType() {
            return String.class;
        }

        @Override
        public String getValue(Item item, Object itemId, Object propertyId) {
            String status = null;

            if ((double) item.getItemProperty("status").getValue() > 0.0) {
                status = "<span class=\"v-icon\" style=\"font-family: " + FontAwesome.CHECK.getFontFamily()
                        + ";color:" + "#2dd085" + "\">&#x"
                        + Integer.toHexString(FontAwesome.CHECK.getCodepoint()) + ";</span>";
            } else {
                status = "<span class=\"v-icon\" style=\"font-family: " + FontAwesome.TIMES.getFontFamily()
                        + ";color:" + "#f54993" + "\">&#x"
                        + Integer.toHexString(FontAwesome.TIMES.getCodepoint()) + ";</span>";
            }

            return status.toString();
        }
    });
    gpc.removeContainerProperty("identifier");

    experiments.setContainerDataSource(gpc);
    // experiments.setHeaderVisible(false);
    // experiments.setHeightMode(HeightMode.ROW);
    experiments.setHeightByRows(gpc.size());
    experiments.setWidth(Page.getCurrent().getBrowserWindowWidth() * 0.6f, Unit.PIXELS);

    experiments.getColumn("status").setRenderer(new ProgressBarRenderer());
    // experiments.setColumnOrder("started", "code", "description", "status", "download",
    // "runWorkflow");
    experiments.setColumnOrder("started", "code", "description", "status", "workflow");

    experiments.getColumn("workflow").setRenderer(new ButtonRenderer(new RendererClickListener() {
        @Override
        public void click(RendererClickEvent event) {
            ExperimentStatusBean esb = (ExperimentStatusBean) event.getItemId();
            TabSheet parent = (TabSheet) getParent();
            PatientView pv = (PatientView) parent.getParent().getParent();
            WorkflowComponent wp = pv.getWorkflowComponent();

            // TODO WATCH OUT NUMBER OF WORKFLOW TAB IS HARDCODED AT THE MOMENT, NO BETTER SOLUTION
            // FOUND SO FAR, e.g. get Tab by Name ?

            // TODO idea get description of item to navigate to the correct workflow ?!
            if (esb.getDescription().equals("Barcode Generation")) {
                ArrayList<String> message = new ArrayList<String>();
                message.add("clicked");
                message.add(currentBean.getId());
                //TODO navigate to barcode dragon rawwwr
                //          message.add(BarcodeView.navigateToLabel);
                //          state.notifyObservers(message);
            } else if (esb.getDescription().equals("Variant Annotation")) {
                /*
                 * ArrayList<String> message = new ArrayList<String>(); message.add("clicked");
                 * StringBuilder sb = new StringBuilder("type="); sb.append("workflowExperimentType");
                 * sb.append("&"); sb.append("id="); sb.append(currentBean.getId()); sb.append("&");
                 * sb.append("experiment="); sb.append("Q_WF_NGS_VARIANT_ANNOTATION");
                 * message.add(sb.toString()); message.add(WorkflowView.navigateToLabel);
                 * state.notifyObservers(message);
                 */

                Map<String, String> args = new HashMap<String, String>();
                args.put("id", currentBean.getId());
                args.put("type", "workflowExperimentType");
                args.put("experiment", "Q_WF_NGS_VARIANT_ANNOTATION");
                parent.setSelectedTab(9);
                wp.update(args);

            } else if (esb.getDescription().equals("Epitope Prediction")) {
                /*
                 * ArrayList<String> message = new ArrayList<String>(); message.add("clicked");
                 * StringBuilder sb = new StringBuilder("type="); sb.append("workflowExperimentType");
                 * sb.append("&"); sb.append("id="); sb.append(currentBean.getId()); sb.append("&");
                 * sb.append("experiment="); sb.append("Q_WF_NGS_EPITOPE_PREDICTION");
                 * message.add(sb.toString()); message.add(WorkflowView.navigateToLabel);
                 * state.notifyObservers(message);
                 */
                Map<String, String> args = new HashMap<String, String>();
                args.put("id", currentBean.getId());
                args.put("type", "workflowExperimentType");
                args.put("experiment", "Q_WF_NGS_EPITOPE_PREDICTION");
                parent.setSelectedTab(9);
                wp.update(args);
            } else if (esb.getDescription().equals("HLA Typing")) {
                /*
                 * ArrayList<String> message = new ArrayList<String>(); message.add("clicked");
                 * StringBuilder sb = new StringBuilder("type="); sb.append("workflowExperimentType");
                 * sb.append("&"); sb.append("id="); sb.append(currentBean.getId()); sb.append("&");
                 * sb.append("experiment="); sb.append("Q_WF_NGS_HLATYPING"); message.add(sb.toString());
                 * message.add(WorkflowView.navigateToLabel); state.notifyObservers(message);
                 */
                Map<String, String> args = new HashMap<String, String>();
                args.put("id", currentBean.getId());
                args.put("type", "workflowExperimentType");
                args.put("experiment", "Q_WF_NGS_HLATYPING");
                parent.setSelectedTab(9);
                wp.update(args);
            }

            else {
                Notification notif = new Notification("Workflow not (yet) available.", Type.TRAY_NOTIFICATION);
                // Customize it
                notif.setDelayMsec(60000);
                notif.setPosition(Position.MIDDLE_CENTER);
                // Show it in the page
                notif.show(Page.getCurrent());
            }
        }
    }));

    experiments.getColumn("started").setRenderer(new HtmlRenderer());

    ProgressBar progressBar = new ProgressBar();
    progressBar.setCaption("Overall Progress");
    progressBar.setWidth(Page.getCurrent().getBrowserWindowWidth() * 0.6f, Unit.PIXELS);
    progressBar.setStyleName("patientprogress");

    status.addComponent(progressBar);
    status.addComponent(experiments);
    status.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER);
    status.setComponentAlignment(experiments, Alignment.MIDDLE_CENTER);

    /**
     * Defined Experiments for iVac - Barcodes available -> done with project creation (done) -
     * Sequencing done (Status Q_NGS_MEASUREMENT) - Variants annotated (Status
     * Q_NGS_VARIANT_CALLING) - HLA Typing done (STATUS Q_NGS_WF_HLA_TYPING) - Epitope Prediction
     * done (STATUS Q_WF_NGS_EPITOPE_PREDICTION)
     */

    for (Iterator i = experimentstatusBeans.getItemIds().iterator(); i.hasNext();) {
        ExperimentStatusBean statusBean = (ExperimentStatusBean) i.next();

        finishedExperiments += statusBean.getStatus();

        // statusBean.setDownload("Download");
        statusBean.setWorkflow("Run");
    }

    progressBar.setValue((float) finishedExperiments / experimentstatusBeans.size());
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.WorkflowComponent.java

License:Open Source License

void showNotification(String message) {
    Notification notif = new Notification(message, Type.TRAY_NOTIFICATION);
    // Customize it
    notif.setDelayMsec(60000);
    notif.setPosition(Position.MIDDLE_CENTER);
    // Show it in the page
    notif.show(Page.getCurrent());//from  ww  w .j  av  a2  s  .com

}

From source file:dhbw.clippinggorilla.utilities.ui.VaadinUtils.java

public static void errorNotification(String caption, String description) {
    Notification not = new Notification(caption, null, Notification.Type.TRAY_NOTIFICATION, true);
    not.setDelayMsec(1000);
    not.setPosition(Position.TOP_CENTER);
    not.setStyleName(ValoTheme.NOTIFICATION_FAILURE + " " + ValoTheme.NOTIFICATION_SMALL);
    not.show(Page.getCurrent());/*from www  . ja  v  a2 s. c o  m*/
}

From source file:dhbw.clippinggorilla.utilities.ui.VaadinUtils.java

public static void infoNotification(String caption, String description) {
    Notification not = new Notification(caption, null, Notification.Type.TRAY_NOTIFICATION, true);
    not.setDelayMsec(1000);
    not.setPosition(Position.BOTTOM_CENTER);
    not.show(Page.getCurrent());//from   w  w w  . j  a  v a  2s  .com
}

From source file:dhbw.clippinggorilla.utilities.ui.VaadinUtils.java

public static void middleInforNotification(String caption, String descripton) {
    Notification not = new Notification(caption, null, Notification.Type.TRAY_NOTIFICATION, true);
    not.setDelayMsec(1000);
    not.setPosition(Position.MIDDLE_CENTER);
    not.show(Page.getCurrent());//from  ww  w . j  a v a2s  . c  o  m
}

From source file:ed.cracken.pos.ui.products.ProductForm.java

public ProductForm(ProductCrudLogic crudLogic) {
    super();/*from   w ww . j  av  a  2  s . co m*/
    viewLogic = crudLogic;
    initComponents();
    price.setConverter(new EuroConverter());

    for (Availability s : Availability.values()) {
        availability.addItem(s);
    }

    fieldGroup = new BeanFieldGroup<>(Product.class);
    fieldGroup.bindMemberFields(this);

    // perform validation and enable/disable buttons while editing
    Property.ValueChangeListener valueListener = (Property.ValueChangeEvent event) -> {
        formHasChanged();
    };
    fieldGroup.getFields().stream().forEach((f) -> {
        f.addValueChangeListener(valueListener);
    });

    fieldGroup.addCommitHandler(new FieldGroup.CommitHandler() {

        @Override
        public void preCommit(FieldGroup.CommitEvent commitEvent) throws FieldGroup.CommitException {
        }

        @Override
        public void postCommit(FieldGroup.CommitEvent commitEvent) throws FieldGroup.CommitException {
            DataService.get().updateProduct(fieldGroup.getItemDataSource().getBean());
        }
    });

    save.addClickListener((Button.ClickEvent event) -> {
        try {
            fieldGroup.commit();

            // only if validation succeeds
            Product product = fieldGroup.getItemDataSource().getBean();
            viewLogic.saveProduct(product);
        } catch (FieldGroup.CommitException e) {
            Notification n = new Notification("Please re-check the fields", Notification.Type.ERROR_MESSAGE);
            n.setDelayMsec(500);
            n.show(getUI().getPage());
        }
    });

    cancel.addClickListener((Button.ClickEvent event) -> {
        viewLogic.cancelProduct();
    });

    delete.addClickListener((Button.ClickEvent event) -> {
        Product product = fieldGroup.getItemDataSource().getBean();
        viewLogic.deleteProduct(product);
    });
}

From source file:ed.cracken.pos.ui.purchases.PurchaseItemForm.java

private void configBinding() {
    fieldGroup = new BeanFieldGroup<>(ItemTo.class);
    fieldGroup.bindMemberFields(this);

    Property.ValueChangeListener valueListener = (Property.ValueChangeEvent event) -> {
        formHasChanged();//w w  w  . ja  v  a  2s  . c  o m
    };
    fieldGroup.getFields().stream().forEach((f) -> {
        f.addValueChangeListener(valueListener);
    });

    save.addClickListener((Button.ClickEvent event) -> {
        try {
            fieldGroup.commit();
            // update grid item
        } catch (FieldGroup.CommitException e) {
            Notification n = new Notification("Please re-check the fields", Notification.Type.ERROR_MESSAGE);
            n.setDelayMsec(500);
            n.show(getUI().getPage());
        }
    });

    cancel.addClickListener((Button.ClickEvent event) -> {
        // just cancel
    });

    delete.addClickListener((Button.ClickEvent event) -> {
        //remove from list
    });
}

From source file:edu.kit.dama.ui.admin.utils.UIComponentTools.java

License:Apache License

/**
 * Show a notification with caption <i>caption</i>, message <i>message</i>
 * of type <i>pType</i> for/*w  w  w  .  j  a v  a 2  s  . co m*/
 * <i>delay</i> at top_center position.
 *
 * @param caption The caption.
 * @param message The message.
 * @param delay The delay (ms) until the nofication disappears.
 * @param pType The notification type.
 * @param pPosition The notification position.
 */
private static void showNotification(String caption, String message, int delay, Notification.Type pType,
        Position position) {
    Notification notification = new Notification(caption, message, pType);
    notification.setPosition(position);
    notification.setDelayMsec(delay);
    notification.setHtmlContentAllowed(true);
    notification.show(Page.getCurrent());
}

From source file:edu.nps.moves.mmowgli.AbstractMmowgliControllerHelper.java

License:Open Source License

public void handlePublishReportsTL() {
    AppMaster.instance().requestPublishReportsTL();

    Notification notification = new Notification("", "Report publication begun",
            Notification.Type.WARNING_MESSAGE);

    notification.setPosition(Position.TOP_CENTER);
    notification.setDelayMsec(5000);
    notification.show(Page.getCurrent());

    GameEventLogger.logRequestReportGenerationTL(Mmowgli2UI.getGlobals().getUserTL());
}