Search in sources :

Example 1 with RefreshDataViewsClickListener

use of com.hack23.cia.web.impl.ui.application.views.pageclicklistener.RefreshDataViewsClickListener 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)

Aggregations

DataSummary (com.hack23.cia.service.api.DataSummary)1 RefreshDataViewsClickListener (com.hack23.cia.web.impl.ui.application.views.pageclicklistener.RefreshDataViewsClickListener)1 RemoveDataClickListener (com.hack23.cia.web.impl.ui.application.views.pageclicklistener.RemoveDataClickListener)1 UpdateSearchIndexClickListener (com.hack23.cia.web.impl.ui.application.views.pageclicklistener.UpdateSearchIndexClickListener)1 ResponsiveRow (com.jarektoro.responsivelayout.ResponsiveRow)1 Button (com.vaadin.ui.Button)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 Secured (org.springframework.security.access.annotation.Secured)1