Search in sources :

Example 1 with UpdateApplicationConfigurationClickListener

use of com.hack23.cia.web.impl.ui.application.views.pageclicklistener.UpdateApplicationConfigurationClickListener in project cia by Hack23.

the class AdminApplicationConfigurationPageModContentFactoryImpl 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_CONFIGURATION);
    final DataContainer<ApplicationConfiguration, Long> dataContainer = getApplicationManager().getDataContainer(ApplicationConfiguration.class);
    final List<ApplicationConfiguration> pageOrderBy = dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, ApplicationConfiguration_.configurationGroup);
    createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);
    getGridFactory().createBasicBeanItemGrid(content, ApplicationConfiguration.class, pageOrderBy, APPLICATION_CONFIGURATION, COLUMN_ORDER, HIDE_COLUMNS, new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_CONFIGURATION_VIEW_NAME, "hjid"), null, null);
    if (pageId != null && !pageId.isEmpty()) {
        final ApplicationConfiguration applicationConfiguration = dataContainer.load(Long.valueOf(pageId));
        if (applicationConfiguration != null) {
            final VerticalLayout leftLayout = new VerticalLayout();
            leftLayout.setSizeFull();
            final VerticalLayout rightLayout = new VerticalLayout();
            rightLayout.setSizeFull();
            final HorizontalLayout horizontalLayout = new HorizontalLayout();
            horizontalLayout.setWidth(ContentSize.FULL_SIZE);
            content.addComponent(horizontalLayout);
            horizontalLayout.addComponent(leftLayout);
            horizontalLayout.addComponent(rightLayout);
            getFormFactory().addFormPanelTextFields(leftLayout, applicationConfiguration, ApplicationConfiguration.class, AS_LIST);
            final UpdateApplicationConfigurationRequest request = new UpdateApplicationConfigurationRequest();
            request.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
            request.setApplicationConfigurationId(applicationConfiguration.getHjid());
            request.setConfigTitle(applicationConfiguration.getConfigTitle());
            request.setConfigDescription(applicationConfiguration.getConfigDescription());
            request.setComponentTitle(applicationConfiguration.getConfigTitle());
            request.setComponentDescription(applicationConfiguration.getComponentDescription());
            request.setPropertyValue(applicationConfiguration.getPropertyValue());
            final ClickListener buttonListener = new UpdateApplicationConfigurationClickListener(request);
            final Panel updateFormPanel = new Panel();
            updateFormPanel.setSizeFull();
            rightLayout.addComponent(updateFormPanel);
            final FormLayout updateFormContent = new FormLayout();
            updateFormPanel.setContent(updateFormContent);
            getFormFactory().addRequestInputFormFields(updateFormContent, request, UpdateApplicationConfigurationRequest.class, AS_LIST2, UPDATE_CONFIGURATION, buttonListener);
        }
    }
    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_APPLICATION_CONFIGURATION_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId);
    return content;
}
Also used : FormLayout(com.vaadin.ui.FormLayout) UpdateApplicationConfigurationClickListener(com.hack23.cia.web.impl.ui.application.views.pageclicklistener.UpdateApplicationConfigurationClickListener) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Panel(com.vaadin.ui.Panel) UpdateApplicationConfigurationRequest(com.hack23.cia.service.api.action.admin.UpdateApplicationConfigurationRequest) PageItemPropertyClickListener(com.hack23.cia.web.impl.ui.application.views.pageclicklistener.PageItemPropertyClickListener) VerticalLayout(com.vaadin.ui.VerticalLayout) ApplicationConfiguration(com.hack23.cia.model.internal.application.system.impl.ApplicationConfiguration) ClickListener(com.vaadin.ui.Button.ClickListener) PageItemPropertyClickListener(com.hack23.cia.web.impl.ui.application.views.pageclicklistener.PageItemPropertyClickListener) UpdateApplicationConfigurationClickListener(com.hack23.cia.web.impl.ui.application.views.pageclicklistener.UpdateApplicationConfigurationClickListener) Secured(org.springframework.security.access.annotation.Secured)

Aggregations

ApplicationConfiguration (com.hack23.cia.model.internal.application.system.impl.ApplicationConfiguration)1 UpdateApplicationConfigurationRequest (com.hack23.cia.service.api.action.admin.UpdateApplicationConfigurationRequest)1 PageItemPropertyClickListener (com.hack23.cia.web.impl.ui.application.views.pageclicklistener.PageItemPropertyClickListener)1 UpdateApplicationConfigurationClickListener (com.hack23.cia.web.impl.ui.application.views.pageclicklistener.UpdateApplicationConfigurationClickListener)1 ClickListener (com.vaadin.ui.Button.ClickListener)1 FormLayout (com.vaadin.ui.FormLayout)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 Panel (com.vaadin.ui.Panel)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 Secured (org.springframework.security.access.annotation.Secured)1