use of fr.univlorraine.ecandidat.views.windows.CtrCandPieceComplementaireWindow in project esup-ecandidat by EsupPortail.
the class FormationController method editPieceCompFormation.
/**
* Edite les pieces complémentaires d'une formation
* @param formations
* @param ctrCand
*/
public void editPieceCompFormation(final List<Formation> formations, final CentreCandidature ctrCand) {
/* Verrou */
if (!checkLockFormations(formations)) {
unlockFormations(formations);
return;
}
List<PieceJustif> pieceJustifs = new ArrayList<>();
List<Formulaire> formulaires = new ArrayList<>();
if (formations.size() == 1) {
final Formation form = formations.get(0);
pieceJustifs = form.getPieceJustifs();
formulaires = form.getFormulaires();
} else {
/* On calcule les PJ et formulaires communs */
final Formation form = formations.get(0);
pieceJustifs = form.getPieceJustifs();
formulaires = form.getFormulaires();
for (final Formation formation : formations) {
if (pieceJustifs.size() != 0) {
pieceJustifs.retainAll(formation.getPieceJustifs());
}
if (formulaires.size() != 0) {
formulaires.retainAll(formation.getFormulaires());
}
if (pieceJustifs.size() == 0 && formulaires.size() == 0) {
break;
}
}
}
final CtrCandPieceComplementaireWindow window = new CtrCandPieceComplementaireWindow(formations, ctrCand, pieceJustifs, formulaires);
window.addCloseListener(e -> unlockFormations(formations));
UI.getCurrent().addWindow(window);
}
Aggregations