Example usage for com.vaadin.ui Panel setIcon

List of usage examples for com.vaadin.ui Panel setIcon

Introduction

In this page you can find the example usage for com.vaadin.ui Panel setIcon.

Prototype

@Override
public void setIcon(Resource icon) 

Source Link

Document

Sets the component's icon.

Usage

From source file:com.cavisson.gui.dashboard.components.controls.Panels.java

License:Apache License

public Panels() {
    setMargin(true);//  www .j a v  a  2 s. com

    Label h1 = new Label("Panels & Layout panels");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);
    TestIcon testIcon = new TestIcon(60);

    Panel panel = new Panel("Normal");
    panel.setIcon(testIcon.get());
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Sized");
    panel.setIcon(testIcon.get());
    panel.setWidth("10em");
    panel.setHeight("250px");
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Custom Caption");
    panel.setIcon(testIcon.get());
    panel.addStyleName("color1");
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Custom Caption");
    panel.setIcon(testIcon.get());
    panel.addStyleName("color2");
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Custom Caption");
    panel.setIcon(testIcon.get());
    panel.addStyleName("color3");
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Borderless style");
    panel.setIcon(testIcon.get());
    panel.addStyleName("borderless");
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Borderless + scroll divider");
    panel.setIcon(testIcon.get());
    panel.addStyleName("borderless");
    panel.addStyleName("scroll-divider");
    panel.setContent(panelContentScroll());
    panel.setHeight("17em");
    row.addComponent(panel);

    panel = new Panel("Well style");
    panel.setIcon(testIcon.get());
    panel.addStyleName("well");
    panel.setContent(panelContent());
    row.addComponent(panel);

    CssLayout layout = new CssLayout();
    layout.setIcon(testIcon.get());
    layout.setCaption("Panel style layout");
    layout.addStyleName("card");
    layout.addComponent(panelContent());
    row.addComponent(layout);

    layout = new CssLayout();
    layout.addStyleName("card");
    row.addComponent(layout);
    HorizontalLayout panelCaption = new HorizontalLayout();
    panelCaption.addStyleName("v-panel-caption");
    panelCaption.setWidth("100%");
    // panelCaption.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    Label label = new Label("Panel style layout");
    panelCaption.addComponent(label);
    panelCaption.setExpandRatio(label, 1);

    Button action = new Button();
    action.setIcon(FontAwesome.PENCIL);
    action.addStyleName("borderless-colored");
    action.addStyleName("small");
    action.addStyleName("icon-only");
    panelCaption.addComponent(action);
    MenuBar dropdown = new MenuBar();
    dropdown.addStyleName("borderless");
    dropdown.addStyleName("small");
    MenuItem addItem = dropdown.addItem("", FontAwesome.CHEVRON_DOWN, null);
    addItem.setStyleName("icon-only");
    addItem.addItem("Settings", null);
    addItem.addItem("Preferences", null);
    addItem.addSeparator();
    addItem.addItem("Sign Out", null);
    panelCaption.addComponent(dropdown);

    layout.addComponent(panelCaption);
    layout.addComponent(panelContent());
    layout.setWidth("14em");

    layout = new CssLayout();
    layout.setIcon(testIcon.get());
    layout.setCaption("Well style layout");
    layout.addStyleName("well");
    layout.addComponent(panelContent());
    row.addComponent(layout);
}

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

License:Apache License

/**
 * Initialise la vue/*from  w ww  .ja  va2  s  . c o  m*/
 */
@PostConstruct
public void init() {

    //On vrifie le droit d'accder  la vue
    if (UI.getCurrent() instanceof MainUI && (userController.isEnseignant() || userController.isEtudiant())
            && MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) {

        LOG.debug(userController.getCurrentUserName() + " NotesView");

        removeAllComponents();
        /* Style */
        setMargin(true);
        setSpacing(true);

        //Test si user enseignant et en vue Enseignant
        if (userController.isEnseignant() && MainUI.getCurrent().isVueEnseignantNotesEtResultats()) {
            //On recupere les notes pour un enseignant
            etudiantController.renseigneNotesEtResultatsVueEnseignant(MainUI.getCurrent().getEtudiant());
        } else {
            //On rcupre les notes pour un tudiant
            etudiantController.renseigneNotesEtResultats(MainUI.getCurrent().getEtudiant());
        }

        /* Titre */
        HorizontalLayout titleLayout = new HorizontalLayout();
        titleLayout.setWidth("100%");
        Label title = new Label(applicationContext.getMessage(NAME + ".title", null, getLocale()));
        title.addStyleName(ValoTheme.LABEL_H1);
        titleLayout.addComponent(title);
        titleLayout.setComponentAlignment(title, Alignment.MIDDLE_LEFT);
        //Test si on a des diplomes ou des etapes
        if ((MainUI.getCurrent().getEtudiant().getDiplomes() != null
                && MainUI.getCurrent().getEtudiant().getDiplomes().size() > 0)
                || (MainUI.getCurrent().getEtudiant().getEtapes() != null
                        && MainUI.getCurrent().getEtudiant().getEtapes().size() > 0)) {
            Button pdfButton = new Button();
            pdfButton.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
            pdfButton.addStyleName("button-big-icon");
            pdfButton.addStyleName("red-button-icon");
            pdfButton.setIcon(FontAwesome.FILE_PDF_O);
            pdfButton.setDescription(
                    applicationContext.getMessage(NAME + ".btn.pdf.description", null, getLocale()));
            if (PropertyUtils.isPushEnabled()) {
                MyFileDownloader fd = new MyFileDownloader(noteController.exportPdfResume());
                fd.extend(pdfButton);
            } else {
                FileDownloader fd = new FileDownloader(noteController.exportPdfResume());
                fd.setOverrideContentType(false);
                fd.extend(pdfButton);
            }
            titleLayout.addComponent(pdfButton);
            titleLayout.setComponentAlignment(pdfButton, Alignment.MIDDLE_RIGHT);
        }
        addComponent(titleLayout);

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

        //Test si user enseignant
        if (userController.isEnseignant()) {
            Panel panelVue = new Panel();

            HorizontalLayout vueLayout = new HorizontalLayout();
            vueLayout.setMargin(true);
            vueLayout.setSpacing(true);
            vueLayout.setSizeFull();

            Button changerVueButton = new Button(
                    applicationContext.getMessage(NAME + ".button.vueEnseignant", null, getLocale()));
            changerVueButton.setStyleName(ValoTheme.BUTTON_PRIMARY);
            if (MainUI.getCurrent().isVueEnseignantNotesEtResultats()) {
                changerVueButton.setStyleName(ValoTheme.BUTTON_FRIENDLY);
                changerVueButton.setCaption(
                        applicationContext.getMessage(NAME + ".button.vueEtudiant", null, getLocale()));
            }
            //On change la variable vueEnseignantNotesEtResultats et on recr la vue en cours
            changerVueButton.addClickListener(e -> {
                etudiantController.changerVueNotesEtResultats();
                init();
            });

            Label vueLabel = new Label(
                    applicationContext.getMessage(NAME + ".label.vueEtudiant", null, getLocale()));
            if (MainUI.getCurrent().isVueEnseignantNotesEtResultats()) {
                vueLabel.setValue(
                        applicationContext.getMessage(NAME + ".label.vueEnseignant", null, getLocale()));
            }
            vueLabel.setContentMode(ContentMode.HTML);
            vueLabel.setStyleName(ValoTheme.LABEL_SMALL);

            vueLayout.addComponent(changerVueButton);
            vueLayout.setComponentAlignment(changerVueButton, Alignment.MIDDLE_CENTER);
            vueLayout.addComponent(vueLabel);
            vueLayout.setExpandRatio(vueLabel, 1);

            panelVue.setContent(vueLayout);
            globalLayout.addComponent(panelVue);
        }

        Panel panelNotesDiplomes = new Panel(
                applicationContext.getMessage(NAME + ".table.diplomes", null, getLocale()));
        //panelNotesDiplomes.addStyleName("small-font-element");

        Table notesDiplomesTable = new Table(null,
                new BeanItemContainer<>(Diplome.class, MainUI.getCurrent().getEtudiant().getDiplomes()));
        notesDiplomesTable.setWidth("100%");
        notesDiplomesTable.setVisibleColumns((Object[]) DIPLOMES_FIELDS_ORDER);
        for (String fieldName : DIPLOMES_FIELDS_ORDER) {
            notesDiplomesTable.setColumnHeader(fieldName,
                    applicationContext.getMessage(NAME + ".table.diplomes." + fieldName, null, getLocale()));
        }
        notesDiplomesTable.addGeneratedColumn(
                applicationContext.getMessage(NAME + ".table.diplomes.session", null, getLocale()),
                new SessionColumnGenerator());
        notesDiplomesTable.addGeneratedColumn(
                applicationContext.getMessage(NAME + ".table.diplomes.note", null, getLocale()),
                new NoteColumnGenerator());
        notesDiplomesTable.addGeneratedColumn(
                applicationContext.getMessage(NAME + ".table.diplomes.resultat", null, getLocale()),
                new ResultatColumnGenerator());

        if (MainUI.getCurrent().getEtudiant().isAfficherRang()) {
            notesDiplomesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.diplomes.mention", null, getLocale()),
                    new MentionColumnGenerator());
        }
        if (configController.isAffMentionEtudiant()) {
            notesDiplomesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.diplomes.rang", null, getLocale()),
                    new RangColumnGenerator());
        }

        notesDiplomesTable.setColumnCollapsingAllowed(true);
        notesDiplomesTable.setColumnReorderingAllowed(false);
        notesDiplomesTable.setSelectable(false);
        notesDiplomesTable.setImmediate(true);
        notesDiplomesTable.setStyleName("noscrollabletable");
        notesDiplomesTable.setPageLength(notesDiplomesTable.getItemIds().size());
        panelNotesDiplomes.setContent(notesDiplomesTable);
        globalLayout.addComponent(panelNotesDiplomes);

        Panel panelNotesEtapes = new Panel(
                applicationContext.getMessage(NAME + ".table.etapes", null, getLocale()));
        //panelNotesEtapes.addStyleName("small-font-element");

        Table notesEtapesTable = new Table(null,
                new BeanItemContainer<>(Etape.class, MainUI.getCurrent().getEtudiant().getEtapes()));
        notesEtapesTable.setWidth("100%");
        notesEtapesTable.setVisibleColumns((Object[]) ETAPES_FIELDS_ORDER);
        for (String fieldName : ETAPES_FIELDS_ORDER) {
            notesEtapesTable.setColumnHeader(fieldName,
                    applicationContext.getMessage(NAME + ".table.etapes." + fieldName, null, getLocale()));
        }
        notesEtapesTable.addGeneratedColumn(
                applicationContext.getMessage(NAME + ".table.etapes.codevers", null, getLocale()),
                new CodeEtapeColumnGenerator());
        notesEtapesTable.addGeneratedColumn(
                applicationContext.getMessage(NAME + ".table.etapes.libelle", null, getLocale()),
                new LibelleEtapeColumnGenerator());
        notesEtapesTable.addGeneratedColumn(
                applicationContext.getMessage(NAME + ".table.etapes.session", null, getLocale()),
                new SessionColumnGenerator());
        notesEtapesTable.addGeneratedColumn(
                applicationContext.getMessage(NAME + ".table.etapes.note", null, getLocale()),
                new NoteColumnGenerator());
        notesEtapesTable.addGeneratedColumn(
                applicationContext.getMessage(NAME + ".table.etapes.resultat", null, getLocale()),
                new ResultatColumnGenerator());

        if (MainUI.getCurrent().getEtudiant().isAfficherRang()) {
            notesEtapesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.etapes.mention", null, getLocale()),
                    new MentionColumnGenerator());
        }
        if (configController.isAffMentionEtudiant()) {
            notesEtapesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.etapes.rang", null, getLocale()),
                    new RangColumnGenerator());
        }

        notesEtapesTable.setColumnCollapsingAllowed(true);
        notesEtapesTable.setColumnReorderingAllowed(false);
        notesEtapesTable.setSelectable(false);
        notesEtapesTable.setImmediate(true);
        notesEtapesTable.setStyleName("noscrollabletable");
        notesEtapesTable.setPageLength(notesEtapesTable.getItemIds().size());
        panelNotesEtapes.setContent(notesEtapesTable);
        globalLayout.addComponent(panelNotesEtapes);

        if (MainUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) {
            Panel panelSignificationResultats = new Panel(
                    applicationContext.getMessage(NAME + ".info.significations.resultats", null, getLocale()));

            panelSignificationResultats.addStyleName("significationpanel");
            panelSignificationResultats.setIcon(FontAwesome.INFO_CIRCLE);

            VerticalLayout significationLayout = new VerticalLayout();
            significationLayout.setMargin(true);
            significationLayout.setSpacing(true);

            String grilleSignficationResultats = "";
            //grilleSignficationResultats = significationResultats.toString().substring(1,significationResultats.toString().length()-1);
            Set<String> ss = MainUI.getCurrent().getEtudiant().getSignificationResultats().keySet();
            for (String k : ss) {
                if (k != null && !k.equals("") && !k.equals(" ")) {
                    grilleSignficationResultats = grilleSignficationResultats + "<b>" + k + "</b>&#160;:&#160;"
                            + MainUI.getCurrent().getEtudiant().getSignificationResultats().get(k);
                    grilleSignficationResultats = grilleSignficationResultats + "&#160;&#160;&#160;";
                }
            }
            Label mapSignificationLabel = new Label(grilleSignficationResultats);
            mapSignificationLabel.setContentMode(ContentMode.HTML);
            mapSignificationLabel.setStyleName(ValoTheme.LABEL_SMALL);
            significationLayout.addComponent(mapSignificationLabel);

            panelSignificationResultats.setContent(significationLayout);
            globalLayout.addComponent(panelSignificationResultats);
        }

        addComponent(globalLayout);
    }
}

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

License:Apache License

private void init() {

    /* Style *//*from   ww w . j  ava  2 s  .  co  m*/
    setWidth(80, Unit.PERCENTAGE);
    setHeight(95, Unit.PERCENTAGE);
    setModal(true);
    setResizable(false);

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

    /* Titre */
    setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale()));

    //Sous titre avec l'anne 
    HorizontalLayout titleLayout = new HorizontalLayout();
    titleLayout.setSizeFull();
    titleLayout.setHeight("20px");
    Label labelAnneeUniv = new Label();
    labelAnneeUniv.setValue(applicationContext.getMessage(NAME + ".label.anneeuniv", null, getLocale()) + " <b>"
            + annee + "</b>");
    labelAnneeUniv.setContentMode(ContentMode.HTML);
    titleLayout.addComponent(labelAnneeUniv);
    titleLayout.setComponentAlignment(labelAnneeUniv, Alignment.MIDDLE_LEFT);

    if (StringUtils.hasText(vetLibelle)) {
        Label labelEtape = new Label();
        labelEtape.setValue(applicationContext.getMessage(NAME + ".label.vet", null, getLocale()) + " : <b>"
                + vetLibelle + "</b>");
        labelEtape.setContentMode(ContentMode.HTML);
        titleLayout.addComponent(labelEtape);
        titleLayout.setComponentAlignment(labelEtape, Alignment.MIDDLE_RIGHT);
    }

    layout.addComponent(titleLayout);

    Panel panelDetailGroupes = new Panel(elpLibelle);
    panelDetailGroupes.setSizeFull();

    if (lgroupes != null && lgroupes.size() > 0) {
        TreeTable detailGroupesTable = new TreeTable();
        detailGroupesTable.setSizeFull();
        HierarchicalContainer hc = new HierarchicalContainer();
        hc.addContainerProperty(ID_PROPERTY, String.class, "");
        hc.addContainerProperty(CODE_COLLECTION_PROPERTY, String.class, "");
        hc.addContainerProperty(CODE_GROUPE_PROPERTY, String.class, "");
        hc.addContainerProperty(LIBELLE_GROUPE_PROPERTY, String.class, "");
        hc.addContainerProperty(CAP_MAX_PROPERTY, String.class, "");
        hc.addContainerProperty(CAP_INT_PROPERTY, String.class, "");
        hc.addContainerProperty(NB_INSCRITS_PROPERTY, String.class, "");
        detailGroupesTable.setContainerDataSource(hc);
        int id = 0;
        for (ElpDeCollection edc : lgroupes) {
            id++;
            for (CollectionDeGroupes cdg : edc.getListeCollection()) {
                id++;
                ObjetBaseCollectionGroupe obj = new ObjetBaseCollectionGroupe();
                obj.setId("" + id);
                obj.setCod_coll(cdg.getCodCollection());
                obj.setCap_max("");
                obj.setCap_int("");
                obj.setNb_inscrits("");
                Item itemCollection = hc.addItem(obj.getId());
                renseignerItem(itemCollection, obj);

                for (Groupe gpe : cdg.getListeGroupes()) {
                    id++;
                    ObjetBaseCollectionGroupe objgpe = new ObjetBaseCollectionGroupe();
                    objgpe.setId("" + id);
                    objgpe.setCod_gpe(gpe.getCodGroupe());
                    objgpe.setLib_gpe(gpe.getLibGroupe());
                    objgpe.setCap_max("" + gpe.getCapMaxGpe());
                    objgpe.setCap_int("" + gpe.getCapIntGpe());
                    objgpe.setNb_inscrits("" + gpe.getNbInscrits());
                    Item i = hc.addItem(objgpe.getId());
                    renseignerItem(i, objgpe);
                    detailGroupesTable.setParent(objgpe.getId(), obj.getId());
                    detailGroupesTable.setChildrenAllowed(objgpe.getId(), false);
                }

                detailGroupesTable.setCollapsed(obj.getId(), false);

            }
        }

        detailGroupesTable.addContainerProperty(ID_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(CODE_COLLECTION_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(CODE_GROUPE_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(LIBELLE_GROUPE_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(CAP_MAX_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(CAP_INT_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(NB_INSCRITS_PROPERTY, String.class, "");

        detailGroupesTable.setVisibleColumns(DETAIL_FIELDS_ORDER);

        detailGroupesTable.setColumnHeader(CODE_COLLECTION_PROPERTY,
                applicationContext.getMessage(NAME + ".table.codecollection", null, getLocale()));
        detailGroupesTable.setColumnHeader(CODE_GROUPE_PROPERTY,
                applicationContext.getMessage(NAME + ".table.codegroupe", null, getLocale()));
        detailGroupesTable.setColumnHeader(LIBELLE_GROUPE_PROPERTY,
                applicationContext.getMessage(NAME + ".table.libgroupe", null, getLocale()));
        detailGroupesTable.setColumnHeader(CAP_MAX_PROPERTY,
                applicationContext.getMessage(NAME + ".table.capmax", null, getLocale()));
        detailGroupesTable.setColumnHeader(CAP_INT_PROPERTY,
                applicationContext.getMessage(NAME + ".table.capint", null, getLocale()));
        detailGroupesTable.setColumnHeader(NB_INSCRITS_PROPERTY,
                applicationContext.getMessage(NAME + ".table.nbinscrits", null, getLocale()));

        detailGroupesTable.setColumnCollapsingAllowed(true);
        detailGroupesTable.setColumnReorderingAllowed(false);
        detailGroupesTable.setSelectable(false);
        detailGroupesTable.setImmediate(true);
        detailGroupesTable.addStyleName("scrollabletable");

        panelDetailGroupes.setContent(detailGroupesTable);

    }

    layout.addComponent(panelDetailGroupes);

    Panel panelCollectionInfo = new Panel(
            applicationContext.getMessage(NAME + ".info.title", null, getLocale()));
    panelCollectionInfo.setIcon(FontAwesome.INFO_CIRCLE);

    panelCollectionInfo.addStyleName("significationpanel");

    VerticalLayout significationLayout = new VerticalLayout();
    significationLayout.setMargin(true);
    significationLayout.setSpacing(true);

    Label mapSignificationLabel = new Label(
            applicationContext.getMessage(NAME + ".collection.info", null, getLocale()));
    mapSignificationLabel.setStyleName(ValoTheme.LABEL_SMALL);
    mapSignificationLabel.setContentMode(ContentMode.HTML);

    significationLayout.addComponent(mapSignificationLabel);

    panelCollectionInfo.setContent(significationLayout);

    layout.addComponent(panelCollectionInfo);

    layout.setExpandRatio(panelDetailGroupes, 1);

    setContent(layout);

    /* Centre la fentre */
    center();

}

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

License:Apache License

private void init() {

    //On vrifie le droit d'accder  la vue
    if ((userController.isEnseignant() || userController.isEtudiant()) && MainUI.getCurrent() != null
            && MainUI.getCurrent().getEtudiant() != null) {

        /* Style */
        setWidth(80, Unit.PERCENTAGE);//from w  w  w .  ja v a 2s .  c  o m
        setHeight(95, Unit.PERCENTAGE);
        setModal(true);
        setResizable(false);

        //Test si user enseignant et en vue Enseignant
        if (userController.isEnseignant() && MainUI.getCurrent().isVueEnseignantNotesEtResultats()) {
            //On recupere les notes pour un enseignant
            etudiantController.renseigneDetailNotesEtResultatsEnseignant(etape);
        } else {
            //On rcupre les notes pour un tudiant
            etudiantController.renseigneDetailNotesEtResultats(etape);
        }

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

        /* Titre */
        setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale()));

        List<ElementPedagogique> lelp = MainUI.getCurrent().getEtudiant().getElementsPedagogiques();

        //Sous titre avec l'anne
        HorizontalLayout titleLayout = new HorizontalLayout();
        titleLayout.setSizeFull();
        titleLayout.setHeight("20px");
        Label messageLabel = new Label(
                applicationContext.getMessage(NAME + ".label.messageinfo", null, getLocale()));
        messageLabel.setContentMode(ContentMode.HTML);
        messageLabel.setStyleName(ValoTheme.LABEL_SMALL);
        titleLayout.addComponent(messageLabel);
        titleLayout.setExpandRatio(messageLabel, 1);
        titleLayout.setComponentAlignment(messageLabel, Alignment.MIDDLE_LEFT);

        //Test si user enseignant
        if (userController.isEnseignant() && lelp != null && lelp.size() > 0) {
            //Bouton pour afficher les filtres
            btnDisplayFiltres = new Button();
            btnDisplayFiltres.setWidth("52px");
            btnDisplayFiltres.setHeight("32px");
            btnDisplayFiltres.setStyleName(ValoTheme.BUTTON_PRIMARY);
            if (MainUI.getCurrent().isVueEnseignantNotesEtResultats()) {
                btnDisplayFiltres.setStyleName(ValoTheme.BUTTON_FRIENDLY);
            }
            btnDisplayFiltres.setIcon(FontAwesome.FILTER);
            btnDisplayFiltres.setDescription(
                    applicationContext.getMessage(NAME + ".btn.displayFilters", null, getLocale()));
            btnDisplayFiltres.addClickListener(e -> {
                btnDisplayFiltres.setVisible(false);
                panelVue.setVisible(true);
            });
            titleLayout.addComponent(btnDisplayFiltres);
            titleLayout.setComponentAlignment(btnDisplayFiltres, Alignment.MIDDLE_RIGHT);
            //titleLayout.setExpandRatio(btnDisplayFiltres, 1);
            btnDisplayFiltres.setVisible(true);
        }

        if (lelp != null && lelp.size() > 0 && configController.isPdfNotesActive()) {
            Button pdfButton = new Button();
            pdfButton.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
            pdfButton.addStyleName("button-icon");
            pdfButton.addStyleName("red-button-icon");
            pdfButton.setIcon(FontAwesome.FILE_PDF_O);
            pdfButton.setDescription(
                    applicationContext.getMessage(NAME + ".btn.pdf.description", null, getLocale()));

            if (PropertyUtils.isPushEnabled()) {
                MyFileDownloader fd = new MyFileDownloader(noteController.exportPdfDetail(etape));
                fd.extend(pdfButton);
            } else {
                FileDownloader fd = new FileDownloader(noteController.exportPdfDetail(etape));
                fd.extend(pdfButton);
            }

            titleLayout.addComponent(pdfButton);
            titleLayout.setComponentAlignment(pdfButton, Alignment.MIDDLE_RIGHT);
        }
        layout.addComponent(titleLayout);

        //Test si user enseignant
        if (userController.isEnseignant() && lelp != null && lelp.size() > 0) {
            panelVue = new Panel();

            HorizontalLayout vueLayout = new HorizontalLayout();
            vueLayout.setMargin(true);
            vueLayout.setSpacing(true);
            vueLayout.setSizeFull();

            Button changerVueButton = new Button(
                    applicationContext.getMessage(NAME + ".button.vueEnseignant", null, getLocale()));
            changerVueButton.setStyleName(ValoTheme.BUTTON_PRIMARY);
            if (MainUI.getCurrent().isVueEnseignantNotesEtResultats()) {
                changerVueButton.setStyleName(ValoTheme.BUTTON_FRIENDLY);
                changerVueButton.setCaption(
                        applicationContext.getMessage(NAME + ".button.vueEtudiant", null, getLocale()));
            }
            //On change la variable vueEnseignantNotesEtResultats et on recr la vue en cours
            changerVueButton.addClickListener(e -> {
                etudiantController.changerVueNotesEtResultats();
                init();
            });

            Label vueLabel = new Label(
                    applicationContext.getMessage(NAME + ".label.vueEtudiant", null, getLocale()));
            if (MainUI.getCurrent().isVueEnseignantNotesEtResultats()) {
                vueLabel.setValue(
                        applicationContext.getMessage(NAME + ".label.vueEnseignant", null, getLocale()));
            }
            vueLabel.setContentMode(ContentMode.HTML);
            vueLabel.setStyleName(ValoTheme.LABEL_SMALL);

            vueLayout.addComponent(changerVueButton);
            vueLayout.setComponentAlignment(changerVueButton, Alignment.MIDDLE_CENTER);
            vueLayout.addComponent(vueLabel);
            vueLayout.setExpandRatio(vueLabel, 1);

            panelVue.setContent(vueLayout);
            layout.addComponent(panelVue);
            panelVue.setVisible(false);
        }

        Panel panelDetailNotes = new Panel(etape.getLibelle() + " - "
                + applicationContext.getMessage(NAME + ".label.anneeuniv", null, getLocale()) + " "
                + etape.getAnnee());
        panelDetailNotes.addStyleName("small-font-element");
        panelDetailNotes.setSizeFull();

        if (lelp != null && lelp.size() > 0) {
            Table detailNotesTable = new Table(null, new BeanItemContainer<>(ElementPedagogique.class, lelp));
            detailNotesTable.setSizeFull();
            detailNotesTable.setVisibleColumns(new String[0]);
            if (contientElpObtenusPrecedemment(lelp)) {
                detailNotesTable.addGeneratedColumn(
                        applicationContext.getMessage(NAME + ".table.elp.annee", null, getLocale()),
                        new AnneeColumnGenerator());
            }
            detailNotesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.code", null, getLocale()),
                    new CodeElpColumnGenerator());
            detailNotesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.libelle", null, getLocale()),
                    new LibelleElpColumnGenerator());
            detailNotesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.notesession1", null, getLocale()),
                    new Session1ColumnGenerator());
            detailNotesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.resultatsession1", null, getLocale()),
                    new ResultatSession1ColumnGenerator());
            detailNotesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.notesession2", null, getLocale()),
                    new Session2ColumnGenerator());
            detailNotesTable.addGeneratedColumn("resultatsession2", new ResultatSession2ColumnGenerator());
            detailNotesTable.setColumnHeader("resultatsession2",
                    applicationContext.getMessage(NAME + ".table.elp.resultatsession2", null, getLocale()));
            if (configController.isAffRangEtudiant() || etudiantController.isAfficherRangElpEpr()) {
                detailNotesTable.addGeneratedColumn(
                        applicationContext.getMessage(NAME + ".table.elp.rang", null, getLocale()),
                        new RangColumnGenerator());
            }
            if (configController.isAffECTSEtudiant()) {
                detailNotesTable.addGeneratedColumn(
                        applicationContext.getMessage(NAME + ".table.elp.ects", null, getLocale()),
                        new ECTSColumnGenerator());
            }
            detailNotesTable.setColumnCollapsingAllowed(true);
            detailNotesTable.setColumnReorderingAllowed(false);
            detailNotesTable.setSelectable(false);
            detailNotesTable.setImmediate(true);
            detailNotesTable.addStyleName("scrollabletable");
            panelDetailNotes.setContent(detailNotesTable);
        } else {
            setHeight(30, Unit.PERCENTAGE);
            HorizontalLayout messageLayout = new HorizontalLayout();
            messageLayout.setSpacing(true);
            messageLayout.setMargin(true);
            Label labelAucunResultat = new Label(
                    applicationContext.getMessage(NAME + ".message.aucuneresultat", null, getLocale()));
            labelAucunResultat.setStyleName(ValoTheme.LABEL_BOLD);
            messageLayout.addComponent(labelAucunResultat);
            panelDetailNotes.setContent(messageLayout);

        }
        layout.addComponent(panelDetailNotes);

        if (lelp != null && lelp.size() > 0
                && MainUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) {
            Panel panelSignificationResultats = new Panel(
                    applicationContext.getMessage(NAME + ".info.significations.resultats", null, getLocale()));

            panelSignificationResultats.addStyleName("significationpanel");
            panelSignificationResultats.addStyleName("small-font-element");
            panelSignificationResultats.setIcon(FontAwesome.INFO_CIRCLE);

            VerticalLayout significationLayout = new VerticalLayout();
            significationLayout.setMargin(true);
            significationLayout.setSpacing(true);

            String grilleSignficationResultats = "";
            //grilleSignficationResultats = significationResultats.toString().substring(1,significationResultats.toString().length()-1);
            Set<String> ss = MainUI.getCurrent().getEtudiant().getSignificationResultats().keySet();
            for (String k : ss) {
                if (k != null && !k.equals("") && !k.equals(" ")) {
                    grilleSignficationResultats = grilleSignficationResultats + "<b>" + k + "</b>&#160;:&#160;"
                            + MainUI.getCurrent().getEtudiant().getSignificationResultats().get(k);
                    grilleSignficationResultats = grilleSignficationResultats + "&#160;&#160;&#160;";
                }
            }
            Label mapSignificationLabel = new Label(grilleSignficationResultats);
            mapSignificationLabel.setStyleName(ValoTheme.LABEL_SMALL);
            mapSignificationLabel.setContentMode(ContentMode.HTML);
            significationLayout.addComponent(mapSignificationLabel);

            panelSignificationResultats.setContent(significationLayout);
            layout.addComponent(panelSignificationResultats);

        }

        layout.setExpandRatio(panelDetailNotes, 1);

        setContent(layout);

        /* Centre la fentre */
        center();

    }

}

From source file:helpers.Utils.java

License:Open Source License

public static Panel createInfoBox(String caption, String description) {
    Panel panel = new Panel(caption);
    panel.setIcon(FontAwesome.INFO);
    panel.setStyleName(ValoTheme.PANEL_BORDERLESS);
    HorizontalLayout layout = new HorizontalLayout();
    Label label = new Label();
    label.setValue(description);/*from w  w w. j  ava2s . c o m*/
    layout.addComponent(label);

    panel.setContent(layout);
    return panel;
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

private Layout getPanelPreviews() {
    Layout grid = getPreviewLayout("Panels");

    Panel panel = new DemoPanel("Panel");
    panel.setIcon(new ThemeResource("../runo/icons/16/document.png"));
    grid.addComponent(panel);//w  w  w.  j  a  v  a 2  s . c o  m

    panel = new DemoPanel();
    grid.addComponent(panel);

    panel = new DemoPanel("Borderless Panel");
    panel.setStyleName(BennuTheme.PANEL_BORDERLESS);
    grid.addComponent(panel);

    panel = new DemoPanel();
    panel.setStyleName(BennuTheme.PANEL_BORDERLESS);
    grid.addComponent(panel);

    panel = new DemoPanel("Light panel");
    panel.setStyleName(BennuTheme.PANEL_LIGHT);
    panel.setIcon(new ThemeResource("../runo/icons/16/document.png"));
    grid.addComponent(panel);

    panel = new DemoPanel();
    panel.setStyleName(BennuTheme.PANEL_LIGHT);
    grid.addComponent(panel);

    panel = new DemoPanel("Borderless Light");
    panel.addStyleName(BennuTheme.PANEL_BORDERLESS);
    panel.addStyleName(BennuTheme.PANEL_LIGHT);
    grid.addComponent(panel);

    panel = new DemoPanel();
    panel.addStyleName(BennuTheme.PANEL_BORDERLESS);
    panel.addStyleName(BennuTheme.PANEL_LIGHT);
    grid.addComponent(panel);

    return grid;
}

From source file:org.jpos.qi.minigl.AccountsView.java

License:Open Source License

private Panel createEntriesPanel() {
    Panel entriesPanel = new Panel(getCaptionFromId("entries"));
    entriesPanel.setIcon(VaadinIcons.EXCHANGE);
    entriesPanel.addStyleName("color1");
    entriesPanel.addStyleName("margin-top-panel");

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/*  w  ww.  java  2s.co  m*/
    layout.setSpacing(true);
    Panel filterPanel = new Panel();
    filterPanel.addStyleName("v-panel-well");

    journals = new JournalsCombo(true);

    rangeLabelTitle = new Label();
    rangeLabelTitle.addStyleName(ValoTheme.LABEL_BOLD);
    dateRangeComponent = new DateRangeComponent(DateRange.ALL_TIME, true) {
        @Override
        protected Button.ClickListener createRefreshListener() {
            return event -> {
                refreshDetails();
            };
        }
    };
    VerticalLayout detailsLayout = new VerticalLayout();

    entryGrid = new EntryGrid(null, false);
    formatEntriesGrid();
    detailsLayout.addComponent(entryGrid);
    detailsLayout.setMargin(false);

    HorizontalLayout layersLayout = new HorizontalLayout();
    layersLayout.setSizeFull();
    layersLayout.setSpacing(true);

    layersCheckBox = new CheckBoxGroup<>(getCaptionFromId("layers").toUpperCase());
    layersCheckBox.setItemCaptionGenerator(item -> item.getId() + " - " + item.getName());
    layersCheckBox.addValueChangeListener(listener -> refreshDetails());

    layersLayout.addComponentsAndExpand(layersCheckBox);
    VerticalLayout vbar = new VerticalLayout(journals, dateRangeComponent, layersLayout);
    vbar.setSpacing(true);
    vbar.setMargin(true);
    filterPanel.setContent(vbar);
    layout.addComponents(rangeLabelTitle, detailsLayout, filterPanel);
    entriesPanel.setContent(layout);
    refreshDetails();
    return entriesPanel;

}

From source file:org.jpos.qi.minigl.TransactionsView.java

License:Open Source License

protected Component buildAndBindCustomComponent(String propertyId) {
    switch (propertyId) {
    case ("tags"): {
        TextField field = new TextField(getCaptionFromId(propertyId));
        Binder.BindingBuilder<GLTransaction, String> builder = formatField(propertyId, field);
        builder.withNullRepresentation("").withConverter(new StringToTagConverter()).bind(propertyId);
        return field;
    }//w  ww  . j av  a2 s  .co  m
    case ("postDate"): {
        return buildAndBindDateField(propertyId);
    }
    case ("journal"): {
        ComboBox<Journal> field = new JournalsCombo(true);
        field.setCaption(getCaptionFromId(propertyId));
        formatField(propertyId, field).bind(propertyId);
        return field;
    }
    case ("entries"): {
        Panel entriesPanel = new Panel(getCaptionFromId(propertyId));
        entriesPanel.setIcon(VaadinIcons.EXCHANGE);
        entriesPanel.addStyleName("color1");
        entriesPanel.addStyleName("margin-top-panel");

        VerticalLayout vl = new VerticalLayout();
        entryGrid = new EntryGrid(null, canEdit());
        getBinder().forField(entryGrid).bind(glTransaction -> this.getInstance(), null);
        if (getInstance() != null && getInstance().getJournal() != null) {
            newEntryForm = new NewEntryForm(getInstance(), (TransactionsHelper) getHelper(), entryGrid);
            vl.addComponents(entryGrid, newEntryForm);
        }
        entriesPanel.setContent(vl);
        return entriesPanel;
    }
    }
    return null;
}