use of fr.univlorraine.ecandidat.vaadin.components.OneClickButton in project esup-ecandidat by EsupPortail.
the class AdminCacheView method init.
/**
* Initialise la vue
*/
@PostConstruct
public void init() {
/* Style */
setSizeFull();
setMargin(true);
setSpacing(true);
/* Titre */
Label titleNom = new Label(applicationContext.getMessage("adminCacheView.title", null, UI.getCurrent().getLocale()));
titleNom.addStyleName(StyleConstants.VIEW_TITLE);
addComponent(titleNom);
/*Label*/
CustomPanel cp = new CustomPanel(applicationContext.getMessage("cache.panel.caption", null, UI.getCurrent().getLocale()), applicationContext.getMessage("cache.panel.label", null, UI.getCurrent().getLocale()), FontAwesome.WARNING);
cp.setMargin(true);
addComponent(cp);
/*Reload ALL*/
OneClickButton button = new OneClickButton(applicationContext.getMessage("cache.action.btn.all", null, UI.getCurrent().getLocale()), FontAwesome.REFRESH);
button.addClickListener(e -> {
cacheController.askToReloadData(null);
reloadContainer();
});
addComponent(button);
cacheTable.addGeneratedColumn(SimpleTablePresentation.CHAMPS_ACTION, new ColumnGenerator() {
private static final long serialVersionUID = 7461290324017459118L;
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
final SimpleTablePresentation bean = (SimpleTablePresentation) itemId;
OneClickButton button = new OneClickButton(applicationContext.getMessage("cache.action.btn", null, UI.getCurrent().getLocale()), FontAwesome.REFRESH);
button.addClickListener(e -> {
cacheController.askToReloadData(bean.getCode());
reloadContainer();
});
return button;
}
});
cacheTable.setVisibleColumns((Object[]) FIELDS_ORDER);
for (String fieldName : FIELDS_ORDER) {
cacheTable.setColumnHeader(fieldName, applicationContext.getMessage("cache." + fieldName, null, UI.getCurrent().getLocale()));
}
cacheTable.setSortContainerPropertyId(SimpleTablePresentation.CHAMPS_TITLE);
cacheTable.setColumnCollapsingAllowed(false);
cacheTable.setColumnReorderingAllowed(false);
cacheTable.setSelectable(false);
cacheTable.setImmediate(true);
cacheTable.setCellStyleGenerator((components, itemId, columnId) -> {
if (columnId != null && columnId.equals(SimpleTablePresentation.CHAMPS_TITLE)) {
return (ValoTheme.LABEL_BOLD);
}
return null;
});
cacheTable.setSizeFull();
addComponent(cacheTable);
setExpandRatio(cacheTable, 1);
}
use of fr.univlorraine.ecandidat.vaadin.components.OneClickButton in project esup-ecandidat by EsupPortail.
the class AdminVersionView method init.
/**
* Initialise la vue
*/
@PostConstruct
public void init() {
/* Style */
setSizeFull();
setMargin(true);
setSpacing(true);
/* Titre */
final Label titleNom = new Label(applicationContext.getMessage("adminVersionView.title", null, UI.getCurrent().getLocale()));
titleNom.addStyleName(StyleConstants.VIEW_TITLE);
addComponent(titleNom);
versionTable.addGeneratedColumn(SimpleTablePresentation.CHAMPS_ACTION, new ColumnGenerator() {
private static final long serialVersionUID = 7461290324017459118L;
@Override
public Object generateCell(final Table source, final Object itemId, final Object columnId) {
final SimpleTablePresentation bean = (SimpleTablePresentation) itemId;
final OneClickButton btnCheck = new OneClickButton(applicationContext.getMessage("btnCheck", null, UI.getCurrent().getLocale()), FontAwesome.ROTATE_RIGHT);
switch(bean.getCode()) {
case NomenclatureUtils.VERSION_DEMAT:
btnCheck.addClickListener(e -> {
fileController.testDemat(true);
});
return btnCheck;
case NomenclatureUtils.VERSION_SI_SCOL_COD:
btnCheck.addClickListener(e -> {
siScolController.testSiScolConnnexion();
});
return btnCheck;
case NomenclatureUtils.VERSION_WS:
btnCheck.addClickListener(e -> {
siScolController.testWSSiScolConnnexion();
});
return btnCheck;
case NomenclatureUtils.VERSION_WS_PJ:
btnCheck.addClickListener(e -> {
if (demoController.getDemoMode()) {
return;
}
final AdminWsPjWindow window = new AdminWsPjWindow();
UI.getCurrent().addWindow(window);
});
return btnCheck;
case NomenclatureUtils.VERSION_LS:
btnCheck.addClickListener(e -> {
formulaireController.testConnexionLS();
});
return btnCheck;
case NomenclatureUtils.VERSION_INES:
btnCheck.addClickListener(e -> {
final AdminInesWindow window = new AdminInesWindow();
UI.getCurrent().addWindow(window);
});
return btnCheck;
default:
return null;
}
}
});
versionTable.setVisibleColumns((Object[]) FIELDS_ORDER);
for (final String fieldName : FIELDS_ORDER) {
versionTable.setColumnHeader(fieldName, applicationContext.getMessage("version." + fieldName, null, UI.getCurrent().getLocale()));
}
versionTable.setSortContainerPropertyId(SimpleTablePresentation.CHAMPS_ORDER);
versionTable.setColumnCollapsingAllowed(false);
versionTable.setColumnReorderingAllowed(false);
versionTable.setSelectable(false);
versionTable.setImmediate(true);
versionTable.setColumnWidth(SimpleTablePresentation.CHAMPS_TITLE, 300);
versionTable.setCellStyleGenerator((components, itemId, columnId) -> {
if (columnId != null && columnId.equals(SimpleTablePresentation.CHAMPS_TITLE)) {
return (ValoTheme.LABEL_BOLD);
}
return null;
});
addComponent(versionTable);
setExpandRatio(versionTable, 1);
}
use of fr.univlorraine.ecandidat.vaadin.components.OneClickButton in project esup-ecandidat by EsupPortail.
the class AssistanceView method getButton.
/**
* @param caption
* @param bwo
* @param icon
* @return un bouton pour l'assistance
*/
private OneClickButton getButton(final String caption, final String bwo, final com.vaadin.server.Resource icon) {
final BrowserWindowOpener browser = new BrowserWindowOpener(new ExternalResource(bwo));
final OneClickButton btn = new OneClickButton(caption, icon);
btn.addStyleName(ValoTheme.BUTTON_LINK);
browser.extend(btn);
return btn;
}
use of fr.univlorraine.ecandidat.vaadin.components.OneClickButton in project esup-ecandidat by EsupPortail.
the class I18nField method getLangueLayout.
/**
* Renvoie un layout contenant un choix de langue et une traduction
*
* @param traductionOther
* @return le layout
*/
private HorizontalLayout getLangueLayout(final I18nTraduction traductionOther) {
/* Le layout renvoyé */
HorizontalLayout hlLangueOther = new HorizontalLayout();
listLayoutTraductions.add(hlLangueOther);
hlLangueOther.setSpacing(true);
hlLangueOther.setWidth(100, Unit.PERCENTAGE);
/* La combobox avec les icones de drapeaux */
ComboBoxLangue cbLangue = new ComboBoxLangue(listeLangueEnService, false);
cbLangue.selectLangue((traductionOther == null ? null : traductionOther.getLangue()));
cbLangue.setWidth(75, Unit.PIXELS);
hlLangueOther.addComponent(cbLangue);
/* Le textField... ou */
AbstractField<String> tfValOther = getNewValueComponent();
tfValOther.setWidth(100, Unit.PERCENTAGE);
if (traductionOther != null) {
tfValOther.setValue(traductionOther.getValTrad());
}
hlLangueOther.addComponent(tfValOther);
hlLangueOther.setExpandRatio(tfValOther, 1);
/* Le bouton de suppression de la langue */
OneClickButton removeLangue = new OneClickButton(FontAwesome.MINUS_SQUARE_O);
removeLangue.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
removeLangue.addStyleName(ValoTheme.BUTTON_BORDERLESS);
removeLangue.addClickListener(e -> {
layoutLangue.removeComponent(hlLangueOther);
listLayoutTraductions.remove(hlLangueOther);
checkVisibleAddLangue();
centerWindow();
});
hlLangueOther.addComponent(removeLangue);
return hlLangueOther;
}
use of fr.univlorraine.ecandidat.vaadin.components.OneClickButton in project esup-ecandidat by EsupPortail.
the class MainUI method focusCurrentMenu.
/**
* Focus le menu courant
* @param viewName
*/
private void focusCurrentMenu(final String viewName) {
if (viewName != null) {
final Menu menu = viewButtons.get(viewName);
if (menu != null && menu.getBtn() instanceof OneClickButton) {
menu.getBtn().addStyleName(SELECTED_ITEM);
menu.getBtn().focus();
}
}
}
Aggregations