Search in sources :

Example 1 with CtrCandPieceComplementaireWindow

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);
}
Also used : Formulaire(fr.univlorraine.ecandidat.entities.ecandidat.Formulaire) CtrCandPieceComplementaireWindow(fr.univlorraine.ecandidat.views.windows.CtrCandPieceComplementaireWindow) ArrayList(java.util.ArrayList) PieceJustif(fr.univlorraine.ecandidat.entities.ecandidat.PieceJustif) Formation(fr.univlorraine.ecandidat.entities.ecandidat.Formation)

Aggregations

Formation (fr.univlorraine.ecandidat.entities.ecandidat.Formation)1 Formulaire (fr.univlorraine.ecandidat.entities.ecandidat.Formulaire)1 PieceJustif (fr.univlorraine.ecandidat.entities.ecandidat.PieceJustif)1 CtrCandPieceComplementaireWindow (fr.univlorraine.ecandidat.views.windows.CtrCandPieceComplementaireWindow)1 ArrayList (java.util.ArrayList)1