use of fr.univlorraine.ecandidat.vaadin.components.TableFormating in project esup-ecandidat by EsupPortail.
the class ScolGestCandidatDroitProfilView method init.
/**
* Initialise la vue
*/
@PostConstruct
public void init() {
super.init(false);
/*Ajout des parametres globaux*/
VerticalLayout vlComplement = new VerticalLayout();
vlComplement.setSpacing(true);
vlComplement.setWidth(100, Unit.PERCENTAGE);
Label titleParamDesc = new Label(applicationContext.getMessage("droitprofilind.gestCandidat.param", null, UI.getCurrent().getLocale()));
titleParamDesc.addStyleName(StyleConstants.VIEW_SUBTITLE);
vlComplement.addComponent(titleParamDesc);
TableFormating table = new TableFormating(null, containerReadOnly);
GestionnaireCandidatListener listener = this;
table.addGeneratedColumn(SimpleTablePresentation.CHAMPS_VALUE, new ColumnGenerator() {
/**
*serialVersionUID*
*/
private static final long serialVersionUID = 4125366493925127117L;
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
final SimpleTablePresentation bean = (SimpleTablePresentation) itemId;
return parametreController.getLibelleParametresGestionCandidat(bean.getValue().toString());
}
});
table.addGeneratedColumn(SimpleTablePresentation.CHAMPS_ACTION, new ColumnGenerator() {
/**
*serialVersionUID*
*/
private static final long serialVersionUID = 5720531607995628916L;
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
final SimpleTablePresentation bean = (SimpleTablePresentation) itemId;
OneClickButton button = new OneClickButton(applicationContext.getMessage("btnModifier", null, UI.getCurrent().getLocale()), FontAwesome.REFRESH);
button.addClickListener(e -> {
parametreController.changeParametreGestionCandidat(listener, bean.getCode(), bean.getValue().toString(), bean.getTitle());
});
return button;
}
});
table.setVisibleColumns((Object[]) FIELDS_ORDER_PARAM);
table.setColumnCollapsingAllowed(false);
table.setColumnReorderingAllowed(false);
table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN);
table.setSelectable(false);
table.setImmediate(true);
table.setPageLength(2);
table.setWidth(100, Unit.PERCENTAGE);
table.setColumnWidth(SimpleTablePresentation.CHAMPS_TITLE, 500);
table.setColumnWidth(SimpleTablePresentation.CHAMPS_VALUE, 460);
table.setCellStyleGenerator((components, itemId, columnId) -> {
if (columnId != null && columnId.equals(SimpleTablePresentation.CHAMPS_TITLE)) {
return (ValoTheme.LABEL_BOLD);
}
return null;
});
vlComplement.addComponent(table);
Label titleParamInd = new Label(applicationContext.getMessage("droitprofilind.gestCandidat.ind", null, UI.getCurrent().getLocale()));
titleParamInd.addStyleName(StyleConstants.VIEW_SUBTITLE);
vlComplement.addComponent(titleParamInd);
addComplement(vlComplement);
/* Inscrit la vue aux mises à jour de droitProfil */
droitProfilIndEntityPusher.registerEntityPushListener(this);
}
use of fr.univlorraine.ecandidat.vaadin.components.TableFormating in project esup-ecandidat by EsupPortail.
the class CommissionParametreView method getTable.
/**
* @param container
* @param size
* @return une table pour formatter les données
*/
private TableFormating getTable(final BeanItemContainer<SimpleTablePresentation> container, final Integer size) {
TableFormating table = new TableFormating(null, container);
table.addBooleanColumn(SimpleTablePresentation.CHAMPS_VALUE, false);
table.setVisibleColumns((Object[]) FIELDS_ORDER);
table.setColumnCollapsingAllowed(false);
table.setColumnReorderingAllowed(false);
table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN);
table.setSelectable(false);
table.setImmediate(true);
table.setPageLength(size);
table.setWidth(100, Unit.PERCENTAGE);
table.setColumnWidth(SimpleTablePresentation.CHAMPS_TITLE, 300);
table.setCellStyleGenerator((components, itemId, columnId) -> {
if (columnId != null && columnId.equals(SimpleTablePresentation.CHAMPS_TITLE)) {
return (ValoTheme.LABEL_BOLD);
}
return null;
});
return table;
}
use of fr.univlorraine.ecandidat.vaadin.components.TableFormating in project esup-ecandidat by EsupPortail.
the class CtrCandParametreView method init.
/* Composants */
/**
* 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_PARAM);
if (securityCtrCandFonc.hasNoRight()) {
return;
}
/* Titre */
Label titleParam = new Label(applicationContext.getMessage("ctrCand.parametre.title", new Object[] { securityCtrCandFonc.getCtrCand().getLibCtrCand() }, UI.getCurrent().getLocale()));
titleParam.addStyleName(StyleConstants.VIEW_TITLE);
addComponent(titleParam);
/* Descriptif */
Label titleParamDesc = new Label(applicationContext.getMessage("ctrCand.parametre.title.desc", null, UI.getCurrent().getLocale()));
titleParamDesc.addStyleName(StyleConstants.VIEW_SUBTITLE);
addComponent(titleParamDesc);
containerReadOnly = new BeanItemContainer<>(SimpleTablePresentation.class);
TableFormating paramReadOnlyTable = new TableFormating(null, containerReadOnly);
paramReadOnlyTable.addBooleanColumn(SimpleTablePresentation.CHAMPS_VALUE, false);
paramReadOnlyTable.setVisibleColumns((Object[]) FIELDS_ORDER);
paramReadOnlyTable.setColumnCollapsingAllowed(false);
paramReadOnlyTable.setColumnReorderingAllowed(false);
paramReadOnlyTable.setColumnHeaderMode(ColumnHeaderMode.HIDDEN);
paramReadOnlyTable.setSelectable(false);
paramReadOnlyTable.setImmediate(true);
paramReadOnlyTable.setPageLength(4);
paramReadOnlyTable.setColumnWidth(SimpleTablePresentation.CHAMPS_TITLE, 300);
paramReadOnlyTable.setCellStyleGenerator((components, itemId, columnId) -> {
if (columnId != null && columnId.equals(SimpleTablePresentation.CHAMPS_TITLE)) {
return (ValoTheme.LABEL_BOLD);
}
return null;
});
addComponent(paramReadOnlyTable);
paramReadOnlyTable.setWidth(100, Unit.PERCENTAGE);
/* Parametres */
/* Boutons */
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
addComponent(buttonsLayout);
Label titleParamParam = new Label(applicationContext.getMessage("ctrCand.parametre.title.param", null, UI.getCurrent().getLocale()));
titleParamParam.setSizeUndefined();
titleParamParam.addStyleName(StyleConstants.VIEW_SUBTITLE);
buttonsLayout.addComponent(titleParamParam);
buttonsLayout.setComponentAlignment(titleParamParam, Alignment.MIDDLE_CENTER);
OneClickButton btnEdit = new OneClickButton(applicationContext.getMessage("btnEdit", null, UI.getCurrent().getLocale()), FontAwesome.PENCIL);
btnEdit.addClickListener(e -> {
centreCandidatureController.editCentreCandidature(securityCtrCandFonc.getCtrCand(), false);
});
buttonsLayout.addComponent(btnEdit);
buttonsLayout.setExpandRatio(btnEdit, 1);
buttonsLayout.setComponentAlignment(btnEdit, Alignment.MIDDLE_LEFT);
TableFormating paramTable = new TableFormating(null, container);
paramTable.addBooleanColumn(SimpleTablePresentation.CHAMPS_VALUE, false);
paramTable.setSizeFull();
paramTable.setVisibleColumns((Object[]) FIELDS_ORDER);
paramTable.setColumnCollapsingAllowed(false);
paramTable.setColumnReorderingAllowed(false);
paramTable.setColumnHeaderMode(ColumnHeaderMode.HIDDEN);
paramTable.setSelectable(false);
paramTable.setImmediate(true);
paramTable.setPageLength(18);
paramTable.setColumnWidth(SimpleTablePresentation.CHAMPS_TITLE, 300);
paramTable.setCellStyleGenerator((components, itemId, columnId) -> {
if (columnId != null && columnId.equals(SimpleTablePresentation.CHAMPS_TITLE)) {
return (ValoTheme.LABEL_BOLD);
}
return null;
});
addComponent(paramTable);
miseAJourContainer(securityCtrCandFonc.getCtrCand());
setExpandRatio(paramTable, 1);
/* Gestion du readOnly */
if (securityCtrCandFonc.isWrite()) {
buttonsLayout.setVisible(true);
} else {
buttonsLayout.setVisible(false);
}
/* Inscrit la vue aux mises à jour de centreCandidature */
centreCandidatureEntityPusher.registerEntityPushListener(this);
}
use of fr.univlorraine.ecandidat.vaadin.components.TableFormating in project esup-ecandidat by EsupPortail.
the class ScolAlertSvaView method init.
/**
* Initialise la vue
*/
@PostConstruct
public void init() {
/* Style */
setSizeFull();
setMargin(true);
setSpacing(true);
/* Titre */
Label titleParam = new Label(applicationContext.getMessage("alertSva.title", null, UI.getCurrent().getLocale()));
titleParam.addStyleName(StyleConstants.VIEW_TITLE);
addComponent(titleParam);
CustomPanel panelMessage = new CustomPanel(applicationContext.getMessage("informations", null, UI.getCurrent().getLocale()), FontAwesome.INFO_CIRCLE);
panelMessage.setMessage(applicationContext.getMessage("alertSva.info", null, UI.getCurrent().getLocale()));
panelMessage.setWidthMax();
panelMessage.setMargin(true);
addComponent(panelMessage);
/* Choix de la date */
HorizontalLayout paramLayout = new HorizontalLayout();
paramLayout.setSpacing(true);
addComponent(paramLayout);
/* Table des parametres */
TableFormating table = new TableFormating(null, parametreContainer);
table.addBooleanColumn(SimpleTablePresentation.CHAMPS_VALUE, false);
String[] FIELDS_ORDER_PARAM = { SimpleTablePresentation.CHAMPS_TITLE, SimpleTablePresentation.CHAMPS_VALUE };
table.setVisibleColumns((Object[]) FIELDS_ORDER_PARAM);
table.setColumnCollapsingAllowed(false);
table.setColumnReorderingAllowed(false);
table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN);
table.setSelectable(false);
table.setImmediate(true);
table.setPageLength(2);
table.setWidth(100, Unit.PERCENTAGE);
table.setColumnWidth(SimpleTablePresentation.CHAMPS_TITLE, 350);
table.setColumnWidth(SimpleTablePresentation.CHAMPS_VALUE, 200);
table.setCellStyleGenerator((components, itemId, columnId) -> {
if (columnId != null && columnId.equals(SimpleTablePresentation.CHAMPS_TITLE)) {
return (ValoTheme.LABEL_BOLD);
}
return null;
});
paramLayout.addComponent(table);
paramLayout.setComponentAlignment(table, Alignment.MIDDLE_CENTER);
OneClickButton buttonDate = new OneClickButton(applicationContext.getMessage("btnModifier", null, UI.getCurrent().getLocale()), FontAwesome.CALENDAR);
buttonDate.addClickListener(e -> {
parametreController.changeSVAParametre(this, parametreDateSva, parametreDefinitif);
});
paramLayout.addComponent(buttonDate);
paramLayout.setComponentAlignment(buttonDate, Alignment.MIDDLE_CENTER);
/* Boutons */
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
addComponent(buttonsLayout);
OneClickButton btnNew = new OneClickButton(applicationContext.getMessage("alertSva.btnNouveau", null, UI.getCurrent().getLocale()), FontAwesome.PLUS);
btnNew.setEnabled(true);
btnNew.addClickListener(e -> {
alertSvaController.editNewAlertSva();
});
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 (alertSvaTable.getValue() instanceof AlertSva) {
alertSvaController.editAlertSva((AlertSva) alertSvaTable.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 (alertSvaTable.getValue() instanceof AlertSva) {
alertSvaController.deleteAlertSva((AlertSva) alertSvaTable.getValue());
}
});
buttonsLayout.addComponent(btnDelete);
buttonsLayout.setComponentAlignment(btnDelete, Alignment.MIDDLE_RIGHT);
/* Table des alertSvas */
BeanItemContainer<AlertSva> container = new BeanItemContainer<>(AlertSva.class, cacheController.getAlertesSva());
alertSvaTable.setContainerDataSource(container);
alertSvaTable.addBooleanColumn(AlertSva_.tesSva.getName());
alertSvaTable.setSizeFull();
alertSvaTable.setVisibleColumns((Object[]) FIELDS_ORDER);
for (String fieldName : FIELDS_ORDER) {
alertSvaTable.setColumnHeader(fieldName, applicationContext.getMessage("alertSva.table." + fieldName, null, UI.getCurrent().getLocale()));
}
alertSvaTable.addGeneratedColumn(AlertSva_.colorSva.getName(), new ColumnGenerator() {
@Override
public Object generateCell(final Table source, final Object itemId, final Object columnId) {
AlertSva alertSva = (AlertSva) itemId;
HorizontalLayout hlColor = new HorizontalLayout();
hlColor.setSpacing(true);
Label labelColor = new Label("<div style='border:1px solid;width:20px;height:20px;background:" + alertSva.getColorSva() + ";'></div>", ContentMode.HTML);
Label labelTxt = new Label(alertSva.getColorSva());
hlColor.addComponent(labelColor);
hlColor.setComponentAlignment(labelColor, Alignment.MIDDLE_LEFT);
hlColor.addComponent(labelTxt);
hlColor.setComponentAlignment(labelTxt, Alignment.MIDDLE_LEFT);
return hlColor;
}
});
alertSvaTable.setSortContainerPropertyId(AlertSva_.nbJourSva.getName());
alertSvaTable.setColumnCollapsingAllowed(true);
alertSvaTable.setColumnReorderingAllowed(true);
alertSvaTable.setSelectable(true);
alertSvaTable.setImmediate(true);
alertSvaTable.addItemSetChangeListener(e -> alertSvaTable.sanitizeSelection());
alertSvaTable.addValueChangeListener(e -> {
/* Les boutons d'édition et de suppression de alertSva sont actifs seulement si une alertSva est sélectionnée. */
boolean alertSvaIsSelectedEdit = alertSvaTable.getValue() instanceof AlertSva;
btnEdit.setEnabled(alertSvaIsSelectedEdit);
btnDelete.setEnabled(alertSvaIsSelectedEdit);
});
alertSvaTable.addItemClickListener(e -> {
if (e.isDoubleClick()) {
alertSvaTable.select(e.getItemId());
btnEdit.click();
}
});
addComponent(alertSvaTable);
setExpandRatio(alertSvaTable, 1);
/* Inscrit la vue aux mises à jour de alerteSva */
alertSvaEntityPusher.registerEntityPushListener(this);
}
Aggregations