List of usage examples for com.vaadin.ui GridLayout addComponent
@Override public void addComponent(Component component)
From source file:dhbw.clippinggorilla.userinterface.windows.GroupProfileWindow.java
private void addRow(GroupInterestProfile profile, boolean included, String value, boolean isAdmin) { GridLayout tagLayout = new GridLayout(2, 1); tagLayout.setWidth("100%"); Label labelTagName = new Label(value, ContentMode.HTML); labelTagName.setWidth("100%"); labelTagName.addStyleName(ValoTheme.LABEL_H3); labelTagName.addStyleName(ValoTheme.LABEL_NO_MARGIN); tagLayout.addComponent(labelTagName); tagLayout.setComponentAlignment(labelTagName, Alignment.MIDDLE_LEFT); if (isAdmin) { Button buttonDeleteTag = new Button(VaadinIcons.TRASH); buttonDeleteTag.addStyleName(ValoTheme.BUTTON_DANGER); buttonDeleteTag.addClickListener(ev -> { profile.getTags().remove(value); if (included) { includedTagsLayouts.get(profile).removeComponent(tagLayout); } else { excludedTagsLayouts.get(profile).removeComponent(tagLayout); }// w w w. j ava 2 s . co m }); tagLayout.addComponent(buttonDeleteTag); tagLayout.setComponentAlignment(buttonDeleteTag, Alignment.MIDDLE_RIGHT); } tagLayout.setWidth("100%"); tagLayout.setColumnExpandRatio(0, 5); tagLayout.setSpacing(true); tagLayout.setMargin(false); if (included) { if (isAdmin) { includedTagsLayouts.get(profile).addComponent(tagLayout, 2); } else { includedTagsLayouts.get(profile).addComponent(tagLayout, 1); } } else { if (isAdmin) { excludedTagsLayouts.get(profile).addComponent(tagLayout, 2); } else { excludedTagsLayouts.get(profile).addComponent(tagLayout, 1); } } }
From source file:dhbw.clippinggorilla.userinterface.windows.NewSourceWindow.java
public Component getThirdStage(Source s) { Label header = new Label(Language.get(Word.CRAWLER)); header.addStyleName(ValoTheme.LABEL_H1); Crawler crawler;/* w w w .ja va 2 s .co m*/ if (s.getCrawler() != null) { crawler = s.getCrawler(); } else { crawler = new Crawler(s); s.setCrawler(crawler); } GridLayout mainGrid = new GridLayout(2, 2); mainGrid.setSizeFull(); mainGrid.setSpacing(true); FormLayout layoutForms = new FormLayout(); //Exclude or Include RadioButtonGroup<Boolean> radios = new RadioButtonGroup<>(); radios.setItems(true, false); radios.setItemCaptionGenerator(b -> b ? Language.get(Word.INCLUDE_TAGS) : Language.get(Word.EXCLUDE_TAGS)); radios.setItemIconGenerator(b -> b ? VaadinIcons.CHECK : VaadinIcons.CLOSE); radios.setSelectedItem(true); radios.addValueChangeListener(event -> include = event.getValue()); //By Class CssLayout addByClassGroup = new CssLayout(); addByClassGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); TextField textFieldAddByClass = new TextField(); textFieldAddByClass.setWidth("465px"); Button buttonAddByClass = new Button(VaadinIcons.PLUS); buttonAddByClass.addClickListener(e -> { crawler.addByClass(textFieldAddByClass.getValue(), include); refreshList(mainGrid, crawler); textFieldAddByClass.clear(); }); addByClassGroup.addComponents(textFieldAddByClass, buttonAddByClass); addByClassGroup.setCaption(Language.get(Word.BYCLASS)); //ByTag CssLayout addByTagGroup = new CssLayout(); addByTagGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); TextField textFieldAddByTag = new TextField(); Button buttonAddByTag = new Button(VaadinIcons.PLUS); textFieldAddByTag.setWidth("465px"); buttonAddByTag.addClickListener(e -> { crawler.addByTag(textFieldAddByTag.getValue(), include); refreshList(mainGrid, crawler); textFieldAddByTag.clear(); }); addByTagGroup.addComponents(textFieldAddByTag, buttonAddByTag); addByTagGroup.setCaption(Language.get(Word.BYTAG)); //ByID CssLayout addByIDGroup = new CssLayout(); addByIDGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); TextField textFieldAddByID = new TextField(); textFieldAddByID.setWidth("465px"); Button buttonAddByID = new Button(VaadinIcons.PLUS); buttonAddByID.addClickListener(e -> { crawler.addByID(textFieldAddByID.getValue(), include); refreshList(mainGrid, crawler); textFieldAddByID.clear(); }); addByIDGroup.addComponents(textFieldAddByID, buttonAddByID); addByIDGroup.setCaption(Language.get(Word.BYID)); //ByAttribute CssLayout addByAttributeGroup = new CssLayout(); addByAttributeGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); TextField textFieldAddByAttributeKey = new TextField(); textFieldAddByAttributeKey.setWidth("233px"); TextField textFieldAddByAttributeValue = new TextField(); textFieldAddByAttributeValue.setWidth("232px"); Button buttonAddByAttribute = new Button(VaadinIcons.PLUS); buttonAddByAttribute.addClickListener(e -> { crawler.addByAttribute(textFieldAddByAttributeKey.getValue(), textFieldAddByAttributeValue.getValue(), include); refreshList(mainGrid, crawler); textFieldAddByAttributeKey.clear(); textFieldAddByAttributeValue.clear(); }); addByAttributeGroup.addComponents(textFieldAddByAttributeKey, textFieldAddByAttributeValue, buttonAddByAttribute); addByAttributeGroup.setCaption(Language.get(Word.BYATTRIBUTEVALUE)); layoutForms.addComponents(radios, addByClassGroup, addByTagGroup, addByIDGroup, addByAttributeGroup); mainGrid.addComponent(layoutForms); Label labelResult = new Label(); Panel panelResult = new Panel(labelResult); labelResult.setWidth("100%"); panelResult.setWidth("100%"); panelResult.setHeight("175px"); mainGrid.addComponent(panelResult, 0, 1, 1, 1); Button buttonTestURL = new Button(); buttonTestURL.setIcon(VaadinIcons.EXTERNAL_LINK); buttonTestURL.setCaption(Language.get(Word.OPEN_LINK)); Button buttonTest = new Button(Language.get(Word.TEST), VaadinIcons.CLIPBOARD_CHECK); buttonTest.addClickListener(ce -> { Article a = CrawlerUtils.executeRandom(crawler); labelResult.setValue(a.getBody()); if (reg != null) { reg.remove(); } reg = buttonTestURL .addClickListener(cev -> UI.getCurrent().getPage().open(a.getUrl(), "_blank", false)); }); refreshList(mainGrid, crawler); Runnable cancel = () -> close(); Runnable next = () -> validateThirdStage(s); VerticalLayout windowLayout = new VerticalLayout(); windowLayout.addComponents(header, mainGrid, getFooter(cancel, next, buttonTest, buttonTestURL)); windowLayout.setComponentAlignment(header, Alignment.MIDDLE_CENTER); windowLayout.setExpandRatio(mainGrid, 5); windowLayout.setWidth("1250px"); return windowLayout; }
From source file:dhbw.clippinggorilla.userinterface.windows.NewSourceWindow.java
public Component getFooter(Runnable cancelRunnable, Runnable nextRunnable, Component... extraComponents) { Label placeholder = new Label(); Button cancel = new Button(Language.get(Word.CANCEL), VaadinIcons.CLOSE); cancel.addClickListener(ce -> cancelRunnable.run()); Button next = new Button(Language.get(Word.NEXT), VaadinIcons.ARROW_RIGHT); next.addClickListener(ce -> nextRunnable.run()); GridLayout footer = new GridLayout(3 + extraComponents.length, 1); footer.setSpacing(true);/*w w w. j av a 2s . c o m*/ footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); footer.setWidth(100.0f, Sizeable.Unit.PERCENTAGE); footer.setSizeUndefined(); footer.setWidth("100%"); for (Component extraComponent : extraComponents) { footer.addComponent(extraComponent); footer.setComponentAlignment(extraComponent, Alignment.MIDDLE_CENTER); } footer.addComponents(placeholder, cancel, next); footer.setColumnExpandRatio(footer.getColumns() - 1 - 2, 1);//ExpandRatio(placeholder, 1); footer.setComponentAlignment(cancel, Alignment.MIDDLE_CENTER); footer.setComponentAlignment(next, Alignment.MIDDLE_CENTER); return footer; }
From source file:edu.nps.moves.mmowgli.AbstractMmowgliControllerHelper.java
License:Open Source License
void handleShowActiveUsersPerServer(MenuBar mbar) { Object[][] oa = Mmowgli2UI.getGlobals().getSessionCountByServer(); Window svrCountWin = new Window("Display Active Users Per Server"); svrCountWin.setModal(true);// w ww .j ava2s . co m VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setWidth("99%"); svrCountWin.setContent(layout); GridLayout gl = new GridLayout(2, Math.max(1, oa.length)); gl.setSpacing(true); gl.addStyleName("m-greyborder"); for (Object[] row : oa) { Label lab = new Label(); lab.setSizeUndefined(); lab.setValue(row[0].toString()); gl.addComponent(lab); gl.setComponentAlignment(lab, Alignment.MIDDLE_RIGHT); gl.addComponent(new Label(row[1].toString())); } layout.addComponent(gl); layout.setComponentAlignment(gl, Alignment.MIDDLE_CENTER); svrCountWin.setWidth("250px"); UI.getCurrent().addWindow(svrCountWin); svrCountWin.center(); }
From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageBase.java
License:Open Source License
@SuppressWarnings("serial") private void wereInTL(User _usr) { Game g = Game.getTL();//from www .j a v a2s . c o m if (!g.isEmailConfirmation()/* && !g.isSMSConfirmation()*/) { _usr.setEmailConfirmed(true); // confirmation didn't happen, but they want to login wereInReallyTL(_usr); // will do update } /* else if(g.isSMSConfirmation()) { // if both are selected, only sms is done } */ else { List<String> sLis = VHibPii.getUserPiiEmails(_usr.getId()); String email = sLis.get(0); final Window emailDialog = new Window("Email Confirmation"); emailDialog.setModal(true); emailDialog.setClosable(false); VerticalLayout vLay = new VerticalLayout(); emailDialog.setContent(vLay); vLay.setMargin(true); vLay.setSpacing(true); vLay.setSizeUndefined(); vLay.setWidth("400px"); Label message = new HtmlLabel("A confirmation email has been sent to <b>" + email + "</b>."); vLay.addComponent(message); message = new Label("Follow the link in the message " + "to confirm your registration and unlock your mmowgli user account."); vLay.addComponent(message); message = new HtmlLabel("Press the <b>Am I confirmed yet?</b> button " + "to play if ready."); vLay.addComponent(message); message = new HtmlLabel( "Alternatively, press <b>Quit -- I'll come back later</b> to login at a future time."); vLay.addComponent(message); GridLayout grid = new GridLayout(); vLay.addComponent(grid); MSysOut.println(NEWUSER_CREATION_LOGS, "email confirmation dialog displayed, user " + _usr.getUserName()); final Button contButt = new Button("Am I confirmed yet?", new ClickListener() { boolean confirmed = false; @Override @HibernateUpdate @HibernateUserUpdate public void buttonClick(ClickEvent event) { MSysOut.println(DEBUG_LOGS, "\"Am I confirmed?\" button handler entered"); HSess.init(); User u = User.getTL(userId); MSysOut.println(NEWUSER_CREATION_LOGS, "\"Am I confirmed?\" clicked, user " + u.getUserName()); if (confirmed) { closePopup(emailDialog); wereInReallyTL(u); // @HibernateUserUpdate //@HibernateUserRead MSysOut.println(NEWUSER_CREATION_LOGS, "\"Am I confirmed?\", positive confirmation, user " + u.getUserName()); } else { MSysOut.println(DEBUG_LOGS, "User.getTL() in RegistrationPageBase.wereInTL()"); //User locUsr = User.getTL(userId); why necessary? //if(locUsr.isEmailConfirmed()) { if (u.isEmailConfirmed()) { confirmed = true; event.getButton().setCaption("I'm ready to play mmowgli!"); } else { MSysOut.println(NEWUSER_CREATION_LOGS, "\"Am I confirmed?\", negative confirmation, user " + u.getUserName()); Notification.show("Your email is not yet confirmed"); } } HSess.close(); } }); grid.addComponent(contButt); contButt.setImmediate(true); Button laterButt = new Button("Quit -- I'll come back later", new ClickListener() { @Override public void buttonClick(ClickEvent event) { MSysOut.println(DEBUG_LOGS, "\"Quit -- I'll come back later\" button handler entered"); HSess.init(); Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getThanksForInterestLink()); HSess.close(); } }); grid.addComponent(laterButt); Button troubleButt = new Button("Send trouble report", new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) // no need for HSess { MSysOut.println(DEBUG_LOGS, "\"Send trouble report\" button handler entered"); HSess.init(); Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getTroubleLink()); HSess.close(); } }); grid.addComponent(troubleButt); openPopupWindowInMainWindow(emailDialog, 500); EmailConfirmation ec = new EmailConfirmation(_usr); EmailConfirmation.saveTL(ec); String confirmUrl = buildConfirmUrl(ec); AppMaster.instance().getMailManager().sendEmailConfirmationTL(email, _usr.getUserName(), confirmUrl); } // else weren't confirmed }
From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyIdeasPanel2.java
License:Open Source License
@SuppressWarnings("unchecked") private Component createProfileTL() { VerticalLayout lay = new VerticalLayout(); lay.setWidth("670px"); Label lab;/*from w w w .j a v a 2s. c om*/ lay.addComponent(lab = new Label()); lab.setHeight("10px"); VerticalLayout innerVL = new VerticalLayout(); innerVL.setSpacing(true); innerVL.setMargin(true); innerVL.setWidth("100%"); //"90%"); innerVL.addStyleName("m-myideaprofile-table"); lay.addComponent(innerVL); GridLayout gridL = new GridLayout(); gridL.setColumns(2); gridL.addStyleName("m-userprofile-text"); gridL.setSpacing(true); CardType ct; int count = 0; int largest = -1; List<Card> lisPos = commonCriteria() .add(Restrictions.eq("cardType", ct = CardType .getCurrentPositiveIdeaCardTypeTL()/*CardTypeManager.getPositiveIdeaCardTypeTL()*/)) .list(); count += lisPos.size(); largest = Math.max(largest, lisPos.size()); List<Card> lisNeg = commonCriteria() .add(Restrictions.eq("cardType", ct = CardType.getCurrentNegativeIdeaCardTypeTL())).list(); //CardTypeManager.getNegativeIdeaCardTypeTL())).list(); count += lisNeg.size(); largest = Math.max(largest, lisNeg.size()); List<Card> lisExpand = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getExpandTypeTL())) .list();//CardTypeManager.getExpandTypeTL())).list(); count += lisExpand.size(); largest = Math.max(largest, lisExpand.size()); List<Card> lisAdapt = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getAdaptTypeTL())) .list();//CardTypeManager.getAdaptTypeTL())).list(); count += lisAdapt.size(); largest = Math.max(largest, lisAdapt.size()); List<Card> lisCounter = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getCounterTypeTL())) .list();//CardTypeManager.getCounterTypeTL())).list(); count += lisCounter.size(); largest = Math.max(largest, lisCounter.size()); List<Card> lisExplore = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getExploreTypeTL())) .list();//CardTypeManager.getExploreTypeTL())).list(); count += lisExplore.size(); largest = Math.max(largest, lisExplore.size()); ct = CardType.getCurrentPositiveIdeaCardTypeTL(); //CardTypeManager.getPositiveIdeaCardTypeTL(); row(ct.getSummaryHeader(), largest, lisPos.size(), ct, gridL); ct = CardType.getCurrentNegativeIdeaCardTypeTL(); //CardTypeManager.getNegativeIdeaCardTypeTL(); row(ct.getSummaryHeader(), largest, lisNeg.size(), ct, gridL); ct = CardType.getExpandTypeTL(); //CardTypeManager.getExpandTypeTL(); row(ct.getSummaryHeader(), largest, lisExpand.size(), ct, gridL); ct = CardType.getAdaptTypeTL(); //CardTypeManager.getAdaptTypeTL(); row(ct.getSummaryHeader(), largest, lisAdapt.size(), ct, gridL); ct = CardType.getCounterTypeTL(); //CardTypeManager.getCounterTypeTL(); row(ct.getSummaryHeader(), largest, lisCounter.size(), ct, gridL); ct = CardType.getExploreTypeTL(); //CardTypeManager.getExploreTypeTL(); row(ct.getSummaryHeader(), largest, lisExplore.size(), ct, gridL); gridL.addComponent(new Label("")); gridL.addComponent(new Label("")); gridL.addComponent(new Label("TOTAL")); gridL.addComponent(new Label("" + count)); innerVL.addComponent(gridL); lay.addComponent(lab = new Label()); lab.setHeight("1px"); lay.setExpandRatio(lab, 1.0f); return lay; }
From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyIdeasPanel2.java
License:Open Source License
private void row(String s, int largest, int sz, CardType ct, GridLayout grid) { float pct = (float) sz / (float) largest; float wd = pct * MAXBARWIDTH; int width = Math.max(Math.round(wd), 1); Label lab;//from www . j a v a 2 s.c om grid.addComponent(lab = new Label(s)); lab.setWidth("160"); lab.setDescription(s); HorizontalLayout hLay = new HorizontalLayout(); hLay.setSpacing(true); hLay.setMargin(false); hLay.addComponent(lab = new HtmlLabel(" ")); ; lab.addStyleName(CardType.getColorStyle(ct)); //CardTypeManager.getColorStyle(ct)); lab.setWidth("" + width + "px"); hLay.addComponent(lab = new Label("" + sz)); grid.addComponent(hLay); }
From source file:edu.nps.moves.mmowgliMobile.ui.UserRenderer2.java
License:Open Source License
public void addRow(GridLayout lay, String label, String value) { Label lbl;//from w w w. java2 s . c om lay.addComponent(lbl = new Label(label)); lbl.setStyleName("light-text"); lbl.setSizeUndefined(); lay.setComponentAlignment(lbl, Alignment.TOP_RIGHT); lay.addComponent(new HtmlLabel(value)); }
From source file:fi.csc.pathway.TutkaUI.java
License:Creative Commons License
/** * Pohjelma, joka luo kyttliittymn./*w w w .j a va 2s . c om*/ */ @Override protected void init(VaadinRequest request) { final String portletContextName = getPortletContextName(request); final VerticalLayout vasenpalkki = new VerticalLayout(); final HorizontalLayout layout = new HorizontalLayout(); //main final HorizontalLayout karttapalkki = new HorizontalLayout(); final HorizontalLayout lkmnext = new HorizontalLayout(); final Label hr = new Label(" ____________________", ContentMode.HTML); final Label aika = new Label("Time", ContentMode.HTML); final Label lkm = new Label("0", ContentMode.HTML); final Button next = new Button("Next"); final OptionGroup tyyppi = new OptionGroup("Type"); final OptionGroup tutka = new OptionGroup("Radar"); final OptionGroup kulma = new OptionGroup("Angle"); final OptionGroup krjet = new OptionGroup("Min vertices"); final Googlekartta gma = new Googlekartta(aika, tutka, kulma, tyyppi, krjet, portletContextName, lkm); final Tutkat tutkat = new Tutkat(); final PopupDateField enddate = new PopupDateField("To:"); final PopupDateField startdate = new PopupDateField("From:"); final GoogleMap oldComponent = gma.getOrigMap(); final GridLayout parametrit = new GridLayout(2, 2); tutkat.alusta(tutka, krjet, oldComponent); parametrit.addComponent(tutka); parametrit.addComponent(krjet); Ilmiot ilmio = new Ilmiot(tyyppi, tutka); kulma.addItem("1.5"); kulma.addItem("0.7"); kulma.addItem(Tutkat.LOW); //luostolla ei ole matalampaa kuin 0.7 kulma.setValue("1.5"); parametrit.addComponent(kulma); parametrit.addComponent(ilmio.getTyyppi()); vasenpalkki.addComponent(parametrit); Tarkista tarkista = new Tarkista(enddate, startdate); vasenpalkki.addComponent(tarkista.getstartdate()); vasenpalkki.addComponent(tarkista.getenddate()); next.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -8146345475859196611L; public void buttonClick(ClickEvent event) { if (gma.updateMap()) { next.setEnabled(false); } } }); final Button button = new Button("Query"); button.addClickListener(new Button.ClickListener() { //Component oldC = oldComponent; private static final long serialVersionUID = -8146345475859196612L; public void buttonClick(ClickEvent event) { if (gma.getMap(startdate.getValue(), enddate.getValue(), tutka.getValue())) { // tm ei ole kaunista, mutta uudelleen lisminen ei haittaa vasenpalkki.addComponent(hr); vasenpalkki.addComponent(aika); lkmnext.addComponent(lkm); next.setEnabled(true); lkmnext.addComponent(next); vasenpalkki.addComponent(lkmnext); } } }); vasenpalkki.addComponent(button); layout.addComponent(vasenpalkki); karttapalkki.setHeight(600, Sizeable.Unit.PIXELS); karttapalkki.addComponent(oldComponent); layout.addComponent(karttapalkki); layout.setMargin(true); setContent(layout); }
From source file:fr.univlorraine.mondossierweb.views.windows.FiltreInscritsMobileWindow.java
License:Apache License
/** * Cre une fentre/*from w ww. ja v a2s .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); }