Example usage for org.apache.wicket.markup.html.navigation.paging PagingNavigator PagingNavigator

List of usage examples for org.apache.wicket.markup.html.navigation.paging PagingNavigator PagingNavigator

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.navigation.paging PagingNavigator PagingNavigator.

Prototype

public PagingNavigator(final String id, final IPageable pageable) 

Source Link

Document

Constructor.

Usage

From source file:almira.sample.web.SearchResultPanel.java

License:Apache License

/**
 * Constructor./*www. j  a v  a 2s.c  om*/
 *
 * @param id          component id
 * @param searchQuery the search query
 */
public SearchResultPanel(String id, String searchQuery) {
    super(id);

    IDataProvider<Catapult> dataProvider;
    if (searchQuery == null) {
        dataProvider = new CatapultListDataProvider(catapultQueryService);
    } else {
        dataProvider = new CatapultSearchDataProvider(catapultQueryService, searchQuery);
    }

    DataView<Catapult> dataView = new DataView<Catapult>("rows", dataProvider, ITEMS_PER_PAGE) {
        @Override
        protected void populateItem(Item<Catapult> item) {
            final Catapult catapult = item.getModelObject();
            item.setModel(new CompoundPropertyModel<Catapult>(catapult));
            item.add(new Label("id"));
            item.add(new Label("name"));
            item.add(new Label("created"));
            item.add(new Label("lastModified"));
            item.add(new Link<Catapult>("delete", item.getModel()) {
                @Override
                public void onClick() {
                    // Detached object: Need to delete by ID!
                    catapultUpdateService.delete(catapult.getId());
                }
            });
        }
    };

    add(dataView);
    add(new PagingNavigator("footerPaginator", dataView));
}

From source file:au.org.theark.admin.web.component.activitymonitor.ActivityMonitorContainerPanel.java

License:Open Source License

@SuppressWarnings("unchecked")
protected WebMarkupContainer initialiseSearchResults() {
    List<ArkSubjectSessionVO> activeUsers = SessionAttributeListener.getActiveUsers();
    // fixed for the ARK-1557 improvement.
    //Logged in sort second
    Collections.sort(activeUsers, new Comparator<ArkSubjectSessionVO>() {
        @Override/*w w w. j  av  a  2 s .  c o m*/
        public int compare(ArkSubjectSessionVO o1, ArkSubjectSessionVO o2) {
            return o2.getStartTimestamp().compareTo(o1.getStartTimestamp());
        }
    });
    //Last Access sort first
    Collections.sort(activeUsers, new Comparator<ArkSubjectSessionVO>() {
        @Override
        public int compare(ArkSubjectSessionVO o1, ArkSubjectSessionVO o2) {
            return o2.getLastAccessTime().compareTo(o1.getLastAccessTime());
        }
    });
    form.getModelObject().setActiveUsers(activeUsers);
    searchResultsPanel = new SearchResultsPanel("searchResultsPanel", feedBackPanel);
    listView = searchResultsPanel
            .buildPageableListView(new PropertyModel(form.getModelObject(), "activeUsers"));
    searchResultsPanel.add(listView);
    PagingNavigator pageNavigator = new PagingNavigator("navigator", listView);
    searchResultsPanel.add(pageNavigator);
    return searchResultsPanel;
}

From source file:au.org.theark.admin.web.component.function.FunctionContainerPanel.java

License:Open Source License

@Override
protected WebMarkupContainer initialiseSearchResults() {
    searchResultsPanel = new SearchResultsPanel("searchResultsPanel", containerForm, arkCrudContainerVO);
    initialiseDataView();//w w  w .  ja v a  2 s .c  om
    dataView = searchResultsPanel.buildDataView(dataProvider);
    dataView.setItemsPerPage(
            iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue());
    PagingNavigator pageNavigator = new PagingNavigator("navigator", dataView);
    searchResultsPanel.add(pageNavigator);
    searchResultsPanel.add(dataView);
    arkCrudContainerVO.getSearchResultPanelContainer().add(searchResultsPanel);
    return arkCrudContainerVO.getSearchResultPanelContainer();
}

From source file:au.org.theark.admin.web.component.rolePolicy.RolePolicyContainerPanel.java

License:Open Source License

@Override
protected WebMarkupContainer initialiseSearchResults() {
    searchResultsPanel = new SearchResultsPanel("searchResultsPanel", containerForm, feedBackPanel,
            arkCrudContainerVO);/*from  w w w  . ja  v a  2 s. com*/
    initialiseDataView();
    dataView = searchResultsPanel.buildDataView(dataProvider);
    dataView.setItemsPerPage(
            iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue());
    PagingNavigator pageNavigator = new PagingNavigator("navigator", dataView);
    searchResultsPanel.add(pageNavigator);
    searchResultsPanel.add(dataView);
    arkCrudContainerVO.getSearchResultPanelContainer().add(searchResultsPanel);
    return arkCrudContainerVO.getSearchResultPanelContainer();
}

From source file:au.org.theark.core.web.component.customfieldupload.CustomFieldUploadContainerPanel.java

License:Open Source License

protected WebMarkupContainer initialiseSearchResults() {
    searchResultListPanel = new SearchResultListPanel("searchResults");

    iModel = new LoadableDetachableModel<Object>() {
        private static final long serialVersionUID = 1L;

        @Override//w w w.  jav a  2 s.  com
        protected Object load() {
            // Return all Uploads for the study in context
            Long sessionStudyId = (Long) SecurityUtils.getSubject().getSession()
                    .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID);

            listView.removeAll();

            if (sessionStudyId != null) {
                Upload searchUpload = new Upload();
                Study study = iArkCommonService.getStudy(sessionStudyId);
                searchUpload.setStudy(study);
                searchUpload.setArkFunction(containerForm.getModelObject().getUpload().getArkFunction());

                java.util.Collection<Upload> studyUploads = iArkCommonService.searchUploads(searchUpload);
                return studyUploads;
            } else {
                return null;
            }
        }
    };

    listView = searchResultListPanel.buildPageableListView(iModel);
    listView.setReuseItems(true);
    PagingNavigator pageNavigator = new PagingNavigator("navigator", listView);
    searchResultListPanel.add(pageNavigator);
    searchResultListPanel.add(listView);
    arkCrudContainerVO.getSearchResultPanelContainer().add(searchResultListPanel);
    searchResultListPanel.setVisible(true);

    return arkCrudContainerVO.getSearchResultPanelContainer();
}

From source file:au.org.theark.core.web.component.panel.table.DataTablePanel.java

License:Open Source License

private void initBody() {
    // Using a nested ListViews
    //TODO Constant for page size
    PageableListView<List<String>> listView = new PageableListView<List<String>>("data", data, 15) {

        private static final long serialVersionUID = 1L;

        @Override//w w w. j  ava  2  s.c  om
        protected void populateItem(ListItem<List<String>> item) {
            IModel model = item.getModel();
            item.add(new ListView<String>("cols", model) {
                private static final long serialVersionUID = 1L;

                @Override
                protected void populateItem(ListItem<String> item) {
                    item.add(new Label("value", item.getModelObject()));
                }

            });

        }
    };
    table.add(listView);
    add(new PagingNavigator("navigator", listView));
}

From source file:au.org.theark.lims.web.component.barcodelabel.BarcodeLabelContainerPanel.java

License:Open Source License

protected WebMarkupContainer initialiseSearchResults() {
    WebMarkupContainer resultListContainer = arkCrudContainerVO.getSearchResultPanelContainer();
    resultListContainer.setOutputMarkupPlaceholderTag(true);

    SearchResultsPanel searchResultsPanel = new SearchResultsPanel("resultListPanel", containerForm,
            arkCrudContainerVO);/*  w  w  w.  j  a  v a  2s.c o  m*/

    initialiseDataView();
    dataView = searchResultsPanel.buildDataView(dataProvider);
    dataView.setItemsPerPage(
            iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue());
    PagingNavigator pageNavigator = new PagingNavigator("navigator", dataView);
    searchResultsPanel.add(pageNavigator);
    searchResultsPanel.add(dataView);
    arkCrudContainerVO.getSearchResultPanelContainer().add(searchResultsPanel);
    return arkCrudContainerVO.getSearchResultPanelContainer();
}

From source file:au.org.theark.lims.web.component.biospecimenupload.BiospecimenUploadContainerPanel.java

License:Open Source License

protected WebMarkupContainer initialiseSearchResults() {
    searchResultPanel = new SearchResultListPanel("searchResults", feedBackPanel, containerForm,
            arkCrudContainerVO);/*from w  ww. j  a  va  2s . co  m*/

    iModel = new LoadableDetachableModel<Object>() {
        private static final long serialVersionUID = 1L;

        @Override
        protected Object load() {
            // Return all Uploads for the Study in context
            java.util.Collection<Upload> studyUploads = new ArrayList<Upload>();
            if (isActionPermitted()) {
                Upload studyUpload = new Upload();
                List<Study> studyListForUser = new ArrayList<Study>(0);
                Long sessionStudyId = (Long) SecurityUtils.getSubject().getSession()
                        .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID);
                Study study = null;
                if (sessionStudyId != null) {
                    study = iArkCommonService.getStudy(sessionStudyId);
                    studyUpload.setStudy(study);
                    studyUpload.setArkFunction(arkFunction);
                    studyListForUser.add(study);
                    studyUploads = iArkCommonService.searchUploadsForBiospecimen(studyUpload, studyListForUser);
                }
            }
            listView.removeAll();
            return studyUploads;
        }
    };

    listView = searchResultPanel.buildPageableListView(iModel);
    listView.setReuseItems(true);
    PagingNavigator pageNavigator = new PagingNavigator("navigator", listView);
    searchResultPanel.add(pageNavigator);
    searchResultPanel.add(listView);
    arkCrudContainerVO.getSearchResultPanelContainer().add(searchResultPanel);
    searchResultPanel.setVisible(true);

    return arkCrudContainerVO.getSearchResultPanelContainer();
}

From source file:au.org.theark.lims.web.component.bioupload.BioUploadContainerPanel.java

License:Open Source License

protected WebMarkupContainer initialiseSearchResults() {
    searchResultPanel = new SearchResultListPanel("searchResults", feedBackPanel, containerForm,
            arkCrudContainerVO);/*from w ww .j  a va  2  s .c  om*/

    iModel = new LoadableDetachableModel<Object>() {
        private static final long serialVersionUID = 1L;

        @Override
        protected Object load() {
            // Return all Uploads for the Study in context
            java.util.Collection<Upload> studyUploads = new ArrayList<Upload>();
            Long sessionStudyId = (Long) SecurityUtils.getSubject().getSession()
                    .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID);

            //if (isActionPermitted() && sessionStudyId != null) {  TODO we need so make sure permission logic only occurs at the highest possible level
            if (sessionStudyId != null) {
                Upload studyUpload = new Upload();
                studyUpload.setStudy(iArkCommonService.getStudy(sessionStudyId));
                //explicitly search all bio uploads not based on ark function 
                //studyUpload.setArkFunction(arkFunction);
                studyUploads = iArkCommonService.searchUploadsForBio(studyUpload);

            }
            listView.removeAll();
            return studyUploads;
        }
    };

    listView = searchResultPanel.buildPageableListView(iModel);
    listView.setReuseItems(true);
    PagingNavigator pageNavigator = new PagingNavigator("navigator", listView);
    searchResultPanel.add(pageNavigator);
    searchResultPanel.add(listView);
    arkCrudContainerVO.getSearchResultPanelContainer().add(searchResultPanel);
    searchResultPanel.setVisible(true);

    return arkCrudContainerVO.getSearchResultPanelContainer();
}

From source file:au.org.theark.phenotypic.web.component.phenodataupload.PhenoDataUploadContainerPanel.java

License:Open Source License

protected WebMarkupContainer initialiseSearchResults() {
    searchResultPanel = new SearchResultListPanel("searchResults", feedBackPanel, containerForm,
            arkCrudContainerVO);/*from w  w  w .j a  va 2 s .  co m*/

    iModel = new LoadableDetachableModel<Object>() {
        private static final long serialVersionUID = 1L;

        @Override
        protected Object load() {
            // Return all Uploads for the Study in context
            java.util.Collection<Upload> studyUploads = new ArrayList<Upload>();
            Long sessionStudyId = (Long) SecurityUtils.getSubject().getSession()
                    .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID);

            //if (isActionPermitted() && sessionStudyId != null) {  TODO we need so make sure permission logic only occurs at the highest possible level
            if (sessionStudyId != null) {
                Upload studyUpload = new Upload();
                studyUpload.setStudy(iArkCommonService.getStudy(sessionStudyId));

                studyUpload.setArkFunction(arkFunction);
                studyUploads = iArkCommonService.searchUploads(studyUpload);

            }
            listView.removeAll();
            return studyUploads;
        }
    };

    listView = searchResultPanel.buildPageableListView(iModel);
    listView.setReuseItems(true);
    PagingNavigator pageNavigator = new PagingNavigator("navigator", listView);
    searchResultPanel.add(pageNavigator);
    searchResultPanel.add(listView);
    arkCrudContainerVO.getSearchResultPanelContainer().add(searchResultPanel);
    searchResultPanel.setVisible(true);

    return arkCrudContainerVO.getSearchResultPanelContainer();
}