Search in sources :

Example 76 with DataContainer

use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.

the class MinistryGovernmentBodiesModContentFactoryImpl method createContent.

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout panelContent = createPanelContent();
    final String pageId = getPageId(parameters);
    final DataContainer<ViewRiksdagenMinistry, String> dataContainer = getApplicationManager().getDataContainer(ViewRiksdagenMinistry.class);
    final ViewRiksdagenMinistry viewRiksdagenMinistry = dataContainer.load(pageId);
    if (viewRiksdagenMinistry != null) {
        getMinistryMenuItemFactory().createMinistryMenuBar(menuBar, pageId);
        LabelFactory.createHeader2Label(panelContent, GOVERNMENT_BODIES);
        governmentBodyChartDataManager.createMinistryGovernmentBodyHeadcountSummaryChart(panelContent, viewRiksdagenMinistry.getNameId());
        panel.setCaption(NAME + "::" + MINISTRY + viewRiksdagenMinistry.getNameId());
        getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MINISTRY_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
    }
    return panelContent;
}
Also used : ViewRiksdagenMinistry(com.hack23.cia.model.internal.application.data.ministry.impl.ViewRiksdagenMinistry) VerticalLayout(com.vaadin.ui.VerticalLayout) Secured(org.springframework.security.access.annotation.Secured)

Example 77 with DataContainer

use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.

the class AdminAgencyPageModContentFactoryImpl 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_AGENCY);
    final DataContainer<Agency, Long> dataContainer = getApplicationManager().getDataContainer(Agency.class);
    final List<Agency> pageOrderBy = dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, Agency_.agencyName);
    createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);
    getGridFactory().createBasicBeanItemGrid(content, Agency.class, pageOrderBy, AGENCY, AGENCY_GRID_COLUMN_ORDER, AGENCY_GRID_HIDE_COLUMNS, AGENCY_GRID_LISTENER, null, AGENCY_GRID_COLLECTION_PROPERTY_CONVERTERS);
    if (pageId != null && !pageId.isEmpty()) {
        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);
        content.setExpandRatio(horizontalLayout, ContentRatio.LARGE_FORM);
        horizontalLayout.addComponent(leftLayout);
        horizontalLayout.addComponent(rightLayout);
        final Agency agency = dataContainer.load(Long.valueOf(pageId));
        if (agency != null) {
            getFormFactory().addFormPanelTextFields(leftLayout, agency, Agency.class, AGENCY_FORM_FIELDS);
            getGridFactory().createBasicBeanItemGrid(rightLayout, Portal.class, agency.getPortals(), PORTAL, PORTAL_GRID_COLUMN_ORDER, PORTAL_GRID_HIDE_COLUMNS, PORTAL_GRID_LISTENER, null, null);
        }
    }
    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_AGENCY_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId);
    return content;
}
Also used : Agency(com.hack23.cia.model.internal.application.system.impl.Agency) VerticalLayout(com.vaadin.ui.VerticalLayout) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Secured(org.springframework.security.access.annotation.Secured)

Example 78 with DataContainer

use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.

the class AdminLanguagePageModContentFactoryImpl 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_LANGUAGE);
    final DataContainer<LanguageData, Long> dataContainer = getApplicationManager().getDataContainer(LanguageData.class);
    final List<LanguageData> pageOrderBy = dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, LanguageData_.languageName);
    createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);
    getGridFactory().createBasicBeanItemGrid(content, LanguageData.class, pageOrderBy, LANGUAGE_DATA, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);
    if (pageId != null && !pageId.isEmpty()) {
        final LanguageData languageData = dataContainer.load(Long.valueOf(pageId));
        if (languageData != null) {
            getFormFactory().addFormPanelTextFields(content, languageData, LanguageData.class, AS_LIST);
        }
    }
    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_LANGUAGE_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId);
    return content;
}
Also used : LanguageData(com.hack23.cia.model.internal.application.system.impl.LanguageData) VerticalLayout(com.vaadin.ui.VerticalLayout) Secured(org.springframework.security.access.annotation.Secured)

Example 79 with DataContainer

use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.

the class DataSummaryOverviewPageModContentFactoryImpl method createContent.

@Secured({ "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout content = createPanelContent();
    getMenuItemFactory().createMainPageMenuBar(menuBar);
    LabelFactory.createHeader2Label(content, ADMIN_DATA_SUMMARY);
    final HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setSizeFull();
    content.addComponent(horizontalLayout);
    content.setExpandRatio(horizontalLayout, ContentRatio.LARGE);
    final DataContainer<DataSummary, String> dataContainer = getApplicationManager().getDataContainer(DataSummary.class);
    final List<DataSummary> all = dataContainer.getAll();
    if (!all.isEmpty()) {
        final DataSummary dataSummary = all.get(0);
        getFormFactory().addFormPanelTextFields(horizontalLayout, dataSummary, DataSummary.class, DATASUMMARY_FORM_FIELDS);
    }
    final VerticalLayout overviewLayout = new VerticalLayout();
    overviewLayout.setSizeFull();
    content.addComponent(overviewLayout);
    content.setExpandRatio(overviewLayout, ContentRatio.LARGE);
    final ResponsiveRow grid = createGridLayout(overviewLayout);
    final Button refreshViewsButton = new Button(REFRESH_VIEWS, VaadinIcons.REFRESH);
    refreshViewsButton.addClickListener(new RefreshDataViewsClickListener());
    createRowItem(grid, refreshViewsButton, REFRESH_ALL_VIEWS);
    final Button updateSearchIndexButton = new Button(UPDATE_SEARCH_INDEX, VaadinIcons.REFRESH);
    updateSearchIndexButton.addClickListener(new UpdateSearchIndexClickListener());
    createRowItem(grid, updateSearchIndexButton, UPDATE_DOCUMENT_SEARCH_INDEX);
    final Button removeDataButton = new Button(REMOVE_POLITICIANS, VaadinIcons.DEL);
    removeDataButton.addClickListener(new RemoveDataClickListener(RemoveDataRequest.DataType.POLITICIAN));
    createRowItem(grid, removeDataButton, REMOVE_POLITICIANS);
    final Button removeDocumentsButton = new Button(REMOVE_DOCUMENTS, VaadinIcons.DEL);
    removeDocumentsButton.addClickListener(new RemoveDataClickListener(RemoveDataRequest.DataType.DOCUMENTS));
    createRowItem(grid, removeDocumentsButton, REMOVE_DOCUMENTS);
    final Button removeApplicationHistoryButton = new Button(REMOVE_APPLICATION_HISTORY, VaadinIcons.DEL);
    removeApplicationHistoryButton.addClickListener(new RemoveDataClickListener(RemoveDataRequest.DataType.APPLICATION_HISTORY));
    createRowItem(grid, removeApplicationHistoryButton, REMOVE_APPLICATION_HISTORY);
    return content;
}
Also used : Button(com.vaadin.ui.Button) ResponsiveRow(com.jarektoro.responsivelayout.ResponsiveRow) RefreshDataViewsClickListener(com.hack23.cia.web.impl.ui.application.views.pageclicklistener.RefreshDataViewsClickListener) UpdateSearchIndexClickListener(com.hack23.cia.web.impl.ui.application.views.pageclicklistener.UpdateSearchIndexClickListener) VerticalLayout(com.vaadin.ui.VerticalLayout) DataSummary(com.hack23.cia.service.api.DataSummary) RemoveDataClickListener(com.hack23.cia.web.impl.ui.application.views.pageclicklistener.RemoveDataClickListener) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Secured(org.springframework.security.access.annotation.Secured)

Example 80 with DataContainer

use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.

the class PartyDocumentActivityPageModContentFactoryImpl method createContent.

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout panelContent = createPanelContent();
    final String pageId = getPageId(parameters);
    final DataContainer<ViewRiksdagenParty, String> dataContainer = getApplicationManager().getDataContainer(ViewRiksdagenParty.class);
    final ViewRiksdagenParty viewRiksdagenParty = dataContainer.load(pageId);
    if (viewRiksdagenParty != null) {
        getPartyMenuItemFactory().createPartyMenuBar(menuBar, pageId);
        LabelFactory.createHeader2Label(panelContent, DOCUMENT_ACTIVITY);
        documentChartDataManager.createDocumentHistoryPartyChart(panelContent, pageId);
        pageCompleted(parameters, panel, pageId, viewRiksdagenParty);
    }
    return panelContent;
}
Also used : ViewRiksdagenParty(com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenParty) VerticalLayout(com.vaadin.ui.VerticalLayout) Secured(org.springframework.security.access.annotation.Secured)

Aggregations

VerticalLayout (com.vaadin.ui.VerticalLayout)75 Secured (org.springframework.security.access.annotation.Secured)75 ViewRiksdagenParty (com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenParty)19 UserAccount (com.hack23.cia.model.internal.application.user.impl.UserAccount)17 ViewRiksdagenCommittee (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee)15 ViewRiksdagenPolitician (com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician)13 CreateApplicationSessionRequest (com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest)13 RegisterUserRequest (com.hack23.cia.service.api.action.application.RegisterUserRequest)13 RegisterUserResponse (com.hack23.cia.service.api.action.application.RegisterUserResponse)13 AbstractServiceFunctionalIntegrationTest (com.hack23.cia.service.impl.AbstractServiceFunctionalIntegrationTest)13 Test (org.junit.Test)13 ViewRiksdagenMinistry (com.hack23.cia.model.internal.application.data.ministry.impl.ViewRiksdagenMinistry)11 DataSeries (org.dussan.vaadin.dcharts.data.DataSeries)11 DocumentElement (com.hack23.cia.model.external.riksdagen.dokumentlista.impl.DocumentElement)10 PersonData (com.hack23.cia.model.external.riksdagen.person.impl.PersonData)10 PerfTest (org.databene.contiperf.PerfTest)10 DocumentStatusContainer (com.hack23.cia.model.external.riksdagen.dokumentstatus.impl.DocumentStatusContainer)8 ViewRiksdagenPartySummary (com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary)7 LoginRequest (com.hack23.cia.service.api.action.application.LoginRequest)7 LoginResponse (com.hack23.cia.service.api.action.application.LoginResponse)7