List of usage examples for com.vaadin.ui FormLayout setStyleName
@Override public void setStyleName(String style)
From source file:com.haulmont.cuba.web.LoginWindow.java
License:Apache License
protected FormLayout createLoginFormLayout(int fieldWidth, boolean localesSelectVisible) { FormLayout loginFormLayout = new FormLayout(); loginFormLayout.setStyleName("cuba-login-form"); loginFormLayout.setSpacing(true);/*from w w w .j a v a 2 s . c o m*/ loginFormLayout.setSizeUndefined(); loginField.setCaption(messages.getMainMessage("loginWindow.loginField", resolvedLocale)); loginFormLayout.addComponent(loginField); loginField.setWidth(fieldWidth + "px"); loginField.setStyleName("username-field"); loginFormLayout.setComponentAlignment(loginField, Alignment.MIDDLE_CENTER); passwordField.setCaption(messages.getMainMessage("loginWindow.passwordField", resolvedLocale)); passwordField.setWidth(fieldWidth + "px"); passwordField.setAutocomplete(true); passwordField.setStyleName("password-field"); loginFormLayout.addComponent(passwordField); loginFormLayout.setComponentAlignment(passwordField, Alignment.MIDDLE_CENTER); if (localesSelectVisible) { localesSelect.setCaption(messages.getMainMessage("loginWindow.localesSelect", resolvedLocale)); localesSelect.setWidth(fieldWidth + "px"); localesSelect.setNullSelectionAllowed(false); loginFormLayout.addComponent(localesSelect); loginFormLayout.setComponentAlignment(localesSelect, Alignment.MIDDLE_CENTER); } if (rememberMeAllowed) { rememberMeCheckBox.setCaption(messages.getMainMessage("loginWindow.rememberMe", resolvedLocale)); rememberMeCheckBox.setStyleName("remember-me"); loginFormLayout.addComponent(rememberMeCheckBox); loginFormLayout.setComponentAlignment(rememberMeCheckBox, Alignment.MIDDLE_CENTER); } okButton.setCaption(messages.getMainMessage("loginWindow.okButton", resolvedLocale)); okButton.addClickListener(submitListener); okButton.setStyleName("cuba-login-submit"); okButton.setIcon(WebComponentsHelper.getIcon("app/images/login-button.png")); loginFormLayout.addComponent(okButton); loginFormLayout.setComponentAlignment(okButton, Alignment.MIDDLE_CENTER); return loginFormLayout; }
From source file:com.jain.common.authenticate.LoginAction.java
License:Apache License
private void createFieldGroup(VerticalLayout layout) { I18NProvider provider = DefaultI18NResourceProvider.instance(); userName = new TextField("user.name"); userName.setCursorPosition(0);/* www . j av a 2s . c o m*/ userName.setRequired(true); userName.setRequiredError(provider.getMessage(getLocale(), "common.something.required", "user.name.title", JAction.LOGIN.getDisplayName())); userName.setDescription("user.name"); userName.setSizeFull(); userName.setStyleName(JNStyleConstants.J_FIELD); password = new PasswordField("password"); password.setRequired(true); password.setRequiredError(provider.getMessage(getLocale(), "common.something.required", "password.title", JAction.LOGIN.getDisplayName())); password.setDescription("password"); password.setSizeFull(); password.setStyleName(JNStyleConstants.J_FIELD); VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setStyleName(ApplicationTheme.VIEW); verticalLayout.setSpacing(true); verticalLayout.setMargin(true); verticalLayout.setWidth("100%"); FormLayout formLayout = new FormLayout(); formLayout.setStyleName(ApplicationTheme.ALTERNATE_VIEW); formLayout.setSpacing(true); formLayout.setMargin(true); formLayout.setWidth("100%"); formLayout.addComponent(userName); formLayout.addComponent(password); verticalLayout.addComponent(formLayout); layout.addComponent(verticalLayout); }
From source file:com.ocs.dynamo.functional.ui.MultiDomainEditLayout.java
License:Apache License
public void build() { mainLayout = new DefaultVerticalLayout(true, true); // form that contains the combo box FormLayout form = new FormLayout(); form.setMargin(true);// w w w.j ava 2 s . com form.setStyleName(DynamoConstants.CSS_CLASS_HALFSCREEN); mainLayout.addComponent(form); // combo box for selecting domain domainCombo = new ComboBox(message("ocs.select.domain")); for (Class<? extends Domain> clazz : getDomainClasses()) { domainCombo.addItem(clazz); domainCombo.setItemCaption(clazz, getEntityModelFactory().getModel(clazz).getDisplayName()); } domainCombo.setNullSelectionAllowed(false); domainCombo.setSizeFull(); // respond to a change by displaying the correct domain domainCombo.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 8441066091930807231L; @Override @SuppressWarnings("unchecked") public void valueChange(ValueChangeEvent event) { selectDomain((Class<? extends Domain>) event.getProperty().getValue()); } }); form.addComponent(domainCombo); selectedDomainLayout = new DefaultVerticalLayout(); mainLayout.addComponent(selectedDomainLayout); // select the first domain (if there is any) if (!getDomainClasses().isEmpty()) { domainCombo.setValue(getDomainClasses().get(0)); } setCompositionRoot(mainLayout); }
From source file:com.ocs.dynamo.ui.composite.form.UploadForm.java
License:Apache License
@Override protected void doBuildLayout(Layout main) { FormLayout form = new FormLayout(); form.setMargin(true);/* w w w.j a v a 2 s . co m*/ if (ScreenMode.VERTICAL.equals(screenMode)) { form.setStyleName(DynamoConstants.CSS_CLASS_HALFSCREEN); } main.addComponent(form); // add custom components doBuildForm(form); // add file upload field UploadReceiver receiver = new UploadReceiver(); Upload upload = new Upload(message("ocs.uploadform.title"), receiver); upload.addSucceededListener(receiver); form.addComponent(upload); if (showCancelButton) { Button cancelButton = new Button(message("ocs.cancel")); cancelButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { cancel(); } }); main.addComponent(cancelButton); } }
From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java
private HorizontalLayout getADC() { // Notification.show(strTbName); VerticalLayout cAgentInfo = new VerticalLayout(); cAgentInfo.setMargin(new MarginInfo(true, true, true, true)); cAgentInfo.setStyleName("c_details_test"); // VerticalLayout cAcc = new VerticalLayout(); Label lbAcc = new Label(); lbAcc.setCaption("Account"); lbAcc.setStyleName("label_search_user lb_frm_add_user u_d_t"); // lbC.setCaption("Identification"); // lbC.setStyleName("label_search_user lb_frm_add_user u_d_t"); // lbAcc.setStyleName("lb_frm_add_user"); ComboBox comboHierarchy = null;//from ww w .j a v a 2s . c o m comboHierarchy = new ComboBox("Profile"); final FormLayout cLBody = new FormLayout(); cLBody.addComponent(lbAcc); // cLBody.setSpacing(true); comboHierarchy.addItem(1); comboHierarchy.setItemCaption(1, "MATS_ADMIN_USER_PROFILE"); comboHierarchy.select(1); comboProfile = comboHierarchy; comboProfile.setRequired(true); // cAcc.addComponent(comboHierarchy); addDatum("Profile", hm.get("Profile Type"), cLBody); TextField tF = new TextField("Username"); tF.setValue("Livepwndz"); tFUN = tF; tFUN.setRequired(true); // cLBody.addComponent(tF); addDatum("Username", hm.get("Username"), cLBody); tF = new TextField("MSISDN"); tF.setValue("+256774191152"); tFMSISDN = tF; tFMSISDN.setRequired(true); // cLBody.addComponent(tF); addDatum("MSISDN", hm.get("MSISDN"), cLBody); tF = new TextField("PIN"); // / cLBody.addComponent(tF); tF = new TextField("Email"); tFAccEmail = tF; tFAccEmail.setRequired(true); tFAccEmail.setValue("ppounds1@gmail.com"); // // cLBody.addComponent(tF); addDatum("Email", hm.get("Email"), cLBody); combo = new ComboBox("Bank Domain"); combo.addItem("Stanbic Bank"); combo.select("Stanbic Bank"); comboBDomain = combo; // // cLBody.addComponent(combo); addDatum("Bank Domain", hm.get("Bank"), cLBody); combo = new ComboBox("Bank Code ID"); combo.addItem("001"); combo.select("001"); comboBID = combo; // cLBody.addComponent(combo); addDatum("Bank Code ID", hm.get("Bank Code"), cLBody); tF = new TextField("Bank Account"); tF.setValue("00232333452315"); tFBAcc = tF; // tFBAcc.setValidationVisible(true); // tFBAcc.addValidator(new NoNull()); // cLBody.addComponent(tF); addDatum("Bank Account", hm.get("Bank Account"), cLBody); combo.addItem(1); combo.setItemCaption(1, "US Dollars"); combo.select(1); comboCur = combo; // cLBody.addComponent(combo); addDatum("Currency", hm.get("Currency"), cLBody); tF = new TextField("Clearing Number"); tF.setValue("00212"); tFClrNo = tF; // cLBody.addComponent(tF); addDatum("Clearing No. ", hm.get("Clearing No."), cLBody); String strNameCap = "Username"; tF = new TextField(strNameCap); HorizontalLayout cAccBody = new HorizontalLayout(); cAccBody.addComponent(cLBody); cLBody.addComponent(cBtnEditCancel); cLBody.setStyleName("c_body_visible"); // cAcc.addComponent(cAccBody); cAgentInfo.addComponent(cLBody); // cBAndCAndAcc.addComponent(cAcc); HorizontalLayout c = new HorizontalLayout(); c.addComponent(cAgentInfo); return c; }
From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java
private HorizontalLayout getPC() { VerticalLayout cAgentInfo = new VerticalLayout(); final HorizontalLayout cPlaceholder = new HorizontalLayout(); cAgentInfo.setMargin(new MarginInfo(true, true, true, true)); cAgentInfo.setStyleName("c_details_test"); final VerticalLayout cLBody = new VerticalLayout(); cLBody.setStyleName("c_body_visible"); tb = new Table("Linked child accounts"); // addLinksTable(); final VerticalLayout cAllProf = new VerticalLayout(); HorizontalLayout cProfActions = new HorizontalLayout(); final FormLayout cProfName = new FormLayout(); cProfName.setStyleName("frm_profile_name"); cProfName.setSizeUndefined();//from w ww . j a v a2 s .c o m final Label lbProf = new Label(); final TextField tFProf = new TextField(); lbProf.setCaption("Profile Name: "); lbProf.setValue("Certified Authorized User."); tFProf.setCaption(lbProf.getCaption()); cProfName.addComponent(lbProf); final Button btnEdit = new Button(); btnEdit.setIcon(FontAwesome.EDIT); btnEdit.setStyleName("btn_link"); btnEdit.setDescription("Edit profile name"); final Button btnCancel = new Button(); btnCancel.setIcon(FontAwesome.UNDO); btnCancel.setStyleName("btn_link"); btnCancel.setDescription("Cancel Profile name editting."); Button btnAdd = new Button("+"); // btnAdd.setIcon(FontAwesome.EDIT); btnAdd.setStyleName("btn_link"); btnAdd.setDescription("Set new profile"); Button btnRemove = new Button("-"); // btnRemove.setIcon(FontAwesome.EDIT); btnRemove.setStyleName("btn_link"); btnRemove.setDescription("Remove current profile"); // cProf.addComponent(cProfName); cProfActions.addComponent(btnEdit); cProfActions.addComponent(btnCancel); cProfActions.addComponent(btnAdd); cProfActions.addComponent(btnRemove); btnCancel.setVisible(false); cAllProf.addComponent(cProfName); cAllProf.addComponent(cProfActions); cAllProf.setComponentAlignment(cProfActions, Alignment.TOP_CENTER); cLBody.addComponent(cAllProf); // cLBody.addComponent(tb); tb.setSelectable(true); cAgentInfo.addComponent(cLBody); btnLink = new Button("Add New Link"); btnLink.setIcon(FontAwesome.LINK); btnLink.setDescription("Link new account."); // cLBody.addComponent(btnLink); // cLBody.setComponentAlignment(btnLink, Alignment.TOP_LEFT); btnLink.addClickListener(new LinkClickHandler()); cPlaceholder.setVisible(false); addLinkUserContainer(); cPlaceholder.setWidth("100%"); cLBody.addComponent(cPlaceholder); cLBody.setComponentAlignment(cPlaceholder, Alignment.TOP_CENTER); HorizontalLayout c = new HorizontalLayout(); c.addComponent(cAgentInfo); btnEdit.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -8427226211153164650L; @Override public void buttonClick(ClickEvent event) { if (btnEdit.getIcon().equals(FontAwesome.EDIT)) { tFProf.setValue(lbProf.getValue()); tFProf.selectAll(); cProfName.replaceComponent(lbProf, tFProf); btnEdit.setIcon(FontAwesome.SAVE); btnCancel.setVisible(true); return; } else if (btnEdit.getIcon().equals(FontAwesome.SAVE)) { lbProf.setValue(tFProf.getValue()); cProfName.replaceComponent(tFProf, lbProf); btnEdit.setIcon(FontAwesome.EDIT); btnCancel.setVisible(false); return; } lbProf.setValue(tFProf.getValue()); cProfName.replaceComponent(tFProf, lbProf); btnEdit.setIcon(FontAwesome.EDIT); btnCancel.setVisible(false); } }); btnCancel.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -2870045546205986347L; @Override public void buttonClick(ClickEvent event) { cProfName.replaceComponent(tFProf, lbProf); btnEdit.setIcon(FontAwesome.EDIT); btnCancel.setVisible(false); } }); btnAdd.addClickListener(new AddProfileHandler(cAllProf, cPlaceholder)); btnRemove.addClickListener(new RemoveProfileHandler(pop)); return c; }
From source file:edu.kit.dama.ui.admin.ProfileView.java
License:Apache License
/** * Build the main layout./*from w w w . j a v a 2 s .co m*/ */ private void buildMainLayout() { //information area screenName = new Label(); screenName.setCaption("Screen Name:"); screenName.setStyleName("form"); firstName = new Label(); firstName.setCaption("First Name:"); firstName.setStyleName("form"); lastName = new Label(); lastName.setCaption("Last Name:"); lastName.setStyleName("form"); email = new Label(); email.setCaption("Email:"); email.setStyleName("form"); FormLayout userInformationForm = new FormLayout(screenName, firstName, lastName, email); userInformationForm.setStyleName("form"); userInformationForm.setCaption("User Information"); tokenDialog = new ServiceAccessTokenDialog(); //Credentials //table with serviceId, key, secret for logged in userId //---mainLogin and webdav are special (username = email), others can be configured in AuthenticatorFactory //---support for adding/regenerating new tokens (support for random secrets) //---support for blocking? //---'show secrets' button credentialTable = new Table("Credentials"); credentialTable.setSelectable(true); credentialTable.setMultiSelect(false); credentialTable.addContainerProperty("ServiceId", String.class, null); credentialTable.addContainerProperty("Key", String.class, null); credentialTable.addContainerProperty("Secret", String.class, null); credentialTable.addStyleName("myboldcaption"); credentialTable.setSizeFull(); Button addCredential = new Button(); addCredential.setIcon(new ThemeResource(IconContainer.ADD)); Button modifyCredential = new Button(); modifyCredential.setIcon(new ThemeResource(IconContainer.EDIT)); Button removeCredential = new Button(); removeCredential.setIcon(new ThemeResource(IconContainer.DELETE)); Button reloadCredentialTable = new Button(); reloadCredentialTable.setIcon(new ThemeResource(IconContainer.REFRESH)); reloadCredentialTable.addClickListener(((event) -> { reload(); })); CheckBox showPasswords = new CheckBox("Show Secrets"); showPasswords.addValueChangeListener((Property.ValueChangeEvent event) -> { showSecrets(showPasswords.getValue()); }); removeCredential.addClickListener((event) -> { Long selection = (Long) credentialTable.getValue(); if (selection != null) { ConfirmationWindow7.showConfirmation("Delete Credential", "If you delete the selected credential, you won't be able to access the associated service any longer.<br/> " + "Do you wish to proceed?", ConfirmationWindow7.OPTION_TYPE.YES_NO_OPTION, ConfirmationWindow7.MESSAGE_TYPE.WARNING, (ConfirmationWindow7.RESULT pResult) -> { switch (pResult) { case YES: removeCredential(selection); break; default: //do nothing } }); } }); modifyCredential.addClickListener((event) -> { Long selection = (Long) credentialTable.getValue(); if (selection != null) { updateCredential(selection); } }); addCredential.addClickListener((event) -> { createCredential(); }); VerticalLayout buttonLayout = new VerticalLayout(addCredential, modifyCredential, removeCredential, reloadCredentialTable); buttonLayout.setComponentAlignment(modifyCredential, Alignment.TOP_LEFT); buttonLayout.setComponentAlignment(removeCredential, Alignment.TOP_LEFT); buttonLayout.setComponentAlignment(reloadCredentialTable, Alignment.TOP_LEFT); buttonLayout.setMargin(true); UIUtils7.GridLayoutBuilder builder = new UIUtils7.GridLayoutBuilder(2, 3); builder.fillRow(userInformationForm, 0, 0, 1); builder.addComponent(credentialTable, 0, 1).addComponent(buttonLayout, 1, 1); builder.fillRow(showPasswords, 0, 2, 1); mainLayout = builder.getLayout(); mainLayout.setSpacing(true); mainLayout.setMargin(true); mainLayout.setRowExpandRatio(1, 1.0f); mainLayout.setColumnExpandRatio(0, .9f); mainLayout.setColumnExpandRatio(1, .1f); mainLayout.setSizeFull(); reload(); }
From source file:fr.univlorraine.mondossierweb.views.ListeInscritsView.java
License:Apache License
public void initListe() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MainUI && userController.isEnseignant()) { // initialisation de la vue removeAllComponents();//w ww . ja v a2s .c o m listeEtapes = null; listeGroupes = null; // Style setMargin(true); setSpacing(true); setSizeFull(); // Rcupration de l'objet de la SE dont on doit afficher les inscrits code = MainUI.getCurrent().getCodeObjListInscrits(); typeFavori = MainUI.getCurrent().getTypeObjListInscrits(); libelleObj = ""; if (typeIsVet() && MainUI.getCurrent().getEtapeListeInscrits() != null) { libelleObj = MainUI.getCurrent().getEtapeListeInscrits().getLibelle(); } if (typeIsElp() && MainUI.getCurrent().getElpListeInscrits() != null) { libelleObj = MainUI.getCurrent().getElpListeInscrits().getLibelle(); } // Si l'objet est renseign if (code != null && typeFavori != null) { //Panel contenant les filtres d'affichage et le bouton de mise en favori HorizontalLayout panelLayout = new HorizontalLayout(); panelLayout.setSizeFull(); panelLayout.addStyleName("small-font-element"); // Layout contenant les filtres FormLayout formInscritLayout = new FormLayout(); formInscritLayout.setStyleName(ValoTheme.FORMLAYOUT_LIGHT); formInscritLayout.setSpacing(true); formInscritLayout.setMargin(true); panelFormInscrits = new Panel(code + " " + libelleObj); //Affichage d'une liste droulante contenant la liste des annes List<String> lannees = MainUI.getCurrent().getListeAnneeInscrits(); if (lannees != null && lannees.size() > 0) { listeAnnees = new ComboBox(applicationContext.getMessage(NAME + ".annee", null, getLocale())); listeAnnees.setPageLength(5); listeAnnees.setTextInputAllowed(false); listeAnnees.setNullSelectionAllowed(false); listeAnnees.setWidth("150px"); for (String annee : lannees) { listeAnnees.addItem(annee); int anneenplusun = Integer.parseInt(annee) + 1; listeAnnees.setItemCaption(annee, annee + "/" + anneenplusun); } listeAnnees.setValue(MainUI.getCurrent().getAnneeInscrits()); //Gestion de l'vnement sur le changement d'anne listeAnnees.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String selectedValue = (String) event.getProperty().getValue(); //faire le changement Map<String, String> parameterMap = new HashMap<>(); parameterMap.put("code", code); parameterMap.put("type", typeFavori); //rcupration de la nouvelle liste if (typeIsVet()) { listeInscritsController.recupererLaListeDesInscrits(parameterMap, selectedValue, MainUI.getCurrent()); } if (typeIsElp()) { listeInscritsController.recupererLaListeDesInscritsELP(parameterMap, selectedValue, MainUI.getCurrent()); } //update de l'affichage initListe(); } }); formInscritLayout.addComponent(listeAnnees); } //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()) { List<VersionEtape> letapes = MainUI.getCurrent().getListeEtapesInscrits(); if (letapes != null && letapes.size() > 0) { listeEtapes = new ComboBox( applicationContext.getMessage(NAME + ".etapes", null, getLocale())); listeEtapes.setPageLength(5); listeEtapes.setNullSelectionAllowed(false); listeEtapes.setTextInputAllowed(false); listeEtapes.setRequired(false); listeEtapes.setWidth("400px"); 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 (MainUI.getCurrent().getEtapeInscrits() != null) { listeEtapes.setValue(MainUI.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) { String vetSelectionnee = (String) event.getProperty().getValue(); if (vetSelectionnee.equals(TOUTES_LES_ETAPES_LABEL)) { vetSelectionnee = null; } MainUI.getCurrent().setEtapeInscrits(vetSelectionnee); //faire le changement String groupeSelectionne = ((listeGroupes != null && listeGroupes.getValue() != null) ? (String) listeGroupes.getValue() : null); if (groupeSelectionne != null && groupeSelectionne.equals(TOUS_LES_GROUPES_LABEL)) { groupeSelectionne = null; } filtrerInscrits(vetSelectionnee, groupeSelectionne); } }); formInscritLayout.addComponent(listeEtapes); } List<ElpDeCollection> lgroupes = MainUI.getCurrent().getListeGroupesInscrits(); if (lgroupes != null && lgroupes.size() > 0) { listeGroupes = new ComboBox(); listeGroupes.setPageLength(5); listeGroupes.setNullSelectionAllowed(false); listeGroupes.setTextInputAllowed(false); listeGroupes.setRequired(false); listeGroupes.setStyleName(ValoTheme.COMBOBOX_BORDERLESS); listeGroupes.setWidth("348px"); 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()); } } } if (MainUI.getCurrent().getGroupeInscrits() != null) { listeGroupes.setValue(MainUI.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) { String grpSelectionnee = (String) event.getProperty().getValue(); if (grpSelectionnee.equals(TOUS_LES_GROUPES_LABEL)) { grpSelectionnee = null; } MainUI.getCurrent().setGroupeInscrits(grpSelectionnee); //faire le changement String etapeSelectionnee = ((listeEtapes != null && listeEtapes.getValue() != null) ? (String) listeEtapes.getValue() : null); if (etapeSelectionnee != null && etapeSelectionnee.equals(TOUTES_LES_ETAPES_LABEL)) { etapeSelectionnee = null; } filtrerInscrits(etapeSelectionnee, grpSelectionnee); } }); HorizontalLayout gpLayout = new HorizontalLayout(); gpLayout.setCaption(applicationContext.getMessage(NAME + ".groupes", null, getLocale())); gpLayout.setMargin(false); gpLayout.setSpacing(false); gpLayout.addComponent(listeGroupes); Button btnDetailGpe = new Button(); btnDetailGpe.setWidth("52px"); btnDetailGpe.setHeight("32px"); btnDetailGpe.setStyleName(ValoTheme.BUTTON_PRIMARY); btnDetailGpe.setIcon(FontAwesome.SEARCH); btnDetailGpe.setDescription( applicationContext.getMessage(NAME + ".detail.groupes", null, getLocale())); btnDetailGpe.addClickListener(e -> { String vet = null; if (listeEtapes != null && listeEtapes.getValue() != null && !listeEtapes.getValue().equals(TOUTES_LES_ETAPES_LABEL)) { vet = listeEtapes.getItemCaption(listeEtapes.getValue()); } DetailGroupesWindow dgw = new DetailGroupesWindow(lgroupes, panelFormInscrits.getCaption(), vet, (String) listeAnnees.getValue()); UI.getCurrent().addWindow(dgw); }); gpLayout.addComponent(btnDetailGpe); formInscritLayout.addComponent(gpLayout); } } panelLayout.addComponent(formInscritLayout); panelLayout.setComponentAlignment(formInscritLayout, Alignment.MIDDLE_LEFT); //Cration du favori pour l'objet concern pas la liste des inscrits List<Favoris> lfav = favorisController.getFavoris(); FavorisPK favpk = new FavorisPK(); favpk.setLogin(userController.getCurrentUserName()); favpk.setIdfav(code); favpk.setTypfav(typeFavori); Favoris favori = new Favoris(); favori.setId(favpk); //Cration du bouton pour ajouter l'objet aux favoris favoriLayout = new VerticalLayout(); favoriLayout.setSizeFull(); favoriLayout.setMargin(true); favoriLayout.setSpacing(true); btnAjoutFavori = new Button( applicationContext.getMessage(NAME + ".btn.ajoutFavori", null, getLocale())); btnAjoutFavori.setIcon(FontAwesome.STAR_O); btnAjoutFavori.addStyleName(ValoTheme.BUTTON_PRIMARY); btnAjoutFavori.setDescription( applicationContext.getMessage(NAME + ".btn.ajoutFavori", null, getLocale())); btnAjoutFavori.addClickListener(e -> { //creation du favori en base sur le clic du bouton favorisController.saveFavori(favori); //On cache le bouton de mise en favori btnAjoutFavori.setVisible(false); //Affichage d'un message de confirmation Notification.show( applicationContext.getMessage(NAME + ".message.favoriAjoute", null, getLocale()), Type.TRAY_NOTIFICATION); }); //Ajout du bouton l'interface favoriLayout.addComponent(btnAjoutFavori); favoriLayout.setComponentAlignment(btnAjoutFavori, Alignment.TOP_RIGHT); if (typeIsElp()) { btnMasquerFiltre = new Button( applicationContext.getMessage(NAME + ".btn.btnMasquerFiltre", null, getLocale())); btnMasquerFiltre.setIcon(FontAwesome.CHEVRON_CIRCLE_UP); btnMasquerFiltre.addStyleName(ValoTheme.BUTTON_FRIENDLY); btnMasquerFiltre.setDescription( applicationContext.getMessage(NAME + ".btn.btnMasquerFiltre", null, getLocale())); btnMasquerFiltre.addClickListener(e -> { panelFormInscrits.setContent(null); if (btnDisplayFiltres != null) { btnDisplayFiltres.setVisible(true); } }); favoriLayout.addComponent(btnMasquerFiltre); favoriLayout.setComponentAlignment(btnMasquerFiltre, Alignment.BOTTOM_RIGHT); } panelLayout.addComponent(favoriLayout); panelLayout.setComponentAlignment(favoriLayout, Alignment.TOP_RIGHT); //Si l'objet est dj en favori if (lfav != null && lfav.contains(favori)) { //On affiche pas le bouton de mise en favori btnAjoutFavori.setVisible(false); } panelFormInscrits.setContent(panelLayout); addComponent(panelFormInscrits); //Rcupration de la liste des inscrits linscrits = MainUI.getCurrent().getListeInscrits(); refreshListeCodind(new BeanItemContainer<>(Inscrit.class, linscrits)); //Test si la liste contient des tudiants if (linscrits != null && linscrits.size() > 0 && listecodind != null && listecodind.size() > 0) { infoLayout = new VerticalLayout(); infoLayout.setSizeFull(); //Layout avec le nb d'inscrit, le bouton trombinoscope et le bouton d'export HorizontalLayout resumeLayout = new HorizontalLayout(); resumeLayout.setWidth("100%"); resumeLayout.setHeight("50px"); //Label affichant le nb d'inscrits infoNbInscrit = new Label( applicationContext.getMessage(NAME + ".message.nbinscrit", null, getLocale()) + " : " + linscrits.size()); leftResumeLayout = new HorizontalLayout(); leftResumeLayout.addComponent(infoNbInscrit); leftResumeLayout.setComponentAlignment(infoNbInscrit, Alignment.MIDDLE_LEFT); Button infoDescriptionButton = new Button(); infoDescriptionButton.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); infoDescriptionButton.setIcon(FontAwesome.INFO_CIRCLE); infoDescriptionButton.setDescription(applicationContext .getMessage(NAME + ".message.info.predescription", null, getLocale())); infoDescriptionButton.addClickListener(e -> { String message = ""; if (typeIsVet()) { message = applicationContext.getMessage(NAME + ".message.info.vetdescription", null, getLocale()); } if (typeIsElp()) { message = applicationContext.getMessage(NAME + ".message.info.elpdescription", null, getLocale()); } HelpBasicWindow hbw = new HelpBasicWindow(message, applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale())); UI.getCurrent().addWindow(hbw); }); leftResumeLayout.addComponent(infoDescriptionButton); leftResumeLayout.setComponentAlignment(infoDescriptionButton, Alignment.MIDDLE_LEFT); //Bouton export trombinoscope btnExportTrombi = new Button(); btnExportTrombi.setIcon(FontAwesome.FILE_PDF_O); btnExportTrombi.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnExportTrombi.addStyleName("button-icon"); btnExportTrombi.addStyleName("red-button-icon"); btnExportTrombi.setDescription( applicationContext.getMessage(NAME + ".pdf.trombinoscope.link", null, getLocale())); //methode qui permet de generer l'export la demande //Cration du nom du fichier String nomFichier = applicationContext.getMessage("pdf.trombinoscope.title", null, Locale.getDefault()) + "_" + panelFormInscrits.getCaption() + ".pdf"; nomFichier = nomFichier.replaceAll(" ", "_"); StreamResource resource = new StreamResource(new StreamResource.StreamSource() { @Override public InputStream getStream() { //recuperation de l'anne slectionne et du libell de l'ELP String annee = (String) listeAnnees.getValue(); String libObj = panelFormInscrits.getCaption(); //cration du trombi en pdf return listeInscritsController.getPdfStream(linscrits, listecodind, libObj, annee); } }, nomFichier); resource.setMIMEType("application/force-download;charset=UTF-8"); resource.setCacheTime(0); //On ajoute le FD sur le bouton d'export if (PropertyUtils.isPushEnabled()) { new MyFileDownloader(resource).extend(btnExportTrombi); } else { FileDownloader fdpdf = new FileDownloader(resource); fdpdf.setOverrideContentType(false); fdpdf.extend(btnExportTrombi); } leftResumeLayout.addComponent(btnExportTrombi); leftResumeLayout.setComponentAlignment(btnExportTrombi, Alignment.MIDDLE_LEFT); //if(!afficherTrombinoscope){ //On cache le bouton d'export pdf btnExportTrombi.setVisible(false); //} //Bouton export liste excel btnExportExcel = new Button(); btnExportExcel.setIcon(FontAwesome.FILE_EXCEL_O); btnExportExcel.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnExportExcel.addStyleName("button-icon"); btnExportExcel .setDescription(applicationContext.getMessage(NAME + ".excel.link", null, getLocale())); String nomFichierXls = applicationContext.getMessage("excel.listeinscrits.title", null, Locale.getDefault()) + "_" + panelFormInscrits.getCaption() + ".xls"; nomFichierXls = nomFichierXls.replaceAll(" ", "_"); StreamResource resourceXls = new StreamResource(new StreamResource.StreamSource() { @Override public InputStream getStream() { //recuperation de l'anne slectionne et du libell de l'ELP String annee = (String) listeAnnees.getValue(); String libObj = panelFormInscrits.getCaption(); //cration du trombi en pdf return listeInscritsController.getXlsStream(linscrits, listecodind, listeGroupes, libObj, annee, typeFavori); } }, nomFichierXls); resourceXls.setMIMEType("application/force-download;charset=UTF-8"); resourceXls.setCacheTime(0); //On ajoute le FD sur le bouton d'export if (PropertyUtils.isPushEnabled()) { new MyFileDownloader(resourceXls).extend(btnExportExcel); } else { FileDownloader fd = new FileDownloader(resourceXls); fd.setOverrideContentType(false); fd.extend(btnExportExcel); } //if(!afficherTrombinoscope){ //On change le bouton d'export pdf par le bouton export excel leftResumeLayout.replaceComponent(btnExportTrombi, btnExportExcel); //} resumeLayout.addComponent(leftResumeLayout); //Middle layout avec les bouton de collapse des colonnes middleResumeLayout = new HorizontalLayout(); middleResumeLayout.setSizeFull(); middleResumeLayout.addStyleName("small-font-element"); middleResumeLayout.setSpacing(true); if (!typeIsVet()) { collapseEtp = new CheckBox( applicationContext.getMessage(NAME + ".collapseEtp.title", null, getLocale())); collapseEtp.setValue(true); collapseEtp.addValueChangeListener(e -> { inscritstable.setColumnCollapsed("etape", !collapseEtp.getValue()); }); collapseEtp.setDescription(applicationContext.getMessage(NAME + ".collapseEtp.description", null, getLocale())); middleResumeLayout.addComponent(collapseEtp); middleResumeLayout.setComponentAlignment(collapseEtp, Alignment.MIDDLE_CENTER); } collapseResultatsS1 = new CheckBox( applicationContext.getMessage(NAME + ".collapseResultatsS1.title", null, getLocale())); collapseResultatsS1.setValue(false); collapseResultatsS1.addValueChangeListener(e -> { inscritstable.setColumnCollapsed("notes1", !collapseResultatsS1.getValue()); }); collapseResultatsS1.setDescription(applicationContext .getMessage(NAME + ".collapseResultatsS1.description", null, getLocale())); middleResumeLayout.addComponent(collapseResultatsS1); middleResumeLayout.setComponentAlignment(collapseResultatsS1, Alignment.MIDDLE_CENTER); collapseResultatsS2 = new CheckBox( applicationContext.getMessage(NAME + ".collapseResultatsS2.title", null, getLocale())); collapseResultatsS2.setValue(false); collapseResultatsS2.addValueChangeListener(e -> { inscritstable.setColumnCollapsed("notes2", !collapseResultatsS2.getValue()); }); collapseResultatsS2.setDescription(applicationContext .getMessage(NAME + ".collapseResultatsS2.description", null, getLocale())); middleResumeLayout.addComponent(collapseResultatsS2); middleResumeLayout.setComponentAlignment(collapseResultatsS2, Alignment.MIDDLE_CENTER); resumeLayout.addComponent(middleResumeLayout); HorizontalLayout buttonResumeLayout = new HorizontalLayout(); buttonResumeLayout.setSizeFull(); buttonResumeLayout.setSpacing(true); //Bouton pour afficher les filtres btnDisplayFiltres = new Button(); btnDisplayFiltres.setWidth("52px"); btnDisplayFiltres.setHeight("32px"); btnDisplayFiltres.setStyleName(ValoTheme.BUTTON_FRIENDLY); btnDisplayFiltres.setIcon(FontAwesome.FILTER); btnDisplayFiltres.setDescription( applicationContext.getMessage(NAME + ".btn.displayFilters", null, getLocale())); btnDisplayFiltres.addClickListener(e -> { panelFormInscrits.setContent(panelLayout); btnDisplayFiltres.setVisible(false); }); buttonResumeLayout.addComponent(btnDisplayFiltres); buttonResumeLayout.setComponentAlignment(btnDisplayFiltres, Alignment.MIDDLE_RIGHT); buttonResumeLayout.setExpandRatio(btnDisplayFiltres, 1); btnDisplayFiltres.setVisible(false); //Bouton trombinoscope btnTrombi = new Button( applicationContext.getMessage(NAME + ".message.trombinoscope", null, getLocale())); if (listeInscritsController.isPhotoProviderOperationnel()) { btnTrombi.setIcon(FontAwesome.GROUP); buttonResumeLayout.addComponent(btnTrombi); //Gestion du clic sur le bouton trombinoscope btnTrombi.addClickListener(e -> { //Si on doit afficher une fentre de loading pendant l'excution if (PropertyUtils.isPushEnabled() && PropertyUtils.isShowLoadingIndicator()) { //affichage de la pop-up de loading MainUI.getCurrent().startBusyIndicator(); //Execution de la mthode en parallle dans un thread executorService.execute(new Runnable() { public void run() { MainUI.getCurrent().access(new Runnable() { @Override public void run() { executeDisplayTrombinoscope(); //close de la pop-up de loading MainUI.getCurrent().stopBusyIndicator(); } }); } }); } else { //On ne doit pas afficher de fentre de loading, on excute directement la mthode executeDisplayTrombinoscope(); } }); buttonResumeLayout.setComponentAlignment(btnTrombi, Alignment.MIDDLE_RIGHT); } //Bouton de retour l'affichage de la liste btnRetourListe = new Button( applicationContext.getMessage(NAME + ".message.retourliste", null, getLocale())); btnRetourListe.setIcon(FontAwesome.BARS); buttonResumeLayout.addComponent(btnRetourListe); //if(!afficherTrombinoscope){ btnRetourListe.setVisible(false); //} //Gestion du clic sur le bouton de retour l'affichage de la liste btnRetourListe.addClickListener(e -> { afficherTrombinoscope = false; btnExportTrombi.setVisible(false); leftResumeLayout.replaceComponent(btnExportTrombi, btnExportExcel); btnTrombi.setVisible(true); btnRetourListe.setVisible(false); dataLayout.removeAllComponents(); dataLayout.addComponent(inscritstable); middleResumeLayout.setVisible(true); }); buttonResumeLayout.setComponentAlignment(btnRetourListe, Alignment.MIDDLE_RIGHT); resumeLayout.addComponent(buttonResumeLayout); infoLayout.addComponent(resumeLayout); //Layout qui contient la liste des inscrits et le trombinoscope dataLayout = new VerticalLayout(); dataLayout.setSizeFull(); //Table contenant la liste des inscrits inscritstable = new Table(null, new BeanItemContainer<>(Inscrit.class, linscrits)); inscritstable.addStyleName("table-without-column-selector"); inscritstable.setSizeFull(); inscritstable.setVisibleColumns(new String[0]); String[] fields = INS_FIELDS_ELP; if (typeIsVet()) { fields = INS_FIELDS_VET; } for (String fieldName : fields) { inscritstable.setColumnHeader(fieldName, applicationContext.getMessage(NAME + ".table." + fieldName, null, getLocale())); } inscritstable.addGeneratedColumn("cod_etu", new CodEtuColumnGenerator()); inscritstable.setColumnHeader("cod_etu", applicationContext.getMessage(NAME + ".table.cod_etu", null, getLocale())); inscritstable.addGeneratedColumn("email", new MailColumnGenerator()); inscritstable.setColumnHeader("email", applicationContext.getMessage(NAME + ".table.email", null, getLocale())); inscritstable.addGeneratedColumn("notes1", new Session1ColumnGenerator()); inscritstable.setColumnHeader("notes1", applicationContext.getMessage(NAME + ".table.notes1", null, getLocale())); inscritstable.addGeneratedColumn("notes2", new Session2ColumnGenerator()); inscritstable.setColumnHeader("notes2", applicationContext.getMessage(NAME + ".table.notes2", null, getLocale())); //Si on est sur un ELP if (typeIsElp()) { //on affiche l'tape de rattachement inscritstable.addGeneratedColumn("etape", new EtapeColumnGenerator()); inscritstable.setColumnHeader("etape", applicationContext.getMessage(NAME + ".table.etape", null, getLocale())); } String[] fields_to_display = INS_FIELDS_TO_DISPLAY_ELP; if (typeIsVet()) { fields_to_display = INS_FIELDS_TO_DISPLAY_VET; } inscritstable.setVisibleColumns((Object[]) fields_to_display); inscritstable.setColumnCollapsingAllowed(true); inscritstable.setColumnReorderingAllowed(false); //On masque les colonnes de notes par dfaut inscritstable.setColumnCollapsed("notes1", true); inscritstable.setColumnCollapsed("notes2", true); inscritstable.setSelectable(false); inscritstable.setImmediate(true); inscritstable.addStyleName("scrollabletable"); //Si on n'a pas dj demand afficher le trombinoscope //if(!afficherTrombinoscope){ //la layout contient la table dataLayout.addComponent(inscritstable); //} //Layout contenant le gridLayout correspondant au trombinoscope verticalLayoutForTrombi = new VerticalLayout(); verticalLayoutForTrombi.setSizeFull(); verticalLayoutForTrombi.addStyleName("v-scrollablepanel"); //Cration du trombinoscope displayTrombinoscope(); verticalLayoutForTrombi.addComponent(trombiLayout); verticalLayoutForTrombi.setSizeFull(); verticalLayoutForTrombi.setHeight(null); //Si on a demand afficher le trombinoscope /*if(afficherTrombinoscope){ //Le layout contient le trombi afficher dataLayout.addComponent(verticalLayoutForTrombi); }*/ infoLayout.addComponent(dataLayout); infoLayout.setExpandRatio(dataLayout, 1); addComponent(infoLayout); setExpandRatio(infoLayout, 1); //Si on a demand afficher le trombinoscope if (afficherTrombinoscope) { //On execute la procdure d'affichage du trombinoscope executeDisplayTrombinoscope(); } } else { Label infoAucuninscrit = new Label( applicationContext.getMessage(NAME + ".message.aucuninscrit", null, getLocale())); addComponent(infoAucuninscrit); setComponentAlignment(infoAucuninscrit, Alignment.TOP_CENTER); setExpandRatio(infoAucuninscrit, 1); } } } }
From source file:org.ripla.web.internal.views.RiplaLogin.java
License:Open Source License
private void createForm(final VerticalLayout inLayout, final IAppConfiguration inConfiguration) { final IMessages lMessages = Activator.getMessages(); final FormLayout lLayout = new FormLayout(); lLayout.setStyleName("ripla-login-form"); //$NON-NLS-1$ lLayout.setWidth(400, Unit.PIXELS);//w w w . jav a 2 s . co m inLayout.addComponent(lLayout); inLayout.setComponentAlignment(lLayout, Alignment.TOP_CENTER); lLayout.addComponent(LabelHelper.createLabel(inConfiguration.getWelcome(), "ripla-welcome")); userid = new TextField(String.format("%s:", lMessages.getMessage("login.field.user"))); //$NON-NLS-1$ //$NON-NLS-2$ lLayout.addComponent(userid); userid.focus(); password = new PasswordField(String.format("%s:", lMessages.getMessage("login.field.pass"))); //$NON-NLS-1$ //$NON-NLS-2$ lLayout.addComponent(password); loginButton = new Button(lMessages.getMessage("login.button")); //$NON-NLS-1$ lLayout.addComponent(loginButton); loginItem = createLoginItem(); final FieldGroup lBinding = new FieldGroup(loginItem); lBinding.bindMemberFields(this); lBinding.setBuffered(false); }