use of fr.univlorraine.ecandidat.vaadin.components.OnDemandFileUtils.OnDemandStreamFile in project esup-ecandidat by EsupPortail.
the class PieceJustifViewTemplate method init.
/**
* Initialise la vue
*/
@PostConstruct
public void init() {
/* Style */
setSizeFull();
setMargin(true);
setSpacing(true);
/* Titre */
titleParam.addStyleName(StyleConstants.VIEW_TITLE);
addComponent(titleParam);
/* Boutons */
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
addComponent(buttonsLayout);
btnNew.setCaption(applicationContext.getMessage("pieceJustif.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 (pieceJustifTable.getValue() instanceof PieceJustif) {
pieceJustifController.editPieceJustif((PieceJustif) pieceJustifTable.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 (pieceJustifTable.getValue() instanceof PieceJustif) {
pieceJustifController.deletePieceJustif((PieceJustif) pieceJustifTable.getValue());
}
});
buttonsLayout.addComponent(btnDelete);
buttonsLayout.setComponentAlignment(btnDelete, Alignment.MIDDLE_RIGHT);
/* Table des pieceJustifs */
pieceJustifTable.addBooleanColumn(PieceJustif_.tesPj.getName());
pieceJustifTable.addBooleanColumn(PieceJustif_.temCommunPj.getName());
pieceJustifTable.addBooleanColumn(PieceJustif_.temUnicitePj.getName());
pieceJustifTable.addBooleanColumn(PieceJustif_.temConditionnelPj.getName());
/* Type de traitement */
pieceJustifTable.addGeneratedColumn(PieceJustif_.typeTraitement.getName(), new ColumnGenerator() {
@Override
public Object generateCell(final Table source, final Object itemId, final Object columnId) {
final PieceJustif pieceJustif = (PieceJustif) itemId;
if (pieceJustif.getTypeTraitement() != null) {
return pieceJustif.getTypeTraitement().getLibTypTrait();
} else {
return applicationContext.getMessage("typeTraitement.lib.all", null, UI.getCurrent().getLocale());
}
}
});
if (!fileController.getModeDematBackoffice().equals(ConstanteUtils.TYPE_FICHIER_STOCK_NONE)) {
pieceJustifTable.addGeneratedColumn(PieceJustif_.fichier.getName(), new ColumnGenerator() {
@Override
public Object generateCell(final Table source, final Object itemId, final Object columnId) {
final PieceJustif pieceJustif = (PieceJustif) itemId;
if (pieceJustif.getFichier() == null) {
if (isVisuPjCommunMode && !isReadOnly) {
OneClickButton btnAdd = new OneClickButton(FontAwesome.PLUS);
btnAdd.addStyleName(StyleConstants.ON_DEMAND_FILE_LAYOUT);
btnAdd.setDescription(applicationContext.getMessage("file.btnAdd", null, UI.getCurrent().getLocale()));
btnAdd.addClickListener(e -> pieceJustifController.addFileToPieceJustificative(pieceJustif));
return btnAdd;
}
return null;
} else {
OnDemandFileLayout fileLayout = new OnDemandFileLayout(pieceJustif.getFichier().getNomFichier());
/* Delete */
if (isVisuPjCommunMode && !isReadOnly) {
fileLayout.addBtnDelClickListener(e -> pieceJustifController.deleteFileToPieceJustificative(pieceJustif));
}
/* Viewer si JPG */
if (MethodUtils.isImgFileName(pieceJustif.getFichier().getNomFichier())) {
fileLayout.addBtnViewerClickListener(e -> {
OnDemandFile file = new OnDemandFile(pieceJustif.getFichier().getNomFichier(), fileController.getInputStreamFromFichier(pieceJustif.getFichier()));
ImageViewerWindow iv = new ImageViewerWindow(file, null);
UI.getCurrent().addWindow(iv);
});
/* Opener si PDF */
} else if (MethodUtils.isPdfFileName(pieceJustif.getFichier().getNomFichier())) {
fileLayout.addBtnViewerPdfBrowserOpener(new OnDemandStreamFile() {
@Override
public OnDemandFile getOnDemandFile() {
return new OnDemandFile(pieceJustif.getFichier().getNomFichier(), fileController.getInputStreamFromFichier(pieceJustif.getFichier()));
}
});
}
/* Download */
fileLayout.addBtnDownloadFileDownloader(new OnDemandStreamFile() {
@Override
public OnDemandFile getOnDemandFile() {
return new OnDemandFile(pieceJustif.getFichier().getNomFichier(), fileController.getInputStreamFromFichier(pieceJustif.getFichier()));
}
});
return fileLayout;
}
}
});
FIELDS_ORDER = FIELDS_ORDER_FILE;
} else {
FIELDS_ORDER = FIELDS_ORDER_NO_FILE;
}
pieceJustifTable.setSizeFull();
pieceJustifTable.setVisibleColumns((Object[]) FIELDS_ORDER);
for (String fieldName : FIELDS_ORDER) {
pieceJustifTable.setColumnHeader(fieldName, applicationContext.getMessage("pieceJustif.table." + fieldName, null, UI.getCurrent().getLocale()));
}
container.setItemSorter(new DefaultItemSorter() {
@Override
public int compare(final Object itemId1, final Object itemId2) {
return ((PieceJustif) itemId1).compareTo((PieceJustif) itemId2);
}
});
pieceJustifTable.addHeaderClickListener(e -> {
container.setItemSorter(new DefaultItemSorter());
isOrderEnable = false;
});
pieceJustifTable.setColumnCollapsingAllowed(true);
pieceJustifTable.setColumnReorderingAllowed(true);
pieceJustifTable.setSelectable(true);
pieceJustifTable.setImmediate(true);
pieceJustifTable.setColumnWidth(PieceJustif_.orderPj.getName(), 60);
pieceJustifTable.addItemSetChangeListener(e -> pieceJustifTable.sanitizeSelection());
pieceJustifTable.addValueChangeListener(e -> {
/*
* Les boutons d'édition et de suppression de pieceJustif sont actifs seulement
* si une pieceJustif est sélectionnée.
*/
boolean pieceJustifIsSelected = pieceJustifTable.getValue() instanceof PieceJustif;
btnEdit.setEnabled(pieceJustifIsSelected);
btnDelete.setEnabled(pieceJustifIsSelected);
});
addComponent(pieceJustifTable);
setExpandRatio(pieceJustifTable, 1);
}
use of fr.univlorraine.ecandidat.vaadin.components.OnDemandFileUtils.OnDemandStreamFile in project esup-ecandidat by EsupPortail.
the class StatViewTemplate method init.
/**
* Initialise le template
*
* @param title
* @param code
* @param libelle
*/
public void init(final String title, final String code, final String libelle, final String libelleHs) {
/* Style */
setSizeFull();
setMargin(true);
setSpacing(true);
/* Titre */
Label titleParam = new Label(title);
titleParam.addStyleName(StyleConstants.VIEW_TITLE);
addComponent(titleParam);
/* Boutons */
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
addComponent(buttonsLayout);
/* Choix de campagne */
HorizontalLayout campagneLayout = new HorizontalLayout();
campagneLayout.setWidth(100, Unit.PERCENTAGE);
campagneLayout.setSpacing(true);
buttonsLayout.addComponent(campagneLayout);
/* Label campagne */
Label labelCampagne = new Label(applicationContext.getMessage("stat.change.camp", null, UI.getCurrent().getLocale()));
labelCampagne.setSizeUndefined();
campagneLayout.addComponent(labelCampagne);
campagneLayout.setComponentAlignment(labelCampagne, Alignment.MIDDLE_LEFT);
/* ListeBox campagne */
List<Campagne> listeCampagne = campagneController.getCampagnes();
listeCampagne.sort(Comparator.comparing(Campagne::getCodCamp).reversed());
cbCampagne = new RequiredComboBox<>(listeCampagne, Campagne.class);
cbCampagne.setValue(campagneController.getCampagneActive());
campagneLayout.addComponent(cbCampagne);
campagneLayout.setExpandRatio(cbCampagne, 1);
campagneLayout.setComponentAlignment(cbCampagne, Alignment.BOTTOM_LEFT);
cbCampagne.addValueChangeListener(e -> {
majContainer();
});
cbDisplayHs.setCaption(libelleHs);
campagneLayout.addComponent(cbDisplayHs);
campagneLayout.setComponentAlignment(cbDisplayHs, Alignment.MIDDLE_LEFT);
cbDisplayHs.addValueChangeListener(e -> {
majContainer();
});
/* Export des candidatures désactivé */
/*
* OneClickButton btnExportCandidature = new
* OneClickButton(applicationContext.getMessage("stat.export.candidature.btn",
* null, UI.getCurrent().getLocale()), FontAwesome.FILE_EXCEL_O);
* btnExportCandidature.setDescription(applicationContext.getMessage(
* "stat.export.candidature.btn", null, UI.getCurrent().getLocale()));
* btnExportCandidature.addClickListener(e->{ CtrCandExportWindow window = new
* CtrCandExportWindow(securityCtrCandFonc.getCtrCand());
* UI.getCurrent().addWindow(window); });
*/
/* La grid */
grid = new GridFormatting<>(StatFormationPresentation.class);
grid.initColumn(new String[] { StatFormationPresentation.CHAMPS_COD, StatFormationPresentation.CHAMPS_LIB, StatFormationPresentation.CHAMPS_LIB_SUPP, StatFormationPresentation.CHAMPS_NB_CANDIDATURE_TOTAL, StatFormationPresentation.CHAMPS_NB_CANDIDATURE_CANCEL, StatFormationPresentation.CHAMPS_NB_STATUT_ATTENTE, StatFormationPresentation.CHAMPS_NB_STATUT_RECEPTIONNE, StatFormationPresentation.CHAMPS_NB_STATUT_COMPLET, StatFormationPresentation.CHAMPS_NB_STATUT_INCOMPLET, StatFormationPresentation.CHAMPS_NB_AVIS_FAVORABLE, StatFormationPresentation.CHAMPS_NB_AVIS_DEFAVORABLE, StatFormationPresentation.CHAMPS_NB_AVIS_LISTECOMP, StatFormationPresentation.CHAMPS_NB_AVIS_LISTEATTENTE, StatFormationPresentation.CHAMPS_NB_AVIS_PRESELECTION, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_VALIDE, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_NON_VALIDE, StatFormationPresentation.CHAMPS_NB_CONFIRM, StatFormationPresentation.CHAMPS_NB_DESIST, StatFormationPresentation.CHAMPS_CAPACITE_ACCUEIL }, "stat.table.", StatFormationPresentation.CHAMPS_LIB);
grid.setSizeFull();
grid.setFrozenColumnCount(2);
grid.setSelectionMode(SelectionMode.NONE);
/* Largeur des colonnes */
grid.setColumnWidth(StatFormationPresentation.CHAMPS_COD, 150);
grid.setColumnsWidth(300, StatFormationPresentation.CHAMPS_LIB, StatFormationPresentation.CHAMPS_LIB_SUPP);
grid.setColumnsWidth(115, StatFormationPresentation.CHAMPS_NB_CANDIDATURE_TOTAL, StatFormationPresentation.CHAMPS_NB_CANDIDATURE_CANCEL, StatFormationPresentation.CHAMPS_NB_STATUT_ATTENTE, StatFormationPresentation.CHAMPS_NB_STATUT_RECEPTIONNE, StatFormationPresentation.CHAMPS_NB_STATUT_COMPLET, StatFormationPresentation.CHAMPS_NB_STATUT_INCOMPLET, StatFormationPresentation.CHAMPS_NB_AVIS_FAVORABLE, StatFormationPresentation.CHAMPS_NB_AVIS_DEFAVORABLE, StatFormationPresentation.CHAMPS_NB_AVIS_LISTECOMP, StatFormationPresentation.CHAMPS_NB_AVIS_LISTEATTENTE, StatFormationPresentation.CHAMPS_NB_AVIS_PRESELECTION, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_VALIDE, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_NON_VALIDE, StatFormationPresentation.CHAMPS_NB_CONFIRM, StatFormationPresentation.CHAMPS_NB_DESIST);
grid.removeFilterCells(StatFormationPresentation.CHAMPS_NB_CANDIDATURE_TOTAL, StatFormationPresentation.CHAMPS_NB_CANDIDATURE_CANCEL, StatFormationPresentation.CHAMPS_NB_STATUT_ATTENTE, StatFormationPresentation.CHAMPS_NB_STATUT_RECEPTIONNE, StatFormationPresentation.CHAMPS_NB_STATUT_COMPLET, StatFormationPresentation.CHAMPS_NB_STATUT_INCOMPLET, StatFormationPresentation.CHAMPS_NB_AVIS_FAVORABLE, StatFormationPresentation.CHAMPS_NB_AVIS_DEFAVORABLE, StatFormationPresentation.CHAMPS_NB_AVIS_LISTECOMP, StatFormationPresentation.CHAMPS_NB_AVIS_LISTEATTENTE, StatFormationPresentation.CHAMPS_NB_AVIS_PRESELECTION, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_VALIDE, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_NON_VALIDE, StatFormationPresentation.CHAMPS_NB_CONFIRM, StatFormationPresentation.CHAMPS_NB_DESIST);
/* Header */
HeaderRow headerRow = grid.prependHeaderRow();
headerRow.setStyleName(ValoTheme.TEXTFIELD_ALIGN_CENTER);
headerRow.join(StatFormationPresentation.CHAMPS_COD, StatFormationPresentation.CHAMPS_LIB).setText("");
headerRow.join(StatFormationPresentation.CHAMPS_NB_CANDIDATURE_TOTAL, StatFormationPresentation.CHAMPS_NB_CANDIDATURE_CANCEL).setText(applicationContext.getMessage("stat.table.header.join.nbCandidature", null, UI.getCurrent().getLocale()));
headerRow.join(StatFormationPresentation.CHAMPS_NB_STATUT_ATTENTE, StatFormationPresentation.CHAMPS_NB_STATUT_RECEPTIONNE, StatFormationPresentation.CHAMPS_NB_STATUT_COMPLET, StatFormationPresentation.CHAMPS_NB_STATUT_INCOMPLET).setText(applicationContext.getMessage("stat.table.header.join.statut", null, UI.getCurrent().getLocale()));
headerRow.join(StatFormationPresentation.CHAMPS_NB_AVIS_FAVORABLE, StatFormationPresentation.CHAMPS_NB_AVIS_DEFAVORABLE, StatFormationPresentation.CHAMPS_NB_AVIS_LISTECOMP, StatFormationPresentation.CHAMPS_NB_AVIS_LISTEATTENTE, StatFormationPresentation.CHAMPS_NB_AVIS_PRESELECTION).setText(applicationContext.getMessage("stat.table.header.join.avis", null, UI.getCurrent().getLocale()));
headerRow.join(StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_VALIDE, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_NON_VALIDE).setText(applicationContext.getMessage("stat.table.header.join.avis.total", null, UI.getCurrent().getLocale()));
headerRow.join(StatFormationPresentation.CHAMPS_NB_CONFIRM, StatFormationPresentation.CHAMPS_NB_DESIST).setText(applicationContext.getMessage("stat.table.header.join.confirm", null, UI.getCurrent().getLocale()));
addComponent(grid);
setExpandRatio(grid, 1);
/* Ajout des totaux dans le footer */
footerRow = grid.prependFooterRow();
footerRow.setStyleName(StyleConstants.GRID_FOOTER);
FooterCell cellTxt = footerRow.join(StatFormationPresentation.CHAMPS_COD, StatFormationPresentation.CHAMPS_LIB);
cellTxt.setText(applicationContext.getMessage("stat.table.footer.join.sum", null, UI.getCurrent().getLocale()));
cellTxt.setStyleName(StyleConstants.GRID_FOOTER_TITLE);
grid.addFilterListener(new FilterListener() {
@Override
public void filter() {
updateFooter();
}
});
grid.setRowStyleGenerator(new RowStyleGenerator() {
@Override
public String getStyle(final RowReference row) {
StatFormationPresentation pres = (StatFormationPresentation) row.getItemId();
if (!pres.getTes()) {
return StyleConstants.GRID_ROW_STAT_HS;
}
return null;
}
});
/* Export */
Button btnExport = new Button(applicationContext.getMessage("btnExport", null, UI.getCurrent().getLocale()), FontAwesome.FILE_EXCEL_O);
btnExport.setDescription(applicationContext.getMessage("btnExport", null, UI.getCurrent().getLocale()));
buttonsLayout.addComponent(btnExport);
buttonsLayout.setComponentAlignment(btnExport, Alignment.MIDDLE_RIGHT);
btnExport.setDisableOnClick(true);
new OnDemandFileDownloader(new OnDemandStreamFile() {
@Override
public OnDemandFile getOnDemandFile() {
OnDemandFile file = statController.generateExport(getCampagne(), code, libelle, grid.getItems(), footerStat, getLibelleExport(), getLibelleSuppExport(), getDisplayCapaciteAccueil());
if (file != null) {
btnExport.setEnabled(true);
return file;
}
btnExport.setEnabled(true);
return null;
}
}, btnExport);
}
use of fr.univlorraine.ecandidat.vaadin.components.OnDemandFileUtils.OnDemandStreamFile in project esup-ecandidat by EsupPortail.
the class CtrCandCommissionView method init.
/**
* Initialise la vue
*/
@PostConstruct
public void init() {
/* Style */
setSizeFull();
setMargin(true);
setSpacing(true);
/* Récupération du centre de canidature en cours */
securityCtrCandFonc = userController.getCtrCandFonctionnalite(NomenclatureUtils.FONCTIONNALITE_GEST_COMMISSION);
if (securityCtrCandFonc.hasNoRight()) {
return;
}
/* Table des centres de candidatures */
VerticalLayout commissionLayout = new VerticalLayout();
commissionLayout.setSizeFull();
commissionLayout.setSpacing(true);
/* Titre */
Label titleParam = new Label(applicationContext.getMessage("commission.title", new Object[] { securityCtrCandFonc.getCtrCand().getLibCtrCand() }, UI.getCurrent().getLocale()));
titleParam.addStyleName(StyleConstants.VIEW_TITLE);
commissionLayout.addComponent(titleParam);
/* Boutons */
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
commissionLayout.addComponent(buttonsLayout);
OneClickButton btnNew = new OneClickButton(applicationContext.getMessage("commission.btnNouveau", null, UI.getCurrent().getLocale()), FontAwesome.PLUS);
btnNew.setEnabled(true);
btnNew.addClickListener(e -> {
commissionController.editNewCommission(securityCtrCandFonc.getCtrCand());
});
buttonsLayout.addComponent(btnNew);
buttonsLayout.setComponentAlignment(btnNew, Alignment.MIDDLE_LEFT);
if (!securityCtrCandFonc.getIsGestAllCommission()) {
btnNew.setEnabled(false);
btnNew.setDescription(applicationContext.getMessage("commission.create.disable", null, UI.getCurrent().getLocale()));
}
OneClickButton btnEdit = new OneClickButton(applicationContext.getMessage("btnEdit", null, UI.getCurrent().getLocale()), FontAwesome.PENCIL);
btnEdit.setEnabled(false);
btnEdit.addClickListener(e -> {
if (commissionTable.getValue() instanceof Commission) {
commissionController.editCommission((Commission) commissionTable.getValue(), true);
}
});
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 (commissionTable.getValue() instanceof Commission) {
commissionController.deleteCommission((Commission) commissionTable.getValue());
}
});
buttonsLayout.addComponent(btnDelete);
buttonsLayout.setComponentAlignment(btnDelete, Alignment.MIDDLE_RIGHT);
Button btnExport = new Button(applicationContext.getMessage("btnExport", null, UI.getCurrent().getLocale()), FontAwesome.FILE_EXCEL_O);
/* Export de la liste des formations */
btnExport.setDescription(applicationContext.getMessage("btnExport", null, UI.getCurrent().getLocale()));
btnExport.setDisableOnClick(true);
new OnDemandFileDownloader(new OnDemandStreamFile() {
@Override
public OnDemandFile getOnDemandFile() {
@SuppressWarnings("unchecked") List<Commission> listeCommission = (List<Commission>) commissionTable.getContainerDataSource().getItemIds();
if (listeCommission.size() == 0) {
btnExport.setEnabled(true);
return null;
}
/* Téléchargement */
OnDemandFile file = commissionController.generateExport(listeCommission, securityCtrCandFonc);
if (file != null) {
btnExport.setEnabled(true);
return file;
}
btnExport.setEnabled(true);
return null;
}
}, btnExport);
buttonsLayout.addComponent(btnExport);
buttonsLayout.setComponentAlignment(btnExport, Alignment.MIDDLE_RIGHT);
/* Table des commissions */
BeanItemContainer<Commission> container = new BeanItemContainer<>(Commission.class, commissionController.getCommissionsByCtrCand(securityCtrCandFonc.getCtrCand(), securityCtrCandFonc.getIsGestAllCommission(), securityCtrCandFonc.getListeIdCommission()));
commissionTable.setContainerDataSource(container);
commissionTable.addBooleanColumn(Commission_.tesComm.getName());
commissionTable.addBooleanColumn(Commission_.temEditLettreComm.getName());
commissionTable.setSortContainerPropertyId(Commission_.codComm.getName());
commissionTable.setColumnCollapsingAllowed(true);
commissionTable.setColumnReorderingAllowed(true);
commissionTable.setSelectable(true);
commissionTable.setImmediate(true);
commissionTable.addItemSetChangeListener(e -> commissionTable.sanitizeSelection());
commissionTable.addValueChangeListener(e -> {
/* Les boutons d'édition et de suppression de commission sont actifs seulement si une commission est sélectionnée. */
boolean commissionIsSelected = commissionTable.getValue() instanceof Commission;
btnEdit.setEnabled(commissionIsSelected);
btnDelete.setEnabled(commissionIsSelected);
btnNewMembre.setEnabled(commissionIsSelected);
if (commissionIsSelected) {
majMembreTable((Commission) commissionTable.getValue());
} else {
majMembreTable(null);
}
});
if (!fileController.getModeDematBackoffice().equals(ConstanteUtils.TYPE_FICHIER_STOCK_NONE)) {
commissionTable.addGeneratedColumn(PieceJustif_.fichier.getName(), new ColumnGenerator() {
/**
* serialVersionUID
*/
private static final long serialVersionUID = -1750183076315269277L;
@Override
public Object generateCell(final Table source, final Object itemId, final Object columnId) {
final Commission commission = (Commission) itemId;
if (commission.getFichier() == null) {
if (securityCtrCandFonc.isWrite()) {
OneClickButton btnAdd = new OneClickButton(FontAwesome.PLUS);
btnAdd.addStyleName(StyleConstants.ON_DEMAND_FILE_LAYOUT);
btnAdd.setDescription(applicationContext.getMessage("file.btnAdd", null, UI.getCurrent().getLocale()));
btnAdd.addClickListener(e -> commissionController.addFileToSignataire(commission));
return btnAdd;
}
return null;
} else {
OnDemandFileLayout fileLayout = new OnDemandFileLayout(commission.getFichier().getNomFichier());
/* Delete */
if (securityCtrCandFonc.isWrite()) {
fileLayout.addBtnDelClickListener(e -> commissionController.deleteFileToSignataire(commission));
}
/* Show */
fileLayout.addBtnViewerClickListener(e -> {
OnDemandFile file = new OnDemandFile(commission.getFichier().getNomFichier(), fileController.getInputStreamFromFichier(commission.getFichier()));
ImageViewerWindow iv = new ImageViewerWindow(file, applicationContext.getMessage("commission.signataire.warning", null, UI.getCurrent().getLocale()));
UI.getCurrent().addWindow(iv);
});
/* Download */
fileLayout.addBtnDownloadFileDownloader(new OnDemandStreamFile() {
@Override
public OnDemandFile getOnDemandFile() {
return new OnDemandFile(commission.getFichier().getNomFichier(), fileController.getInputStreamFromFichier(commission.getFichier()));
}
});
return fileLayout;
}
}
});
FIELDS_ORDER = FIELDS_ORDER_FILE;
} else {
FIELDS_ORDER = FIELDS_ORDER_NO_FILE;
}
commissionTable.setVisibleColumns((Object[]) FIELDS_ORDER);
for (String fieldName : FIELDS_ORDER) {
commissionTable.setColumnHeader(fieldName, applicationContext.getMessage("commission.table." + fieldName, null, UI.getCurrent().getLocale()));
}
commissionLayout.addComponent(commissionTable);
commissionLayout.setExpandRatio(commissionTable, 1);
commissionTable.setSizeFull();
addComponent(commissionLayout);
setExpandRatio(commissionLayout, 3);
/* Commission Membre */
VerticalLayout commissionMembreLayout = new VerticalLayout();
commissionMembreLayout.setSizeFull();
commissionMembreLayout.setSpacing(true);
/* Titre */
HorizontalLayout layoutMembreLabel = new HorizontalLayout();
layoutMembreLabel.setSpacing(true);
Label titleMembre = new Label(applicationContext.getMessage("commission.title.membre", null, UI.getCurrent().getLocale()));
titleMembre.addStyleName(StyleConstants.VIEW_SUBTITLE);
layoutMembreLabel.addComponent(titleMembre);
layoutMembreLabel.setComponentAlignment(titleMembre, Alignment.BOTTOM_LEFT);
labelMembre.setValue(applicationContext.getMessage("commission.membre.nocomm", null, UI.getCurrent().getLocale()));
labelMembre.addStyleName(ValoTheme.LABEL_SMALL);
layoutMembreLabel.addComponent(labelMembre);
layoutMembreLabel.setComponentAlignment(labelMembre, Alignment.BOTTOM_LEFT);
commissionMembreLayout.addComponent(layoutMembreLabel);
/* Boutons */
HorizontalLayout buttonsLayoutMembre = new HorizontalLayout();
buttonsLayoutMembre.setWidth(100, Unit.PERCENTAGE);
buttonsLayoutMembre.setSpacing(true);
commissionMembreLayout.addComponent(buttonsLayoutMembre);
btnNewMembre.setCaption(applicationContext.getMessage("droitprofilind.btnNouveauMembre", null, UI.getCurrent().getLocale()));
btnNewMembre.setEnabled(false);
btnNewMembre.addClickListener(e -> {
commissionController.addProfilToMembre((Commission) commissionTable.getValue());
});
buttonsLayoutMembre.addComponent(btnNewMembre);
buttonsLayoutMembre.setComponentAlignment(btnNewMembre, Alignment.MIDDLE_LEFT);
/* Edit profil */
OneClickButton btnEditMembre = new OneClickButton(applicationContext.getMessage("btnEdit", null, UI.getCurrent().getLocale()), FontAwesome.PENCIL);
btnEditMembre.setEnabled(false);
btnEditMembre.addClickListener(e -> {
if (commissionMembreTable.getValue() instanceof CommissionMembre) {
commissionController.updateProfilToMembre((CommissionMembre) commissionMembreTable.getValue());
}
});
buttonsLayoutMembre.addComponent(btnEditMembre);
buttonsLayoutMembre.setComponentAlignment(btnEditMembre, Alignment.MIDDLE_CENTER);
/* Delete profil */
OneClickButton btnDeleteMembre = new OneClickButton(applicationContext.getMessage("btnDelete", null, UI.getCurrent().getLocale()), FontAwesome.TRASH_O);
btnDeleteMembre.setEnabled(false);
btnDeleteMembre.addClickListener(e -> {
if (commissionMembreTable.getValue() instanceof CommissionMembre) {
commissionController.deleteProfilToMembre((CommissionMembre) commissionMembreTable.getValue());
}
});
buttonsLayoutMembre.addComponent(btnDeleteMembre);
buttonsLayoutMembre.setComponentAlignment(btnDeleteMembre, Alignment.MIDDLE_RIGHT);
/* Table des CommissionMembre */
BeanItemContainer<CommissionMembre> containerMembre = new BeanItemContainer<>(CommissionMembre.class);
containerMembre.addNestedContainerProperty(CommissionMembre_.droitProfilInd.getName() + "." + DroitProfilInd_.individu.getName() + "." + Individu_.loginInd.getName());
containerMembre.addNestedContainerProperty(CommissionMembre_.droitProfilInd.getName() + "." + DroitProfilInd_.individu.getName() + "." + Individu_.libelleInd.getName());
containerMembre.addNestedContainerProperty(CommissionMembre_.droitProfilInd.getName() + "." + DroitProfilInd_.droitProfil.getName() + "." + DroitProfil_.libProfil.getName());
commissionMembreTable.setContainerDataSource(containerMembre);
commissionMembreTable.addBooleanColumn(CommissionMembre_.temIsPresident.getName());
commissionMembreTable.setVisibleColumns((Object[]) FIELDS_ORDER_MEMBRE);
for (String fieldName : FIELDS_ORDER_MEMBRE) {
commissionMembreTable.setColumnHeader(fieldName, applicationContext.getMessage("droit." + fieldName, null, UI.getCurrent().getLocale()));
}
commissionMembreTable.setSortContainerPropertyId(CommissionMembre_.droitProfilInd.getName() + "." + DroitProfilInd_.individu.getName() + "." + Individu_.loginInd.getName());
commissionMembreTable.setColumnCollapsingAllowed(true);
commissionMembreTable.setColumnReorderingAllowed(true);
commissionMembreTable.setSelectable(true);
commissionMembreTable.setImmediate(true);
commissionMembreTable.addItemSetChangeListener(e -> commissionMembreTable.sanitizeSelection());
commissionMembreTable.addValueChangeListener(e -> {
/* Les boutons d'édition et de suppression de commission sont actifs seulement si une commission est sélectionnée. */
boolean membreIsSelected = commissionMembreTable.getValue() instanceof CommissionMembre;
btnDeleteMembre.setEnabled(membreIsSelected);
btnEditMembre.setEnabled(membreIsSelected);
});
commissionMembreLayout.addComponent(commissionMembreTable);
commissionMembreLayout.setExpandRatio(commissionMembreTable, 1);
commissionMembreTable.setSizeFull();
addComponent(commissionMembreLayout);
setExpandRatio(commissionMembreLayout, 2);
/* Gestion du readOnly */
if (securityCtrCandFonc.isWrite()) {
commissionTable.addItemClickListener(e -> {
if (e.isDoubleClick()) {
commissionTable.select(e.getItemId());
btnEdit.click();
}
});
commissionMembreTable.addItemClickListener(e -> {
if (e.isDoubleClick()) {
commissionMembreTable.select(e.getItemId());
btnEditMembre.click();
}
});
buttonsLayout.setVisible(true);
buttonsLayoutMembre.setVisible(true);
} else {
buttonsLayout.setVisible(false);
buttonsLayoutMembre.setVisible(false);
}
/* Inscrit la vue aux mises à jour de commission */
commissionEntityPusher.registerEntityPushListener(this);
}
use of fr.univlorraine.ecandidat.vaadin.components.OnDemandFileUtils.OnDemandStreamFile in project esup-ecandidat by EsupPortail.
the class ScolCentreCandidatureView method init.
/**
* Initialise la vue
*/
@PostConstruct
public void init() {
/* Style */
setSizeFull();
setMargin(true);
setSpacing(true);
if (parametreController.getSiScolMode().equals(ConstanteUtils.SI_SCOL_APOGEE)) {
FIELDS_ORDER_GEST = FIELDS_ORDER_GEST_APOGEE;
} else {
FIELDS_ORDER_GEST = FIELDS_ORDER_GEST_SI_SCOL;
}
/* Table des centres de candidatures */
VerticalLayout ctrCandLayout = new VerticalLayout();
ctrCandLayout.setSizeFull();
ctrCandLayout.setSpacing(true);
/* Titre */
Label titleParam = new Label(applicationContext.getMessage("ctrCand.title", null, UI.getCurrent().getLocale()));
titleParam.addStyleName(StyleConstants.VIEW_TITLE);
ctrCandLayout.addComponent(titleParam);
/* Boutons */
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
ctrCandLayout.addComponent(buttonsLayout);
OneClickButton btnNew = new OneClickButton(applicationContext.getMessage("ctrCand.btnNouveau", null, UI.getCurrent().getLocale()), FontAwesome.PLUS);
btnNew.setEnabled(true);
btnNew.addClickListener(e -> {
centreCandidatureController.editNewCentreCandidature();
});
buttonsLayout.addComponent(btnNew);
buttonsLayout.setComponentAlignment(btnNew, Alignment.MIDDLE_LEFT);
OneClickButton btnEdit = new OneClickButton(applicationContext.getMessage("btnEdit", null, UI.getCurrent().getLocale()), FontAwesome.PENCIL);
btnEdit.setEnabled(false);
btnEdit.addClickListener(e -> {
if (centreCandidatureTable.getValue() instanceof CentreCandidature) {
centreCandidatureController.editCentreCandidature((CentreCandidature) centreCandidatureTable.getValue(), true);
}
});
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 (centreCandidatureTable.getValue() instanceof CentreCandidature) {
centreCandidatureController.deleteCentreCandidature((CentreCandidature) centreCandidatureTable.getValue());
}
});
buttonsLayout.addComponent(btnDelete);
buttonsLayout.setComponentAlignment(btnDelete, Alignment.MIDDLE_RIGHT);
Button btnExport = new Button(applicationContext.getMessage("btnExport", null, UI.getCurrent().getLocale()), FontAwesome.FILE_EXCEL_O);
/* Export de la liste des formations */
btnExport.setDescription(applicationContext.getMessage("btnExport", null, UI.getCurrent().getLocale()));
btnExport.setDisableOnClick(true);
new OnDemandFileDownloader(new OnDemandStreamFile() {
@Override
public OnDemandFile getOnDemandFile() {
@SuppressWarnings("unchecked") List<CentreCandidature> liste = (List<CentreCandidature>) centreCandidatureTable.getContainerDataSource().getItemIds();
if (liste.size() == 0) {
btnExport.setEnabled(true);
return null;
}
/* Téléchargement */
OnDemandFile file = centreCandidatureController.generateExport(liste);
if (file != null) {
btnExport.setEnabled(true);
return file;
}
btnExport.setEnabled(true);
return null;
}
}, btnExport);
buttonsLayout.addComponent(btnExport);
buttonsLayout.setComponentAlignment(btnExport, Alignment.MIDDLE_RIGHT);
/* Table des centreCandidatures */
BeanItemContainer<CentreCandidature> container = new BeanItemContainer<>(CentreCandidature.class, centreCandidatureController.getCentreCandidatures());
centreCandidatureTable.setContainerDataSource(container);
centreCandidatureTable.addBooleanColumn(CentreCandidature_.tesCtrCand.getName());
centreCandidatureTable.addBooleanColumn(CentreCandidature_.temDematCtrCand.getName());
centreCandidatureTable.setVisibleColumns((Object[]) FIELDS_ORDER);
for (String fieldName : FIELDS_ORDER) {
centreCandidatureTable.setColumnHeader(fieldName, applicationContext.getMessage("ctrCand.table." + fieldName, null, UI.getCurrent().getLocale()));
}
centreCandidatureTable.setSortContainerPropertyId(CentreCandidature_.codCtrCand.getName());
centreCandidatureTable.setColumnCollapsingAllowed(true);
centreCandidatureTable.setColumnReorderingAllowed(true);
centreCandidatureTable.setSelectable(true);
centreCandidatureTable.setImmediate(true);
centreCandidatureTable.addItemSetChangeListener(e -> centreCandidatureTable.sanitizeSelection());
centreCandidatureTable.addValueChangeListener(e -> {
/* Les boutons d'édition et de suppression de centreCandidature sont actifs seulement si une centreCandidature est sélectionnée. */
boolean centreCandidatureIsSelected = centreCandidatureTable.getValue() instanceof CentreCandidature;
btnEdit.setEnabled(centreCandidatureIsSelected);
btnDelete.setEnabled(centreCandidatureIsSelected);
btnNewGest.setEnabled(centreCandidatureIsSelected);
if (centreCandidatureIsSelected) {
majGestionnaireTable((CentreCandidature) centreCandidatureTable.getValue());
} else {
majGestionnaireTable(null);
}
});
centreCandidatureTable.addItemClickListener(e -> {
if (e.isDoubleClick()) {
centreCandidatureTable.select(e.getItemId());
btnEdit.click();
}
});
ctrCandLayout.addComponent(centreCandidatureTable);
ctrCandLayout.setExpandRatio(centreCandidatureTable, 1);
centreCandidatureTable.setSizeFull();
addComponent(ctrCandLayout);
setExpandRatio(ctrCandLayout, 3);
/* Gestionnaires */
VerticalLayout ctrCandGestLayout = new VerticalLayout();
ctrCandGestLayout.setSizeFull();
ctrCandGestLayout.setSpacing(true);
/* Titre */
HorizontalLayout layoutCtrGestLabel = new HorizontalLayout();
layoutCtrGestLabel.setSpacing(true);
Label titleGest = new Label(applicationContext.getMessage("ctrCand.title.gest", null, UI.getCurrent().getLocale()));
titleGest.addStyleName(StyleConstants.VIEW_SUBTITLE);
layoutCtrGestLabel.addComponent(titleGest);
layoutCtrGestLabel.setComponentAlignment(titleGest, Alignment.BOTTOM_LEFT);
labelCtrCandGest.setValue(applicationContext.getMessage("ctrCand.gest.noctrCand", null, UI.getCurrent().getLocale()));
labelCtrCandGest.addStyleName(ValoTheme.LABEL_SMALL);
layoutCtrGestLabel.addComponent(labelCtrCandGest);
layoutCtrGestLabel.setComponentAlignment(labelCtrCandGest, Alignment.BOTTOM_LEFT);
ctrCandGestLayout.addComponent(layoutCtrGestLabel);
/* Boutons */
HorizontalLayout buttonsLayoutGest = new HorizontalLayout();
buttonsLayoutGest.setWidth(100, Unit.PERCENTAGE);
buttonsLayoutGest.setSpacing(true);
ctrCandGestLayout.addComponent(buttonsLayoutGest);
btnNewGest.setCaption(applicationContext.getMessage("droitprofilind.btnNouveauGest", null, UI.getCurrent().getLocale()));
btnNewGest.setEnabled(false);
btnNewGest.addClickListener(e -> {
centreCandidatureController.addProfilToGestionnaire((CentreCandidature) centreCandidatureTable.getValue());
});
buttonsLayoutGest.addComponent(btnNewGest);
buttonsLayoutGest.setComponentAlignment(btnNewGest, Alignment.MIDDLE_LEFT);
/* Edit profil */
OneClickButton btnEditGest = new OneClickButton(applicationContext.getMessage("btnEdit", null, UI.getCurrent().getLocale()), FontAwesome.PENCIL);
btnEditGest.setEnabled(false);
btnEditGest.addClickListener(e -> {
if (centreCandidatureGestTable.getValue() instanceof Gestionnaire) {
centreCandidatureController.updateProfilToGestionnaire((Gestionnaire) centreCandidatureGestTable.getValue());
}
});
buttonsLayoutGest.addComponent(btnEditGest);
buttonsLayoutGest.setComponentAlignment(btnEditGest, Alignment.MIDDLE_CENTER);
/* Delete profil */
OneClickButton btnDeleteGest = new OneClickButton(applicationContext.getMessage("btnDelete", null, UI.getCurrent().getLocale()), FontAwesome.TRASH_O);
btnDeleteGest.setEnabled(false);
btnDeleteGest.addClickListener(e -> {
if (centreCandidatureGestTable.getValue() instanceof Gestionnaire) {
centreCandidatureController.deleteProfilToGestionnaire((Gestionnaire) centreCandidatureGestTable.getValue());
}
});
buttonsLayoutGest.addComponent(btnDeleteGest);
buttonsLayoutGest.setComponentAlignment(btnDeleteGest, Alignment.MIDDLE_RIGHT);
/* Table des gestionnaires */
BeanItemContainer<Gestionnaire> containerGest = new BeanItemContainer<>(Gestionnaire.class);
containerGest.addNestedContainerProperty(Gestionnaire_.droitProfilInd.getName() + "." + DroitProfilInd_.individu.getName() + "." + Individu_.loginInd.getName());
containerGest.addNestedContainerProperty(Gestionnaire_.siScolCentreGestion.getName() + "." + SiScolCentreGestion_.libCge.getName());
containerGest.addNestedContainerProperty(Gestionnaire_.droitProfilInd.getName() + "." + DroitProfilInd_.individu.getName() + "." + Individu_.libelleInd.getName());
containerGest.addNestedContainerProperty(Gestionnaire_.droitProfilInd.getName() + "." + DroitProfilInd_.droitProfil.getName() + "." + DroitProfil_.libProfil.getName());
centreCandidatureGestTable.setContainerDataSource(containerGest);
centreCandidatureGestTable.setVisibleColumns((Object[]) FIELDS_ORDER_GEST);
for (String fieldName : FIELDS_ORDER_GEST) {
centreCandidatureGestTable.setColumnHeader(fieldName, applicationContext.getMessage("droit." + fieldName, null, UI.getCurrent().getLocale()));
}
centreCandidatureGestTable.setSortContainerPropertyId(Gestionnaire_.droitProfilInd.getName() + "." + DroitProfilInd_.individu.getName() + "." + Individu_.loginInd.getName());
centreCandidatureGestTable.setColumnCollapsingAllowed(true);
centreCandidatureGestTable.setColumnReorderingAllowed(true);
centreCandidatureGestTable.setSelectable(true);
centreCandidatureGestTable.setImmediate(true);
centreCandidatureGestTable.addItemSetChangeListener(e -> centreCandidatureGestTable.sanitizeSelection());
centreCandidatureGestTable.addValueChangeListener(e -> {
/* Les boutons d'édition et de suppression de centreCandidature sont actifs seulement si une centreCandidature est sélectionnée. */
boolean gestIsSelected = centreCandidatureGestTable.getValue() instanceof Gestionnaire;
btnDeleteGest.setEnabled(gestIsSelected);
btnEditGest.setEnabled(gestIsSelected);
});
centreCandidatureGestTable.addItemClickListener(e -> {
if (e.isDoubleClick()) {
centreCandidatureGestTable.select(e.getItemId());
btnEditGest.click();
}
});
ctrCandGestLayout.addComponent(centreCandidatureGestTable);
ctrCandGestLayout.setExpandRatio(centreCandidatureGestTable, 1);
centreCandidatureGestTable.setSizeFull();
addComponent(ctrCandGestLayout);
setExpandRatio(ctrCandGestLayout, 2);
/* Inscrit la vue aux mises à jour de centreCandidature */
centreCandidatureEntityPusher.registerEntityPushListener(this);
}
use of fr.univlorraine.ecandidat.vaadin.components.OnDemandFileUtils.OnDemandStreamFile in project esup-ecandidat by EsupPortail.
the class CommissionParametreView method init.
/* Composants */
/**
* Initialise la vue
*/
@PostConstruct
public void init() {
/* Style */
// setSizeFull();
setWidth(100, Unit.PERCENTAGE);
setMargin(true);
setSpacing(true);
/* Récupération de la commission en cours en cours */
securityCommissionFonc = userController.getCommissionFonctionnalite(NomenclatureUtils.FONCTIONNALITE_PARAM);
if (securityCommissionFonc.hasNoRight()) {
return;
}
/* Titre + bouton */
HorizontalLayout titleButtonLayout = new HorizontalLayout();
titleButtonLayout.setWidth(100, Unit.PERCENTAGE);
titleButtonLayout.setSpacing(true);
addComponent(titleButtonLayout);
/* Titre */
Label titleParam = new Label(applicationContext.getMessage("commission.parametre.title", new Object[] { securityCommissionFonc.getCommission().getLibComm() }, UI.getCurrent().getLocale()));
titleParam.addStyleName(StyleConstants.VIEW_TITLE);
titleButtonLayout.addComponent(titleParam);
/* Descriptif */
Label titleParamDesc = new Label(applicationContext.getMessage("commission.parametre.title.desc", null, UI.getCurrent().getLocale()));
titleParamDesc.addStyleName(StyleConstants.VIEW_SUBTITLE);
addComponent(titleParamDesc);
addComponent(getTable(containerReadOnly, 3));
/* Parametres généraux */
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
addComponent(buttonsLayout);
Label titleParamParam = new Label(applicationContext.getMessage("commission.parametre.title.param", null, UI.getCurrent().getLocale()));
titleParamParam.setSizeUndefined();
titleParamParam.addStyleName(StyleConstants.VIEW_SUBTITLE);
buttonsLayout.addComponent(titleParamParam);
buttonsLayout.setComponentAlignment(titleParamParam, Alignment.MIDDLE_CENTER);
/* Bouton */
OneClickButton btnEdit = new OneClickButton(applicationContext.getMessage("btnEdit", null, UI.getCurrent().getLocale()), FontAwesome.PENCIL);
btnEdit.addClickListener(e -> {
commissionController.editCommission(securityCommissionFonc.getCommission(), false);
});
buttonsLayout.addComponent(btnEdit);
buttonsLayout.setExpandRatio(btnEdit, 1);
buttonsLayout.setComponentAlignment(btnEdit, Alignment.MIDDLE_LEFT);
/* La table */
addComponent(getTable(containerGeneral, 10));
/* Lettres */
Label titleParamLettre = new Label(applicationContext.getMessage("commission.parametre.title.lettre", null, UI.getCurrent().getLocale()));
titleParamLettre.addStyleName(StyleConstants.VIEW_SUBTITLE);
addComponent(titleParamLettre);
addComponent(getTable(containerLettre, 2));
/* Signataire */
HorizontalLayout hlSignataire = new HorizontalLayout();
hlSignataire.setWidth(100, Unit.PERCENTAGE);
hlSignataire.setSpacing(true);
addComponent(hlSignataire);
/* Label signataire */
VerticalLayout vlLabelSignataire = new VerticalLayout();
vlLabelSignataire.setSpacing(true);
Label labelTitleLabelSign = new Label(applicationContext.getMessage("commission.parametre.sign.label", null, UI.getCurrent().getLocale()));
labelTitleLabelSign.addStyleName(StyleConstants.LABEL_MORE_BOLD);
labelTitleLabelSign.setSizeUndefined();
vlLabelSignataire.addComponent(labelTitleLabelSign);
vlLabelSignataire.setComponentAlignment(labelTitleLabelSign, Alignment.MIDDLE_CENTER);
labelSignataire.setSizeUndefined();
labelSignataire.setContentMode(ContentMode.HTML);
labelSignataire.addStyleName(StyleConstants.LABEL_SAUT_LIGNE);
vlLabelSignataire.addComponent(labelSignataire);
vlLabelSignataire.setComponentAlignment(labelSignataire, Alignment.MIDDLE_CENTER);
hlSignataire.addComponent(vlLabelSignataire);
/* Image signature */
VerticalLayout vlImgSignataire = new VerticalLayout();
vlImgSignataire.setSpacing(true);
Label labelTitleImgSign = new Label(applicationContext.getMessage("commission.parametre.sign.img", null, UI.getCurrent().getLocale()));
labelTitleImgSign.addStyleName(StyleConstants.LABEL_MORE_BOLD);
labelTitleImgSign.setSizeUndefined();
vlImgSignataire.addComponent(labelTitleImgSign);
vlImgSignataire.setComponentAlignment(labelTitleImgSign, Alignment.MIDDLE_CENTER);
if (securityCommissionFonc.isWrite()) {
btnAddImage.setCaption(applicationContext.getMessage("file.btnAdd", null, UI.getCurrent().getLocale()));
btnAddImage.addClickListener(e -> commissionController.addFileToSignataire(securityCommissionFonc.getCommission()));
btnAddImage.setVisible(false);
vlImgSignataire.addComponent(btnAddImage);
vlImgSignataire.setComponentAlignment(btnAddImage, Alignment.MIDDLE_CENTER);
btnDeleteImage.setCaption(applicationContext.getMessage("file.btnDel", null, UI.getCurrent().getLocale()));
btnDeleteImage.addClickListener(e -> commissionController.deleteFileToSignataire(securityCommissionFonc.getCommission()));
btnDeleteImage.setVisible(false);
vlImgSignataire.addComponent(btnDeleteImage);
vlImgSignataire.setComponentAlignment(btnDeleteImage, Alignment.MIDDLE_CENTER);
}
vlImgSignataire.addComponent(imgSignataire);
vlImgSignataire.setComponentAlignment(imgSignataire, Alignment.MIDDLE_CENTER);
hlSignataire.addComponent(vlImgSignataire);
/* Boutons de test de lettre */
VerticalLayout vlButtonLettre = new VerticalLayout();
vlButtonLettre.setSpacing(true);
hlSignataire.addComponent(vlButtonLettre);
Label labelLettreTest = new Label(applicationContext.getMessage("commission.parametre.sign.test", null, UI.getCurrent().getLocale()));
labelLettreTest.addStyleName(StyleConstants.LABEL_MORE_BOLD);
labelLettreTest.setSizeUndefined();
vlButtonLettre.addComponent(labelLettreTest);
vlButtonLettre.setComponentAlignment(labelLettreTest, Alignment.MIDDLE_CENTER);
btnTestAdm.setCaption(applicationContext.getMessage("commission.parametre.test.lettre.adm", null, UI.getCurrent().getLocale()));
new OnDemandFileDownloader(new OnDemandStreamFile() {
@Override
public OnDemandFile getOnDemandFile() {
return commissionController.testLettreAdm(securityCommissionFonc.getCommission(), ConstanteUtils.TEMPLATE_LETTRE_ADM, applicationContext.getMessage("candidature.lettre.file.adm", new Object[] { "AXQDF1P8_Martinpat_Jean", "CODFORM" }, UI.getCurrent().getLocale()));
}
}, btnTestAdm);
btnTestRef.setCaption(applicationContext.getMessage("commission.parametre.test.lettre.ref", null, UI.getCurrent().getLocale()));
new OnDemandFileDownloader(new OnDemandStreamFile() {
@Override
public OnDemandFile getOnDemandFile() {
return commissionController.testLettreAdm(securityCommissionFonc.getCommission(), ConstanteUtils.TEMPLATE_LETTRE_REFUS, applicationContext.getMessage("candidature.lettre.file.ref", new Object[] { "AXQDF1P8_Martinpat_Jean", "CODFORM" }, UI.getCurrent().getLocale()));
}
}, btnTestRef);
vlButtonLettre.addComponent(btnTestAdm);
vlButtonLettre.addComponent(btnTestRef);
miseAJourContainer(securityCommissionFonc.getCommission());
/* Gestion du readOnly */
if (securityCommissionFonc.isWrite()) {
btnEdit.setVisible(true);
} else {
btnEdit.setVisible(false);
}
/* Inscrit la vue aux mises à jour de centreCandidature */
commissionEntityPusher.registerEntityPushListener(this);
}
Aggregations