Search in sources :

Example 1 with AdminInesWindow

use of fr.univlorraine.ecandidat.views.windows.AdminInesWindow 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);
}
Also used : FormulaireController(fr.univlorraine.ecandidat.controllers.FormulaireController) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) VerticalLayout(com.vaadin.ui.VerticalLayout) UI(com.vaadin.ui.UI) SiScolController(fr.univlorraine.ecandidat.controllers.SiScolController) DemoController(fr.univlorraine.ecandidat.controllers.DemoController) AdminInesWindow(fr.univlorraine.ecandidat.views.windows.AdminInesWindow) FontAwesome(com.vaadin.server.FontAwesome) NomenclatureUtils(fr.univlorraine.ecandidat.utils.NomenclatureUtils) Label(com.vaadin.ui.Label) ViewChangeEvent(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent) NomenclatureController(fr.univlorraine.ecandidat.controllers.NomenclatureController) SpringView(com.vaadin.spring.annotation.SpringView) ValoTheme(com.vaadin.ui.themes.ValoTheme) SimpleTablePresentation(fr.univlorraine.ecandidat.utils.bean.presentation.SimpleTablePresentation) ColumnGenerator(com.vaadin.ui.Table.ColumnGenerator) ConstanteUtils(fr.univlorraine.ecandidat.utils.ConstanteUtils) Resource(javax.annotation.Resource) StyleConstants(fr.univlorraine.ecandidat.StyleConstants) FileController(fr.univlorraine.ecandidat.controllers.FileController) AdminWsPjWindow(fr.univlorraine.ecandidat.views.windows.AdminWsPjWindow) ApplicationContext(org.springframework.context.ApplicationContext) BeanItemContainer(com.vaadin.data.util.BeanItemContainer) List(java.util.List) Table(com.vaadin.ui.Table) PostConstruct(javax.annotation.PostConstruct) TableFormating(fr.univlorraine.ecandidat.vaadin.components.TableFormating) View(com.vaadin.navigator.View) OneClickButton(fr.univlorraine.ecandidat.vaadin.components.OneClickButton) Table(com.vaadin.ui.Table) SimpleTablePresentation(fr.univlorraine.ecandidat.utils.bean.presentation.SimpleTablePresentation) AdminInesWindow(fr.univlorraine.ecandidat.views.windows.AdminInesWindow) ColumnGenerator(com.vaadin.ui.Table.ColumnGenerator) OneClickButton(fr.univlorraine.ecandidat.vaadin.components.OneClickButton) Label(com.vaadin.ui.Label) AdminWsPjWindow(fr.univlorraine.ecandidat.views.windows.AdminWsPjWindow) PostConstruct(javax.annotation.PostConstruct)

Aggregations

BeanItemContainer (com.vaadin.data.util.BeanItemContainer)1 View (com.vaadin.navigator.View)1 ViewChangeEvent (com.vaadin.navigator.ViewChangeListener.ViewChangeEvent)1 FontAwesome (com.vaadin.server.FontAwesome)1 SpringView (com.vaadin.spring.annotation.SpringView)1 Label (com.vaadin.ui.Label)1 Table (com.vaadin.ui.Table)1 ColumnGenerator (com.vaadin.ui.Table.ColumnGenerator)1 UI (com.vaadin.ui.UI)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 ValoTheme (com.vaadin.ui.themes.ValoTheme)1 StyleConstants (fr.univlorraine.ecandidat.StyleConstants)1 DemoController (fr.univlorraine.ecandidat.controllers.DemoController)1 FileController (fr.univlorraine.ecandidat.controllers.FileController)1 FormulaireController (fr.univlorraine.ecandidat.controllers.FormulaireController)1 NomenclatureController (fr.univlorraine.ecandidat.controllers.NomenclatureController)1 SiScolController (fr.univlorraine.ecandidat.controllers.SiScolController)1 ConstanteUtils (fr.univlorraine.ecandidat.utils.ConstanteUtils)1 NomenclatureUtils (fr.univlorraine.ecandidat.utils.NomenclatureUtils)1 SimpleTablePresentation (fr.univlorraine.ecandidat.utils.bean.presentation.SimpleTablePresentation)1