Search in sources :

Example 1 with ListPropertyConverter

use of com.hack23.cia.web.impl.ui.application.views.common.converters.ListPropertyConverter in project cia by Hack23.

the class AdminApplicationSessionPageModContentFactoryImpl method createContent.

@Secured({ "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout content = createPanelContent();
    final String pageId = getPageId(parameters);
    final int pageNr = getPageNr(parameters);
    getMenuItemFactory().createMainPageMenuBar(menuBar);
    LabelFactory.createHeader2Label(content, ADMIN_APPLICATION_SESSION);
    final DataContainer<ApplicationSession, Long> dataContainer = getApplicationManager().getDataContainer(ApplicationSession.class);
    final List<ApplicationSession> pageOrderBy = dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, ApplicationSession_.createdDate);
    createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);
    getGridFactory().createBasicBeanItemGrid(content, ApplicationSession.class, pageOrderBy, APPLICATION_SESSION, COLUMN_ORDER, HIDE_COLUMNS, new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_SESSION_VIEW_NAME, "hjid"), null, new ListPropertyConverter[] { new ListPropertyConverter("page", "events", "actionName") });
    if (pageId != null && !pageId.isEmpty()) {
        final ApplicationSession applicationSession = dataContainer.load(Long.valueOf(pageId));
        if (applicationSession != null) {
            final VerticalLayout rightLayout = new VerticalLayout();
            rightLayout.setSizeFull();
            final HorizontalLayout horizontalLayout = new HorizontalLayout();
            horizontalLayout.setWidth(ContentSize.FULL_SIZE);
            content.addComponent(horizontalLayout);
            content.setExpandRatio(horizontalLayout, ContentRatio.GRID);
            getFormFactory().addFormPanelTextFields(horizontalLayout, applicationSession, ApplicationSession.class, AS_LIST);
            horizontalLayout.addComponent(rightLayout);
            horizontalLayout.setExpandRatio(rightLayout, ContentRatio.GRID);
            getGridFactory().createBasicBeanItemGrid(rightLayout, ApplicationActionEvent.class, applicationSession.getEvents(), APPLICATION_ACTION_EVENT, COLUMN_ORDER2, HIDE_COLUMNS2, new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_EVENTS_VIEW_NAME, "hjid"), null, null);
        }
    }
    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_APPLICATION_SESSION_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId);
    return content;
}
Also used : ApplicationSession(com.hack23.cia.model.internal.application.system.impl.ApplicationSession) PageItemPropertyClickListener(com.hack23.cia.web.impl.ui.application.views.pageclicklistener.PageItemPropertyClickListener) VerticalLayout(com.vaadin.ui.VerticalLayout) ListPropertyConverter(com.hack23.cia.web.impl.ui.application.views.common.converters.ListPropertyConverter) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Secured(org.springframework.security.access.annotation.Secured)

Example 2 with ListPropertyConverter

use of com.hack23.cia.web.impl.ui.application.views.common.converters.ListPropertyConverter in project cia by Hack23.

the class GridFactoryImpl method setColumnConverters.

/**
 * Sets the column converters.
 *
 * @param collectionPropertyConverter
 *            the collection property converter
 * @param grid
 *            the grid
 */
private static void setColumnConverters(final ListPropertyConverter[] collectionPropertyConverter, final Grid grid) {
    if (collectionPropertyConverter != null) {
        for (final ListPropertyConverter converter : collectionPropertyConverter) {
            grid.removeColumn(converter.getColumn());
            Column column = grid.addColumn(converter);
            column.setCaption(WordUtils.capitalize(converter.getColumn()));
            column.setId(converter.getColumn());
        }
    }
}
Also used : Column(com.vaadin.ui.Grid.Column) ListPropertyConverter(com.hack23.cia.web.impl.ui.application.views.common.converters.ListPropertyConverter)

Aggregations

ListPropertyConverter (com.hack23.cia.web.impl.ui.application.views.common.converters.ListPropertyConverter)2 ApplicationSession (com.hack23.cia.model.internal.application.system.impl.ApplicationSession)1 PageItemPropertyClickListener (com.hack23.cia.web.impl.ui.application.views.pageclicklistener.PageItemPropertyClickListener)1 Column (com.vaadin.ui.Grid.Column)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 Secured (org.springframework.security.access.annotation.Secured)1