Example usage for com.vaadin.ui Notification setPosition

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

Introduction

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

Prototype

public void setPosition(Position position) 

Source Link

Document

Sets the position of the notification message.

Usage

From source file:de.fatalix.app.view.login.LoginView.java

private void showNotification(Notification notification, String style) {
    // keep the notification visible a little while after moving the
    // mouse, or until clicked
    notification.setPosition(Position.TOP_CENTER);
    notification.setStyleName(ValoTheme.NOTIFICATION_BAR);
    notification.setDelayMsec(2000);/*from  w ww .  j a  v  a 2  s  .  c  om*/
    notification.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 ww  w .jav a  2s.  c o  m
    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);/*ww w. ja  v  a 2 s  . c om*/
    notif.setPosition(Position.MIDDLE_CENTER);
    // Show it in the page
    notif.show(Page.getCurrent());

}

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);//  ww  w .j  a  va2s.co  m
    not.setPosition(Position.TOP_CENTER);
    not.setStyleName(ValoTheme.NOTIFICATION_FAILURE + " " + ValoTheme.NOTIFICATION_SMALL);
    not.show(Page.getCurrent());
}

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);/*from  w  w w  .  j  av  a 2 s.c  o m*/
    not.setPosition(Position.BOTTOM_CENTER);
    not.show(Page.getCurrent());
}

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);//  w ww . j a  va 2s. co m
    not.setPosition(Position.MIDDLE_CENTER);
    not.show(Page.getCurrent());
}

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/*ww w.  j  av a2 s.c  om*/
 * <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

private void showNotifInAllBrowserWindows(String content, String title, String style) {
    StringBuilder sb = new StringBuilder();
    sb.append("<br/>");
    sb.append(content);/*from   www  . ja v  a  2  s .  c o  m*/
    filterContent(sb);
    sb.append("<br/><span style='font-size:x-small'>Click to close.</span>");
    Notification notif = new Notification(title, sb.toString(), Notification.Type.ERROR_MESSAGE);
    notif.setHtmlContentAllowed(true);
    notif.setPosition(Position.MIDDLE_CENTER);
    notif.setStyleName(style);

    iterateUIs(notif, new UIHandler() {
        public boolean handle(Mmowgli2UI ui, Object notif) {
            ((Notification) notif).show(ui.getPage());
            return true;
        }
    });
}

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);/*  w  w  w.j  a va  2  s.  c om*/
    notification.show(Page.getCurrent());

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

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

License:Open Source License

private void showNotification(String content, String title, String style) {
    StringBuilder sb = new StringBuilder();
    sb.append("<br/>");
    sb.append(content);/*from ww w.j  a v a 2  s.  c  o  m*/
    // filterContent(sb);
    sb.append("<br/><span style='font-size:x-small'>Click to close.</span>");
    Notification notif = new Notification(title, sb.toString(), Notification.Type.ERROR_MESSAGE);
    notif.setHtmlContentAllowed(true);
    notif.setPosition(Position.MIDDLE_CENTER);
    notif.setStyleName(style);

    notif.show(myUI.getPage());
}