Skip to content

Commit 9c4501c

Browse files
committed
possibilité d'empecher d'écraser le code/libellé des formations
1 parent 0590761 commit 9c4501c

File tree

4 files changed

+72
-27
lines changed

4 files changed

+72
-27
lines changed

src/main/java/fr/univlorraine/ecandidat/views/windows/CtrCandFormationWindow.java

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -227,32 +227,36 @@ public CtrCandFormationWindow(final Formation formation, final SecurityCtrCandFo
227227

228228
btnApo.addClickListener(e -> {
229229
final SearchFormationApoWindow window = new SearchFormationApoWindow(ctrCand.getIdCtrCand());
230-
window.addVetListener(v -> {
231-
if (v.getId() != null && v.getId().getCodEtpVet() != null && v.getId().getCodVrsVet() != null) {
232-
rtfCodEtpVetApo.setValue(v.getId().getCodEtpVet());
233-
rtfCodVrsVetApo.setValue(v.getId().getCodVrsVet());
234-
final RequiredTextField rtfCodForm = (RequiredTextField) fieldGroup.getField(Formation_.codForm.getName());
235-
rtfCodForm.setValue(v.getId().getCodEtpVet() + "-" + v.getId().getCodVrsVet());
230+
window.addVetListener((vet, useCode, useLibelle) -> {
231+
if (vet.getId() != null && vet.getId().getCodEtpVet() != null && vet.getId().getCodVrsVet() != null) {
232+
rtfCodEtpVetApo.setValue(vet.getId().getCodEtpVet());
233+
rtfCodVrsVetApo.setValue(vet.getId().getCodVrsVet());
234+
if (useCode) {
235+
final RequiredTextField rtfCodForm = (RequiredTextField) fieldGroup.getField(Formation_.codForm.getName());
236+
rtfCodForm.setValue(vet.getId().getCodEtpVet() + "-" + vet.getId().getCodVrsVet());
237+
}
236238

237239
/* Initialisation du diplome */
238240
rtfCodDipApo.setValue(null);
239241
rtfCodVrsDdiApo.setValue(null);
240242
rtfLibDipApoo.setValue(null);
241243
}
242-
if (v.getLibVet() != null) {
243-
rtfLibApo.setValue(v.getLibVet());
244-
final RequiredTextField rtfLibForm = (RequiredTextField) fieldGroup.getField(Formation_.libForm.getName());
245-
rtfLibForm.setValue(v.getLibVet());
244+
if (vet.getLibVet() != null) {
245+
rtfLibApo.setValue(vet.getLibVet());
246+
if (useLibelle) {
247+
final RequiredTextField rtfLibForm = (RequiredTextField) fieldGroup.getField(Formation_.libForm.getName());
248+
rtfLibForm.setValue(vet.getLibVet());
249+
}
246250
}
247251

248-
if (v.getId().getCodCge() != null) {
252+
if (vet.getId().getCodCge() != null) {
249253
final RequiredComboBox<SiScolCentreGestion> comboBoxCGE = (RequiredComboBox<SiScolCentreGestion>) fieldGroup.getField(Formation_.siScolCentreGestion.getName());
250-
comboBoxCGE.setValue(tableRefController.getSiScolCentreGestionByCode(v.getId().getCodCge()));
254+
comboBoxCGE.setValue(tableRefController.getSiScolCentreGestionByCode(vet.getId().getCodCge()));
251255
comboBoxCGE.setEnabled(false);
252256
}
253-
if (v.getId().getCodTpd() != null) {
257+
if (vet.getId().getCodTpd() != null) {
254258
final RequiredComboBox<TypDiplome> comboBoxTd = (RequiredComboBox<TypDiplome>) fieldGroup.getField(Formation_.siScolTypDiplome.getName());
255-
comboBoxTd.setValue(tableRefController.getSiScolTypDiplomeByCode(v.getId().getCodTpd()));
259+
comboBoxTd.setValue(tableRefController.getSiScolTypDiplomeByCode(vet.getId().getCodTpd()));
256260
comboBoxTd.setEnabled(false);
257261
}
258262
majFieldDip();
@@ -337,17 +341,20 @@ public CtrCandFormationWindow(final Formation formation, final SecurityCtrCandFo
337341

338342
btnPegase.addClickListener(e -> {
339343
final SearchFormationPegaseWindow window = new SearchFormationPegaseWindow();
340-
window.addFormationListener(form -> {
344+
window.addFormationListener((form, useCode, useLibelle) -> {
341345
if (form.getCode() != null) {
342346
rtfCodFormPegase.setValue(form.getCode());
343-
final RequiredTextField rtfCodForm = (RequiredTextField) fieldGroup.getField(Formation_.codForm.getName());
344-
rtfCodForm.setValue(form.getCode());
345-
347+
if (useCode) {
348+
final RequiredTextField rtfCodForm = (RequiredTextField) fieldGroup.getField(Formation_.codForm.getName());
349+
rtfCodForm.setValue(form.getCode());
350+
}
346351
}
347352
if (form.getLibelleLong() != null) {
348353
rtfLibFormPegase.setValue(form.getLibelleLong());
349-
final RequiredTextField rtfLibForm = (RequiredTextField) fieldGroup.getField(Formation_.libForm.getName());
350-
rtfLibForm.setValue(form.getLibelleLong());
354+
if (useLibelle) {
355+
final RequiredTextField rtfLibForm = (RequiredTextField) fieldGroup.getField(Formation_.libForm.getName());
356+
rtfLibForm.setValue(form.getLibelleLong());
357+
}
351358
}
352359

353360
// if (form.getCodeStructure() != null) {

src/main/java/fr/univlorraine/ecandidat/views/windows/SearchFormationApoWindow.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.vaadin.event.ShortcutListener;
2828
import com.vaadin.server.FontAwesome;
2929
import com.vaadin.ui.Alignment;
30+
import com.vaadin.ui.CheckBox;
3031
import com.vaadin.ui.HorizontalLayout;
3132
import com.vaadin.ui.Label;
3233
import com.vaadin.ui.Notification;
@@ -69,6 +70,10 @@ public class SearchFormationApoWindow extends Window {
6970
private final OneClickButton btnValider;
7071
private final OneClickButton btnAnnuler;
7172

73+
/* Utilisation des codes et libellés */
74+
private final CheckBox cbUseCode = new CheckBox();
75+
private final CheckBox cbUseLibelle = new CheckBox();
76+
7277
/* Listener */
7378
private VetListener vetListener;
7479

@@ -119,6 +124,18 @@ public void handleAction(final Object sender, final Object target) {
119124

120125
layout.addComponent(searchLayout);
121126

127+
/* Utilisation des codes et libellés */
128+
final HorizontalLayout useCodeLibelleLayout = new HorizontalLayout(cbUseCode, cbUseLibelle);
129+
useCodeLibelleLayout.setSpacing(true);
130+
cbUseCode.setCaption(applicationContext.getMessage("formation.window.apo.useCode", null, UI.getCurrent().getLocale()));
131+
cbUseCode.setValue(true);
132+
useCodeLibelleLayout.setComponentAlignment(cbUseCode, Alignment.MIDDLE_LEFT);
133+
cbUseLibelle.setCaption(applicationContext.getMessage("formation.window.apo.useLibelle", null, UI.getCurrent().getLocale()));
134+
cbUseLibelle.setValue(true);
135+
useCodeLibelleLayout.setComponentAlignment(cbUseLibelle, Alignment.MIDDLE_LEFT);
136+
137+
layout.addComponent(useCodeLibelleLayout);
138+
122139
/* Table de Resultat de recherche */
123140
grid.initColumn(FIELDS_ORDER, "vet.", "id.codEtpVet");
124141
grid.setColumnWidth("id.codEtpVet", 120);
@@ -176,7 +193,7 @@ private void performAction() {
176193
Notification.show(applicationContext.getMessage("window.search.selectrow", null, UI.getCurrent().getLocale()), Notification.Type.WARNING_MESSAGE);
177194
return;
178195
} else {
179-
vetListener.btnOkClick(vet);
196+
vetListener.btnOkClick(vet, cbUseCode.getValue(), cbUseLibelle.getValue());
180197
close();
181198
}
182199
}
@@ -215,9 +232,9 @@ public interface VetListener extends Serializable {
215232
/**
216233
* Appelé lorsque Oui est cliqué.
217234
* @param vet
218-
* la vet a renvoyer
235+
* la vet a renvoyer
219236
*/
220-
void btnOkClick(Vet vet);
237+
void btnOkClick(Vet vet, boolean useCode, boolean useLibelle);
221238

222239
}
223240

src/main/java/fr/univlorraine/ecandidat/views/windows/SearchFormationPegaseWindow.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.vaadin.event.ShortcutListener;
2929
import com.vaadin.server.FontAwesome;
3030
import com.vaadin.ui.Alignment;
31+
import com.vaadin.ui.CheckBox;
3132
import com.vaadin.ui.HorizontalLayout;
3233
import com.vaadin.ui.Label;
3334
import com.vaadin.ui.Notification;
@@ -74,6 +75,10 @@ public class SearchFormationPegaseWindow extends Window {
7475
private final OneClickButton btnValider;
7576
private final OneClickButton btnAnnuler;
7677

78+
/* Utilisation des codes et libellés */
79+
private final CheckBox cbUseCode = new CheckBox();
80+
private final CheckBox cbUseLibelle = new CheckBox();
81+
7782
/* Listener */
7883
private FormationListener formationListener;
7984

@@ -123,6 +128,18 @@ public void handleAction(final Object sender, final Object target) {
123128

124129
layout.addComponent(searchLayout);
125130

131+
/* Utilisation des codes et libellés */
132+
final HorizontalLayout useCodeLibelleLayout = new HorizontalLayout(cbUseCode, cbUseLibelle);
133+
useCodeLibelleLayout.setSpacing(true);
134+
cbUseCode.setCaption(applicationContext.getMessage("formation.window.pegase.useCode", null, UI.getCurrent().getLocale()));
135+
cbUseCode.setValue(true);
136+
useCodeLibelleLayout.setComponentAlignment(cbUseCode, Alignment.MIDDLE_LEFT);
137+
cbUseLibelle.setCaption(applicationContext.getMessage("formation.window.pegase.useLibelle", null, UI.getCurrent().getLocale()));
138+
cbUseLibelle.setValue(true);
139+
useCodeLibelleLayout.setComponentAlignment(cbUseLibelle, Alignment.MIDDLE_LEFT);
140+
141+
layout.addComponent(useCodeLibelleLayout);
142+
126143
/* Table de Resultat de recherche */
127144
grid.initColumn(FIELDS_ORDER, "form.pegase.", FormationPegase.FIELD_NAME_CODE);
128145
grid.setColumnWidth(FormationPegase.FIELD_NAME_CODE, 150);
@@ -176,7 +193,7 @@ private void performAction() {
176193
Notification.show(applicationContext.getMessage("window.search.selectrow", null, UI.getCurrent().getLocale()), Notification.Type.WARNING_MESSAGE);
177194
return;
178195
} else {
179-
formationListener.btnOkClick(form);
196+
formationListener.btnOkClick(form, cbUseCode.getValue(), cbUseLibelle.getValue());
180197
close();
181198
}
182199
}
@@ -220,7 +237,7 @@ public interface FormationListener extends Serializable {
220237
* @param vet
221238
* la vet a renvoyer
222239
*/
223-
void btnOkClick(FormationPegase form);
240+
void btnOkClick(FormationPegase form, boolean useCode, boolean useLibelle);
224241

225242
}
226243

src/main/resources/i18n/backoffice/backoffice-messages.properties

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,8 @@ formation.table.urlForm = Url offre formation
887887
formation.title = Formations - {0}
888888
formation.window = Edition de formation
889889
formation.window.apo.limit = La recherche ram\u00E8ne les {0} premiers r\u00E9sultats
890+
formation.window.apo.useCode = Utiliser 'Code Etp Vet-Code Vrs Vet' comme code formation
891+
formation.window.apo.useLibelle = Utiliser 'Libell\u00E9 Web Vet' comme libell\u00E9 formation
890892
formation.window.apodip.no = Aucun dipl\u00F4me trouv\u00E9 pour cette VET
891893
formation.window.apodip.one = Un seul dipl\u00F4me trouv\u00E9 pour cette VET
892894
formation.window.btn.apo = Chercher formation Apog\u00E9e
@@ -896,6 +898,8 @@ formation.window.btn.pegase = Chercher formation P\u00E9gase
896898
formation.window.confirmDelete = Voulez-vous supprimer la formation ''{0}'' ?
897899
formation.window.confirmDeleteTitle = Suppression d'une formation
898900
formation.window.pegase.limit = La recherche ram\u00E8ne les {0} premiers r\u00E9sultats
901+
formation.window.pegase.useCode = Utiliser 'Code' comme code formation
902+
formation.window.pegase.useLibelle = Utiliser 'Libell\u00E9' comme libell\u00E9 formation
899903
formation.window.sheet.apo = Apog\u00E9e
900904
formation.window.sheet.date = Dates/D\u00E9lais
901905
formation.window.sheet.epreuve = Pr\u00E9s\u00E9lection
@@ -1425,10 +1429,10 @@ version.ws.pj.window = Test du WebService des PJ SiScol
14251429
version.ws.result = R\u00E9sultat
14261430
version.ws.title = Test de connexion au Web Service
14271431

1428-
vet.codVet = Code vet
1432+
vet.codVet = Code Vet
14291433
vet.id.codCge = Code CGE
14301434
vet.id.codEtpVet = Code \u00E9tape
1431-
vet.id.codVrsVet = Code vrs vet
1435+
vet.id.codVrsVet = Code Vrs Vet
14321436
vet.libTypDip = Type Dipl\u00F4me
14331437
vet.libVet = Libell\u00E9 Web Vet
14341438

0 commit comments

Comments
 (0)