From 9c4501c9fc657eaaf4300e4366e8be6a4c2b7be1 Mon Sep 17 00:00:00 2001 From: Kevin Date: Thu, 21 Nov 2024 09:32:22 +0100 Subject: [PATCH] =?UTF-8?q?possibilit=C3=A9=20d'empecher=20d'=C3=A9craser?= =?UTF-8?q?=20le=20code/libell=C3=A9=20des=20formations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/windows/CtrCandFormationWindow.java | 47 +++++++++++-------- .../windows/SearchFormationApoWindow.java | 23 +++++++-- .../windows/SearchFormationPegaseWindow.java | 21 ++++++++- .../backoffice/backoffice-messages.properties | 8 +++- 4 files changed, 72 insertions(+), 27 deletions(-) diff --git a/src/main/java/fr/univlorraine/ecandidat/views/windows/CtrCandFormationWindow.java b/src/main/java/fr/univlorraine/ecandidat/views/windows/CtrCandFormationWindow.java index ca2e7cbf..a0f536a5 100644 --- a/src/main/java/fr/univlorraine/ecandidat/views/windows/CtrCandFormationWindow.java +++ b/src/main/java/fr/univlorraine/ecandidat/views/windows/CtrCandFormationWindow.java @@ -227,32 +227,36 @@ public CtrCandFormationWindow(final Formation formation, final SecurityCtrCandFo btnApo.addClickListener(e -> { final SearchFormationApoWindow window = new SearchFormationApoWindow(ctrCand.getIdCtrCand()); - window.addVetListener(v -> { - if (v.getId() != null && v.getId().getCodEtpVet() != null && v.getId().getCodVrsVet() != null) { - rtfCodEtpVetApo.setValue(v.getId().getCodEtpVet()); - rtfCodVrsVetApo.setValue(v.getId().getCodVrsVet()); - final RequiredTextField rtfCodForm = (RequiredTextField) fieldGroup.getField(Formation_.codForm.getName()); - rtfCodForm.setValue(v.getId().getCodEtpVet() + "-" + v.getId().getCodVrsVet()); + window.addVetListener((vet, useCode, useLibelle) -> { + if (vet.getId() != null && vet.getId().getCodEtpVet() != null && vet.getId().getCodVrsVet() != null) { + rtfCodEtpVetApo.setValue(vet.getId().getCodEtpVet()); + rtfCodVrsVetApo.setValue(vet.getId().getCodVrsVet()); + if (useCode) { + final RequiredTextField rtfCodForm = (RequiredTextField) fieldGroup.getField(Formation_.codForm.getName()); + rtfCodForm.setValue(vet.getId().getCodEtpVet() + "-" + vet.getId().getCodVrsVet()); + } /* Initialisation du diplome */ rtfCodDipApo.setValue(null); rtfCodVrsDdiApo.setValue(null); rtfLibDipApoo.setValue(null); } - if (v.getLibVet() != null) { - rtfLibApo.setValue(v.getLibVet()); - final RequiredTextField rtfLibForm = (RequiredTextField) fieldGroup.getField(Formation_.libForm.getName()); - rtfLibForm.setValue(v.getLibVet()); + if (vet.getLibVet() != null) { + rtfLibApo.setValue(vet.getLibVet()); + if (useLibelle) { + final RequiredTextField rtfLibForm = (RequiredTextField) fieldGroup.getField(Formation_.libForm.getName()); + rtfLibForm.setValue(vet.getLibVet()); + } } - if (v.getId().getCodCge() != null) { + if (vet.getId().getCodCge() != null) { final RequiredComboBox comboBoxCGE = (RequiredComboBox) fieldGroup.getField(Formation_.siScolCentreGestion.getName()); - comboBoxCGE.setValue(tableRefController.getSiScolCentreGestionByCode(v.getId().getCodCge())); + comboBoxCGE.setValue(tableRefController.getSiScolCentreGestionByCode(vet.getId().getCodCge())); comboBoxCGE.setEnabled(false); } - if (v.getId().getCodTpd() != null) { + if (vet.getId().getCodTpd() != null) { final RequiredComboBox comboBoxTd = (RequiredComboBox) fieldGroup.getField(Formation_.siScolTypDiplome.getName()); - comboBoxTd.setValue(tableRefController.getSiScolTypDiplomeByCode(v.getId().getCodTpd())); + comboBoxTd.setValue(tableRefController.getSiScolTypDiplomeByCode(vet.getId().getCodTpd())); comboBoxTd.setEnabled(false); } majFieldDip(); @@ -337,17 +341,20 @@ public CtrCandFormationWindow(final Formation formation, final SecurityCtrCandFo btnPegase.addClickListener(e -> { final SearchFormationPegaseWindow window = new SearchFormationPegaseWindow(); - window.addFormationListener(form -> { + window.addFormationListener((form, useCode, useLibelle) -> { if (form.getCode() != null) { rtfCodFormPegase.setValue(form.getCode()); - final RequiredTextField rtfCodForm = (RequiredTextField) fieldGroup.getField(Formation_.codForm.getName()); - rtfCodForm.setValue(form.getCode()); - + if (useCode) { + final RequiredTextField rtfCodForm = (RequiredTextField) fieldGroup.getField(Formation_.codForm.getName()); + rtfCodForm.setValue(form.getCode()); + } } if (form.getLibelleLong() != null) { rtfLibFormPegase.setValue(form.getLibelleLong()); - final RequiredTextField rtfLibForm = (RequiredTextField) fieldGroup.getField(Formation_.libForm.getName()); - rtfLibForm.setValue(form.getLibelleLong()); + if (useLibelle) { + final RequiredTextField rtfLibForm = (RequiredTextField) fieldGroup.getField(Formation_.libForm.getName()); + rtfLibForm.setValue(form.getLibelleLong()); + } } // if (form.getCodeStructure() != null) { diff --git a/src/main/java/fr/univlorraine/ecandidat/views/windows/SearchFormationApoWindow.java b/src/main/java/fr/univlorraine/ecandidat/views/windows/SearchFormationApoWindow.java index aa0a5b50..209fb411 100644 --- a/src/main/java/fr/univlorraine/ecandidat/views/windows/SearchFormationApoWindow.java +++ b/src/main/java/fr/univlorraine/ecandidat/views/windows/SearchFormationApoWindow.java @@ -27,6 +27,7 @@ import com.vaadin.event.ShortcutListener; import com.vaadin.server.FontAwesome; import com.vaadin.ui.Alignment; +import com.vaadin.ui.CheckBox; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Notification; @@ -69,6 +70,10 @@ public class SearchFormationApoWindow extends Window { private final OneClickButton btnValider; private final OneClickButton btnAnnuler; + /* Utilisation des codes et libellés */ + private final CheckBox cbUseCode = new CheckBox(); + private final CheckBox cbUseLibelle = new CheckBox(); + /* Listener */ private VetListener vetListener; @@ -119,6 +124,18 @@ public void handleAction(final Object sender, final Object target) { layout.addComponent(searchLayout); + /* Utilisation des codes et libellés */ + final HorizontalLayout useCodeLibelleLayout = new HorizontalLayout(cbUseCode, cbUseLibelle); + useCodeLibelleLayout.setSpacing(true); + cbUseCode.setCaption(applicationContext.getMessage("formation.window.apo.useCode", null, UI.getCurrent().getLocale())); + cbUseCode.setValue(true); + useCodeLibelleLayout.setComponentAlignment(cbUseCode, Alignment.MIDDLE_LEFT); + cbUseLibelle.setCaption(applicationContext.getMessage("formation.window.apo.useLibelle", null, UI.getCurrent().getLocale())); + cbUseLibelle.setValue(true); + useCodeLibelleLayout.setComponentAlignment(cbUseLibelle, Alignment.MIDDLE_LEFT); + + layout.addComponent(useCodeLibelleLayout); + /* Table de Resultat de recherche */ grid.initColumn(FIELDS_ORDER, "vet.", "id.codEtpVet"); grid.setColumnWidth("id.codEtpVet", 120); @@ -176,7 +193,7 @@ private void performAction() { Notification.show(applicationContext.getMessage("window.search.selectrow", null, UI.getCurrent().getLocale()), Notification.Type.WARNING_MESSAGE); return; } else { - vetListener.btnOkClick(vet); + vetListener.btnOkClick(vet, cbUseCode.getValue(), cbUseLibelle.getValue()); close(); } } @@ -215,9 +232,9 @@ public interface VetListener extends Serializable { /** * Appelé lorsque Oui est cliqué. * @param vet - * la vet a renvoyer + * la vet a renvoyer */ - void btnOkClick(Vet vet); + void btnOkClick(Vet vet, boolean useCode, boolean useLibelle); } diff --git a/src/main/java/fr/univlorraine/ecandidat/views/windows/SearchFormationPegaseWindow.java b/src/main/java/fr/univlorraine/ecandidat/views/windows/SearchFormationPegaseWindow.java index 22462338..19cfc10a 100644 --- a/src/main/java/fr/univlorraine/ecandidat/views/windows/SearchFormationPegaseWindow.java +++ b/src/main/java/fr/univlorraine/ecandidat/views/windows/SearchFormationPegaseWindow.java @@ -28,6 +28,7 @@ import com.vaadin.event.ShortcutListener; import com.vaadin.server.FontAwesome; import com.vaadin.ui.Alignment; +import com.vaadin.ui.CheckBox; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Notification; @@ -74,6 +75,10 @@ public class SearchFormationPegaseWindow extends Window { private final OneClickButton btnValider; private final OneClickButton btnAnnuler; + /* Utilisation des codes et libellés */ + private final CheckBox cbUseCode = new CheckBox(); + private final CheckBox cbUseLibelle = new CheckBox(); + /* Listener */ private FormationListener formationListener; @@ -123,6 +128,18 @@ public void handleAction(final Object sender, final Object target) { layout.addComponent(searchLayout); + /* Utilisation des codes et libellés */ + final HorizontalLayout useCodeLibelleLayout = new HorizontalLayout(cbUseCode, cbUseLibelle); + useCodeLibelleLayout.setSpacing(true); + cbUseCode.setCaption(applicationContext.getMessage("formation.window.pegase.useCode", null, UI.getCurrent().getLocale())); + cbUseCode.setValue(true); + useCodeLibelleLayout.setComponentAlignment(cbUseCode, Alignment.MIDDLE_LEFT); + cbUseLibelle.setCaption(applicationContext.getMessage("formation.window.pegase.useLibelle", null, UI.getCurrent().getLocale())); + cbUseLibelle.setValue(true); + useCodeLibelleLayout.setComponentAlignment(cbUseLibelle, Alignment.MIDDLE_LEFT); + + layout.addComponent(useCodeLibelleLayout); + /* Table de Resultat de recherche */ grid.initColumn(FIELDS_ORDER, "form.pegase.", FormationPegase.FIELD_NAME_CODE); grid.setColumnWidth(FormationPegase.FIELD_NAME_CODE, 150); @@ -176,7 +193,7 @@ private void performAction() { Notification.show(applicationContext.getMessage("window.search.selectrow", null, UI.getCurrent().getLocale()), Notification.Type.WARNING_MESSAGE); return; } else { - formationListener.btnOkClick(form); + formationListener.btnOkClick(form, cbUseCode.getValue(), cbUseLibelle.getValue()); close(); } } @@ -220,7 +237,7 @@ public interface FormationListener extends Serializable { * @param vet * la vet a renvoyer */ - void btnOkClick(FormationPegase form); + void btnOkClick(FormationPegase form, boolean useCode, boolean useLibelle); } diff --git a/src/main/resources/i18n/backoffice/backoffice-messages.properties b/src/main/resources/i18n/backoffice/backoffice-messages.properties index fc85f54b..6c216fb7 100644 --- a/src/main/resources/i18n/backoffice/backoffice-messages.properties +++ b/src/main/resources/i18n/backoffice/backoffice-messages.properties @@ -887,6 +887,8 @@ formation.table.urlForm = Url offre formation formation.title = Formations - {0} formation.window = Edition de formation formation.window.apo.limit = La recherche ram\u00E8ne les {0} premiers r\u00E9sultats +formation.window.apo.useCode = Utiliser 'Code Etp Vet-Code Vrs Vet' comme code formation +formation.window.apo.useLibelle = Utiliser 'Libell\u00E9 Web Vet' comme libell\u00E9 formation formation.window.apodip.no = Aucun dipl\u00F4me trouv\u00E9 pour cette VET formation.window.apodip.one = Un seul dipl\u00F4me trouv\u00E9 pour cette VET formation.window.btn.apo = Chercher formation Apog\u00E9e @@ -896,6 +898,8 @@ formation.window.btn.pegase = Chercher formation P\u00E9gase formation.window.confirmDelete = Voulez-vous supprimer la formation ''{0}'' ? formation.window.confirmDeleteTitle = Suppression d'une formation formation.window.pegase.limit = La recherche ram\u00E8ne les {0} premiers r\u00E9sultats +formation.window.pegase.useCode = Utiliser 'Code' comme code formation +formation.window.pegase.useLibelle = Utiliser 'Libell\u00E9' comme libell\u00E9 formation formation.window.sheet.apo = Apog\u00E9e formation.window.sheet.date = Dates/D\u00E9lais formation.window.sheet.epreuve = Pr\u00E9s\u00E9lection @@ -1425,10 +1429,10 @@ version.ws.pj.window = Test du WebService des PJ SiScol version.ws.result = R\u00E9sultat version.ws.title = Test de connexion au Web Service -vet.codVet = Code vet +vet.codVet = Code Vet vet.id.codCge = Code CGE vet.id.codEtpVet = Code \u00E9tape -vet.id.codVrsVet = Code vrs vet +vet.id.codVrsVet = Code Vrs Vet vet.libTypDip = Type Dipl\u00F4me vet.libVet = Libell\u00E9 Web Vet