Example usage for com.vaadin.ui Notification TYPE_TRAY_NOTIFICATION

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

Introduction

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

Prototype

Type TYPE_TRAY_NOTIFICATION

To view the source code for com.vaadin.ui Notification TYPE_TRAY_NOTIFICATION.

Click Source Link

Usage

From source file:com.expressui.core.MainApplication.java

License:Open Source License

/**
 * Shows message in tray area.//from   www  .  j av  a2s .co m
 *
 * @param delayMSec delay in milliseconds to display message
 * @param message   message to display
 */
public void showTrayMessage(int delayMSec, String message) {
    Window.Notification notification = new Window.Notification(message,
            Window.Notification.TYPE_TRAY_NOTIFICATION);
    notification.setPosition(Window.Notification.POSITION_BOTTOM_RIGHT);
    notification.setDelayMsec(delayMSec);
    notification.setHtmlContentAllowed(true);
    getInstance().showNotification(notification);
}

From source file:fr.univlorraine.mondossierweb.MdwTouchkitUI.java

License:Apache License

/**
 * Affiche du message d'intro/*  w w  w.  j  a v a2s  . c  o m*/
 */
private void afficherMessageIntro(String text) {

    Notification note = new Notification(text, "", Notification.TYPE_TRAY_NOTIFICATION, true);
    note.setPosition(Position.MIDDLE_CENTER);
    note.setDelayMsec(6000);
    note.show(this.getPage());

    /**
     * ANCIENNE VERSION AVEC POPUP WINDOW
     */
    /*
    //Recuperer dans la base si l'utilisateur a une prfrence pour l'affichage le message
    String val  = userController.getPreference(Utils.SHOW_MESSAGE_INTRO_MOBILE_PREFERENCE);
            
    //Par dfaut on affiche le message
    boolean afficherMessage = true;
            
    //Si on a une prfrence pour l'utilisateur en ce qui concerne l'affichage du message d'accueil mobile
    if(StringUtils.hasText(val)){
       //On rcupre ce choix dans afficherMessage
       afficherMessage = Boolean.valueOf(val);
    }
            
    //Si on doit afficher le message
    if(afficherMessage){
            
       //Cration de la pop-pup contenant le message
       HelpMobileWindow hbw = new HelpMobileWindow(text,applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale()),true);
            
       //Sur la fermeture de la fentre
       hbw.addCloseListener(g->{
    //On va enregistrer en base que l'utilisateur ne souhaite plus afficher le message si la checkbox propose par la pop-up a t coche
    boolean choix = hbw.getCheckBox().getValue();
    //Test si l'utilisateur a coch la case pour ne plus afficher le message
    if(choix){
       //mettre a jour dans la base de donnes
       userController.updatePreference(Utils.SHOW_MESSAGE_INTRO_MOBILE_PREFERENCE, "false");
    }
       });
            
       //Affichage de la pop_up
       UI.getCurrent().addWindow(hbw);
            
    }
     */
}

From source file:fr.univlorraine.mondossierweb.MdwTouchkitUI.java

License:Apache License

/**
 * Cration du menu tudiant//  w ww  .j  a  v a 2s  .c  o  m
 */
private void initMenuEtudiant() {

    //Si le menuEtudiant n'a jamais t initialis
    if (menuEtudiant == null) {
        //On cr le menuEtudiant
        menuEtudiant = new TabBarView();
    }

    //Cration de l'onglet Informations
    tabInfoAnnuelles = menuEtudiant.addTab(informationsAnnuellesMobileView,
            applicationContext.getMessage("mobileUI.infoannuelles.title", null, getLocale()), FontAwesome.INFO);
    tabInfoAnnuelles.setId("tabInfoAnnuelles");

    //Cration de l'onglet Calendrier
    tabCalendrier = menuEtudiant.addTab(calendrierMobileView,
            applicationContext.getMessage("mobileUI.calendrier.title", null, getLocale()),
            FontAwesome.CALENDAR);
    tabCalendrier.setId("tabCalendrier");

    //Si le navigationManager des notes est null
    if (noteNavigationManager == null) {
        //On cr le navigationManager
        noteNavigationManager = new NavigationManager();
    }
    //le composant affich dans le navigationManager est la vue des notes
    noteNavigationManager.setCurrentComponent(notesMobileView);
    //le composant suivant  afficher dans le navigationManager est la vue du dtail des notes
    noteNavigationManager.setNextComponent(notesDetailMobileView);
    //Cration de l'onglet Rsultats
    tabNotes = menuEtudiant.addTab(noteNavigationManager,
            applicationContext.getMessage("mobileUI.resultats.title", null, getLocale()), FontAwesome.LIST);
    tabNotes.setId("tabNotes");

    //Dtection du retour sur la vue du dtail des notes pour mettre  jour le JS
    menuEtudiant.addListener(new SelectedTabChangeListener() {
        @Override
        public void selectedTabChange(SelectedTabChangeEvent event) {
            //test si on se rend sur la vue des notes
            if (menuEtudiant.getSelelectedTab().equals(tabNotes)) {
                //test si on se rend sur le dtail des notes
                if (noteNavigationManager.getCurrentComponent().equals(notesDetailMobileView)) {
                    //On met  jour le JS (qui est normalement perdu, sans explication)
                    notesDetailMobileView.refreshJavascript();
                }
            }

            //test si on se rend sur la vue calendrier
            if (menuEtudiant.getSelelectedTab().equals(tabCalendrier)) {
                /* Message d'info */
                if (applicationContext.getMessage(CalendrierMobileView.NAME + ".message.info", null,
                        getLocale()) != null) {
                    Notification note = new Notification(applicationContext
                            .getMessage(CalendrierMobileView.NAME + ".message.info", null, getLocale()), "",
                            Notification.TYPE_TRAY_NOTIFICATION, true);
                    note.setPosition(Position.MIDDLE_CENTER);
                    note.setDelayMsec(6000);
                    note.show(Page.getCurrent());
                    //Notification.show("", applicationContext.getMessage(CalendrierMobileView.NAME+".message.info", null, getLocale()), Notification.TYPE_TRAY_NOTIFICATION);
                }
            }
        }
    });

}

From source file:fr.univlorraine.mondossierweb.views.FavorisMobileView.java

License:Apache License

/**
 * Initialise la vue/* w  w  w.jav  a2  s.co m*/
 */
@PostConstruct
public void init() {

    //On vrifie le droit d'accder  la vue
    if (UI.getCurrent() instanceof MdwTouchkitUI && userController.isEnseignant()) {
        removeAllComponents();

        /* Style */
        setSizeFull();

        liste_types_inscrits = new LinkedList<String>();
        liste_types_inscrits.add("ELP");
        liste_types_inscrits.add("VET");

        liste_type_arbo = new LinkedList<String>();
        liste_type_arbo.add("CMP");
        liste_type_arbo.add("VET");

        List<Favoris> lfav = favorisController.getFavoris();

        //NAVBAR
        HorizontalLayout navbar = new HorizontalLayout();
        navbar.setSizeFull();
        navbar.setHeight("40px");
        navbar.setStyleName("navigation-bar");

        //Bouton info
        infoButton = new Button();
        infoButton.setIcon(FontAwesome.INFO);
        infoButton.setStyleName("v-nav-button");
        infoButton.addClickListener(e -> {
            /**
             * NOUVELLE VERSION
             */
            Notification note = new Notification(
                    applicationContext.getMessage("helpWindowMobile.text.enseignant", null, getLocale()), "",
                    Notification.TYPE_TRAY_NOTIFICATION, true);
            note.setPosition(Position.MIDDLE_CENTER);
            note.setDelayMsec(6000);
            note.show(UI.getCurrent().getPage());
            /**
             * ANCIENNE VERSION
             */
            /*
            //afficher message
            HelpMobileWindow hbw = new HelpMobileWindow(applicationContext.getMessage("helpWindowMobile.text.enseignant", null, getLocale()),applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale()),false);
                    
            UI.getCurrent().addWindow(hbw);
            */
        });
        navbar.addComponent(infoButton);
        navbar.setComponentAlignment(infoButton, Alignment.MIDDLE_LEFT);

        //Title
        Label labelFav = new Label(applicationContext.getMessage(NAME + ".title.label", null, getLocale()));
        labelFav.setStyleName("v-label-navbar");
        navbar.addComponent(labelFav);
        navbar.setComponentAlignment(labelFav, Alignment.MIDDLE_CENTER);

        //Bouton Search
        Button searchButton = new Button();
        searchButton.setIcon(FontAwesome.SEARCH);
        searchButton.setStyleName("v-nav-button");
        navbar.addComponent(searchButton);
        navbar.setComponentAlignment(searchButton, Alignment.MIDDLE_RIGHT);
        searchButton.addClickListener(e -> {
            ((MdwTouchkitUI) MdwTouchkitUI.getCurrent()).navigateToRecherche(NAME);
        });
        navbar.setExpandRatio(labelFav, 1);
        addComponent(navbar);

        VerticalLayout globalLayout = new VerticalLayout();
        globalLayout.setSizeFull();
        globalLayout.setSpacing(true);
        globalLayout.setMargin(true);

        FormLayout labelLayout = new FormLayout();
        labelLayout.setSizeFull();
        labelLayout.setMargin(false);
        labelLayout.setSpacing(false);

        Label infoLabel = new Label(applicationContext.getMessage(NAME + ".info.label", null, getLocale()));
        infoLabel.setStyleName(ValoTheme.LABEL_SMALL);
        infoLabel.setIcon(FontAwesome.INFO_CIRCLE);
        infoLabel.setWidth("100%");

        labelLayout.addComponent(infoLabel);
        globalLayout.addComponent(labelLayout);

        if (lfav != null && lfav.size() > 0) {
            if (favorisContientVet(lfav)) {

                Panel vetPanel = new Panel(
                        applicationContext.getMessage(NAME + ".vetpanel.title", null, getLocale()));
                vetPanel.setStyleName("centertitle-panel");
                vetPanel.addStyleName("v-colored-panel-caption");
                vetPanel.setSizeFull();

                VerticalLayout vetLayout = new VerticalLayout();
                vetLayout.setSizeFull();
                vetLayout.setHeight(null);
                int i = 0;
                for (Favoris fav : lfav) {
                    if (fav.getId().getTypfav().equals(Utils.VET)) {
                        i++;

                        HorizontalLayout favVetLayout = new HorizontalLayout();
                        favVetLayout.setSizeFull();
                        favVetLayout.setMargin(true);
                        favVetLayout.setSpacing(true);
                        favVetLayout.setStyleName("v-layout-multiline");
                        favVetLayout.setWidth("100%");
                        favVetLayout.setHeight("100%");

                        Button codeButton = new Button(fav.getId().getIdfav());
                        codeButton.setCaption(fav.getId().getIdfav());
                        Utils.setButtonStyle(codeButton);
                        codeButton.setWidth("90px");
                        codeButton.addClickListener(e -> {
                            accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav());
                        });

                        Button libButton = new Button(favorisController.getLibObjFavori(fav.getId().getTypfav(),
                                fav.getId().getIdfav()));
                        Utils.setButtonStyle(libButton);
                        libButton.setHeight("100%");
                        libButton.setWidth("100%");
                        libButton.addClickListener(e -> {
                            accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav());
                        });

                        favVetLayout.addComponent(codeButton);
                        //favVetLayout.setComponentAlignment(codeButton, Alignment.MIDDLE_CENTER);
                        favVetLayout.addComponent(libButton);
                        favVetLayout.setComponentAlignment(libButton, Alignment.MIDDLE_CENTER);
                        favVetLayout.setExpandRatio(libButton, 1);
                        vetLayout.addComponent(favVetLayout);
                        if (i > 1) {
                            favVetLayout.addStyleName("line-separator");
                        }
                    }
                }
                vetPanel.setContent(vetLayout);
                globalLayout.addComponent(vetPanel);

            }

            if (favorisContientElp(lfav)) {
                Panel elpPanel = new Panel(
                        applicationContext.getMessage(NAME + ".elppanel.title", null, getLocale()));
                elpPanel.setStyleName("centertitle-panel");
                elpPanel.addStyleName("v-colored-panel-caption");
                elpPanel.setSizeFull();

                VerticalLayout elpLayout = new VerticalLayout();
                elpLayout.setSizeFull();
                elpLayout.setHeight(null);
                int i = 0;
                for (Favoris fav : lfav) {
                    if (fav.getId().getTypfav().equals(Utils.ELP)) {
                        i++;
                        HorizontalLayout favElpLayout = new HorizontalLayout();
                        favElpLayout.setSizeFull();
                        favElpLayout.setMargin(true);
                        favElpLayout.setSpacing(true);
                        favElpLayout.setStyleName("v-layout-multiline");
                        favElpLayout.setWidth("100%");
                        favElpLayout.setHeight("100%");

                        Button codeButton = new Button(fav.getId().getIdfav());
                        Utils.setButtonStyle(codeButton);
                        codeButton.setWidth("90px");
                        codeButton.addClickListener(e -> {
                            accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav());
                        });

                        Button libButton = new Button(favorisController.getLibObjFavori(fav.getId().getTypfav(),
                                fav.getId().getIdfav()));
                        Utils.setButtonStyle(libButton);
                        libButton.setHeight("100%");
                        libButton.setWidth("100%");
                        libButton.addClickListener(e -> {
                            accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav());
                        });

                        favElpLayout.addComponent(codeButton);
                        favElpLayout.addComponent(libButton);
                        favElpLayout.setComponentAlignment(libButton, Alignment.MIDDLE_CENTER);
                        favElpLayout.setExpandRatio(libButton, 1);
                        elpLayout.addComponent(favElpLayout);
                        if (i > 1) {
                            favElpLayout.addStyleName("line-separator");
                        }
                    }
                }
                elpPanel.setContent(elpLayout);
                globalLayout.addComponent(elpPanel);
            }

        }

        labelAucunFavoriLayout = new HorizontalLayout();
        labelAucunFavoriLayout.setMargin(true);
        labelAucunFavoriLayout.setSizeFull();
        Button aucunFavoris = new Button(
                applicationContext.getMessage(NAME + ".favoris.aucun", null, getLocale()));
        aucunFavoris.setStyleName("v-nav-button");
        aucunFavoris.addStyleName(ValoTheme.BUTTON_LINK);
        aucunFavoris.addClickListener(e -> {
            ((MdwTouchkitUI) MdwTouchkitUI.getCurrent()).navigateToRecherche(NAME);
        });

        labelAucunFavoriLayout.addComponent(aucunFavoris);
        labelAucunFavoriLayout.setVisible(false);
        globalLayout.addComponent(labelAucunFavoriLayout);

        if (lfav == null || lfav.size() == 0) {
            labelAucunFavoriLayout.setVisible(true);
        }

        //addComponent(globalLayout);
        contentLayout.setStyleName("v-scrollableelement");
        contentLayout.addComponent(globalLayout);
        addComponent(contentLayout);
        setExpandRatio(contentLayout, 1);

    }
}

From source file:org.axonframework.examples.addressbook.vaadin.ui.ContactForm.java

License:Apache License

private void handleDelete() {
    setReadOnly(true);//from w  w w. j a v a  2s .co  m
    ContactFormBean contact = obtainContactFormBeanFromDatasource();
    RemoveContactCommand command = new RemoveContactCommand();
    command.setContactId(contact.getIdentifier());
    commandBus.dispatch(new GenericCommandMessage<Object>(command));
    String message = "Removed the contact with name " + contact.getName();
    fireEvent(new FormIsSuccessfullyCommittedEvent(this));
    getApplication().getMainWindow().showNotification(message, Window.Notification.TYPE_TRAY_NOTIFICATION);
}

From source file:org.axonframework.examples.addressbook.vaadin.ui.ContactForm.java

License:Apache License

private void handleSave() {
    String message;/*from   w  w  w . j  a  v a  2  s . co m*/
    if (!isValid()) {
        return;
    }

    AbstractOrderCommand command;
    ContactFormBean contact = obtainContactFormBeanFromDatasource();

    if (newContactMode) {
        newContactMode = false;
        CreateContactCommand createCommand = new CreateContactCommand();
        createCommand.setNewContactName(contact.getName());
        command = createCommand;
        message = "Created new contact with name " + contact.getName();
    } else {
        ChangeContactNameCommand changeCommand = new ChangeContactNameCommand();
        changeCommand.setContactNewName(contact.getName());
        changeCommand.setContactId(contact.getIdentifier());
        command = changeCommand;
        message = "Changed name of contact into " + contact.getName();
    }
    commandBus.dispatch(new GenericCommandMessage<Object>(command));
    fireEvent(new FormIsSuccessfullyCommittedEvent(this));
    setReadOnly(true);
    getApplication().getMainWindow().showNotification(message, Window.Notification.TYPE_TRAY_NOTIFICATION);
}

From source file:se.natusoft.osgi.aps.apsconfigadminweb.gui.vaadin.components.ConfigEditor.java

License:Open Source License

/**
 * Shows notification./*from  w w w .  j a  va  2  s  . c  o  m*/
 *
 * @param caption The message caption.
 * @param message The notification message.
 */
private void showNotification(String caption, String message) {
    showNotification(caption, message, Notification.TYPE_TRAY_NOTIFICATION);
}

From source file:se.natusoft.osgi.aps.apsconfigadminweb.gui.vaadin.components.ConfigEditor.java

License:Open Source License

/**
 * Saves the edited configuration.//from  w w w . ja  v a  2  s  . c  o  m
 */
private void saveEdit() {
    try {
        this.configAdminService.updateConfiguration(this.editedConfigAdmin);
        this.editedConfigAdmin.sendConfigModifiedEvent();
        showNotification("Saved!", "Saved config for '" + this.editedConfigAdmin.getConfigId() + "'!",
                Notification.TYPE_TRAY_NOTIFICATION);
    } catch (APSNoServiceAvailableException nsae) {
        this.logger.error("Faled to save config for '" + this.editedConfigAdmin.getConfigId() + "'!", nsae);

        showNotification("Save Faield!",
                "The configuration service is currently not available on the server! Please try again later.",
                Notification.TYPE_ERROR_MESSAGE);
    }
}

From source file:se.natusoft.osgi.aps.apsconfigadminweb.gui.vaadin.components.ConfigEditor.java

License:Open Source License

/**
 * Cancels the edit./*from w w  w  .  j  a v  a  2s .  c om*/
 */
private void cancelEdit() {
    this.editedConfigAdmin = this.liveConfigAdmin.cloneConfig();

    refresh();
    if (this.nodeSelector != null) {
        this.nodeSelector.refreshData();
    }

    showNotification("Cancelled!", "Cancelled changes for '" + this.editedConfigAdmin.getConfigId() + "'!",
            Notification.TYPE_TRAY_NOTIFICATION);
}

From source file:se.natusoft.osgi.aps.apsconfigadminweb.gui.vaadin.components.ConfigEnvEditor.java

License:Open Source License

/**
 * Shows notification./*from  w w  w . ja v  a2 s. c o m*/
 *
 * @param message The notification message.
 */
private void notify(String message) {
    getWindow().showNotification("Config environment changed", message, Notification.TYPE_TRAY_NOTIFICATION);
}