List of usage examples for com.vaadin.ui FormLayout FormLayout
public FormLayout()
From source file:fr.amapj.view.views.mescontrats.PopupAdhesion.java
License:Open Source License
@Override protected void createContent(VerticalLayout contentLayout) { // /*ww w .j a v a 2 s . c o m*/ String entete = getEntete(); Label l = new Label(entete, ContentMode.HTML); l.addStyleName(ChameleonTheme.LABEL_BIG); contentLayout.addComponent(l); // if (canModify == true) { FormLayout f = new FormLayout(); textField = BaseUiTools.createCurrencyField("Montant de votre adhsion", false); textField.setConvertedValue(new Integer(getPropositionMontant())); textField.addStyleName("cell-saisie"); f.addComponent(textField); contentLayout.addComponent(f); } // String bas = getBasPage(); l = new Label(bas, ContentMode.HTML); l.addStyleName(ChameleonTheme.LABEL_BIG); contentLayout.addComponent(l); }
From source file:fr.amapj.view.views.parametres.ParametresView.java
License:Open Source License
/** * //from www . j av a 2 s. co m */ @Override public void enterIn(ViewChangeEvent event) { // Bloc identifiants FormLayout form1 = new FormLayout(); form1.setMargin(false); form1.addStyleName("light"); addComponent(form1); Label section = new Label("Paramtres de l'AMAP"); section.addStyleName("h2"); section.addStyleName("colored"); form1.addComponent(section); nomAmap = addTextField("Nom de l'AMAP ", form1); villeAmap = addTextField("Ville de l'AMAP ", form1); addButton("Changer les paramtres gnraux", e -> handleChangerParam()); final PopupListener listener = this; addButton("Ecran \"Mes contrats\" , Gnralits", e -> CorePopup.open(new PEMesContratsEditorPart(), listener)); addButton("Ecran \"Mes contrats\" , Saisie des paiements par l'amapien", e -> CorePopup.open(new PESaisiePaiementEditorPart(), listener)); addButton("Ecran \"Mes livraisons\"", e -> CorePopup.open(new PEMesLivraisonsEditorPart(), listener)); addButton("Ecran \"Liste des adhrents\"", e -> CorePopup.open(new PEListeAdherentEditorPart(), listener)); addButton("Ecran \"Livraison d'un producteur\"", e -> CorePopup.open(new PELivraisonProducteurEditorPart(), listener)); addButton("Ecran \"Livraison d'un amapien\"", e -> CorePopup.open(new PELivraisonAmapienEditorPart(), listener)); addButton("Ecran \"Rception des chques\"", e -> CorePopup.open(new PEReceptionChequeEditorPart(), listener)); addButton("Ecran \"Synthse multi contrats\"", e -> CorePopup.open(new PESyntheseMultiContratEditorPart(), listener)); refresh(); }
From source file:fr.amapj.view.views.permanence.mespermanences.grille.InscriptionPopup.java
License:Open Source License
@Override protected void createContent(VerticalLayout contentLayout) { ////w w w . ja v a 2 s. c o m UnePeriodePermanenceDTO periodePermanenceDTO = new MesPermanencesService() .loadCompteurPeriodePermanence(idPeriodePermanence, userId); // if (periodePermanenceDTO.nbInscription >= periodePermanenceDTO.nbSouhaite) { Label l = new Label( "Il est impossible de vous inscrire car vous tes dj inscrit sur suffisamment de dates."); contentLayout.addComponent(l); hasSaveButton = false; return; } // On verifie si il faut faire un choix du rle List<Long> roleIds = findRolesId(); if (roleIds.size() == 0) { Label l = new Label("Impossible de vous inscrire - plus de roles."); contentLayout.addComponent(l); hasSaveButton = false; return; } if (roleIds.size() == 1) { Label l = new Label("Etes vous sr de vouloir vous inscrire pour la date du " + FormatUtils.getFullDate().format(date.datePerm) + " ? "); contentLayout.addComponent(l); selectedRole = roleIds.get(0); return; } Label l = new Label("Veuillez choisir votre rle pour vous inscrire la date du " + FormatUtils.getFullDate().format(date.datePerm) + " : "); contentLayout.addComponent(l); FormLayout f = new FormLayout(); box = new Searcher(new SDRoleAllowed(roleIds)); box.setWidth("80%"); f.addComponent(box); contentLayout.addComponent(f); }
From source file:fr.amapj.view.views.permanence.periode.PopupSaisieUtilisateur.java
License:Open Source License
@Override protected void createContent(VerticalLayout contentLayout) { FormLayout f = new FormLayout(); box = new Searcher(new SDUtilisateurPeriodePermanence(dto, toExclude)); box.setWidth("80%"); f.addComponent(box);//from w w w. j a v a 2s.com contentLayout.addComponent(f); }
From source file:fr.amapj.view.views.receptioncheque.PopupSaisieAvoir.java
License:Open Source License
@Override protected void createContent(VerticalLayout contentLayout) { PEReceptionCheque peConf = (PEReceptionCheque) new ParametresService() .loadParamEcran(MenuList.RECEPTION_CHEQUES); boolean allowNegativeNumber = peConf.saisieAvoirNegatif == ChoixOuiNon.OUI; FormLayout f = new FormLayout(); textField = BaseUiTools.createCurrencyField("Montant de l'avoir", allowNegativeNumber); textField.setConvertedValue(new Integer(contratSigneDTO.mntAvoirInitial)); textField.addStyleName("align-center"); textField.addStyleName("big"); String message = "<h3> Saisie d'un avoir pour " + contratSigneDTO.prenomUtilisateur + " " + contratSigneDTO.nomUtilisateur + "</h3>"; f.addComponent(new Label(message, ContentMode.HTML)); f.addComponent(textField);//from w ww. ja va 2s . co m contentLayout.addComponent(f); }
From source file:fr.univlorraine.mondossierweb.views.AdressesView.java
License:Apache License
/** * Initialise la vue//from w w w. j a v a2s . 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) { removeAllComponents(); /* Style */ setMargin(true); setSpacing(true); /* Titre */ Label title = new Label(applicationContext.getMessage(NAME + ".title", null, getLocale())); title.addStyleName(ValoTheme.LABEL_H1); addComponent(title); VerticalLayout globalLayout = new VerticalLayout(); globalLayout.setSizeFull(); globalLayout.setSpacing(true); //Layout avec les infos etatcivil et contact CssLayout idLayout = new CssLayout(); idLayout.setSizeFull(); idLayout.setStyleName("flexwrap"); globalLayout.addComponent(idLayout); // Enable Responsive CSS selectors for the layout Responsive.makeResponsive(idLayout); if (MainUI.getCurrent().getEtudiant().getAdresseAnnuelle() != null) { FormLayout formAdresseAnnuelleLayout = new FormLayout(); formAdresseAnnuelleLayout.setSpacing(true); formAdresseAnnuelleLayout.setMargin(true); Panel panelAdresseAnnuelle = new Panel( applicationContext.getMessage(NAME + ".adresseannuelle.title", null, getLocale()) + " " + MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAnnee()); String captionAdresseAnnuelle = applicationContext.getMessage(NAME + ".adresse.title", null, getLocale()); Label fieldAdresseAnnuelle = new Label(); formatLabel(fieldAdresseAnnuelle, captionAdresseAnnuelle, MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresse1()); formAdresseAnnuelleLayout.addComponent(fieldAdresseAnnuelle); String annuelle2 = valuateTextFieldFromMultipleValues( MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresse2(), MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresse3()); if (annuelle2 != null) { Label fieldAdresseAnnuelle2 = new Label(); formatLabel(fieldAdresseAnnuelle2, null, annuelle2); formAdresseAnnuelleLayout.addComponent(fieldAdresseAnnuelle2); } String captionVilleAnnuelle = applicationContext.getMessage(NAME + ".ville.title", null, getLocale()); Label fieldVilleAnnuelle = new Label(); formatLabel(fieldVilleAnnuelle, captionVilleAnnuelle, valuateTextFieldFromMultipleValues( MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresseetranger(), MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getCodePostal(), MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getVille())); formAdresseAnnuelleLayout.addComponent(fieldVilleAnnuelle); String captionPaysAnnuelle = applicationContext.getMessage(NAME + ".pays.title", null, getLocale()); Label fieldPaysAnnuelle = new Label(); formatLabel(fieldPaysAnnuelle, captionPaysAnnuelle, MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getPays()); formAdresseAnnuelleLayout.addComponent(fieldPaysAnnuelle); String captionTelephoneAnnuelle = applicationContext.getMessage(NAME + ".telephone.title", null, getLocale()); Label fieldTelephoneAnnuelle = new Label(); formatLabel(fieldTelephoneAnnuelle, captionTelephoneAnnuelle, MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getNumerotel()); formAdresseAnnuelleLayout.addComponent(fieldTelephoneAnnuelle); panelAdresseAnnuelle.setContent(formAdresseAnnuelleLayout); HorizontalLayout adresseAnnuelleGlobalLayout = new HorizontalLayout(); adresseAnnuelleGlobalLayout.setSizeUndefined(); adresseAnnuelleGlobalLayout.setStyleName("firstitembox"); adresseAnnuelleGlobalLayout.addComponent(panelAdresseAnnuelle); adresseAnnuelleGlobalLayout.setExpandRatio(panelAdresseAnnuelle, 1); idLayout.addComponent(adresseAnnuelleGlobalLayout); } if (MainUI.getCurrent().getEtudiant().getAdresseFixe() != null) { FormLayout formAdresseFixeLayout = new FormLayout(); formAdresseFixeLayout.setSpacing(true); formAdresseFixeLayout.setMargin(true); Panel panelAdresseFixe = new Panel( applicationContext.getMessage(NAME + ".adressefixe.title", null, getLocale())); String captionAdresseFixe = applicationContext.getMessage(NAME + ".adresse.title", null, getLocale()); Label fieldAdresseFixe = new Label(); formatLabel(fieldAdresseFixe, captionAdresseFixe, MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresse1()); formAdresseFixeLayout.addComponent(fieldAdresseFixe); String adfixe2 = valuateTextFieldFromMultipleValues( MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresse2(), MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresse3()); if (adfixe2 != null) { Label fieldAdresseFixe2 = new Label(); formatLabel(fieldAdresseFixe2, null, adfixe2); formAdresseFixeLayout.addComponent(fieldAdresseFixe2); } String captionVilleFixe = applicationContext.getMessage(NAME + ".ville.title", null, getLocale()); Label fieldVilleFixe = new Label(); formatLabel(fieldVilleFixe, captionVilleFixe, valuateTextFieldFromMultipleValues( MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresseetranger(), MainUI.getCurrent().getEtudiant().getAdresseFixe().getCodePostal(), MainUI.getCurrent().getEtudiant().getAdresseFixe().getVille())); formAdresseFixeLayout.addComponent(fieldVilleFixe); String captionPaysFixe = applicationContext.getMessage(NAME + ".pays.title", null, getLocale()); Label fieldPaysFixe = new Label(); formatLabel(fieldPaysFixe, captionPaysFixe, MainUI.getCurrent().getEtudiant().getAdresseFixe().getPays()); formAdresseFixeLayout.addComponent(fieldPaysFixe); String captionTelephoneFixe = applicationContext.getMessage(NAME + ".telephone.title", null, getLocale()); Label fieldTelephoneFixe = new Label(); formatLabel(fieldTelephoneFixe, captionTelephoneFixe, MainUI.getCurrent().getEtudiant().getAdresseFixe().getNumerotel()); formAdresseFixeLayout.addComponent(fieldTelephoneFixe); panelAdresseFixe.setContent(formAdresseFixeLayout); HorizontalLayout adresseFixeGlobalLayout = new HorizontalLayout(); adresseFixeGlobalLayout.setSizeUndefined(); adresseFixeGlobalLayout.setStyleName("itembox"); adresseFixeGlobalLayout.addComponent(panelAdresseFixe); adresseFixeGlobalLayout.setExpandRatio(panelAdresseFixe, 1); idLayout.addComponent(adresseFixeGlobalLayout); } addComponent(globalLayout); if (userController.isEtudiant() && configController.isModificationAdressesAutorisee() && MainUI.getCurrent().getEtudiant().getAdresseAnnuelle() != null) { HorizontalLayout btnLayout = new HorizontalLayout(); btnLayout.setSizeFull(); btnLayout.setSpacing(true); Button btnModifAdresses = new Button( applicationContext.getMessage(NAME + ".bouton.modifieradresses", null, getLocale())); btnModifAdresses.setStyleName(ValoTheme.BUTTON_PRIMARY); btnModifAdresses.setIcon(FontAwesome.EDIT); btnModifAdresses.addClickListener(e -> { ModificationAdressesWindow maw = new ModificationAdressesWindow( MainUI.getCurrent().getEtudiant()); maw.addCloseListener(f -> { init(); }); UI.getCurrent().addWindow(maw); }); btnLayout.addComponent(btnModifAdresses); btnLayout.setComponentAlignment(btnModifAdresses, Alignment.MIDDLE_LEFT); addComponent(btnLayout); } } }
From source file:fr.univlorraine.mondossierweb.views.EtatCivilView.java
License:Apache License
/** * Initialise la vue// ww w . j a va 2 s. c o m */ @PostConstruct public void init() { LOG.debug(userController.getCurrentUserName() + " EtatCivilView"); //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MainUI && (userController.isEnseignant() || userController.isEtudiant())) { if (MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) { LOG.debug(userController.getCurrentUserName() + " init EtatCivilView"); /* Style */ setMargin(true); setSpacing(true); /* Titre */ Label title = new Label(applicationContext.getMessage(NAME + ".title", null, getLocale())); title.addStyleName(ValoTheme.LABEL_H1); addComponent(title); VerticalLayout globalLayout = new VerticalLayout(); globalLayout.setSizeFull(); globalLayout.setSpacing(true); //Layout avec les infos etatcivil et contact CssLayout idLayout = new CssLayout(); idLayout.setSizeFull(); idLayout.setStyleName("flexwrap"); globalLayout.addComponent(idLayout); // Enable Responsive CSS selectors for the layout Responsive.makeResponsive(idLayout); /* Generalites */ FormLayout formGeneralitesLayout = new FormLayout(); formGeneralitesLayout.setSpacing(true); formGeneralitesLayout.setMargin(true); Panel panelGeneralites = new Panel( applicationContext.getMessage(NAME + ".generalites.title", null, getLocale())); String captionNumDossier = applicationContext.getMessage(NAME + ".numdossier.title", null, getLocale()); Label fieldNumDossier = new Label(); formatLabel(fieldNumDossier, captionNumDossier, MainUI.getCurrent().getEtudiant().getCod_etu()); formGeneralitesLayout.addComponent(fieldNumDossier); String captionNNE = applicationContext.getMessage(NAME + ".nne.title", null, getLocale()); Label fieldNNE = new Label(); formatLabel(fieldNNE, captionNNE, MainUI.getCurrent().getEtudiant().getCod_nne()); formGeneralitesLayout.addComponent(fieldNNE); String captionNom = applicationContext.getMessage(NAME + ".nom.title", null, getLocale()); Label fieldNom = new Label(); formatLabel(fieldNom, captionNom, MainUI.getCurrent().getEtudiant().getNom()); formGeneralitesLayout.addComponent(fieldNom); String captionMail = applicationContext.getMessage(NAME + ".mail.title", null, getLocale()); Label mailLabel = new Label(); mailLabel.setCaption(captionMail); String mail = MainUI.getCurrent().getEtudiant().getEmail(); if (StringUtils.hasText(mail)) { mail = "<a href=\"mailto:" + mail + "\">" + mail + "</a>"; mailLabel.setValue(mail); mailLabel.setContentMode(ContentMode.HTML); } mailLabel.setSizeFull(); formGeneralitesLayout.addComponent(mailLabel); String captionNationalite = applicationContext.getMessage(NAME + ".nationalite.title", null, getLocale()); Label fieldNationalite = new Label(); formatLabel(fieldNationalite, captionNationalite, MainUI.getCurrent().getEtudiant().getNationalite()); formGeneralitesLayout.addComponent(fieldNationalite); String captionDateNaissance = applicationContext.getMessage(NAME + ".naissance.title", null, getLocale()); Label fieldDateNaissance = new Label(); formatLabel(fieldDateNaissance, captionDateNaissance, MainUI.getCurrent().getEtudiant().getDatenaissance()); formGeneralitesLayout.addComponent(fieldDateNaissance); String captionLieuNaissance = applicationContext.getMessage(NAME + ".lieunaissance.title", null, getLocale()); Label fieldLieuNaissance = new Label(); formatLabel(fieldLieuNaissance, captionLieuNaissance, MainUI.getCurrent().getEtudiant().getLieunaissance()); formGeneralitesLayout.addComponent(fieldLieuNaissance); String captionDepNaissance = applicationContext.getMessage(NAME + ".depnaissance.title", null, getLocale()); Label fieldDepNaissance = new Label(); formatLabel(fieldDepNaissance, captionDepNaissance, MainUI.getCurrent().getEtudiant().getDepartementnaissance()); formGeneralitesLayout.addComponent(fieldDepNaissance); panelGeneralites.setContent(formGeneralitesLayout); HorizontalLayout generalitesGlobalLayout = new HorizontalLayout(); generalitesGlobalLayout.setSizeUndefined(); generalitesGlobalLayout.setStyleName("firstitembox"); generalitesGlobalLayout.addComponent(panelGeneralites); generalitesGlobalLayout.setExpandRatio(panelGeneralites, 1); idLayout.addComponent(generalitesGlobalLayout); /* Bac */ Panel panelBac = new Panel(applicationContext.getMessage(NAME + ".bac.title", null, getLocale())); //Si plusieurs bac if (MainUI.getCurrent().getEtudiant().getListeBac() != null && MainUI.getCurrent().getEtudiant().getListeBac().size() > 1) { panelBac.setCaption(applicationContext.getMessage(NAME + ".bacs.title", null, getLocale())); TabSheet bacTabSheet = new TabSheet(); VerticalLayout vBacLayout = new VerticalLayout(); vBacLayout.setSizeFull(); bacTabSheet.setSizeFull(); bacTabSheet.addStyleName(ValoTheme.TABSHEET_FRAMED); for (BacEtatCivil bec : MainUI.getCurrent().getEtudiant().getListeBac()) { FormLayout tabBacLayout = new FormLayout(); tabBacLayout.setSizeFull(); tabBacLayout.setMargin(false); ajouterBacToView(tabBacLayout, bec); bacTabSheet.addTab(tabBacLayout, bec.getCod_bac(), FontAwesome.GRADUATION_CAP); } vBacLayout.addComponent(bacTabSheet); panelBac.setContent(vBacLayout); } else { //Si un seul bac FormLayout formBacLayout = new FormLayout(); formBacLayout.setSizeFull(); if (MainUI.getCurrent().getEtudiant().getListeBac() != null && MainUI.getCurrent().getEtudiant().getListeBac().size() == 1) { formBacLayout.setSpacing(true); formBacLayout.setMargin(true); ajouterBacToView(formBacLayout, MainUI.getCurrent().getEtudiant().getListeBac().get(0)); } panelBac.setContent(formBacLayout); } HorizontalLayout bacGlobalLayout = new HorizontalLayout(); bacGlobalLayout.setSizeUndefined(); bacGlobalLayout.setStyleName("itembox"); bacGlobalLayout.addComponent(panelBac); bacGlobalLayout.setExpandRatio(panelBac, 1); idLayout.addComponent(bacGlobalLayout); /* Info de contact */ panelContact = new Panel(applicationContext.getMessage(NAME + ".contact.title", null, getLocale())); renseignerPanelContact(); globalLayout.addComponent(panelContact); addComponent(globalLayout); } else { /* Erreur */ addComponent(new BasicErreurMessageLayout(applicationContext)); } } }
From source file:fr.univlorraine.mondossierweb.views.EtatCivilView.java
License:Apache License
private void renseignerPanelContact() { VerticalLayout contactLayout = new VerticalLayout(); /* Layout pour afficher les erreurs */ VerticalLayout erreursLayout = new VerticalLayout(); contactLayout.addComponent(erreursLayout); erreursLayout.setVisible(false);/*from w ww . j ava 2 s .com*/ /* Layout avec les champ 'Portable' et 'Email personnel' */ FormLayout formContactLayout = new FormLayout(); formContactLayout.setSpacing(true); formContactLayout.setMargin(true); String captionTelPortable = applicationContext.getMessage(NAME + ".portable.title", null, getLocale()); fieldTelPortable = new TextField(captionTelPortable, MainUI.getCurrent().getEtudiant().getTelPortable()); formatTextField(fieldTelPortable); fieldTelPortable.setMaxLength(15); formContactLayout.addComponent(fieldTelPortable); if (userController.isEtudiant()) { String captionMailPerso = applicationContext.getMessage(NAME + ".mailperso.title", null, getLocale()); fieldMailPerso = new TextField(captionMailPerso, MainUI.getCurrent().getEtudiant().getEmailPerso()); formatTextField(fieldMailPerso); fieldMailPerso.setMaxLength(200); formContactLayout.addComponent(fieldMailPerso); } contactLayout.addComponent(formContactLayout); /* Si user tudiant , modifications autorise des coordonnes de contact * et si l'tudiant possde une addresse annuelle, on affiche les boutons de modification */ if (userController.isEtudiant() && configController.isModificationCoordonneesPersoAutorisee() && MainUI.getCurrent().getEtudiant().getAdresseAnnuelle() != null) { //Layout pour les boutons de modification HorizontalLayout btnLayout = new HorizontalLayout(); btnLayout.setSizeFull(); btnLayout.setSpacing(true); btnLayout.setMargin(true); //Bouton pour valider la modification btnValidModifCoordonneesPerso = new Button( applicationContext.getMessage(NAME + ".bouton.validercoordonnees", null, getLocale())); btnValidModifCoordonneesPerso.setStyleName(ValoTheme.BUTTON_FRIENDLY); btnValidModifCoordonneesPerso.setIcon(FontAwesome.CHECK); btnValidModifCoordonneesPerso.addClickListener(e -> { erreursLayout.removeAllComponents(); List<String> retour = etudiantController.updateContact(fieldTelPortable.getValue(), fieldMailPerso.getValue(), MainUI.getCurrent().getEtudiant().getCod_etu()); //si modif ok if (retour != null && retour.size() == 1 && retour.get(0).equals("OK")) { etudiantController.recupererEtatCivil(); renseignerPanelContact(); } else { //affichage erreurs if (retour != null && retour.size() > 0) { String errorMsg = ""; for (String erreur : retour) { if (!errorMsg.equals("")) errorMsg = errorMsg + "<br />"; errorMsg = errorMsg + erreur; } Label labelErreur = new Label(errorMsg); labelErreur.setContentMode(ContentMode.HTML); labelErreur.setStyleName(ValoTheme.LABEL_FAILURE); erreursLayout.addComponent(labelErreur); } erreursLayout.setVisible(true); } }); btnValidModifCoordonneesPerso.setVisible(false); btnLayout.addComponent(btnValidModifCoordonneesPerso); btnLayout.setComponentAlignment(btnValidModifCoordonneesPerso, Alignment.MIDDLE_CENTER); //Bouton pour annuler la modification btnAnnulerModifCoordonneesPerso = new Button( applicationContext.getMessage(NAME + ".bouton.annulercoordonnees", null, getLocale())); btnAnnulerModifCoordonneesPerso.setStyleName(ValoTheme.BUTTON_DANGER); btnAnnulerModifCoordonneesPerso.setIcon(FontAwesome.TIMES); btnAnnulerModifCoordonneesPerso.addClickListener(e -> { erreursLayout.removeAllComponents(); fieldMailPerso.setValue(MainUI.getCurrent().getEtudiant().getEmailPerso()); fieldMailPerso.setEnabled(false); fieldMailPerso.addStyleName(ValoTheme.TEXTFIELD_BORDERLESS); fieldTelPortable.setValue(MainUI.getCurrent().getEtudiant().getTelPortable()); fieldTelPortable.setEnabled(false); fieldTelPortable.addStyleName(ValoTheme.TEXTFIELD_BORDERLESS); btnValidModifCoordonneesPerso.setVisible(false); btnAnnulerModifCoordonneesPerso.setVisible(false); btnModifCoordonneesPerso.setVisible(true); }); btnAnnulerModifCoordonneesPerso.setVisible(false); btnLayout.addComponent(btnAnnulerModifCoordonneesPerso); btnLayout.setComponentAlignment(btnAnnulerModifCoordonneesPerso, Alignment.MIDDLE_CENTER); //Bouton pour activer la modification des donnes btnModifCoordonneesPerso = new Button( applicationContext.getMessage(NAME + ".bouton.modifiercoordonnees", null, getLocale())); btnModifCoordonneesPerso.setStyleName(ValoTheme.BUTTON_PRIMARY); btnModifCoordonneesPerso.setIcon(FontAwesome.EDIT); btnModifCoordonneesPerso.addClickListener(e -> { fieldMailPerso.setEnabled(true); fieldMailPerso.removeStyleName(ValoTheme.TEXTFIELD_BORDERLESS); fieldTelPortable.setEnabled(true); fieldTelPortable.removeStyleName(ValoTheme.TEXTFIELD_BORDERLESS); btnValidModifCoordonneesPerso.setVisible(true); btnAnnulerModifCoordonneesPerso.setVisible(true); btnModifCoordonneesPerso.setVisible(false); }); btnLayout.addComponent(btnModifCoordonneesPerso); btnLayout.setComponentAlignment(btnModifCoordonneesPerso, Alignment.MIDDLE_CENTER); contactLayout.addComponent(btnLayout); } panelContact.setContent(contactLayout); }
From source file:fr.univlorraine.mondossierweb.views.FavorisMobileView.java
License:Apache License
/** * Initialise la vue/*from w ww . ja va2 s .c om*/ */ @PostConstruct public void init() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MdwTouchkitUI && userController.isEnseignant()) { removeAllComponents(); /* Style */ setSizeFull(); liste_types_inscrits = new LinkedList<String>(); liste_types_inscrits.add("ELP"); liste_types_inscrits.add("VET"); liste_type_arbo = new LinkedList<String>(); liste_type_arbo.add("CMP"); liste_type_arbo.add("VET"); List<Favoris> lfav = favorisController.getFavoris(); //NAVBAR HorizontalLayout navbar = new HorizontalLayout(); navbar.setSizeFull(); navbar.setHeight("40px"); navbar.setStyleName("navigation-bar"); //Bouton info infoButton = new Button(); infoButton.setIcon(FontAwesome.INFO); infoButton.setStyleName("v-nav-button"); infoButton.addClickListener(e -> { /** * NOUVELLE VERSION */ Notification note = new Notification( applicationContext.getMessage("helpWindowMobile.text.enseignant", null, getLocale()), "", Notification.TYPE_TRAY_NOTIFICATION, true); note.setPosition(Position.MIDDLE_CENTER); note.setDelayMsec(6000); note.show(UI.getCurrent().getPage()); /** * ANCIENNE VERSION */ /* //afficher message HelpMobileWindow hbw = new HelpMobileWindow(applicationContext.getMessage("helpWindowMobile.text.enseignant", null, getLocale()),applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale()),false); UI.getCurrent().addWindow(hbw); */ }); navbar.addComponent(infoButton); navbar.setComponentAlignment(infoButton, Alignment.MIDDLE_LEFT); //Title Label labelFav = new Label(applicationContext.getMessage(NAME + ".title.label", null, getLocale())); labelFav.setStyleName("v-label-navbar"); navbar.addComponent(labelFav); navbar.setComponentAlignment(labelFav, Alignment.MIDDLE_CENTER); //Bouton Search Button searchButton = new Button(); searchButton.setIcon(FontAwesome.SEARCH); searchButton.setStyleName("v-nav-button"); navbar.addComponent(searchButton); navbar.setComponentAlignment(searchButton, Alignment.MIDDLE_RIGHT); searchButton.addClickListener(e -> { ((MdwTouchkitUI) MdwTouchkitUI.getCurrent()).navigateToRecherche(NAME); }); navbar.setExpandRatio(labelFav, 1); addComponent(navbar); VerticalLayout globalLayout = new VerticalLayout(); globalLayout.setSizeFull(); globalLayout.setSpacing(true); globalLayout.setMargin(true); FormLayout labelLayout = new FormLayout(); labelLayout.setSizeFull(); labelLayout.setMargin(false); labelLayout.setSpacing(false); Label infoLabel = new Label(applicationContext.getMessage(NAME + ".info.label", null, getLocale())); infoLabel.setStyleName(ValoTheme.LABEL_SMALL); infoLabel.setIcon(FontAwesome.INFO_CIRCLE); infoLabel.setWidth("100%"); labelLayout.addComponent(infoLabel); globalLayout.addComponent(labelLayout); if (lfav != null && lfav.size() > 0) { if (favorisContientVet(lfav)) { Panel vetPanel = new Panel( applicationContext.getMessage(NAME + ".vetpanel.title", null, getLocale())); vetPanel.setStyleName("centertitle-panel"); vetPanel.addStyleName("v-colored-panel-caption"); vetPanel.setSizeFull(); VerticalLayout vetLayout = new VerticalLayout(); vetLayout.setSizeFull(); vetLayout.setHeight(null); int i = 0; for (Favoris fav : lfav) { if (fav.getId().getTypfav().equals(Utils.VET)) { i++; HorizontalLayout favVetLayout = new HorizontalLayout(); favVetLayout.setSizeFull(); favVetLayout.setMargin(true); favVetLayout.setSpacing(true); favVetLayout.setStyleName("v-layout-multiline"); favVetLayout.setWidth("100%"); favVetLayout.setHeight("100%"); Button codeButton = new Button(fav.getId().getIdfav()); codeButton.setCaption(fav.getId().getIdfav()); Utils.setButtonStyle(codeButton); codeButton.setWidth("90px"); codeButton.addClickListener(e -> { accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav()); }); Button libButton = new Button(favorisController.getLibObjFavori(fav.getId().getTypfav(), fav.getId().getIdfav())); Utils.setButtonStyle(libButton); libButton.setHeight("100%"); libButton.setWidth("100%"); libButton.addClickListener(e -> { accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav()); }); favVetLayout.addComponent(codeButton); //favVetLayout.setComponentAlignment(codeButton, Alignment.MIDDLE_CENTER); favVetLayout.addComponent(libButton); favVetLayout.setComponentAlignment(libButton, Alignment.MIDDLE_CENTER); favVetLayout.setExpandRatio(libButton, 1); vetLayout.addComponent(favVetLayout); if (i > 1) { favVetLayout.addStyleName("line-separator"); } } } vetPanel.setContent(vetLayout); globalLayout.addComponent(vetPanel); } if (favorisContientElp(lfav)) { Panel elpPanel = new Panel( applicationContext.getMessage(NAME + ".elppanel.title", null, getLocale())); elpPanel.setStyleName("centertitle-panel"); elpPanel.addStyleName("v-colored-panel-caption"); elpPanel.setSizeFull(); VerticalLayout elpLayout = new VerticalLayout(); elpLayout.setSizeFull(); elpLayout.setHeight(null); int i = 0; for (Favoris fav : lfav) { if (fav.getId().getTypfav().equals(Utils.ELP)) { i++; HorizontalLayout favElpLayout = new HorizontalLayout(); favElpLayout.setSizeFull(); favElpLayout.setMargin(true); favElpLayout.setSpacing(true); favElpLayout.setStyleName("v-layout-multiline"); favElpLayout.setWidth("100%"); favElpLayout.setHeight("100%"); Button codeButton = new Button(fav.getId().getIdfav()); Utils.setButtonStyle(codeButton); codeButton.setWidth("90px"); codeButton.addClickListener(e -> { accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav()); }); Button libButton = new Button(favorisController.getLibObjFavori(fav.getId().getTypfav(), fav.getId().getIdfav())); Utils.setButtonStyle(libButton); libButton.setHeight("100%"); libButton.setWidth("100%"); libButton.addClickListener(e -> { accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav()); }); favElpLayout.addComponent(codeButton); favElpLayout.addComponent(libButton); favElpLayout.setComponentAlignment(libButton, Alignment.MIDDLE_CENTER); favElpLayout.setExpandRatio(libButton, 1); elpLayout.addComponent(favElpLayout); if (i > 1) { favElpLayout.addStyleName("line-separator"); } } } elpPanel.setContent(elpLayout); globalLayout.addComponent(elpPanel); } } labelAucunFavoriLayout = new HorizontalLayout(); labelAucunFavoriLayout.setMargin(true); labelAucunFavoriLayout.setSizeFull(); Button aucunFavoris = new Button( applicationContext.getMessage(NAME + ".favoris.aucun", null, getLocale())); aucunFavoris.setStyleName("v-nav-button"); aucunFavoris.addStyleName(ValoTheme.BUTTON_LINK); aucunFavoris.addClickListener(e -> { ((MdwTouchkitUI) MdwTouchkitUI.getCurrent()).navigateToRecherche(NAME); }); labelAucunFavoriLayout.addComponent(aucunFavoris); labelAucunFavoriLayout.setVisible(false); globalLayout.addComponent(labelAucunFavoriLayout); if (lfav == null || lfav.size() == 0) { labelAucunFavoriLayout.setVisible(true); } //addComponent(globalLayout); contentLayout.setStyleName("v-scrollableelement"); contentLayout.addComponent(globalLayout); addComponent(contentLayout); setExpandRatio(contentLayout, 1); } }
From source file:fr.univlorraine.mondossierweb.views.InformationsAnnuellesMobileView.java
License:Apache License
public void refresh() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MdwTouchkitUI && (userController.isEnseignant() || userController.isEtudiant()) && MdwTouchkitUI.getCurrent() != null && MdwTouchkitUI.getCurrent().getEtudiant() != null) { removeAllComponents();//w w w .j a v a 2s . c o m /* Style */ setMargin(false); setSpacing(false); setSizeFull(); //NAVBAR HorizontalLayout navbar = new HorizontalLayout(); navbar.setSizeFull(); navbar.setHeight("40px"); navbar.setStyleName("navigation-bar"); //Bouton retour if (userController.isEnseignant()) { returnButton = new Button(); returnButton.setIcon(FontAwesome.ARROW_LEFT); //returnButton.setStyleName(ValoTheme.BUTTON_ICON_ONLY); returnButton.setStyleName("v-nav-button"); returnButton.addClickListener(e -> { if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent() .getDossierEtuFromView().equals(ListeInscritsMobileView.NAME)) { MdwTouchkitUI.getCurrent().navigateToListeInscrits(); } else { if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent() .getDossierEtuFromView().equals(RechercheMobileView.NAME)) { MdwTouchkitUI.getCurrent().navigateToRecherche(null); } } }); navbar.addComponent(returnButton); navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT); } //Title Label labelTrombi = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom()); labelTrombi.setStyleName("v-label-navbar"); navbar.addComponent(labelTrombi); navbar.setComponentAlignment(labelTrombi, Alignment.MIDDLE_CENTER); if (userController.isEnseignant()) { //Si on ne peut pas dj revenir sur la recherche via le bouton 'retour' if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() == null || !MdwTouchkitUI.getCurrent().getDossierEtuFromView().equals(RechercheMobileView.NAME)) { //Bouton Search Button searchButton = new Button(); searchButton.setIcon(FontAwesome.SEARCH); searchButton.setStyleName("v-nav-button"); navbar.addComponent(searchButton); navbar.setComponentAlignment(searchButton, Alignment.MIDDLE_RIGHT); searchButton.addClickListener(e -> { ((MdwTouchkitUI) MdwTouchkitUI.getCurrent()).navigateToRecherche(NAME); }); } } navbar.setExpandRatio(labelTrombi, 1); addComponent(navbar); VerticalLayout globalLayout = new VerticalLayout(); //globalLayout.setSizeFull(); globalLayout.setSpacing(true); globalLayout.setMargin(true); globalLayout.setStyleName("v-scrollableelement"); VerticalLayout slimLayout = new VerticalLayout(); slimLayout.setSpacing(false); slimLayout.setMargin(false); //slimLayout.setStyleName("v-scrollableelement"); String mail = MdwTouchkitUI.getCurrent().getEtudiant().getEmail(); if (StringUtils.hasText(mail)) { Panel mailPanel = new Panel(); mailPanel.setStyleName("panel-without-bottom-line-separator"); HorizontalLayout mailLayout = new HorizontalLayout(); mailLayout.setSizeFull(); mailLayout.setHeight("25px"); Label mailLabel = new Label(); mail = "<a href=\"mailto:" + mail + "\">" + mail + "</a>"; mailLabel.setValue(mail); mailLabel.setContentMode(ContentMode.HTML); mailLabel.setSizeFull(); mailLabel.addStyleName("label-centre"); mailLayout.addComponent(mailLabel); mailLayout.setComponentAlignment(mailLabel, Alignment.MIDDLE_CENTER); mailPanel.setContent(mailLayout); slimLayout.addComponent(mailPanel); slimLayout.setComponentAlignment(mailPanel, Alignment.MIDDLE_CENTER); } Panel etuPanel = new Panel(); HorizontalLayout photoLayout = new HorizontalLayout(); photoLayout.setId(MdwTouchkitUI.getCurrent().getEtudiant().getCod_ind()); photoLayout.setSizeFull(); if (MdwTouchkitUI.getCurrent().getEtudiant().getPhoto() != null) { Image fotoEtudiant = new Image(null, new ExternalResource(MdwTouchkitUI.getCurrent().getEtudiant().getPhoto())); fotoEtudiant.setWidth("120px"); fotoEtudiant.setStyleName(ValoTheme.BUTTON_LINK); photoLayout.addComponent(fotoEtudiant); } VerticalLayout nomCodeLayout = new VerticalLayout(); //nomCodeLayout.setSizeFull(); nomCodeLayout.setSpacing(false); Label labelNomEtudiant = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom()); labelNomEtudiant.setSizeFull(); labelNomEtudiant.setStyleName(ValoTheme.LABEL_BOLD); labelNomEtudiant.addStyleName("label-centre"); nomCodeLayout.addComponent(labelNomEtudiant); nomCodeLayout.setComponentAlignment(labelNomEtudiant, Alignment.MIDDLE_CENTER); //nomCodeLayout.setExpandRatio(labelNomEtudiant, 1); Label codetuLabel = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getCod_etu()); codetuLabel.setSizeFull(); codetuLabel.setStyleName(ValoTheme.LABEL_TINY); codetuLabel.addStyleName("label-centre"); nomCodeLayout.addComponent(codetuLabel); nomCodeLayout.setComponentAlignment(codetuLabel, Alignment.MIDDLE_CENTER); photoLayout.addComponent(nomCodeLayout); photoLayout.setComponentAlignment(nomCodeLayout, Alignment.MIDDLE_CENTER); photoLayout.setExpandRatio(nomCodeLayout, 1); etuPanel.setContent(photoLayout); slimLayout.addComponent(etuPanel); slimLayout.setComponentAlignment(etuPanel, Alignment.MIDDLE_CENTER); globalLayout.addComponent(slimLayout); Panel panelInfos = new Panel(applicationContext.getMessage(NAME + ".infos.title", null, getLocale()) + " " + Utils.getAnneeUniversitaireEnCours( etudiantController.getAnneeUnivEnCours(MdwTouchkitUI.getCurrent()))); panelInfos.setStyleName("centertitle-panel"); panelInfos.addStyleName("v-colored-panel-caption"); //Si l'tudiant est inscrit pour l'anne en cours if (MdwTouchkitUI.getCurrent().getEtudiant().isInscritPourAnneeEnCours()) { FormLayout formInfosLayout = new FormLayout(); formInfosLayout.setSpacing(true); formInfosLayout.setMargin(true); //Numro Anonymat visible que si l'utilisateur est tudiant List<Anonymat> lano = null; if (!userController.isEnseignant() && userController.isEtudiant()) { lano = MdwTouchkitUI.getCurrent().getEtudiant().getNumerosAnonymat(); if (lano != null) { //Si l'tudiant n'a qu'un seul numro d'anonymat if (lano.size() == 1) { String captionNumAnonymat = applicationContext.getMessage(NAME + ".numanonymat.title", null, getLocale()); TextField fieldNumAnonymat = new TextField(captionNumAnonymat, MdwTouchkitUI .getCurrent().getEtudiant().getNumerosAnonymat().get(0).getCod_etu_ano()); formatTextField(fieldNumAnonymat); //fieldNumAnonymat.setIcon(FontAwesome.INFO_CIRCLE); //fieldNumAnonymat.setDescription(applicationContext.getMessage(NAME+".numanonymat.description", null, getLocale())); formInfosLayout.addComponent(fieldNumAnonymat); } //Si l'tudiant a plusieurs numros d'anonymat if (lano.size() > 1) { int i = 0; for (Anonymat ano : lano) { String captionNumAnonymat = ""; if (i == 0) { //Pour le premier numro affich on affiche le libell du champ captionNumAnonymat = applicationContext.getMessage(NAME + ".numanonymats.title", null, getLocale()); } TextField fieldNumAnonymat = new TextField(captionNumAnonymat, ano.getCod_etu_ano() + " (" + ano.getLib_man() + ")"); formatTextField(fieldNumAnonymat); if (i == 0) { //Pour le premier numro affich on affiche l'info bulle //fieldNumAnonymat.setIcon(FontAwesome.INFO_CIRCLE); //fieldNumAnonymat.setDescription(applicationContext.getMessage(NAME+".numanonymat.description", null, getLocale())); } formInfosLayout.addComponent(fieldNumAnonymat); i++; } } } } String captionBousier = applicationContext.getMessage(NAME + ".boursier.title", null, getLocale()); TextField fieldNumBoursier = new TextField(captionBousier, MdwTouchkitUI.getCurrent().getEtudiant().isBoursier() ? applicationContext.getMessage(NAME + ".boursier.oui", null, getLocale()) : applicationContext.getMessage(NAME + ".boursier.non", null, getLocale())); formatTextField(fieldNumBoursier); formInfosLayout.addComponent(fieldNumBoursier); String captionSalarie = applicationContext.getMessage(NAME + ".salarie.title", null, getLocale()); TextField fieldSalarie = new TextField(captionSalarie, MdwTouchkitUI.getCurrent().getEtudiant().isTemSalarie() == true ? applicationContext.getMessage(NAME + ".salarie.oui", null, getLocale()) : applicationContext.getMessage(NAME + ".salarie.non", null, getLocale())); formatTextField(fieldSalarie); formInfosLayout.addComponent(fieldSalarie); String captionAmenagementEtude = applicationContext.getMessage(NAME + ".amenagementetude.title", null, getLocale()); TextField fieldAmenagementEtude = new TextField(captionAmenagementEtude, MdwTouchkitUI.getCurrent().getEtudiant().isTemAmenagementEtude() == true ? applicationContext.getMessage(NAME + ".amenagementetude.oui", null, getLocale()) : applicationContext.getMessage(NAME + ".amenagementetude.non", null, getLocale())); formatTextField(fieldAmenagementEtude); formInfosLayout.addComponent(fieldAmenagementEtude); panelInfos.setContent(formInfosLayout); } else { HorizontalLayout labelNonInscritLayout = new HorizontalLayout(); labelNonInscritLayout.setMargin(true); labelNonInscritLayout.setSizeFull(); Label labelNonInscrit = new Label( applicationContext.getMessage(NAME + ".inscrit.non", null, getLocale())); labelNonInscrit.setStyleName(ValoTheme.LABEL_COLORED); labelNonInscrit.addStyleName(ValoTheme.LABEL_BOLD); labelNonInscrit.setWidth("100%"); labelNonInscrit.addStyleName("label-centre"); labelNonInscritLayout.addComponent(labelNonInscrit); panelInfos.setContent(labelNonInscritLayout); } globalLayout.addComponent(panelInfos); addComponent(globalLayout); setExpandRatio(globalLayout, 1); } }