Example usage for com.vaadin.ui.themes ValoTheme BUTTON_LINK

List of usage examples for com.vaadin.ui.themes ValoTheme BUTTON_LINK

Introduction

In this page you can find the example usage for com.vaadin.ui.themes ValoTheme BUTTON_LINK.

Prototype

String BUTTON_LINK

To view the source code for com.vaadin.ui.themes ValoTheme BUTTON_LINK.

Click Source Link

Document

Makes the button look like the Link component.

Usage

From source file:de.symeda.sormas.ui.utils.ConfirmationComponent.java

License:Open Source License

public Button getCancelButton() {
    if (cancelButton == null) {
        cancelButton = new Button(I18nProperties.getCaption(Captions.actionCancel));
        cancelButton.addStyleName(ValoTheme.BUTTON_LINK);

        cancelButton.addClickListener(new ClickListener() {
            @Override/*from  ww  w.ja v  a  2 s .c  o m*/
            public void buttonClick(ClickEvent event) {
                onCancel();
                onDone();
            }
        });
    }
    return cancelButton;
}

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

License:Open Source License

/**
 * initializes the description layout/*ww  w.ja  v a 2  s.c o m*/
 * 
 * @return
 */
VerticalLayout initDescription() {
    VerticalLayout sampleDescription = new VerticalLayout();
    VerticalLayout sampleDescriptionContent = new VerticalLayout();

    // sampleDescriptionContent.setMargin(true);
    sampleDescription.setCaption("");

    // sampleDescriptionContent.setIcon(FontAwesome.FILE_TEXT_O);
    sampleTypeLabel = new Label("");
    sampleParentLabel = new Label("", ContentMode.HTML);

    parentButton = new Button("");
    parentButton.setStyleName(ValoTheme.BUTTON_LINK);
    parentButton.setIcon(FontAwesome.ARROW_CIRCLE_RIGHT);

    // Navigate to parent sample given by caption of button
    parentButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            State state = (State) UI.getCurrent().getSession().getAttribute("state");
            ArrayList<String> message = new ArrayList<String>();
            message.add("clicked");
            message.add(currentBean.getParents().get(0).getIdentifier());
            message.add("sample");
            state.notifyObservers(message);
        }
    });

    numberOfDatasetsLabel = new Label("");
    lastChangedDatasetLabel = new Label("");
    propertiesLabel = new Label("", ContentMode.HTML);
    propertiesLabel.setCaption("Properties");
    experimentalFactorLabel = new Label("", ContentMode.HTML);

    sampleDescriptionContent.addComponent(sampleTypeLabel);
    sampleDescriptionContent.addComponent(sampleParentLabel);
    sampleDescriptionContent.addComponent(parentButton);
    // sampleDescriptionContent.addComponent(numberOfDatasetsLabel);
    // sampleDescriptionContent.addComponent(lastChangedDatasetLabel);
    sampleDescriptionContent.addComponent(propertiesLabel);
    sampleDescriptionContent.addComponent(experimentalFactorLabel);
    sampleDescriptionContent.setSpacing(true);

    sampleDescriptionContent.setMargin(new MarginInfo(true, false, true, true));
    sampleDescription.addComponent(sampleDescriptionContent);
    sampleDescription.setMargin(new MarginInfo(true, false, true, true));
    return sampleDescription;
}

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

License:Apache License

/**
 * Initialise la vue/*ww  w. j  av a2s  . c  o  m*/
 */
@PostConstruct
public void init() {

    //On vrifie le droit d'accder  la vue
    if (userController.isEnseignant()) {
        // Style 
        setMargin(true);
        setSpacing(true);

        // Rcupration de la configuration pour cette vue
        String docUrl = configController.getAssistanceDocUrl();
        String helpdeskUrl = configController.getAssistanceHelpdeskUrl();
        String mailContact = configController.getAssistanceContactMail();

        // Titre 
        Label title = new Label(applicationContext.getMessage(NAME + ".title", null, getLocale()));
        title.addStyleName(ValoTheme.LABEL_H1);
        addComponent(title);

        // Texte
        if (StringUtils.hasText(applicationContext.getMessage(NAME + ".text", null, getLocale()))) {
            addComponent(new Label(applicationContext.getMessage(NAME + ".text", null, getLocale()),
                    ContentMode.HTML));
        }

        // Afficher la pop-up de dmarrage 
        Button popupBtn = new Button(applicationContext.getMessage(NAME + ".btnPopUp", null, getLocale()),
                FontAwesome.INFO);
        popupBtn.addStyleName(ValoTheme.BUTTON_LINK);
        popupBtn.addClickListener(e -> MainUI.getCurrent().afficherMessageIntroEnseignants(true, false));
        addComponent(popupBtn);

        // Accs  la documentation 
        if (StringUtils.hasText(docUrl)) {
            Button docBtn = new Button(applicationContext.getMessage(NAME + ".btnDoc", null, getLocale()),
                    FontAwesome.FILE_TEXT);
            docBtn.addStyleName(ValoTheme.BUTTON_LINK);
            BrowserWindowOpener docBwo = new BrowserWindowOpener(docUrl);
            docBwo.extend(docBtn);
            addComponent(docBtn);
        }

        // Envoyer un ticket 
        if (StringUtils.hasText(helpdeskUrl)) {
            Button helpDeskBtn = new Button(
                    applicationContext.getMessage(NAME + ".btnHelpdesk", null, getLocale()),
                    FontAwesome.AMBULANCE);
            helpDeskBtn.addStyleName(ValoTheme.BUTTON_LINK);
            BrowserWindowOpener helpDeskBwo = new BrowserWindowOpener(helpdeskUrl);
            helpDeskBwo.extend(helpDeskBtn);
            addComponent(helpDeskBtn);
        }

        // Envoyer un mail 
        if (StringUtils.hasText(mailContact)) {
            Button contactBtn = new Button(applicationContext.getMessage(NAME + ".btnContact",
                    new Object[] { mailContact }, getLocale()), FontAwesome.ENVELOPE);
            contactBtn.addStyleName(ValoTheme.BUTTON_LINK);
            BrowserWindowOpener contactBwo = new BrowserWindowOpener("mailto:" + mailContact);
            contactBwo.extend(contactBtn);
            addComponent(contactBtn);
        }

        /* Deconnexion */
        //Voir si on peut accder  l'appli hors ENT, le dtecter, et afficher le bouton dconnexion
        if (configController.isLogoutCasPropose()) {
            Button decoBtn = new Button("Dconnexion", FontAwesome.SIGN_OUT);
            decoBtn.addStyleName(ValoTheme.BUTTON_LINK);
            decoBtn.addClickListener(e -> {
                getUI().getPage().setLocation("j_spring_security_logout");
            });
            addComponent(decoBtn);
        }
    }
}

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

License:Apache License

/**
 * Initialise la vue/*w  w w  . ja  va 2 s.com*/
 */
@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:fr.univlorraine.mondossierweb.views.InformationsAnnuellesMobileView.java

License:Apache License

public void refresh() {

    //On vrifie le droit d'accder  la vue
    if (UI.getCurrent() instanceof MdwTouchkitUI
            && (userController.isEnseignant() || userController.isEtudiant())
            && MdwTouchkitUI.getCurrent() != null && MdwTouchkitUI.getCurrent().getEtudiant() != null) {
        removeAllComponents();// w w  w. jav  a 2 s.com

        /* Style */
        setMargin(false);
        setSpacing(false);
        setSizeFull();

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

        //Bouton retour
        if (userController.isEnseignant()) {
            returnButton = new Button();
            returnButton.setIcon(FontAwesome.ARROW_LEFT);
            //returnButton.setStyleName(ValoTheme.BUTTON_ICON_ONLY);
            returnButton.setStyleName("v-nav-button");
            returnButton.addClickListener(e -> {
                if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent()
                        .getDossierEtuFromView().equals(ListeInscritsMobileView.NAME)) {
                    MdwTouchkitUI.getCurrent().navigateToListeInscrits();
                } else {

                    if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent()
                            .getDossierEtuFromView().equals(RechercheMobileView.NAME)) {
                        MdwTouchkitUI.getCurrent().navigateToRecherche(null);
                    }
                }
            });
            navbar.addComponent(returnButton);
            navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT);
        }

        //Title
        Label labelTrombi = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom());
        labelTrombi.setStyleName("v-label-navbar");
        navbar.addComponent(labelTrombi);
        navbar.setComponentAlignment(labelTrombi, Alignment.MIDDLE_CENTER);

        if (userController.isEnseignant()) {
            //Si on ne peut pas dj revenir sur la recherche via le bouton 'retour'
            if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() == null
                    || !MdwTouchkitUI.getCurrent().getDossierEtuFromView().equals(RechercheMobileView.NAME)) {
                //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(labelTrombi, 1);
        addComponent(navbar);

        VerticalLayout globalLayout = new VerticalLayout();
        //globalLayout.setSizeFull();
        globalLayout.setSpacing(true);
        globalLayout.setMargin(true);
        globalLayout.setStyleName("v-scrollableelement");

        VerticalLayout slimLayout = new VerticalLayout();
        slimLayout.setSpacing(false);
        slimLayout.setMargin(false);
        //slimLayout.setStyleName("v-scrollableelement");

        String mail = MdwTouchkitUI.getCurrent().getEtudiant().getEmail();
        if (StringUtils.hasText(mail)) {
            Panel mailPanel = new Panel();
            mailPanel.setStyleName("panel-without-bottom-line-separator");
            HorizontalLayout mailLayout = new HorizontalLayout();
            mailLayout.setSizeFull();
            mailLayout.setHeight("25px");
            Label mailLabel = new Label();

            mail = "<a href=\"mailto:" + mail + "\">" + mail + "</a>";
            mailLabel.setValue(mail);
            mailLabel.setContentMode(ContentMode.HTML);

            mailLabel.setSizeFull();
            mailLabel.addStyleName("label-centre");
            mailLayout.addComponent(mailLabel);
            mailLayout.setComponentAlignment(mailLabel, Alignment.MIDDLE_CENTER);
            mailPanel.setContent(mailLayout);
            slimLayout.addComponent(mailPanel);
            slimLayout.setComponentAlignment(mailPanel, Alignment.MIDDLE_CENTER);
        }

        Panel etuPanel = new Panel();
        HorizontalLayout photoLayout = new HorizontalLayout();
        photoLayout.setId(MdwTouchkitUI.getCurrent().getEtudiant().getCod_ind());
        photoLayout.setSizeFull();
        if (MdwTouchkitUI.getCurrent().getEtudiant().getPhoto() != null) {
            Image fotoEtudiant = new Image(null,
                    new ExternalResource(MdwTouchkitUI.getCurrent().getEtudiant().getPhoto()));
            fotoEtudiant.setWidth("120px");
            fotoEtudiant.setStyleName(ValoTheme.BUTTON_LINK);
            photoLayout.addComponent(fotoEtudiant);

        }
        VerticalLayout nomCodeLayout = new VerticalLayout();
        //nomCodeLayout.setSizeFull();
        nomCodeLayout.setSpacing(false);

        Label labelNomEtudiant = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom());
        labelNomEtudiant.setSizeFull();
        labelNomEtudiant.setStyleName(ValoTheme.LABEL_BOLD);
        labelNomEtudiant.addStyleName("label-centre");
        nomCodeLayout.addComponent(labelNomEtudiant);
        nomCodeLayout.setComponentAlignment(labelNomEtudiant, Alignment.MIDDLE_CENTER);
        //nomCodeLayout.setExpandRatio(labelNomEtudiant, 1);

        Label codetuLabel = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getCod_etu());
        codetuLabel.setSizeFull();
        codetuLabel.setStyleName(ValoTheme.LABEL_TINY);
        codetuLabel.addStyleName("label-centre");
        nomCodeLayout.addComponent(codetuLabel);
        nomCodeLayout.setComponentAlignment(codetuLabel, Alignment.MIDDLE_CENTER);

        photoLayout.addComponent(nomCodeLayout);
        photoLayout.setComponentAlignment(nomCodeLayout, Alignment.MIDDLE_CENTER);
        photoLayout.setExpandRatio(nomCodeLayout, 1);

        etuPanel.setContent(photoLayout);

        slimLayout.addComponent(etuPanel);
        slimLayout.setComponentAlignment(etuPanel, Alignment.MIDDLE_CENTER);

        globalLayout.addComponent(slimLayout);

        Panel panelInfos = new Panel(applicationContext.getMessage(NAME + ".infos.title", null, getLocale())
                + " " + Utils.getAnneeUniversitaireEnCours(
                        etudiantController.getAnneeUnivEnCours(MdwTouchkitUI.getCurrent())));
        panelInfos.setStyleName("centertitle-panel");
        panelInfos.addStyleName("v-colored-panel-caption");

        //Si l'tudiant est inscrit pour l'anne en cours
        if (MdwTouchkitUI.getCurrent().getEtudiant().isInscritPourAnneeEnCours()) {

            FormLayout formInfosLayout = new FormLayout();
            formInfosLayout.setSpacing(true);
            formInfosLayout.setMargin(true);

            //Numro Anonymat visible que si l'utilisateur est tudiant
            List<Anonymat> lano = null;
            if (!userController.isEnseignant() && userController.isEtudiant()) {
                lano = MdwTouchkitUI.getCurrent().getEtudiant().getNumerosAnonymat();
                if (lano != null) {
                    //Si l'tudiant n'a qu'un seul numro d'anonymat
                    if (lano.size() == 1) {
                        String captionNumAnonymat = applicationContext.getMessage(NAME + ".numanonymat.title",
                                null, getLocale());
                        TextField fieldNumAnonymat = new TextField(captionNumAnonymat, MdwTouchkitUI
                                .getCurrent().getEtudiant().getNumerosAnonymat().get(0).getCod_etu_ano());
                        formatTextField(fieldNumAnonymat);
                        //fieldNumAnonymat.setIcon(FontAwesome.INFO_CIRCLE);
                        //fieldNumAnonymat.setDescription(applicationContext.getMessage(NAME+".numanonymat.description", null, getLocale()));
                        formInfosLayout.addComponent(fieldNumAnonymat);
                    }
                    //Si l'tudiant a plusieurs numros d'anonymat
                    if (lano.size() > 1) {
                        int i = 0;
                        for (Anonymat ano : lano) {
                            String captionNumAnonymat = "";
                            if (i == 0) {
                                //Pour le premier numro affich on affiche le libell du champ
                                captionNumAnonymat = applicationContext.getMessage(NAME + ".numanonymats.title",
                                        null, getLocale());
                            }
                            TextField fieldNumAnonymat = new TextField(captionNumAnonymat,
                                    ano.getCod_etu_ano() + " (" + ano.getLib_man() + ")");
                            formatTextField(fieldNumAnonymat);
                            if (i == 0) {
                                //Pour le premier numro affich on affiche l'info bulle
                                //fieldNumAnonymat.setIcon(FontAwesome.INFO_CIRCLE);
                                //fieldNumAnonymat.setDescription(applicationContext.getMessage(NAME+".numanonymat.description", null, getLocale()));
                            }
                            formInfosLayout.addComponent(fieldNumAnonymat);
                            i++;
                        }
                    }
                }
            }

            String captionBousier = applicationContext.getMessage(NAME + ".boursier.title", null, getLocale());
            TextField fieldNumBoursier = new TextField(captionBousier,
                    MdwTouchkitUI.getCurrent().getEtudiant().isBoursier()
                            ? applicationContext.getMessage(NAME + ".boursier.oui", null, getLocale())
                            : applicationContext.getMessage(NAME + ".boursier.non", null, getLocale()));
            formatTextField(fieldNumBoursier);
            formInfosLayout.addComponent(fieldNumBoursier);

            String captionSalarie = applicationContext.getMessage(NAME + ".salarie.title", null, getLocale());
            TextField fieldSalarie = new TextField(captionSalarie,
                    MdwTouchkitUI.getCurrent().getEtudiant().isTemSalarie() == true
                            ? applicationContext.getMessage(NAME + ".salarie.oui", null, getLocale())
                            : applicationContext.getMessage(NAME + ".salarie.non", null, getLocale()));
            formatTextField(fieldSalarie);
            formInfosLayout.addComponent(fieldSalarie);

            String captionAmenagementEtude = applicationContext.getMessage(NAME + ".amenagementetude.title",
                    null, getLocale());
            TextField fieldAmenagementEtude = new TextField(captionAmenagementEtude,
                    MdwTouchkitUI.getCurrent().getEtudiant().isTemAmenagementEtude() == true
                            ? applicationContext.getMessage(NAME + ".amenagementetude.oui", null, getLocale())
                            : applicationContext.getMessage(NAME + ".amenagementetude.non", null, getLocale()));
            formatTextField(fieldAmenagementEtude);
            formInfosLayout.addComponent(fieldAmenagementEtude);

            panelInfos.setContent(formInfosLayout);
        } else {

            HorizontalLayout labelNonInscritLayout = new HorizontalLayout();
            labelNonInscritLayout.setMargin(true);
            labelNonInscritLayout.setSizeFull();
            Label labelNonInscrit = new Label(
                    applicationContext.getMessage(NAME + ".inscrit.non", null, getLocale()));
            labelNonInscrit.setStyleName(ValoTheme.LABEL_COLORED);
            labelNonInscrit.addStyleName(ValoTheme.LABEL_BOLD);
            labelNonInscrit.setWidth("100%");
            labelNonInscrit.addStyleName("label-centre");
            labelNonInscritLayout.addComponent(labelNonInscrit);
            panelInfos.setContent(labelNonInscritLayout);

        }
        globalLayout.addComponent(panelInfos);

        addComponent(globalLayout);
        setExpandRatio(globalLayout, 1);

    }
}

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

License:Apache License

/**
 * Affichage du trombinoscope/* ww w .j a  v a  2s  .  c  om*/
 */
private void displayTrombinoscope(boolean completion) {
    // Rcupration de la liste des inscrits
    List<Inscrit> linscrits = MdwTouchkitUI.getCurrent().getListeInscrits();

    // On rinitialise le layout contenant le trombinoscope
    if (trombiLayout != null) {
        //On n'a pas fait 'afficher suivant'
        if (!completion) {
            trombiLayout.removeAllComponents();
        }
    } else {
        trombiLayout = new VerticalLayout();
        trombiLayout.setSizeFull();
        trombiLayout.setSpacing(true);
    }

    int compteurEtu = 0;
    //Pour chaque inscrit
    for (Inscrit inscrit : linscrits) {

        compteurEtu++;
        //Si on affiche tout sur une page ou si l'tudiant doit tre affich sur cette page
        if (pageMax == 1 || ((((pageEnCours - 1) * nbEtuParPage) < compteurEtu)
                && (compteurEtu <= ((pageEnCours) * nbEtuParPage)))) {

            boolean afficherEtudiant = true;

            //Si l'tudiant n'est pas dans la VET slectionne, on ne l'affiche pas
            if (StringUtils.hasText(vetSelectionnee)
                    && (inscrit.getId_etp() == null || !inscrit.getId_etp().contains(vetSelectionnee))) {
                afficherEtudiant = false;

            }

            // Si l'tudiant n'est pas dans le groupe slectionn, on ne l'affiche pas
            if (StringUtils.hasText(groupeSelectionne) && (inscrit.getCodes_groupes() == null
                    || !inscrit.getCodes_groupes().contains(groupeSelectionne))) {
                afficherEtudiant = false;
            }

            // Si l'tudiant doit tre affich
            if (afficherEtudiant) {

                // Panel contenant l'tudiant
                Panel etuPanel = new Panel();

                // Layout du Panel contenant l'tudiant
                HorizontalLayout photoLayout = new HorizontalLayout();
                // Ajout d'un id sur le layout
                photoLayout.setId(inscrit.getCod_ind());
                photoLayout.setSizeFull();

                // Si on a une url renseigne vers la photo de l'tudiant
                if (inscrit.getUrlphoto() != null) {

                    // Image contenant la photo de l'tudiant
                    Image fotoEtudiant = new Image(null, new ExternalResource(inscrit.getUrlphoto()));
                    fotoEtudiant.setWidth("120px");
                    fotoEtudiant.setStyleName(ValoTheme.BUTTON_LINK);
                    // Gestion du clic sur la photo
                    fotoEtudiant.addClickListener(e -> {
                        // Au clic sur la photo on redirige vers le contenu du dossier de l'tudiant dont la photo a t clique
                        rechercheController.accessToMobileDetail(inscrit.getCod_etu().toString(),
                                Utils.TYPE_ETU, false);
                    });
                    // Ajout de la photo au layout
                    photoLayout.addComponent(fotoEtudiant);

                }

                // Layout contenant le nom, prnom et le codetu
                VerticalLayout nomCodeLayout = new VerticalLayout();
                //nomCodeLayout.setSizeFull();
                nomCodeLayout.setSpacing(false);

                // Bouton contenant le nom/prnom
                Button btnNomEtudiant = new Button(inscrit.getPrenom() + " " + inscrit.getNom());
                Utils.setButtonStyle(btnNomEtudiant);

                // Ajout du bouton au layout
                nomCodeLayout.addComponent(btnNomEtudiant);
                //Gestion du clic sur le bouton
                btnNomEtudiant.addClickListener(e -> {
                    // Au clic sur le bouton on redirige vers le contenu du dossier de l'tudiant dont le nom a t cliqu
                    rechercheController.accessToMobileDetail(inscrit.getCod_etu().toString(), Utils.TYPE_ETU,
                            false);
                });
                nomCodeLayout.setComponentAlignment(btnNomEtudiant, Alignment.MIDDLE_CENTER);
                //nomCodeLayout.setExpandRatio(btnNomEtudiant, 1);

                // Label contenant le codetu
                Label codetuLabel = new Label(inscrit.getCod_etu());
                codetuLabel.setSizeFull();
                codetuLabel.setStyleName(ValoTheme.LABEL_TINY);
                codetuLabel.addStyleName("label-centre");

                // Ajout du label au layout
                nomCodeLayout.addComponent(codetuLabel);
                nomCodeLayout.setComponentAlignment(codetuLabel, Alignment.MIDDLE_CENTER);

                // Ajout du layout contenant nom, prnom et codetu au layout de la photo
                photoLayout.addComponent(nomCodeLayout);
                photoLayout.setComponentAlignment(nomCodeLayout, Alignment.MIDDLE_CENTER);
                photoLayout.setExpandRatio(nomCodeLayout, 1);

                // Ajout du layout de la photo comme contenu du panel
                etuPanel.setContent(photoLayout);
                trombiLayout.addComponent(etuPanel);
                trombiLayout.setComponentAlignment(etuPanel, Alignment.MIDDLE_CENTER);
            }
        }
    }

}

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

License:Apache License

private void displayTrombinoscope() {
    List<Inscrit> linscrits = MainUI.getCurrent().getListeInscrits();

    if (trombiLayout != null) {
        trombiLayout.removeAllComponents();
    } else {//from  w  w  w  . j  a  va2  s.c om
        trombiLayout = new GridLayout();
        trombiLayout.setColumns(5);
        trombiLayout.setWidth("100%");
        trombiLayout.setHeight(null);
        trombiLayout.setSpacing(true);
    }

    for (Inscrit inscrit : linscrits) {
        if (listecodind.contains(inscrit.getCod_ind())) {
            VerticalLayout photoLayout = new VerticalLayout();
            photoLayout.setId(inscrit.getCod_ind());
            photoLayout.setHeight("100%");
            if (inscrit.getUrlphoto() != null) {
                //Button fotoEtu=new Button();
                Image fotoEtudiant = new Image(null, new ExternalResource(inscrit.getUrlphoto()));
                fotoEtudiant.setWidth("120px");
                fotoEtudiant.setStyleName(ValoTheme.BUTTON_LINK);
                fotoEtudiant.addClickListener(e -> {
                    rechercheController.accessToDetail(inscrit.getCod_etu().toString(), Utils.TYPE_ETU, null);
                });

                photoLayout.addComponent(fotoEtudiant);
                //photoLayout.addComponent(fotoEtu);
                photoLayout.setComponentAlignment(fotoEtudiant, Alignment.MIDDLE_CENTER);
                photoLayout.setExpandRatio(fotoEtudiant, 1);

            }
            VerticalLayout nomCodeLayout = new VerticalLayout();
            nomCodeLayout.setSizeFull();
            nomCodeLayout.setSpacing(false);

            Button btnNomEtudiant = new Button(inscrit.getPrenom() + " " + inscrit.getNom());
            btnNomEtudiant.setSizeFull();
            btnNomEtudiant.setStyleName(ValoTheme.BUTTON_BORDERLESS);
            btnNomEtudiant.addStyleName("link");
            btnNomEtudiant.addStyleName("v-link");
            nomCodeLayout.addComponent(btnNomEtudiant);
            btnNomEtudiant.addClickListener(e -> {
                rechercheController.accessToDetail(inscrit.getCod_etu().toString(), Utils.TYPE_ETU, null);
            });
            nomCodeLayout.setComponentAlignment(btnNomEtudiant, Alignment.MIDDLE_CENTER);
            //nomCodeLayout.setExpandRatio(btnNomEtudiant, 1);

            Label codetuLabel = new Label(inscrit.getCod_etu());
            codetuLabel.setSizeFull();
            codetuLabel.setStyleName(ValoTheme.LABEL_TINY);
            codetuLabel.addStyleName("label-centre");
            nomCodeLayout.addComponent(codetuLabel);
            nomCodeLayout.setComponentAlignment(codetuLabel, Alignment.TOP_CENTER);

            photoLayout.addComponent(nomCodeLayout);

            trombiLayout.addComponent(photoLayout);
            trombiLayout.setComponentAlignment(photoLayout, Alignment.MIDDLE_CENTER);
        }
    }

}

From source file:fr.univlorraine.mondossierweb.views.windows.HelpBasicWindow.java

License:Apache License

/**
 * Cre une fentre de confirmation/*from ww w. ja  va  2s  .c  o m*/
 * @param message
 * @param titre
 */
public HelpBasicWindow(String message, String titre, boolean displayLienContact) {
    /* Style */
    setWidth(900, Unit.PIXELS);
    setModal(true);
    setResizable(false);
    setClosable(false);

    /* Layout */
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(false);
    setContent(layout);

    /* Titre */
    setCaption(titre);

    // Lien de contact
    if (displayLienContact) {
        String mailContact = configController.getAssistanceContactMail();
        if (StringUtils.hasText(mailContact)) {
            Button contactBtn = new Button(
                    applicationContext.getMessage(NAME + ".btnContact", null, getLocale()),
                    FontAwesome.ENVELOPE);
            contactBtn.addStyleName(ValoTheme.BUTTON_LINK);
            BrowserWindowOpener contactBwo = new BrowserWindowOpener("mailto:" + mailContact);
            contactBwo.extend(contactBtn);
            layout.addComponent(contactBtn);
            layout.setComponentAlignment(contactBtn, Alignment.TOP_RIGHT);
        }
    }

    /* Texte */
    Label textLabel = new Label(message, ContentMode.HTML);
    layout.addComponent(textLabel);

    /* Boutons */
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setWidth(100, Unit.PERCENTAGE);
    buttonsLayout.setSpacing(true);
    layout.addComponent(buttonsLayout);

    btnFermer.setCaption(applicationContext.getMessage("helpWindow.btnFermer", null, getLocale()));
    btnFermer.setIcon(FontAwesome.TIMES);
    btnFermer.addClickListener(e -> close());
    buttonsLayout.addComponent(btnFermer);
    buttonsLayout.setComponentAlignment(btnFermer, Alignment.MIDDLE_RIGHT);

    /* Centre la fentre */
    center();
}

From source file:io.mateu.ui.vaadin.framework.MyUI.java

License:Apache License

/**
 * construye el menu/*ww w  . ja  v a 2  s.co m*/
 *
 * @param request
 * @return
 */
CssLayout buildMenu(VaadinRequest request) {

    HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName(ValoTheme.MENU_TITLE);
    menu.addComponent(top);
    //menu.addComponent(createThemeSelect());

    Button showMenu = new Button("Menu", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (menu.getStyleName().contains("valo-menu-visible")) {
                menu.removeStyleName("valo-menu-visible");
            } else {
                menu.addStyleName("valo-menu-visible");
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName("valo-menu-toggle");
    showMenu.setIcon(FontAwesome.LIST);
    menu.addComponent(showMenu);

    //Label title = new Label("<h3><strong>" + getApp().getName() + "</strong></h3>", ContentMode.HTML);

    Button title = new Button(getApp().getName(), new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            Page.getCurrent().open("#!",
                    (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName());
        }
    });
    title.addStyleName(ValoTheme.BUTTON_LINK);
    title.addStyleName("tituloapp");

    title.setSizeUndefined();
    top.addComponent(title);
    top.setExpandRatio(title, 1);

    settings = new MenuBar();
    settings.addStyleName("user-menu");
    settings.addStyleName("mi-user-menu");
    menu.addComponent(settings);

    HorizontalLayout navlinks = new HorizontalLayout();
    navlinks.setSpacing(true);

    {
        Button nav = new Button(VaadinIcons.ARROWS_CROSS, new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                Page.getCurrent().open("#!nav",
                        (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName());
            }
        });
        nav.addStyleName(ValoTheme.BUTTON_LINK);
        nav.setDescription("Search inside menu");
        nav.addStyleName("navlink");

        navlinks.addComponent(nav);
    }

    if (MateuUI.getApp().isFavouritesAvailable()) {
        Button nav = new Button(VaadinIcons.USER_STAR, new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                Page.getCurrent().open("#!favourites",
                        (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName());
            }
        });
        nav.addStyleName(ValoTheme.BUTTON_LINK);
        nav.addStyleName("navlink");
        nav.setDescription("My favourites");
        nav.setVisible(MateuUI.getApp().getUserData() != null);

        linkFavoritos = nav;

        navlinks.addComponent(nav);
    }

    if (MateuUI.getApp().isLastEditedAvailable()) {
        Button nav = new Button(VaadinIcons.RECORDS, new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                Page.getCurrent().open("#!lastedited",
                        (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName());
            }
        });
        nav.addStyleName(ValoTheme.BUTTON_LINK);
        nav.addStyleName("navlink");
        nav.setDescription("Last edited records");
        nav.setVisible(MateuUI.getApp().getUserData() != null);

        linkUltimosRegistros = nav;

        navlinks.addComponent(nav);
    }

    HorizontalLayout aux = new HorizontalLayout(navlinks);
    aux.setSpacing(false);
    aux.addStyleName("contenedoriconosnav");
    menu.addComponent(aux);

    if (MateuUI.getApp().isFavouritesAvailable()) {
        aux = new HorizontalLayout();
        {
            Button nav = new Button(VaadinIcons.STAR, new ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    System.out.println(Page.getCurrent().getUriFragment());
                    System.out.println(Page.getCurrent().getLocation());
                }
            });
            nav.addStyleName(ValoTheme.BUTTON_LINK);
            nav.addStyleName("navlink");
            nav.setDescription("Add current page to my favourites");
            nav.setVisible(MateuUI.getApp().getUserData() != null);

            linkNuevoFavorito = nav;

            aux.addComponent(nav);
        }
        aux.setSpacing(false);
        aux.addStyleName("contenedoriconosnav");
        menu.addComponent(aux);
    }

    menuItemsLayout.setPrimaryStyleName("valo-menuitems");
    menu.addComponent(menuItemsLayout);

    refreshMenu(null, null);

    return menu;
}

From source file:io.mateu.ui.vaadin.framework.MyUI.java

License:Apache License

/**
 * construye el men// w w  w  .  j a  va2  s .c  o m
 */
public void refreshMenu(AbstractArea area, MenuEntry menu) {

    if (area != null && area.equals(getAreaActual())) {

        // no cambia el area. Solo puede cambiar el menu

        if ((menu == null && getMenuActual() == null) || (menu != null && menu.equals(getMenuActual()))) {

            // no cambia nada. no hacemos nada

        } else {
            setMenuActual(menu);
        }

    } else {

        // cambia el area. debemos reconstruir el menu

        setAreaActual(area);

        VaadinSession s = VaadinSession.getCurrent();

        boolean autentico = s.getAttribute("usuario") != null;

        List<AbstractArea> areas = new ArrayList<>();

        for (AbstractArea a : getApp().getAreas()) {
            if (autentico) {
                if (!a.isPublicAccess()) {
                    if (area == null)
                        area = a;
                    areas.add(a);
                }
            } else {
                if (!getApp().isAuthenticationNeeded() || a.isPublicAccess()) {
                    if (area == null)
                        area = a;
                    areas.add(a);
                }
            }
        }

        menuItemsLayout.removeAllComponents();
        /**
         * area no puede ser null
         */
        if (area != null) {

            divIndicadorAreaActual = new VerticalLayout();
            divIndicadorAreaActual.setSpacing(false);
            divIndicadorAreaActual.addStyleName("divIndicadorAreaActual");

            if (areas.size() > 1) {

                Button b;
                AbstractArea finalArea = area;
                divIndicadorAreaActual
                        .addComponent(b = new Button("You are at " + ((area != null) ? area.getName() : "--"),
                                new ClickListener() {
                                    @Override
                                    public void buttonClick(ClickEvent clickEvent) {
                                        navigator.navigateTo(getApp().getAreaId(finalArea) + "/changearea");
                                    }
                                }));
                b.addStyleName(ValoTheme.BUTTON_LINK);
                b.addStyleName("linkotrasareas");

                menuItemsLayout.addComponent(divIndicadorAreaActual);
            }

            buildMenuOptions(area);
        }

        setMenuActual(menu);
    }

}