Search in sources :

Example 1 with Tag

use of fr.univlorraine.ecandidat.entities.ecandidat.Tag in project esup-ecandidat by EsupPortail.

the class TagController method editNewTag.

/**
 * Ouvre une fenêtre d'édition d'un nouveau tag.
 */
public void editNewTag(final CentreCandidature ctrCand) {
    Tag tag = new Tag();
    tag.setTesTag(true);
    tag.setCentreCandidature(ctrCand);
    UI.getCurrent().addWindow(new ScolTagWindow(tag));
}
Also used : ScolTagWindow(fr.univlorraine.ecandidat.views.windows.ScolTagWindow) Tag(fr.univlorraine.ecandidat.entities.ecandidat.Tag)

Example 2 with Tag

use of fr.univlorraine.ecandidat.entities.ecandidat.Tag in project esup-ecandidat by EsupPortail.

the class TagViewTemplate method init.

/**
 * Initialise la vue
 */
@PostConstruct
public void init() {
    /* Style */
    setSizeFull();
    setMargin(true);
    setSpacing(true);
    /* Titre */
    title.addStyleName(StyleConstants.VIEW_TITLE);
    addComponent(title);
    /* Boutons */
    buttonsLayout.setWidth(100, Unit.PERCENTAGE);
    buttonsLayout.setSpacing(true);
    addComponent(buttonsLayout);
    btnNew.setCaption(applicationContext.getMessage("tag.btnNouveau", null, UI.getCurrent().getLocale()));
    btnNew.setEnabled(true);
    buttonsLayout.addComponent(btnNew);
    buttonsLayout.setComponentAlignment(btnNew, Alignment.MIDDLE_LEFT);
    btnEdit.setCaption(applicationContext.getMessage("btnEdit", null, UI.getCurrent().getLocale()));
    btnEdit.setEnabled(false);
    btnEdit.addClickListener(e -> {
        if (tagTable.getValue() instanceof Tag) {
            tagController.editTag((Tag) tagTable.getValue());
        }
    });
    buttonsLayout.addComponent(btnEdit);
    buttonsLayout.setComponentAlignment(btnEdit, Alignment.MIDDLE_CENTER);
    OneClickButton btnDelete = new OneClickButton(applicationContext.getMessage("btnDelete", null, UI.getCurrent().getLocale()), FontAwesome.TRASH_O);
    btnDelete.setEnabled(false);
    btnDelete.addClickListener(e -> {
        if (tagTable.getValue() instanceof Tag) {
            tagController.deleteTag((Tag) tagTable.getValue());
        }
    });
    buttonsLayout.addComponent(btnDelete);
    buttonsLayout.setComponentAlignment(btnDelete, Alignment.MIDDLE_RIGHT);
    /* Table des tags */
    tagTable.addBooleanColumn(Tag_.tesTag.getName());
    tagTable.setSizeFull();
    tagTable.setVisibleColumns((Object[]) FIELDS_ORDER);
    for (String fieldName : FIELDS_ORDER) {
        tagTable.setColumnHeader(fieldName, applicationContext.getMessage("tag.table." + fieldName, null, UI.getCurrent().getLocale()));
    }
    tagTable.addGeneratedColumn(Tag_.colorTag.getName(), new ColumnGenerator() {

        @Override
        public Object generateCell(final Table source, final Object itemId, final Object columnId) {
            Tag tag = (Tag) itemId;
            HorizontalLayout hlColor = new HorizontalLayout();
            hlColor.setSpacing(true);
            Label labelColor = new Label("<div style='border:1px solid;width:20px;height:20px;background:" + tag.getColorTag() + ";'></div>", ContentMode.HTML);
            Label labelTxt = new Label(tag.getColorTag());
            hlColor.addComponent(labelColor);
            hlColor.setComponentAlignment(labelColor, Alignment.MIDDLE_LEFT);
            hlColor.addComponent(labelTxt);
            hlColor.setComponentAlignment(labelTxt, Alignment.MIDDLE_LEFT);
            return hlColor;
        }
    });
    tagTable.setSortContainerPropertyId(Tag_.libTag.getName());
    tagTable.setColumnCollapsingAllowed(true);
    tagTable.setColumnReorderingAllowed(true);
    tagTable.setSelectable(true);
    tagTable.setImmediate(true);
    tagTable.addItemSetChangeListener(e -> tagTable.sanitizeSelection());
    tagTable.addValueChangeListener(e -> {
        /* Les boutons d'édition et de suppression de tag sont actifs seulement si une tag est sélectionnée. */
        boolean tagIsSelectedEdit = tagTable.getValue() instanceof Tag;
        btnEdit.setEnabled(tagIsSelectedEdit);
        btnDelete.setEnabled(tagIsSelectedEdit);
    });
    addComponent(tagTable);
    setExpandRatio(tagTable, 1);
}
Also used : Table(com.vaadin.ui.Table) ColumnGenerator(com.vaadin.ui.Table.ColumnGenerator) OneClickButton(fr.univlorraine.ecandidat.vaadin.components.OneClickButton) Label(com.vaadin.ui.Label) Tag(fr.univlorraine.ecandidat.entities.ecandidat.Tag) HorizontalLayout(com.vaadin.ui.HorizontalLayout) PostConstruct(javax.annotation.PostConstruct)

Example 3 with Tag

use of fr.univlorraine.ecandidat.entities.ecandidat.Tag in project esup-ecandidat by EsupPortail.

the class CandidatureViewTemplate method getNullTag.

/**
 * @return un tag correspondant au tag null dans la combobox de recherche de candidature : utilisé pour n'afficher que les tags qui sont null
 */
public Tag getNullTag() {
    final Tag tagNull = new Tag();
    tagNull.setIdTag(-1);
    tagNull.setLibTag(applicationContext.getMessage("filter.null", null, UI.getCurrent().getLocale()));
    return tagNull;
}
Also used : Tag(fr.univlorraine.ecandidat.entities.ecandidat.Tag)

Example 4 with Tag

use of fr.univlorraine.ecandidat.entities.ecandidat.Tag in project esup-ecandidat by EsupPortail.

the class CandidatureViewTemplate method getComboBoxFilterTag.

/**
 * @return une combobox pour les tags
 */
@SuppressWarnings("unchecked")
public ComboBox getComboBoxFilterTag() {
    /* Tag spécifique */
    final Tag tagAll = new Tag();
    tagAll.setIdTag(0);
    tagAll.setLibTag(applicationContext.getMessage("filter.all", null, UI.getCurrent().getLocale()));
    /* Liste des tags */
    final ComboBox sampleIdCB = new ComboBox();
    sampleIdCB.setPageLength(20);
    sampleIdCB.setTextInputAllowed(false);
    final BeanItemContainer<Tag> container = new BeanItemContainer<>(Tag.class);
    container.addNestedContainerProperty(Tag.PROPERTY_ICON);
    container.addBean(tagAll);
    container.addBean(getNullTag());
    listeTags.forEach(e -> {
        container.addItem(e).getItemProperty(Tag.PROPERTY_ICON).setValue(new StreamResource(new TagImageSource(e.getColorTag()), e.getIdTag() + ".png"));
    });
    sampleIdCB.setNullSelectionItemId(tagAll);
    sampleIdCB.setContainerDataSource(container);
    sampleIdCB.setItemCaptionPropertyId(Tag_.libTag.getName());
    sampleIdCB.setItemIconPropertyId(Tag.PROPERTY_ICON);
    sampleIdCB.setImmediate(true);
    return sampleIdCB;
}
Also used : StreamResource(com.vaadin.server.StreamResource) ComboBox(com.vaadin.ui.ComboBox) BeanItemContainer(com.vaadin.data.util.BeanItemContainer) Tag(fr.univlorraine.ecandidat.entities.ecandidat.Tag) TagImageSource(fr.univlorraine.ecandidat.vaadin.components.TagImageSource)

Example 5 with Tag

use of fr.univlorraine.ecandidat.entities.ecandidat.Tag in project esup-ecandidat by EsupPortail.

the class CandidatureViewTemplate method init.

/**
 * Initialise la vue
 */
/**
 * @param modeModification
 * @param typGestionCandidature
 * @param isCanceled
 * @param isArchived
 */
public void init(final Boolean modeModification, final String typGestionCandidature, final Boolean isCanceled, final Boolean isArchived) {
    modeModif = modeModification;
    /* Style */
    setSizeFull();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setSizeFull();
    addComponent(layout);
    /* Titre */
    final HorizontalLayout hlTitle = new HorizontalLayout();
    hlTitle.setWidth(100, Unit.PERCENTAGE);
    hlTitle.setSpacing(true);
    titleView.setSizeUndefined();
    titleView.addStyleName(StyleConstants.VIEW_TITLE);
    hlTitle.addComponent(titleView);
    /* PopUp Légende */
    pvLegende = new PopupView(applicationContext.getMessage("legend.popup.link", null, UI.getCurrent().getLocale()), null);
    pvLegende.setVisible(false);
    hlTitle.addComponent(pvLegende);
    hlTitle.setComponentAlignment(pvLegende, Alignment.MIDDLE_LEFT);
    final Label spacer1 = new Label();
    spacer1.setWidth(100, Unit.PERCENTAGE);
    hlTitle.addComponent(spacer1);
    hlTitle.setExpandRatio(spacer1, 1);
    /* Label du nombre de candidatures */
    nbCandidatureLabel.setSizeUndefined();
    nbCandidatureLabel.addStyleName(ValoTheme.LABEL_COLORED);
    nbCandidatureLabel.addStyleName(StyleConstants.LABEL_ITALIC);
    hlTitle.addComponent(nbCandidatureLabel);
    hlTitle.setComponentAlignment(nbCandidatureLabel, Alignment.BOTTOM_RIGHT);
    final Label labelSpaceNb = new Label(" - ");
    labelSpaceNb.setSizeUndefined();
    labelSpaceNb.addStyleName(ValoTheme.LABEL_COLORED);
    labelSpaceNb.addStyleName(StyleConstants.LABEL_ITALIC);
    hlTitle.addComponent(labelSpaceNb);
    hlTitle.setComponentAlignment(labelSpaceNb, Alignment.BOTTOM_RIGHT);
    nbCandidatureLabelSelected.setSizeUndefined();
    nbCandidatureLabelSelected.addStyleName(ValoTheme.LABEL_COLORED);
    nbCandidatureLabelSelected.addStyleName(StyleConstants.LABEL_MORE_BOLD);
    nbCandidatureLabelSelected.addStyleName(StyleConstants.LABEL_ITALIC);
    hlTitle.addComponent(nbCandidatureLabelSelected);
    hlTitle.setComponentAlignment(nbCandidatureLabelSelected, Alignment.BOTTOM_RIGHT);
    layout.addComponent(hlTitle);
    /* Les droits sur les candidatures */
    final List<DroitFonctionnalite> listeDroitFonc = droitProfilController.getCandidatureFonctionnalite(typGestionCandidature, null);
    Boolean droitOpenCandidature = false;
    final Authentication auth = userController.getCurrentAuthentication();
    if (MethodUtils.isGestionCandidatureCtrCand(typGestionCandidature)) {
        /* Récupération du centre de candidature en cours */
        securityCtrCandFonc = userController.getCtrCandFonctionnalite(NomenclatureUtils.FONCTIONNALITE_GEST_CANDIDATURE, auth);
        if (securityCtrCandFonc.hasNoRight()) {
            return;
        }
        /* Verification que l'utilisateur a le droit d'ouvrir la candidature */
        final SecurityCtrCandFonc openCandidatureFonc = userController.getCtrCandFonctionnalite(NomenclatureUtils.FONCTIONNALITE_GEST_FENETRE_CAND, auth);
        if (!openCandidatureFonc.hasNoRight()) {
            droitOpenCandidature = true;
        }
        /* Chooser de commissions */
        final List<Commission> liste = commissionController.getCommissionsEnServiceByCtrCand(securityCtrCandFonc.getCtrCand(), securityCtrCandFonc.getIsGestAllCommission(), securityCtrCandFonc.getListeIdCommission(), isArchived);
        liste.sort(Comparator.comparing(Commission::getGenericLibelleAlternatif));
        cbCommission.setWidth(500, Unit.PIXELS);
        cbCommission.setItemCaptionPropertyId(ConstanteUtils.GENERIC_LIBELLE_ALTERNATIF);
        cbCommission.setTextInputAllowed(true);
        cbCommission.filterListValue(liste);
        cbCommission.setFilteringMode(FilteringMode.CONTAINS);
        cbCommission.setItemCaptionMode(ItemCaptionMode.PROPERTY);
        cbCommission.setPageLength(25);
        if (liste.size() > 0) {
            final Integer idCommEnCours = preferenceController.getPrefCandIdComm();
            if (idCommEnCours != null) {
                if (!cbCommission.setCommissionValue(idCommEnCours)) {
                    cbCommission.setValue(liste.get(0));
                }
            } else {
                cbCommission.setValue(liste.get(0));
            }
        }
        cbCommission.addValueChangeListener(e -> {
            majContainer();
            preferenceController.setPrefCandIdComm(getCommission());
        });
        /* Filtrage */
        final Panel panelCommission = new Panel();
        panelCommission.setWidth(100, Unit.PERCENTAGE);
        final HorizontalLayout filtreLayout = new HorizontalLayout();
        filtreLayout.setMargin(true);
        layout.addComponent(panelCommission);
        filtreLayout.setSpacing(true);
        final Label labelFiltre = new Label(applicationContext.getMessage("candidature.change.commission", null, UI.getCurrent().getLocale()));
        filtreLayout.addComponent(labelFiltre);
        filtreLayout.setComponentAlignment(labelFiltre, Alignment.MIDDLE_LEFT);
        filtreLayout.addComponent(cbCommission);
        filtreLayout.setComponentAlignment(cbCommission, Alignment.BOTTOM_LEFT);
        // popup astuce
        final PopupView pvAstuce = new PopupView(createPopUpAstuce());
        filtreLayout.addComponent(pvAstuce);
        filtreLayout.setComponentAlignment(pvAstuce, Alignment.MIDDLE_LEFT);
        panelCommission.setContent(filtreLayout);
    } else if (MethodUtils.isGestionCandidatureCommission(typGestionCandidature)) {
        /* Récupération de la commission en cours en cours */
        securityCommissionFonc = userController.getCommissionFonctionnalite(NomenclatureUtils.FONCTIONNALITE_GEST_CANDIDATURE, auth);
        if (securityCommissionFonc.hasNoRight()) {
            return;
        }
        /* Verification que l'utilisateur a le droit d'ouvrir la candidature */
        final SecurityCommissionFonc openCandidatureFonc = userController.getCommissionFonctionnalite(NomenclatureUtils.FONCTIONNALITE_GEST_FENETRE_CAND, auth);
        if (!openCandidatureFonc.hasNoRight()) {
            droitOpenCandidature = true;
        }
    }
    /* Mise a jour des listes utilisées */
    listeAlertesSva = alertSvaController.getAlertSvaEnService();
    listeTags = tagController.getTagEnServiceByCtrCand(getCentreCandidature());
    final Boolean droitOpenCandidatureFinal = droitOpenCandidature;
    /* Boutons */
    final HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setWidth(100, Unit.PERCENTAGE);
    buttonsLayout.setSpacing(true);
    layout.addComponent(buttonsLayout);
    /* Bouton d'ouverture de candidature */
    btnOpen.setCaption(applicationContext.getMessage("btnOpen", null, UI.getCurrent().getLocale()));
    btnOpen.setEnabled(false);
    btnOpen.addClickListener(e -> {
        final Candidature candidature = getCandidatureSelected();
        if (droitOpenCandidatureFinal && candidature != null) {
            candidatureController.openCandidatureGestionnaire(candidature, isCanceled, isArchived, listeDroitFonc);
        }
    });
    buttonsLayout.addComponent(btnOpen);
    buttonsLayout.setComponentAlignment(btnOpen, Alignment.MIDDLE_LEFT);
    if (modeModif && listeDroitFonc.stream().filter(e -> !e.getCodFonc().equals(NomenclatureUtils.FONCTIONNALITE_GEST_FENETRE_CAND)).count() > 0) {
        /* Bouton d'action */
        btnAction.setCaption(applicationContext.getMessage("btnAction", null, UI.getCurrent().getLocale()));
        btnAction.setEnabled(false);
        btnAction.addClickListener(e -> {
            final List<Candidature> listeCheck = getListeCandidatureSelected();
            if (listeCheck.size() == 0) {
                Notification.show(applicationContext.getMessage("candidature.noselected", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
            } else if (listeCheck.size() > ConstanteUtils.SIZE_MAX_EDITION_MASSE) {
                Notification.show(applicationContext.getMessage("candidature.toomuchselected", new Object[] { ConstanteUtils.SIZE_MAX_EDITION_MASSE }, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
                return;
            } else {
                candidatureCtrCandController.editActionCandidatureMasse(listeCheck, listeDroitFonc, getCentreCandidature(), this);
            }
        });
        buttonsLayout.addComponent(btnAction);
        buttonsLayout.setComponentAlignment(btnAction, Alignment.MIDDLE_CENTER);
    }
    /* Les options */
    final HorizontalLayout hlOption = new HorizontalLayout();
    hlOption.setSpacing(true);
    buttonsLayout.addComponent(hlOption);
    buttonsLayout.setComponentAlignment(hlOption, Alignment.MIDDLE_RIGHT);
    /* Export de la liste de candidature */
    btnExport.setDescription(applicationContext.getMessage("btnExport", null, UI.getCurrent().getLocale()));
    btnExport.addClickListener(e -> {
        @SuppressWarnings("unchecked") final List<Candidature> listeCand = (List<Candidature>) candidatureGrid.getContainerDataSource().getItemIds();
        if (listeCand.size() == 0) {
            return;
        }
        final CtrCandExportWindow window = new CtrCandExportWindow(getCommission(), listeCand);
        UI.getCurrent().addWindow(window);
    });
    hlOption.addComponent(btnExport);
    /* Filtres de comboBox perso */
    final String libFilterNull = applicationContext.getMessage("filter.null", null, UI.getCurrent().getLocale());
    final String libFilterExceptAtt = applicationContext.getMessage("filter.except.attente", null, UI.getCurrent().getLocale());
    final List<ComboBoxFilterPresentation> listeCbFilter = new ArrayList<>();
    /* Filtre de tag */
    listeCbFilter.add(new ComboBoxFilterPresentation(Candidature_.tags.getName(), getComboBoxFilterTag(), getNullTag(), TypeFilter.LIST_CONTAINS));
    /* Les filtres sur les Strings */
    listeCbFilter.add(new ComboBoxFilterPresentation(Candidature_.typeStatut.getName() + "." + TypeStatut_.libTypStatut.getName(), libFilterExceptAtt, tableRefController.getTypeStatutEnAttente().getLibTypStatut(), getComboBoxTypStatut(libFilterExceptAtt)));
    listeCbFilter.add(new ComboBoxFilterPresentation(Candidature_.typeTraitement.getName() + "." + TypeTraitement_.libTypTrait.getName(), libFilterExceptAtt, tableRefController.getTypeTraitementEnAttente().getLibTypTrait(), getComboBoxTypTrait(libFilterExceptAtt)));
    listeCbFilter.add(new ComboBoxFilterPresentation(LAST_TYPE_DECISION_PREFIXE + TypeDecisionCandidature_.typeDecision.getName() + "." + TypeDecision_.libTypDec.getName(), getComboBoxTypDec(libFilterNull), libFilterNull, TypeFilter.EQUALS));
    listeCbFilter.add(new ComboBoxFilterPresentation(Candidature_.siScolCatExoExt.getName() + "." + SiScolCatExoExt.DISPLAY_LIB_FIELD, getComboBoxCatExoExt(libFilterNull), libFilterNull, TypeFilter.EQUALS));
    /* La colonne de tag n'est plus automatiquement visibles si aucun tags en service */
    final String[] fieldsOrderVisibletoUse = (listeTags.size() != 0) ? FIELDS_ORDER_VISIBLE : (String[]) ArrayUtils.removeElement(FIELDS_ORDER_VISIBLE, Candidature_.tags.getName());
    /* Les préférences */
    final Integer frozen = preferenceController.getPrefCandFrozenColonne(1);
    final String[] visibleColonne = preferenceController.getPrefCandColonnesVisible(fieldsOrderVisibletoUse, FIELDS_ORDER);
    final String[] orderColonne = preferenceController.getPrefCandColonnesOrder(FIELDS_ORDER);
    final List<SortOrder> sortColonne = preferenceController.getPrefCandSortColonne(FIELDS_ORDER);
    /* Bouton de modification de preferences */
    final OneClickButton btnPref = new OneClickButton(FontAwesome.COG);
    btnPref.setDescription(applicationContext.getMessage("preference.view.btn", null, UI.getCurrent().getLocale()));
    btnPref.addClickListener(e -> {
        final CtrCandPreferenceViewWindow window = new CtrCandPreferenceViewWindow(candidatureGrid.getColumns(), candidatureGrid.getFrozenColumnCount(), FIELDS_ORDER.length, candidatureGrid.getSortOrder());
        window.addPreferenceViewListener(new PreferenceViewListener() {

            @Override
            public void saveInSession(final String valeurColonneVisible, final String valeurColonneOrder, final Integer frozenCols, final List<SortOrder> listeSortOrder) {
                preferenceController.savePrefCandInSession(valeurColonneVisible, valeurColonneOrder, frozenCols, listeSortOrder, true);
                candidatureGrid.setFrozenColumnCount(frozenCols);
                candidatureGrid.sort(listeSortOrder);
            }

            @Override
            public void saveInDb(final String valeurColonneVisible, final String valeurColonneOrder, final Integer frozenCols, final List<SortOrder> listeSortOrder) {
                preferenceController.savePrefCandInDb(valeurColonneVisible, valeurColonneOrder, frozenCols, listeSortOrder);
                candidatureGrid.setFrozenColumnCount(frozenCols);
                candidatureGrid.sort(listeSortOrder);
            }

            @Override
            public void initPref() {
                preferenceController.initPrefCand();
                candidatureGrid.setFrozenColumnCount(1);
                candidatureGrid.initColumn(FIELDS_ORDER, FIELDS_ORDER_VISIBLE, FIELDS_ORDER, "candidature.table.", preferenceController.getDefaultSortOrder(), listeCbFilter);
                candidatureGrid.sort();
            }
        });
        UI.getCurrent().addWindow(window);
    });
    /* Download du dossier */
    btnDownload.setEnabled(false);
    final Integer nb = parametreController.getNbDownloaMultipliedMax();
    if (nb.equals(1)) {
        btnDownload.setDescription(applicationContext.getMessage("candidature.download.btn", null, UI.getCurrent().getLocale()));
    } else {
        btnDownload.setDescription(applicationContext.getMessage("candidature.download.multiple.btn", new Object[] { nb }, UI.getCurrent().getLocale()));
    }
    new OnDemandFileDownloader(new OnDemandStreamFile() {

        @Override
        public OnDemandFile getOnDemandFile() {
            final OnDemandFile file = candidatureController.downlaodMultipleDossier(getListeCandidatureSelected(), getCommission());
            if (file != null) {
                btnDownload.setEnabled(true);
                return file;
            }
            btnDownload.setEnabled(true);
            return null;
        }
    }, btnDownload);
    /* Download des PJ */
    btnDownloadPj.setEnabled(false);
    btnDownloadPj.setDescription(applicationContext.getMessage("candidature.download.pj.btn", new Object[] { nb }, UI.getCurrent().getLocale()));
    btnDownloadPj.addClickListener(e -> {
        UI.getCurrent().addWindow(new CtrCandDownloadPJWindow(getCommission(), getListeCandidatureSelected()));
    });
    hlOption.addComponent(btnExport);
    hlOption.addComponent(btnDownload);
    hlOption.addComponent(btnDownloadPj);
    hlOption.addComponent(btnPref);
    /* Grid des candidatures */
    candidatureGrid.initColumn(FIELDS_ORDER, visibleColonne, orderColonne, "candidature.table.", sortColonne, listeCbFilter);
    /* Ajout des colonnes gelées */
    candidatureGrid.setFrozenColumnCount(frozen);
    /* Ajout du flag */
    candidatureGrid.setColumnConverter(Candidature_.tags.getName(), new TagsToHtmlSquareConverter());
    candidatureGrid.setColumnRenderer(Candidature_.tags.getName(), new HtmlRenderer());
    /* Formatage monnétaire */
    candidatureGrid.setColumnConverter(Candidature_.mntChargeCand.getName(), new BigDecimalMonetaireToStringConverter());
    candidatureGrid.setColumnRenderer(Candidature_.mntChargeCand.getName(), new HtmlRenderer());
    /* Mise a jour des données lors du filtre */
    candidatureGrid.addFilterListener(() -> {
        deselectFilter();
    });
    /* Mode de selection de la grid */
    if (modeModif) {
        candidatureGrid.setSelectionMode(SelectionMode.MULTI);
        final MultiSelectionModel selection = (MultiSelectionModel) candidatureGrid.getSelectionModel();
        selection.setSelectionLimit(ConstanteUtils.SIZE_MAX_EDITION_MASSE);
        candidatureGrid.addSelectionListener(e -> {
            if (candidatureGrid.getSelectedRows().size() == ConstanteUtils.SIZE_MAX_EDITION_MASSE) {
                Notification.show(applicationContext.getMessage("candidature.maxselected", new Object[] { ConstanteUtils.SIZE_MAX_EDITION_MASSE }, UI.getCurrent().getLocale()), Type.TRAY_NOTIFICATION);
            }
        });
    } else {
        candidatureGrid.setSelectionMode(SelectionMode.SINGLE);
    }
    /* Selection de la grid */
    candidatureGrid.addSelectionListener(e -> {
        setButtonState(droitOpenCandidatureFinal, listeDroitFonc);
        majNbCandidatures();
    });
    /* CLique sur un item */
    candidatureGrid.addItemClickListener(e -> {
        /* Suivant le mode de slection de la grid on fait un traitement */
        if (modeModif) {
            final MultiSelectionModel selection = (MultiSelectionModel) candidatureGrid.getSelectionModel();
            selection.deselectAll();
            try {
                selection.select(e.getItemId());
            } catch (final Exception e1) {
                Notification.show(applicationContext.getMessage("candidature.select.error", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
                majContainer();
                return;
            }
            setButtonState(droitOpenCandidatureFinal, listeDroitFonc);
            if (droitOpenCandidatureFinal && e.isDoubleClick()) {
                if (e.getItemId() instanceof Candidature) {
                    candidatureController.openCandidatureGestionnaire((Candidature) e.getItemId(), isCanceled, isArchived, listeDroitFonc);
                }
            }
            majNbCandidatures();
        } else {
            final SingleSelectionModel selection = (SingleSelectionModel) candidatureGrid.getSelectionModel();
            try {
                selection.select(e.getItemId());
            } catch (final Exception e1) {
                Notification.show(applicationContext.getMessage("candidature.select.error", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
                majContainer();
                return;
            }
            setButtonState(droitOpenCandidatureFinal, listeDroitFonc);
            if (e.isDoubleClick()) {
                if (droitOpenCandidatureFinal && e.getItemId() instanceof Candidature) {
                    candidatureController.openCandidatureGestionnaire((Candidature) e.getItemId(), isCanceled, isArchived, listeDroitFonc);
                }
            }
            majNbCandidatures();
        }
    });
    /* Ajustement de la taille de colonnes */
    candidatureGrid.setColumnWidth(Candidature_.candidat.getName() + "." + Candidat_.compteMinima.getName() + "." + CompteMinima_.numDossierOpiCptMin.getName(), 120);
    candidatureGrid.setColumnWidth(Candidature_.candidat.getName() + "." + Candidat_.nomPatCandidat.getName(), 130);
    candidatureGrid.setColumnWidth(Candidature_.candidat.getName() + "." + Candidat_.prenomCandidat.getName(), 120);
    candidatureGrid.setColumnWidth(Candidature_.formation.getName() + "." + Formation_.codForm.getName(), 130);
    candidatureGrid.setColumnWidth(Candidature_.formation.getName() + "." + Formation_.libForm.getName(), 200);
    candidatureGrid.setColumnWidth(LAST_TYPE_DECISION_PREFIXE + TypeDecisionCandidature_.commentTypeDecCand.getName(), 120);
    candidatureGrid.setColumnWidth(LAST_TYPE_DECISION_PREFIXE + TypeDecisionCandidature_.motivationAvis.getName() + "." + MotivationAvis_.libMotiv.getName(), 120);
    candidatureGrid.setColumnWidth(Candidature_.typeStatut.getName() + "." + TypeStatut_.libTypStatut.getName(), 145);
    candidatureGrid.setColumnWidth(Candidature_.typeTraitement.getName() + "." + TypeTraitement_.libTypTrait.getName(), 157);
    candidatureGrid.setColumnWidth(Candidature_.temAcceptCand.getName(), 151);
    candidatureGrid.setColumnWidth(Candidature_.tags.getName(), 100);
    candidatureGrid.setColumnWidth(Candidature_.datNewConfirmCand.getName(), 210);
    candidatureGrid.setColumnWidth(Candidature_.datNewRetourCand.getName(), 180);
    layout.addComponent(candidatureGrid);
    layout.setExpandRatio(candidatureGrid, 1);
    candidatureGrid.setSizeFull();
    /* Ajoute les alertes SVA */
    addAlertSva(isCanceled, isArchived);
    /* Ajoute la légende */
    addLegend();
}
Also used : Panel(com.vaadin.ui.Panel) CommissionController(fr.univlorraine.ecandidat.controllers.CommissionController) PreferenceController(fr.univlorraine.ecandidat.controllers.PreferenceController) Opi_(fr.univlorraine.ecandidat.entities.ecandidat.Opi_) CtrCandExportWindow(fr.univlorraine.ecandidat.views.windows.CtrCandExportWindow) OnDemandStreamFile(fr.univlorraine.ecandidat.vaadin.components.OnDemandFileUtils.OnDemandStreamFile) CandidatureController(fr.univlorraine.ecandidat.controllers.CandidatureController) Alignment(com.vaadin.ui.Alignment) UI(com.vaadin.ui.UI) PreferenceViewListener(fr.univlorraine.ecandidat.views.windows.CtrCandPreferenceViewWindow.PreferenceViewListener) CentreCandidature(fr.univlorraine.ecandidat.entities.ecandidat.CentreCandidature) Map(java.util.Map) Page(com.vaadin.server.Page) CompteMinima_(fr.univlorraine.ecandidat.entities.ecandidat.CompteMinima_) GridFormatting(fr.univlorraine.ecandidat.vaadin.components.GridFormatting) ItemCaptionMode(com.vaadin.ui.AbstractSelect.ItemCaptionMode) ValoTheme(com.vaadin.ui.themes.ValoTheme) OnDemandFileDownloader(fr.univlorraine.ecandidat.vaadin.components.OnDemandFileDownloader) PopupView(com.vaadin.ui.PopupView) Candidature_(fr.univlorraine.ecandidat.entities.ecandidat.Candidature_) ConstanteUtils(fr.univlorraine.ecandidat.utils.ConstanteUtils) Position(com.vaadin.shared.Position) FilteringMode(com.vaadin.shared.ui.combobox.FilteringMode) MethodUtils(fr.univlorraine.ecandidat.utils.MethodUtils) SecurityCtrCandFonc(fr.univlorraine.ecandidat.services.security.SecurityCtrCandFonc) TypeDecisionCandidature_(fr.univlorraine.ecandidat.entities.ecandidat.TypeDecisionCandidature_) Resource(javax.annotation.Resource) StyleConstants(fr.univlorraine.ecandidat.StyleConstants) TypeDecisionCandidature(fr.univlorraine.ecandidat.entities.ecandidat.TypeDecisionCandidature) RowStyleGenerator(com.vaadin.ui.Grid.RowStyleGenerator) TypeTraitement_(fr.univlorraine.ecandidat.entities.ecandidat.TypeTraitement_) BeanItemContainer(com.vaadin.data.util.BeanItemContainer) SingleSelectionModel(com.vaadin.ui.Grid.SingleSelectionModel) List(java.util.List) Type(com.vaadin.ui.Notification.Type) TagsToHtmlSquareConverter(fr.univlorraine.ecandidat.vaadin.components.GridConverter.TagsToHtmlSquareConverter) OnDemandFile(fr.univlorraine.ecandidat.vaadin.components.OnDemandFile) TypeDecisionController(fr.univlorraine.ecandidat.controllers.TypeDecisionController) LocalDate(java.time.LocalDate) TypeFilter(fr.univlorraine.ecandidat.utils.bean.presentation.ComboBoxFilterPresentation.TypeFilter) AdresseController(fr.univlorraine.ecandidat.controllers.AdresseController) Candidature(fr.univlorraine.ecandidat.entities.ecandidat.Candidature) SortOrder(com.vaadin.data.sort.SortOrder) UserController(fr.univlorraine.ecandidat.controllers.UserController) Authentication(org.springframework.security.core.Authentication) SelectionMode(com.vaadin.ui.Grid.SelectionMode) OneClickButton(fr.univlorraine.ecandidat.vaadin.components.OneClickButton) DroitProfilController(fr.univlorraine.ecandidat.controllers.DroitProfilController) TypeDecision_(fr.univlorraine.ecandidat.entities.ecandidat.TypeDecision_) StreamResource(com.vaadin.server.StreamResource) ContentMode(com.vaadin.shared.ui.label.ContentMode) BeanItem(com.vaadin.data.util.BeanItem) VerticalLayout(com.vaadin.ui.VerticalLayout) ComboBox(com.vaadin.ui.ComboBox) TableRefController(fr.univlorraine.ecandidat.controllers.TableRefController) HashMap(java.util.HashMap) AlertSva(fr.univlorraine.ecandidat.entities.ecandidat.AlertSva) BigDecimalMonetaireToStringConverter(fr.univlorraine.ecandidat.vaadin.components.GridConverter.BigDecimalMonetaireToStringConverter) Content(com.vaadin.ui.PopupView.Content) Tag_(fr.univlorraine.ecandidat.entities.ecandidat.Tag_) CtrCandDownloadPJWindow(fr.univlorraine.ecandidat.views.windows.CtrCandDownloadPJWindow) ArrayList(java.util.ArrayList) FontAwesome(com.vaadin.server.FontAwesome) CacheController(fr.univlorraine.ecandidat.controllers.CacheController) NomenclatureUtils(fr.univlorraine.ecandidat.utils.NomenclatureUtils) Notification(com.vaadin.ui.Notification) Formation_(fr.univlorraine.ecandidat.entities.ecandidat.Formation_) Label(com.vaadin.ui.Label) Candidat_(fr.univlorraine.ecandidat.entities.ecandidat.Candidat_) CtrCandPreferenceViewWindow(fr.univlorraine.ecandidat.views.windows.CtrCandPreferenceViewWindow) SiScolCatExoExt(fr.univlorraine.ecandidat.entities.ecandidat.SiScolCatExoExt) MotivationAvis_(fr.univlorraine.ecandidat.entities.ecandidat.MotivationAvis_) CandidatureMasseListener(fr.univlorraine.ecandidat.utils.ListenerUtils.CandidatureMasseListener) TypeStatut_(fr.univlorraine.ecandidat.entities.ecandidat.TypeStatut_) RowReference(com.vaadin.ui.Grid.RowReference) TagController(fr.univlorraine.ecandidat.controllers.TagController) TagImageSource(fr.univlorraine.ecandidat.vaadin.components.TagImageSource) Tag(fr.univlorraine.ecandidat.entities.ecandidat.Tag) ComboBoxCommission(fr.univlorraine.ecandidat.vaadin.form.combo.ComboBoxCommission) ApplicationContext(org.springframework.context.ApplicationContext) DroitFonctionnalite(fr.univlorraine.ecandidat.entities.ecandidat.DroitFonctionnalite) Commission(fr.univlorraine.ecandidat.entities.ecandidat.Commission) ParametreController(fr.univlorraine.ecandidat.controllers.ParametreController) ChronoUnit(java.time.temporal.ChronoUnit) AlertSvaController(fr.univlorraine.ecandidat.controllers.AlertSvaController) HorizontalLayout(com.vaadin.ui.HorizontalLayout) CandidatureCtrCandController(fr.univlorraine.ecandidat.controllers.CandidatureCtrCandController) SecurityCommissionFonc(fr.univlorraine.ecandidat.services.security.SecurityCommissionFonc) CandidaturePieceController(fr.univlorraine.ecandidat.controllers.CandidaturePieceController) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer) ComboBoxFilterPresentation(fr.univlorraine.ecandidat.utils.bean.presentation.ComboBoxFilterPresentation) Comparator(java.util.Comparator) ArrayUtils(org.apache.commons.lang.ArrayUtils) Component(com.vaadin.ui.Component) MultiSelectionModel(com.vaadin.ui.Grid.MultiSelectionModel) OnDemandStreamFile(fr.univlorraine.ecandidat.vaadin.components.OnDemandFileUtils.OnDemandStreamFile) SingleSelectionModel(com.vaadin.ui.Grid.SingleSelectionModel) MultiSelectionModel(com.vaadin.ui.Grid.MultiSelectionModel) Label(com.vaadin.ui.Label) ComboBoxCommission(fr.univlorraine.ecandidat.vaadin.form.combo.ComboBoxCommission) Commission(fr.univlorraine.ecandidat.entities.ecandidat.Commission) ArrayList(java.util.ArrayList) CentreCandidature(fr.univlorraine.ecandidat.entities.ecandidat.CentreCandidature) TypeDecisionCandidature(fr.univlorraine.ecandidat.entities.ecandidat.TypeDecisionCandidature) Candidature(fr.univlorraine.ecandidat.entities.ecandidat.Candidature) OnDemandFile(fr.univlorraine.ecandidat.vaadin.components.OnDemandFile) SecurityCommissionFonc(fr.univlorraine.ecandidat.services.security.SecurityCommissionFonc) HorizontalLayout(com.vaadin.ui.HorizontalLayout) CtrCandDownloadPJWindow(fr.univlorraine.ecandidat.views.windows.CtrCandDownloadPJWindow) CtrCandExportWindow(fr.univlorraine.ecandidat.views.windows.CtrCandExportWindow) CtrCandPreferenceViewWindow(fr.univlorraine.ecandidat.views.windows.CtrCandPreferenceViewWindow) List(java.util.List) ArrayList(java.util.ArrayList) OneClickButton(fr.univlorraine.ecandidat.vaadin.components.OneClickButton) OnDemandFileDownloader(fr.univlorraine.ecandidat.vaadin.components.OnDemandFileDownloader) PopupView(com.vaadin.ui.PopupView) SortOrder(com.vaadin.data.sort.SortOrder) PreferenceViewListener(fr.univlorraine.ecandidat.views.windows.CtrCandPreferenceViewWindow.PreferenceViewListener) ComboBoxFilterPresentation(fr.univlorraine.ecandidat.utils.bean.presentation.ComboBoxFilterPresentation) Panel(com.vaadin.ui.Panel) BigDecimalMonetaireToStringConverter(fr.univlorraine.ecandidat.vaadin.components.GridConverter.BigDecimalMonetaireToStringConverter) Authentication(org.springframework.security.core.Authentication) TagsToHtmlSquareConverter(fr.univlorraine.ecandidat.vaadin.components.GridConverter.TagsToHtmlSquareConverter) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer) SecurityCtrCandFonc(fr.univlorraine.ecandidat.services.security.SecurityCtrCandFonc) DroitFonctionnalite(fr.univlorraine.ecandidat.entities.ecandidat.DroitFonctionnalite)

Aggregations

Tag (fr.univlorraine.ecandidat.entities.ecandidat.Tag)5 BeanItemContainer (com.vaadin.data.util.BeanItemContainer)2 StreamResource (com.vaadin.server.StreamResource)2 ComboBox (com.vaadin.ui.ComboBox)2 HorizontalLayout (com.vaadin.ui.HorizontalLayout)2 Label (com.vaadin.ui.Label)2 TagImageSource (fr.univlorraine.ecandidat.vaadin.components.TagImageSource)2 SortOrder (com.vaadin.data.sort.SortOrder)1 BeanItem (com.vaadin.data.util.BeanItem)1 FontAwesome (com.vaadin.server.FontAwesome)1 Page (com.vaadin.server.Page)1 Position (com.vaadin.shared.Position)1 FilteringMode (com.vaadin.shared.ui.combobox.FilteringMode)1 ContentMode (com.vaadin.shared.ui.label.ContentMode)1 ItemCaptionMode (com.vaadin.ui.AbstractSelect.ItemCaptionMode)1 Alignment (com.vaadin.ui.Alignment)1 Component (com.vaadin.ui.Component)1 MultiSelectionModel (com.vaadin.ui.Grid.MultiSelectionModel)1 RowReference (com.vaadin.ui.Grid.RowReference)1 RowStyleGenerator (com.vaadin.ui.Grid.RowStyleGenerator)1