List of usage examples for com.vaadin.ui FormLayout setMargin
@Override public void setMargin(boolean enabled)
From source file:eu.maxschuster.vaadin.signaturefield.demo.DemoUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { getPage().setTitle(pageTitle);/*from w ww. j a v a 2s . c o m*/ final VerticalLayout margin = new VerticalLayout(); setContent(margin); final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setWidth("658px"); margin.addComponent(layout); margin.setComponentAlignment(layout, Alignment.TOP_CENTER); final Label header1 = new Label(pageTitle); header1.addStyleName("h1"); header1.setSizeUndefined(); layout.addComponent(header1); layout.setComponentAlignment(header1, Alignment.TOP_CENTER); final TabSheet tabSheet = new TabSheet(); tabSheet.setWidth("100%"); layout.addComponent(tabSheet); layout.setComponentAlignment(tabSheet, Alignment.TOP_CENTER); final Panel signaturePanel = new Panel(); signaturePanel.addStyleName("signature-panel"); signaturePanel.setWidth("100%"); tabSheet.addTab(signaturePanel, "Demo"); final VerticalLayout signatureLayout = new VerticalLayout(); signatureLayout.setMargin(true); signatureLayout.setSpacing(true); signatureLayout.setSizeFull(); signaturePanel.setContent(signatureLayout); final SignatureField signatureField = new SignatureField(); signatureField.setWidth("100%"); signatureField.setHeight("318px"); signatureField.setPenColor(Color.ULTRAMARINE); signatureField.setBackgroundColor("white"); signatureField.setConverter(new StringToDataUrlConverter()); signatureField.setPropertyDataSource(dataUrlProperty); signatureField.setVelocityFilterWeight(0.7); signatureLayout.addComponent(signatureField); signatureLayout.setComponentAlignment(signatureField, Alignment.MIDDLE_CENTER); final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.setWidth("100%"); signatureLayout.addComponent(buttonLayout); final Button clearButton = new Button("Clear", new ClickListener() { @Override public void buttonClick(ClickEvent event) { signatureField.clear(); } }); buttonLayout.addComponent(clearButton); buttonLayout.setComponentAlignment(clearButton, Alignment.MIDDLE_LEFT); final Label message = new Label("Sign above"); message.setSizeUndefined(); buttonLayout.addComponent(message); buttonLayout.setComponentAlignment(message, Alignment.MIDDLE_CENTER); final ButtonLink saveButtonLink = new ButtonLink("Save", null); saveButtonLink.setTargetName("_blank"); buttonLayout.addComponent(saveButtonLink); buttonLayout.setComponentAlignment(saveButtonLink, Alignment.MIDDLE_RIGHT); final Panel optionsPanel = new Panel(); optionsPanel.setSizeFull(); tabSheet.addTab(optionsPanel, "Options"); final FormLayout optionsLayout = new FormLayout(); optionsLayout.setMargin(true); optionsLayout.setSpacing(true); optionsPanel.setContent(optionsLayout); final ComboBox mimeTypeComboBox = new ComboBox(null, mimeTypeContainer); optionsLayout.addComponent(mimeTypeComboBox); mimeTypeComboBox.setItemCaptionPropertyId("mimeType"); mimeTypeComboBox.setNullSelectionAllowed(false); mimeTypeComboBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { MimeType mimeType = (MimeType) event.getProperty().getValue(); signatureField.setMimeType(mimeType); } }); mimeTypeComboBox.setValue(MimeType.PNG); mimeTypeComboBox.setCaption("Result MIME-Type"); final CheckBox immediateCheckBox = new CheckBox("immediate", false); optionsLayout.addComponent(immediateCheckBox); immediateCheckBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean immediate = (Boolean) event.getProperty().getValue(); signatureField.setImmediate(immediate); } }); final CheckBox readOnlyCheckBox = new CheckBox("readOnly", false); optionsLayout.addComponent(readOnlyCheckBox); readOnlyCheckBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean readOnly = (Boolean) event.getProperty().getValue(); signatureField.setReadOnly(readOnly); mimeTypeComboBox.setReadOnly(readOnly); clearButton.setEnabled(!readOnly); } }); final CheckBox requiredCheckBox = new CheckBox("required (causes bug that clears field)", false); optionsLayout.addComponent(requiredCheckBox); requiredCheckBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean required = (Boolean) event.getProperty().getValue(); signatureField.setRequired(required); } }); final CheckBox clearButtonEnabledButton = new CheckBox("clearButtonEnabled", false); optionsLayout.addComponent(clearButtonEnabledButton); clearButtonEnabledButton.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean clearButtonEnabled = (Boolean) event.getProperty().getValue(); signatureField.setClearButtonEnabled(clearButtonEnabled); } }); final Panel resultPanel = new Panel("Results:"); resultPanel.setWidth("100%"); layout.addComponent(resultPanel); final VerticalLayout resultLayout = new VerticalLayout(); resultLayout.setMargin(true); resultPanel.setContent(resultLayout); final Image stringPreviewImage = new Image("String preview image:"); stringPreviewImage.setWidth("500px"); resultLayout.addComponent(stringPreviewImage); final Image dataUrlPreviewImage = new Image("DataURL preview image:"); dataUrlPreviewImage.setWidth("500px"); resultLayout.addComponent(dataUrlPreviewImage); final TextArea textArea = new TextArea("DataURL:"); textArea.setWidth("100%"); textArea.setHeight("300px"); resultLayout.addComponent(textArea); final Label emptyLabel = new Label(); emptyLabel.setCaption("Is Empty:"); emptyLabel.setValue(String.valueOf(signatureField.isEmpty())); resultLayout.addComponent(emptyLabel); signatureField.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String signature = (String) event.getProperty().getValue(); stringPreviewImage.setSource(signature != null ? new ExternalResource(signature) : null); textArea.setValue(signature); emptyLabel.setValue(String.valueOf(signatureField.isEmpty())); } }); dataUrlProperty.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { try { final DataUrl signature = (DataUrl) event.getProperty().getValue(); dataUrlPreviewImage.setSource( signature != null ? new ExternalResource(serializer.serialize(signature)) : null); StreamResource streamResource = null; if (signature != null) { StreamSource streamSource = new StreamSource() { @Override public InputStream getStream() { return new ByteArrayInputStream(signature.getData()); } }; MimeType mimeType = MimeType.valueOfMimeType(signature.getMimeType()); String extension = null; switch (mimeType) { case JPEG: extension = "jpg"; break; case PNG: extension = "png"; break; } streamResource = new StreamResource(streamSource, "signature." + extension); streamResource.setMIMEType(signature.getMimeType()); streamResource.setCacheTime(0); } saveButtonLink.setResource(streamResource); } catch (MalformedURLException e) { logger.error(e.getMessage(), e); } } }); }
From source file:facs.components.Settings.java
License:Open Source License
private void addNewDevice() { final Window subWindow = new Window("Add Device"); FormLayout form = new FormLayout(); form.setMargin(true); final TextField name = new TextField(); name.setImmediate(true);//from w w w . j a v a2s . co m name.addValidator(new StringLengthValidator("The name must be 1-85 letters long (Was {0}).", 1, 85, true)); name.setCaption("Name of new device"); form.addComponent(name); final TextArea description = new TextArea(); description.setImmediate(true); description.addValidator( new StringLengthValidator("The name must be 1-255 letters long (Was {0}).", 1, 255, true)); description.setCaption("Description"); form.addComponent(description); final OptionGroup restricted = new OptionGroup("Is Device restricted by operators?"); restricted.addItem("yes"); restricted.setMultiSelect(true); form.addComponent(restricted); HorizontalLayout buttons = new HorizontalLayout(); Button save = new Button("save"); buttons.addComponent(save); Button discard = new Button("discard"); discard.setDescription("discarding will abort the process of adding a new device into the databse."); buttons.addComponent(discard); buttons.setSpacing(true); form.addComponent(buttons); subWindow.setContent(form); form.setMargin(true); form.setSpacing(true); buttons.setMargin(true); buttons.setSpacing(true); // Center it in the browser window subWindow.center(); subWindow.setModal(true); subWindow.setWidth("50%"); // Open it in the UI UI.getCurrent().addWindow(subWindow); discard.addClickListener(new ClickListener() { /** * */ private static final long serialVersionUID = -5808910314649620731L; @Override public void buttonClick(ClickEvent event) { subWindow.close(); } }); save.addClickListener(new ClickListener() { /** * */ private static final long serialVersionUID = 3748395242651585005L; @Override public void buttonClick(ClickEvent event) { if (name.isValid() && description.isValid()) { Set<String> restr = (Set<String>) restricted.getValue(); int deviceId = DBManager.getDatabaseInstance().addDevice(name.getValue(), description.getValue(), (restr.size() == 1)); DeviceBean bean = new DeviceBean(deviceId, name.getValue(), description.getValue(), (restr.size() == 1)); devicesGrid.addRow(bean); } else { Notification.show("Failed to add device to database."); } } }); // DeviceBean db = new DeviceBean(0, "Device 1","some description1", false); // TODO // add to database /* * boolean added = false;//DBManager.getDatabaseInstance().addDevice(db); //TODO test //add to * grid if(added){ devicesGrid.addRow(db); }else{ //TODO log failed operation * Notification.show("Failed to add device to database.", Type.ERROR_MESSAGE); } */ }
From source file:fr.amapj.view.views.parametres.ParametresView.java
License:Open Source License
/** * /*from www. j a v a 2 s . com*/ */ @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.univlorraine.mondossierweb.views.AdressesView.java
License:Apache License
/** * Initialise la vue/*ww w .ja v a 2s . c o m*/ */ @PostConstruct public void init() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MainUI && (userController.isEnseignant() || userController.isEtudiant()) && MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) { 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//w w w .j av a2s. 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 ww w.j av a 2s . c om*/ /* 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/* www. j a v a2 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();//from w w w . j a v a 2 s. 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); } }
From source file:fr.univlorraine.mondossierweb.views.InformationsAnnuellesView.java
License:Apache License
/** * Initialise la vue/*from ww w.j a v a 2 s. c om*/ */ @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) { /* Style */ setMargin(true); setSpacing(true); /* Titre */ Label title = new Label(applicationContext.getMessage(NAME + ".title", null, getLocale())); title.addStyleName(ValoTheme.LABEL_H1); addComponent(title); HorizontalLayout globalLayout = new HorizontalLayout(); globalLayout.setSizeFull(); globalLayout.setSpacing(true); Panel panelInfos = new Panel(applicationContext.getMessage(NAME + ".infos.title", null, getLocale()) + " " + Utils.getAnneeUniversitaireEnCours( etudiantController.getAnneeUnivEnCours(MainUI.getCurrent()))); 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.isEtudiant()) { lano = MainUI.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, MainUI.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, MainUI.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, MainUI.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, MainUI.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); globalLayout.addComponent(panelInfos); //Si on affiche aucun ou un seul numro d'anonymat, on diminue la largeur du panneau. /*if(lano==null || lano.size()<2) { globalLayout.addComponent(new VerticalLayout()); }*/ addComponent(globalLayout); } }
From source file:fr.univlorraine.mondossierweb.views.InscriptionsView.java
License:Apache License
/** * Initialise la vue//from w ww .j a va 2s. 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) { /* 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); //Si les informations sur les inscriptions n'ont pas dj t rcupres, on les rcupre if (MainUI.getCurrent().getEtudiant().getLibEtablissement() == null) { etudiantController.recupererInscriptions(); } //Test si la rcupration des inscriptions via le WS s'est bien passe if (MainUI.getCurrent().isRecuperationWsInscriptionsOk()) { //Tout c'est bien pass lors de la rcupration des infos via le WS Panel panelInscription = new Panel(MainUI.getCurrent().getEtudiant().getLibEtablissement()); Table inscriptionsTable = new Table(null, new BeanItemContainer<>(Inscription.class, MainUI.getCurrent().getEtudiant().getLinsciae())); inscriptionsTable.setWidth("100%"); String[] colonnes = IA_FIELDS_ORDER; if (userController.isEtudiant()) { colonnes = IA_FIELDS_ORDER_ETU; } inscriptionsTable.setVisibleColumns((Object[]) colonnes); for (String fieldName : colonnes) { inscriptionsTable.setColumnHeader(fieldName, applicationContext.getMessage(NAME + ".table." + fieldName, null, getLocale())); } inscriptionsTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.lib_etp", null, getLocale()), new LibelleInscriptionColumnGenerator()); //inscriptionsTable.setSortContainerPropertyId("cod_anu"); inscriptionsTable.setColumnCollapsingAllowed(true); inscriptionsTable.setColumnReorderingAllowed(false); inscriptionsTable.setSelectable(false); inscriptionsTable.setImmediate(true); inscriptionsTable.setStyleName("noscrollabletable"); inscriptionsTable.setPageLength(inscriptionsTable.getItemIds().size()); panelInscription.setContent(inscriptionsTable); globalLayout.addComponent(panelInscription); //DAC Panel panelDAC = new Panel(applicationContext.getMessage(NAME + ".dac.title", null, getLocale())); if (MainUI.getCurrent().getEtudiant().getLinscdac() != null && MainUI.getCurrent().getEtudiant().getLinscdac().size() > 0) { Table inscriptionsDAC = new Table(null, new BeanItemContainer<>(Inscription.class, MainUI.getCurrent().getEtudiant().getLinscdac())); inscriptionsDAC.setWidth("100%"); inscriptionsDAC.setVisibleColumns((Object[]) DAC_FIELDS_ORDER); for (String fieldName : DAC_FIELDS_ORDER) { inscriptionsDAC.setColumnHeader(fieldName, applicationContext.getMessage(NAME + ".tabledac." + fieldName, null, getLocale())); } inscriptionsDAC.setColumnCollapsingAllowed(true); inscriptionsDAC.setColumnReorderingAllowed(false); inscriptionsDAC.setSelectable(false); inscriptionsDAC.setImmediate(true); inscriptionsDAC.setStyleName("noscrollabletable"); inscriptionsDAC.setPageLength(inscriptionsDAC.getItemIds().size()); panelDAC.setContent(inscriptionsDAC); } else { HorizontalLayout labelDacLayout = new HorizontalLayout(); labelDacLayout.setMargin(true); labelDacLayout.setSizeFull(); Label aucuneDAC = new Label( applicationContext.getMessage(NAME + ".dac.aucune", null, getLocale()) + " " + MainUI.getCurrent().getEtudiant().getLibEtablissement()); aucuneDAC.setStyleName(ValoTheme.LABEL_COLORED); aucuneDAC.addStyleName(ValoTheme.LABEL_BOLD); labelDacLayout.addComponent(aucuneDAC); panelDAC.setContent(labelDacLayout); } globalLayout.addComponent(panelDAC); Panel panelPremInscription = new Panel( applicationContext.getMessage(NAME + ".premiereinsc.title", null, getLocale())); FormLayout formPremInscription = new FormLayout(); formPremInscription.setSpacing(true); formPremInscription.setMargin(true); String captionAnneePremInscription = applicationContext.getMessage(NAME + ".premiereinsc.annee", null, getLocale()); TextField fieldAnneePremInscription = new TextField(captionAnneePremInscription, MainUI.getCurrent().getEtudiant().getAnneePremiereInscrip()); formatTextField(fieldAnneePremInscription); formPremInscription.addComponent(fieldAnneePremInscription); String captionEtbPremInscription = applicationContext.getMessage(NAME + ".premiereinsc.etb", null, getLocale()); TextField fieldEtbPremInscription = new TextField(captionEtbPremInscription, MainUI.getCurrent().getEtudiant().getEtbPremiereInscrip()); formatTextField(fieldEtbPremInscription); formPremInscription.addComponent(fieldEtbPremInscription); panelPremInscription.setContent(formPremInscription); globalLayout.addComponent(panelPremInscription); addComponent(globalLayout); } else { //Il y a eu un soucis lors de la rcupration des infos via le WS Panel panelErreurInscription = new Panel(); Label labelMsgErreur = new Label( applicationContext.getMessage("AllView.erreur.message", null, getLocale())); panelErreurInscription.setContent(labelMsgErreur); addComponent(panelErreurInscription); } } }