Skip to content

Commit

Permalink
possibilité d'empecher d'écraser le code/libellé des formations
Browse files Browse the repository at this point in the history
  • Loading branch information
khergalant committed Nov 21, 2024
1 parent 0590761 commit 9c4501c
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<SiScolCentreGestion> comboBoxCGE = (RequiredComboBox<SiScolCentreGestion>) 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<TypDiplome> comboBoxTd = (RequiredComboBox<TypDiplome>) fieldGroup.getField(Formation_.siScolTypDiplome.getName());
comboBoxTd.setValue(tableRefController.getSiScolTypDiplomeByCode(v.getId().getCodTpd()));
comboBoxTd.setValue(tableRefController.getSiScolTypDiplomeByCode(vet.getId().getCodTpd()));
comboBoxTd.setEnabled(false);
}
majFieldDip();
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -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);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -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);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 9c4501c

Please sign in to comment.