List of usage examples for com.vaadin.ui Button addStyleName
@Override public void addStyleName(String style)
From source file:fr.univlorraine.mondossierweb.views.NotesView.java
License:Apache License
/** * Initialise la vue/*ww w .j a v a2 s.co 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> : " + MainUI.getCurrent().getEtudiant().getSignificationResultats().get(k); grilleSignficationResultats = grilleSignficationResultats + "   "; } } 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.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 ww w.j ava2 s . 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> : " + MainUI.getCurrent().getEtudiant().getSignificationResultats().get(k); grilleSignficationResultats = grilleSignficationResultats + "   "; } } 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:fr.univlorraine.mondossierweb.views.windows.FiltreInscritsMobileWindow.java
License:Apache License
/** * Cre une fentre/*from w w w.j ava 2 s. c o m*/ */ public FiltreInscritsMobileWindow() { setWidth("95%"); setModal(true); setResizable(false); setClosable(true); setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale())); setStyleName("v-popover-blank"); typeFavori = MdwTouchkitUI.getCurrent().getTypeObjListInscrits(); GridLayout layout = new GridLayout(1, 2); layout.setWidth("100%"); layout.setSpacing(true); layout.setMargin(true); setContent(layout); //Si on affiche la liste des inscrits un ELP //on doit affiche l'tape d'appartenance et ventuellement les groupes //Affichage d'une liste droulante contenant la liste des annes if (typeIsElp()) { //GESTION DES ETAPES List<VersionEtape> letapes = MdwTouchkitUI.getCurrent().getListeEtapesInscrits(); if (letapes != null && letapes.size() > 0) { Label etapeLabel = new Label(applicationContext.getMessage(NAME + ".etape", null, getLocale())); layout.addComponent(etapeLabel); layout.setComponentAlignment(etapeLabel, Alignment.BOTTOM_LEFT); listeEtapes = new NativeSelect(); listeEtapes.setNullSelectionAllowed(false); listeEtapes.setRequired(false); listeEtapes.setWidth("100%"); listeEtapes.addItem(TOUTES_LES_ETAPES_LABEL); listeEtapes.setItemCaption(TOUTES_LES_ETAPES_LABEL, TOUTES_LES_ETAPES_LABEL); for (VersionEtape etape : letapes) { String idEtape = etape.getId().getCod_etp() + "/" + etape.getId().getCod_vrs_vet(); listeEtapes.addItem(idEtape); listeEtapes.setItemCaption(idEtape, "[" + idEtape + "] " + etape.getLib_web_vet()); } if (MdwTouchkitUI.getCurrent().getEtapeInscrits() != null) { listeEtapes.setValue(MdwTouchkitUI.getCurrent().getEtapeInscrits()); } else { listeEtapes.setValue(TOUTES_LES_ETAPES_LABEL); } //Gestion de l'vnement sur le changement d'tape listeEtapes.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { vetSelectionnee = (String) event.getProperty().getValue(); if (vetSelectionnee.equals(TOUTES_LES_ETAPES_LABEL)) { vetSelectionnee = null; } MdwTouchkitUI.getCurrent().setEtapeInscrits(vetSelectionnee); //faire le changement groupeSelectionne = ((listeGroupes != null && listeGroupes.getValue() != null) ? (String) listeGroupes.getValue() : null); if (groupeSelectionne != null && groupeSelectionne.equals(TOUS_LES_GROUPES_LABEL)) { groupeSelectionne = null; } //update de l'affichage //initListe(); } }); layout.addComponent(listeEtapes); } //GESTION DES GROUPES List<ElpDeCollection> lgroupes = MdwTouchkitUI.getCurrent().getListeGroupesInscrits(); if (lgroupes != null && lgroupes.size() > 0) { // Label "GROUPE" HorizontalLayout gLayout = new HorizontalLayout(); gLayout.setSizeFull(); Label groupeLabel = new Label(applicationContext.getMessage(NAME + ".groupe", null, getLocale())); gLayout.addComponent(groupeLabel); gLayout.setComponentAlignment(groupeLabel, Alignment.MIDDLE_LEFT); layout.addComponent(gLayout); //Liste droulante pour choisir le groupe listeGroupes = new NativeSelect(); listeGroupes.setNullSelectionAllowed(false); listeGroupes.setRequired(false); listeGroupes.setWidth("100%"); listeGroupes.addItem(TOUS_LES_GROUPES_LABEL); listeGroupes.setItemCaption(TOUS_LES_GROUPES_LABEL, TOUS_LES_GROUPES_LABEL); for (ElpDeCollection edc : lgroupes) { for (CollectionDeGroupes cdg : edc.getListeCollection()) { for (Groupe groupe : cdg.getListeGroupes()) { listeGroupes.addItem(groupe.getCleGroupe()); listeGroupes.setItemCaption(groupe.getCleGroupe(), groupe.getLibGroupe()); } } } //On pr-remplie le groupe choisi si on en a dj choisi un if (MdwTouchkitUI.getCurrent().getGroupeInscrits() != null) { listeGroupes.setValue(MdwTouchkitUI.getCurrent().getGroupeInscrits()); } else { listeGroupes.setValue(TOUS_LES_GROUPES_LABEL); } //Gestion de l'vnement sur le changement de groupe listeGroupes.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { groupeSelectionne = (String) event.getProperty().getValue(); if (groupeSelectionne.equals(TOUS_LES_GROUPES_LABEL)) { groupeSelectionne = null; } MdwTouchkitUI.getCurrent().setGroupeInscrits(groupeSelectionne); //faire le changement vetSelectionnee = ((listeEtapes != null && listeEtapes.getValue() != null) ? (String) listeEtapes.getValue() : null); if (vetSelectionnee != null && vetSelectionnee.equals(TOUTES_LES_ETAPES_LABEL)) { vetSelectionnee = null; } } }); layout.addComponent(listeGroupes); } } // Bouton "Filtrer" HorizontalLayout bLayout = new HorizontalLayout(); bLayout.setSizeFull(); Button closeButton = new Button(applicationContext.getMessage(NAME + ".filtrerBtn", null, getLocale())); closeButton.setStyleName(ValoTheme.BUTTON_PRIMARY); closeButton.addStyleName("v-popover-button"); demandeFiltrage = false; closeButton.addClickListener(e -> { //retourner vetSelectionnee et groupeSelectionne; demandeFiltrage = true; close(); }); bLayout.addComponent(closeButton); bLayout.setComponentAlignment(closeButton, Alignment.MIDDLE_CENTER); layout.addComponent(bLayout); }
From source file:fr.univlorraine.mondossierweb.views.windows.HelpBasicWindow.java
License:Apache License
/** * Cre une fentre de confirmation//www . ja v a 2 s .com * @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:fr.univlorraine.mondossierweb.views.windows.SignificationsMobileWindow.java
License:Apache License
/** * Cre une fentre/*w w w. java2s.c om*/ */ public SignificationsMobileWindow(boolean afficherSignificationIndicateurProfondeur) { setWidth("95%"); setHeight("95%"); setCaption(applicationContext.getMessage("significationsWindow.title", null, getLocale())); setModal(true); setResizable(false); setClosable(false); setStyleName("v-popover-blank"); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); setContent(layout); VerticalLayout panelLayout = new VerticalLayout(); panelLayout.setWidth("100%"); panelLayout.setStyleName("v-scrollableelement"); panelLayout.setSpacing(true); panelLayout.setMargin(true); if (MdwTouchkitUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) { Panel panelSignificationResultats = new Panel(); panelSignificationResultats.setCaption( applicationContext.getMessage(NAME + ".info.significations.resultats", null, getLocale())); panelSignificationResultats.addStyleName("significationpanel"); panelSignificationResultats.setWidth("100%"); VerticalLayout significationLayout = new VerticalLayout(); significationLayout.setWidth("100%"); significationLayout.setMargin(true); significationLayout.setSpacing(true); Set<String> ss = MdwTouchkitUI.getCurrent().getEtudiant().getSignificationResultats().keySet(); for (String k : ss) { if (k != null && !k.equals("") && !k.equals(" ")) { HorizontalLayout signLayout = new HorizontalLayout(); signLayout.setSizeFull(); signLayout.setMargin(true); signLayout.setSpacing(true); Label codeLabel = new Label(k); codeLabel.setStyleName(ValoTheme.LABEL_BOLD); codeLabel.addStyleName("v-label-align-right"); signLayout.addComponent(codeLabel); Label valueLabel = new Label( "" + MdwTouchkitUI.getCurrent().getEtudiant().getSignificationResultats().get(k)); signLayout.addComponent(valueLabel); significationLayout.addComponent(signLayout); } } panelSignificationResultats.setContent(significationLayout); panelLayout.addComponent(panelSignificationResultats); } if (afficherSignificationIndicateurProfondeur) { Panel panelSignificationIndicateurs = new Panel(); panelSignificationIndicateurs.setCaption( applicationContext.getMessage(NAME + ".info.significations.indicateurs", null, getLocale())); panelSignificationIndicateurs.addStyleName("significationpanel"); panelSignificationIndicateurs.setWidth("100%"); VerticalLayout significationLayout = new VerticalLayout(); significationLayout.setMargin(true); significationLayout.setSpacing(true); significationLayout.setWidth("100%"); //1er NIVEAU HorizontalLayout levelLayout1 = new HorizontalLayout(); levelLayout1.setWidth("100%"); HorizontalLayout levelMainLayout1 = new HorizontalLayout(); levelMainLayout1.setWidth("100%"); levelMainLayout1.setSpacing(true); levelMainLayout1.setStyleName("level-indicator-layout"); int k = 0; for (int i = 0; i < 1; i++) { //Ajout d'un level k++; Label libLevelLayout = new Label(); libLevelLayout.setSizeFull(); libLevelLayout.setHeight("8px"); libLevelLayout.setStyleName("layout-level-green-indicator"); levelMainLayout1.addComponent(libLevelLayout); } //On pense avoir 7 level maxi for (int j = k; j < 8; j++) { Label libLevelSpaceLayout = new Label(); libLevelSpaceLayout.setSizeFull(); libLevelSpaceLayout.setHeight("8px"); levelMainLayout1.addComponent(libLevelSpaceLayout); } levelLayout1.addComponent(levelMainLayout1); levelLayout1.addComponent(new Label("1er niveau")); significationLayout.addComponent(levelLayout1); //2em NIVEAU HorizontalLayout levelLayout2 = new HorizontalLayout(); levelLayout2.setSizeFull(); HorizontalLayout levelMainLayout2 = new HorizontalLayout(); levelMainLayout2.setSizeFull(); levelMainLayout2.setSpacing(true); levelMainLayout2.setStyleName("level-indicator-layout"); k = 0; for (int i = 0; i < 2; i++) { //Ajout d'un level k++; Label libLevelLayout = new Label(); libLevelLayout.setSizeFull(); libLevelLayout.setHeight("8px"); libLevelLayout.setStyleName("layout-level-green-indicator"); levelMainLayout2.addComponent(libLevelLayout); } //On pense avoir 7 level maxi for (int j = k; j < 8; j++) { Label libLevelSpaceLayout = new Label(); libLevelSpaceLayout.setSizeFull(); libLevelSpaceLayout.setHeight("8px"); levelMainLayout2.addComponent(libLevelSpaceLayout); } levelLayout2.addComponent(levelMainLayout2); levelLayout2.addComponent(new Label("2em niveau")); significationLayout.addComponent(levelLayout2); //3em NIVEAU HorizontalLayout levelLayout3 = new HorizontalLayout(); levelLayout3.setSizeFull(); HorizontalLayout levelMainLayout3 = new HorizontalLayout(); levelMainLayout3.setSizeFull(); levelMainLayout3.setSpacing(true); levelMainLayout3.setStyleName("level-indicator-layout"); k = 0; for (int i = 0; i < 3; i++) { //Ajout d'un level k++; Label libLevelLayout = new Label(); libLevelLayout.setSizeFull(); libLevelLayout.setHeight("8px"); libLevelLayout.setStyleName("layout-level-green-indicator"); levelMainLayout3.addComponent(libLevelLayout); } //On pense avoir 7 level maxi for (int j = k; j < 8; j++) { Label libLevelSpaceLayout = new Label(); libLevelSpaceLayout.setSizeFull(); libLevelSpaceLayout.setHeight("8px"); levelMainLayout3.addComponent(libLevelSpaceLayout); } levelLayout3.addComponent(levelMainLayout3); levelLayout3.addComponent(new Label("3em niveau")); significationLayout.addComponent(levelLayout3); //4em NIVEAU HorizontalLayout levelLayout4 = new HorizontalLayout(); levelLayout4.setSizeFull(); HorizontalLayout levelMainLayout4 = new HorizontalLayout(); levelMainLayout4.setSizeFull(); levelMainLayout4.setSpacing(true); levelMainLayout4.setStyleName("level-indicator-layout"); k = 0; for (int i = 0; i < 4; i++) { //Ajout d'un level k++; Label libLevelLayout = new Label(); libLevelLayout.setSizeFull(); libLevelLayout.setHeight("8px"); libLevelLayout.setStyleName("layout-level-green-indicator"); levelMainLayout4.addComponent(libLevelLayout); } //On pense avoir 7 level maxi for (int j = k; j < 8; j++) { Label libLevelSpaceLayout = new Label(); libLevelSpaceLayout.setSizeFull(); libLevelSpaceLayout.setHeight("8px"); levelMainLayout4.addComponent(libLevelSpaceLayout); } levelLayout4.addComponent(levelMainLayout4); levelLayout4.addComponent(new Label("4em niveau")); significationLayout.addComponent(levelLayout4); //ETC HorizontalLayout levelLayoutEtc = new HorizontalLayout(); levelLayoutEtc.setSizeFull(); levelLayoutEtc.addComponent(new Label("...")); levelLayoutEtc.addComponent(new Label("")); significationLayout.addComponent(levelLayoutEtc); panelSignificationIndicateurs.setContent(significationLayout); panelLayout.addComponent(panelSignificationIndicateurs); } layout.addComponent(panelLayout); // close button HorizontalLayout bLayout = new HorizontalLayout(); bLayout.setSizeFull(); bLayout.setHeight("50px"); Button closeButton = new Button(); //closeButton.setCaption(applicationContext.getMessage("significationsWindow.btnFermer", null, getLocale())); closeButton.setStyleName(ValoTheme.BUTTON_PRIMARY); closeButton.addStyleName("v-popover-button"); closeButton.setIcon(FontAwesome.CHECK); closeButton.addClickListener(e -> { close(); }); bLayout.addComponent(closeButton); bLayout.setComponentAlignment(closeButton, Alignment.MIDDLE_CENTER); layout.addComponent(bLayout); layout.setExpandRatio(panelLayout, 1); }
From source file:info.magnolia.configuration.app.problem.toolbar.ProblemToolbarViewImpl.java
License:Open Source License
private void iniSearchField() { Button clearSearchBoxButton = new Button(); clearSearchBoxButton.setStyleName("m-closebutton"); clearSearchBoxButton.addStyleName("icon-delete-search"); clearSearchBoxButton.addStyleName("searchbox-clearbutton"); // Preventing the button to spoil the tab-navigation due to its changing display value. clearSearchBoxButton.setTabIndex(-1); clearSearchBoxButton.addClickListener(new Button.ClickListener() { @Override//from w w w.j a v a2 s . c o m public void buttonClick(Button.ClickEvent event) { searchField.setValue(""); } }); Icon searchIcon = new Icon("search"); searchIcon.addStyleName("searchbox-icon"); Icon searchArrow = new Icon("arrow2_s"); searchArrow.addStyleName("searchbox-arrow"); searchField = buildSearchField(); searchLayout.setVisible(true); searchLayout.addComponent(searchField); searchLayout.addComponent(clearSearchBoxButton); searchLayout.addComponent(searchIcon); searchLayout.addComponent(searchArrow); searchLayout.setStyleName("searchbox"); VerticalLayout searchLayoutWrapper = new VerticalLayout(); searchLayoutWrapper.setStyleName("workbench"); searchLayoutWrapper.addComponent(searchLayout); addComponent(searchLayoutWrapper); }
From source file:info.magnolia.jcrtools.JcrToolsViewImpl.java
License:Open Source License
protected void build() { Button executeButton = new Button(i18n.translate(EXECUTE_BUTTON_LABEL)); executeButton.addStyleName("v-button-smallapp"); executeButton.addStyleName("commit"); executeButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { listener.onActionTriggered(); }/*from ww w . j av a 2 s. co m*/ }); buttonLayout.addStyleName("v-csslayout-smallapp-actions"); buttonLayout.addComponent(executeButton); inputSection.addComponent(buttonLayout); content.addSection(inputSection); }
From source file:info.magnolia.photoreview.app.config.PhotoReviewConfigViewImpl.java
License:Open Source License
private Component createFormLayout() { formLayout = new FormLayout(); Label sectionTitle = new Label(i18n.translate("photoreview.config.title")); sectionTitle.addStyleName("section-title"); formLayout.addComponent(sectionTitle); Button saveButton = new Button(i18n.translate("photoreview.main.saveSettings.label")); saveButton.addStyleName("commit"); saveButton.addClickListener(new ClickListener() { @Override//from w w w. j av a2s . c om public void buttonClick(ClickEvent event) { listener.saveSettings(dataSource); } }); formLayout.addComponent(saveButton); return formLayout; }
From source file:info.magnolia.security.app.dialog.field.WebAccessFieldFactory.java
License:Open Source License
private Component createRuleRow(final AbstractOrderedLayout parentContainer, final AbstractJcrNodeAdapter ruleItem, final Label emptyLabel) { final HorizontalLayout ruleLayout = new HorizontalLayout(); ruleLayout.setSpacing(true);//from w ww .j a va2s .co m ruleLayout.setWidth("100%"); NativeSelect accessRights = new NativeSelect(); accessRights.addItem(Permission.ALL); accessRights.setItemCaption(Permission.ALL, i18n.translate("security.web.field.getPost")); accessRights.addItem(Permission.READ); accessRights.setItemCaption(Permission.READ, i18n.translate("security.web.field.get")); accessRights.addItem(Permission.NONE); accessRights.setItemCaption(Permission.NONE, i18n.translate("security.web.field.deny")); accessRights.setNullSelectionAllowed(false); accessRights.setImmediate(true); accessRights.setInvalidAllowed(false); accessRights.setNewItemsAllowed(false); Property permissionsProperty = ruleItem.getItemProperty(PERMISSIONS_PROPERTY_NAME); if (permissionsProperty == null) { permissionsProperty = new DefaultProperty<Long>(Long.class, Permission.ALL); ruleItem.addItemProperty(PERMISSIONS_PROPERTY_NAME, permissionsProperty); } accessRights.setPropertyDataSource(permissionsProperty); ruleLayout.addComponent(accessRights); TextField path = new TextField(); path.setWidth("100%"); Property pathProperty = ruleItem.getItemProperty(PATH_PROPERTY_NAME); if (pathProperty == null) { pathProperty = new DefaultProperty<String>(String.class, "/*"); ruleItem.addItemProperty(PATH_PROPERTY_NAME, pathProperty); } path.setPropertyDataSource(pathProperty); ruleLayout.addComponent(path); ruleLayout.setExpandRatio(path, 1.0f); final Button deleteButton = new Button(); deleteButton.setHtmlContentAllowed(true); deleteButton.setCaption("<span class=\"" + "icon-trash" + "\"></span>"); deleteButton.addStyleName("inline"); deleteButton.setDescription(i18n.translate("security.web.field.delete")); deleteButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { parentContainer.removeComponent(ruleLayout); ruleItem.getParent().removeChild(ruleItem); if (parentContainer.getComponentCount() == 1) { parentContainer.addComponent(emptyLabel, 0); } } }); ruleLayout.addComponent(deleteButton); return ruleLayout; }
From source file:info.magnolia.security.app.dialog.field.WorkspaceAccessFieldFactory.java
License:Open Source License
protected Component createRuleRow(final AbstractOrderedLayout parentContainer, final AbstractJcrNodeAdapter ruleItem, final Label emptyLabel) { final HorizontalLayout ruleLayout = new HorizontalLayout(); ruleLayout.setSpacing(true);/*from w ww . j ava 2s . c o m*/ ruleLayout.setWidth("100%"); NativeSelect accessRights = new NativeSelect(); accessRights.setNullSelectionAllowed(false); accessRights.setImmediate(true); accessRights.setInvalidAllowed(false); accessRights.setNewItemsAllowed(false); accessRights.addItem(Permission.ALL); accessRights.setItemCaption(Permission.ALL, i18n.translate("security.workspace.field.readWrite")); accessRights.addItem(Permission.READ); accessRights.setItemCaption(Permission.READ, i18n.translate("security.workspace.field.readOnly")); accessRights.addItem(Permission.NONE); accessRights.setItemCaption(Permission.NONE, i18n.translate("security.workspace.field.denyAccess")); accessRights.setPropertyDataSource(ruleItem.getItemProperty(AccessControlList.PERMISSIONS_PROPERTY_NAME)); ruleLayout.addComponent(accessRights); NativeSelect accessType = new NativeSelect(); accessType.setNullSelectionAllowed(false); accessType.setImmediate(true); accessType.setInvalidAllowed(false); accessType.setNewItemsAllowed(false); accessType.setWidth("150px"); accessType.addItem(AccessControlList.ACCESS_TYPE_NODE); accessType.setItemCaption(AccessControlList.ACCESS_TYPE_NODE, i18n.translate("security.workspace.field.selected")); accessType.addItem(AccessControlList.ACCESS_TYPE_CHILDREN); accessType.setItemCaption(AccessControlList.ACCESS_TYPE_CHILDREN, i18n.translate("security.workspace.field.subnodes")); accessType.addItem(AccessControlList.ACCESS_TYPE_NODE_AND_CHILDREN); accessType.setItemCaption(AccessControlList.ACCESS_TYPE_NODE_AND_CHILDREN, i18n.translate("security.workspace.field.selectedSubnodes")); Property accessTypeProperty = ruleItem.getItemProperty(ACCESS_TYPE_PROPERTY_NAME); accessType.setPropertyDataSource(accessTypeProperty); ruleLayout.addComponent(accessType); final TextField path = new TextField(); path.setWidth("100%"); path.setPropertyDataSource(ruleItem.getItemProperty(AccessControlList.PATH_PROPERTY_NAME)); ruleLayout.addComponent(path); ruleLayout.setExpandRatio(path, 1.0f); Button chooseButton = new Button(i18n.translate("security.workspace.field.choose")); chooseButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { openChooseDialog(path); } }); ruleLayout.addComponent(chooseButton); Button deleteButton = new Button(); deleteButton.setHtmlContentAllowed(true); deleteButton.setCaption("<span class=\"" + "icon-trash" + "\"></span>"); deleteButton.addStyleName("inline"); deleteButton.setDescription(i18n.translate("security.workspace.field.delete")); deleteButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { parentContainer.removeComponent(ruleLayout); ruleItem.getParent().removeChild(ruleItem); if (parentContainer.getComponentCount() == 1) { parentContainer.addComponent(emptyLabel, 0); } } }); ruleLayout.addComponent(deleteButton); return ruleLayout; }