use of fr.univlorraine.ecandidat.vaadin.form.combo.ComboBoxMotivationAvis in project esup-ecandidat by EsupPortail.
the class CtrCandActionCandidatureWindow method majAvisComponent.
/**
* Mise à jour des composants pour les avis
*/
private void majAvisComponent() {
final ComboBoxTypeDecision cbTypeDecision = (ComboBoxTypeDecision) fieldGroupDecision.getField(TypeDecisionCandidature_.typeDecision.getName());
final ComboBoxMotivationAvis cbMotivation = (ComboBoxMotivationAvis) fieldGroupDecision.getField(TypeDecisionCandidature_.motivationAvis.getName());
final RequiredIntegerField fieldRang = (RequiredIntegerField) fieldGroupDecision.getField(TypeDecisionCandidature_.listCompRangTypDecCand.getName());
final RequiredTextField fieldLieuPreselect = (RequiredTextField) fieldGroupDecision.getField(TypeDecisionCandidature_.preselectLieuTypeDecCand.getName());
final RequiredDateField fieldDatePreselect = (RequiredDateField) fieldGroupDecision.getField(TypeDecisionCandidature_.preselectDateTypeDecCand.getName());
final RequiredCheckBox fieldAppel = (RequiredCheckBox) fieldGroupDecision.getField(TypeDecisionCandidature_.temAppelTypeDecCand.getName());
final LocalTimeField fieldHeurePreselect = (LocalTimeField) fieldGroupDecision.getField(TypeDecisionCandidature_.preselectHeureTypeDecCand.getName());
final RequiredTextArea fieldComment = (RequiredTextArea) fieldGroupDecision.getField(TypeDecisionCandidature_.commentTypeDecCand.getName());
if (cbTypeDecision.getValue() != null) {
if (candidature != null && candidature.getLastTypeDecision() != null && candidature.getLastTypeDecision().getTemValidTypeDecCand() && candidature.getLastTypeDecision().getTypeDecision().getTemDefinitifTypDec() && parametreController.getIsAppel()) {
fieldAppel.setVisible(true);
} else {
fieldAppel.setVisible(false);
fieldAppel.setValue(false);
}
fieldComment.setVisible(true);
final TypeDecision typeDecision = (TypeDecision) cbTypeDecision.getValue();
if (typeDecision.getTypeAvis().getCodTypAvis().equals(NomenclatureUtils.TYP_AVIS_DEF)) {
cbMotivation.setBoxNeeded(true, null);
} else {
cbMotivation.setBoxNeeded(false, null);
}
if (typeDecision.getTypeAvis().getCodTypAvis().equals(NomenclatureUtils.TYP_AVIS_LISTE_COMP)) {
fieldRang.setVisible(true);
fieldRang.setRequired(true);
fieldRang.setRequiredError(applicationContext.getMessage("validation.obigatoire", null, UI.getCurrent().getLocale()));
} else {
fieldRang.setVisible(false);
fieldRang.setRequired(false);
fieldRang.setRequiredError(null);
fieldRang.setValue(null);
}
if (typeDecision.getTypeAvis().getCodTypAvis().equals(NomenclatureUtils.TYP_AVIS_PRESELECTION)) {
fieldLieuPreselect.setVisible(true);
fieldDatePreselect.setVisible(true);
fieldHeurePreselect.setVisible(true);
if (candidature != null) {
fieldLieuPreselect.setValue(candidature.getFormation().getPreselectLieuForm());
fieldDatePreselect.setValue((candidature.getFormation().getPreselectDateForm() != null) ? Date.valueOf(candidature.getFormation().getPreselectDateForm()) : null);
fieldHeurePreselect.setValue(candidature.getFormation().getPreselectHeureForm());
} else {
fieldLieuPreselect.setValue(null);
fieldDatePreselect.setValue(null);
fieldHeurePreselect.setValue(null);
}
} else {
fieldLieuPreselect.setVisible(false);
fieldDatePreselect.setVisible(false);
fieldHeurePreselect.setVisible(false);
}
} else {
cbMotivation.setBoxNeeded(false, null);
fieldRang.setVisible(false);
fieldRang.setRequired(false);
fieldRang.setRequiredError(null);
fieldRang.setValue(null);
fieldLieuPreselect.setVisible(false);
fieldDatePreselect.setVisible(false);
fieldHeurePreselect.setVisible(false);
fieldLieuPreselect.setValue(null);
fieldDatePreselect.setValue(null);
fieldHeurePreselect.setValue(null);
fieldAppel.setVisible(false);
fieldAppel.setValue(false);
fieldComment.setValue(null);
fieldComment.setVisible(false);
}
center();
}
Aggregations