Example usage for org.apache.wicket.model Model of

List of usage examples for org.apache.wicket.model Model of

Introduction

In this page you can find the example usage for org.apache.wicket.model Model of.

Prototype

public static <T extends Serializable> Model<T> of(T object) 

Source Link

Document

Factory methods for Model which uses type inference to make code shorter.

Usage

From source file:an.dpr.manteniket.components.BootstrapNavigationToolbar.java

License:Apache License

/**
 * Factory method used to create the navigator label that will be used by
 * the datatable/*from   ww w. j  a v  a  2s.c om*/
 * 
 * @param navigatorId
 *            component id navigator label should be created with
 * @param table
 *            dataview used by datatable
 * @return navigator label that will be used to navigate the data table
 * 
 */
protected WebComponent newNavigatorLabel(final String navigatorId, final DataTable<?, ?> table) {
    return new Label(navigatorId, Model.of(""));
}

From source file:at.molindo.wicketutils.utils.MockUtilsTest.java

License:Apache License

@Test
public void withSession() throws Exception {
    DummyApplication testApp = new DummyApplication();
    try {/*w  ww .ja va  2  s . c o m*/

        assertFalse(Application.exists());
        assertFalse(Session.exists());
        assertFalse(RequestCycle.get() != null);

        String stringResource = MockUtils.withRequest(testApp, new MockRequestCallback<String>() {

            @Override
            public String call() {
                // some basic testing
                assertTrue(Application.exists());
                assertFalse(Session.exists());
                assertTrue(RequestCycle.get() != null);

                return new StringResourceModel("someResource", (IModel<?>) null, Model.of("default value"))
                        .getString();
            }

        });
        assertEquals("default value", stringResource);

        String url = MockUtils.withRequest(testApp, new MockRequestCallback<String>() {

            @Override
            public String call() {
                return RequestCycle.get().urlFor(HomePage.class, null).toString();
            }

        });
        assertEquals(".", url);

        Locale locale = MockUtils.withRequest(testApp, new IMockRequestCallback<Locale>() {

            @Override
            public void configure(MockRequest request) {
                request.setLocale(Locale.GERMAN);
            }

            @Override
            public Locale call() {
                return Session.get().getLocale();
            }

        });
        assertEquals(Locale.GERMAN, locale);

        assertFalse(Application.exists());
        assertFalse(Session.exists());
        assertFalse(RequestCycle.get() != null);
    } finally {
        testApp.destroy();
    }
}

From source file:au.org.theark.core.web.component.customfield.SearchResultListPanel.java

License:Open Source License

private void addToolbars(DataView<CustomField> customFieldDataView) {
    List<IColumn<CustomField>> columns = new ArrayList<IColumn<CustomField>>();
    columns.add(new ExportableTextColumn<CustomField>(Model.of("name"), "name"));
    columns.add(new ExportableTextColumn<CustomField>(Model.of("fieldType"), "fieldType.name"));
    columns.add(new ExportableTextColumn<CustomField>(Model.of("description"), "description"));
    columns.add(new ExportableTextColumn<CustomField>(Model.of("fieldLabel"), "fieldLabel"));
    columns.add(new ExportableTextColumn<CustomField>(Model.of("unitType"), "unitType.name"));
    columns.add(new ExportableTextColumn<CustomField>(Model.of("encodedValues"), "encodedValues"));
    columns.add(new ExportableTextColumn<CustomField>(Model.of("minValue"), "minValue"));
    columns.add(new ExportableTextColumn<CustomField>(Model.of("maxValue"), "maxValue"));
    columns.add(new ExportableTextColumn<CustomField>(Model.of("missingValue"), "missingValue"));

    DataTable table = new DataTable("datatable", columns, customFieldDataView.getDataProvider(),
            iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue());
    List<String> headers = new ArrayList<String>(0);
    headers.add("FIELD_NAME");
    headers.add("FIELD_TYPE");
    headers.add("DESCRIPTION");
    headers.add("QUESTION");
    headers.add("UNITS");
    headers.add("ENCODED_VALUES");
    headers.add("MINIMUM_VALUE");
    headers.add("MAXIMUM_VALUE");
    headers.add("MISSING_VALUE");

    String filename = "data_dictionary";
    RepeatingView toolbars = new RepeatingView("toolbars");
    ExportToolbar<String> exportToolBar = new ExportToolbar<String>(table, headers, filename);
    toolbars.add(new Component[] { exportToolBar });
    add(toolbars);/*www .j  a va2  s. co m*/
}

From source file:au.org.theark.core.web.component.customfieldcategory.SearchResultListPanel.java

License:Open Source License

private void addToolbars(DataView<CustomFieldCategory> customFieldCategoryDataView) {
    List<IColumn<CustomFieldCategory>> columns = new ArrayList<IColumn<CustomFieldCategory>>();
    columns.add(new ExportableTextColumn<CustomFieldCategory>(Model.of("name"), "name"));
    columns.add(/*from ww w  .j ava  2 s  . c om*/
            new ExportableTextColumn<CustomFieldCategory>(Model.of("customFieldType"), "customFieldType.name"));
    columns.add(new ExportableTextColumn<CustomFieldCategory>(Model.of("description"), "description"));
    columns.add(
            new ExportableTextColumn<CustomFieldCategory>(Model.of("parentCategory"), "parentCategory.name"));
    columns.add(new ExportableTextColumn<CustomFieldCategory>(Model.of("orderNumber"), "orderNumber"));

    DataTable table = new DataTable("datatable", columns, customFieldCategoryDataView.getDataProvider(),
            iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue());
    List<String> headers = new ArrayList<String>(0);
    headers.add("FIELD_NAME");
    headers.add("CUSTOM_FIELD_TYPE");
    headers.add("DESCRIPTION");
    headers.add("PARENT_CATEGORY");
    headers.add("ORDER_NUMBER");

    String filename = "data_dictionary";
    RepeatingView toolbars = new RepeatingView("toolbars");
    ExportToolbar<String> exportToolBar = new ExportToolbar<String>(table, headers, filename);
    toolbars.add(new Component[] { exportToolBar });
    add(toolbars);
}

From source file:au.org.theark.lims.web.component.biospecimen.form.BiospecimenListForm.java

License:Open Source License

private void initialiseDataView() {
    dataViewListWMC = new WebMarkupContainer("dataViewListWMC");
    dataViewListWMC.setOutputMarkupId(true);
    // Data provider to paginate resultList
    biospecimenProvider = new ArkDataProvider2<LimsVO, Biospecimen>() {

        private static final long serialVersionUID = 1L;

        public int size() {
            return (int) iLimsService.getBiospecimenCount(criteriaModel.getObject());
        }//from www.  j  a  v  a 2s  . c o  m

        public Iterator<Biospecimen> iterator(int first, int count) {
            List<Biospecimen> biospecimenList = new ArrayList<Biospecimen>();
            if (ArkPermissionHelper.isActionPermitted(au.org.theark.core.Constants.SEARCH)) {
                biospecimenList = iLimsService.searchPageableBiospecimens(criteriaModel.getObject(), first,
                        count);
            }
            return biospecimenList.iterator();
        }
    };
    // Set the criteria into the data provider's model
    biospecimenProvider.setCriteriaModel(cpModel);

    dataView = buildDataView(biospecimenProvider);
    dataView.setItemsPerPage(
            iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue());

    AjaxPagingNavigator pageNavigator = new AjaxPagingNavigator("navigator", dataView) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onAjaxEvent(AjaxRequestTarget target) {
            target.add(dataViewListWMC);
        }
    };
    dataViewListWMC.add(pageNavigator);
    dataViewListWMC.add(dataView);

    List<IColumn<Biospecimen>> columns = new ArrayList<IColumn<Biospecimen>>();
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("BiospecimenUID"), "biospecimenUid"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("Study"), "study.name"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("SubjectUID"), "linkSubjectStudy.subjectUID"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("ParentUID"), "parentUid"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("Collection"), "bioCollection.name"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("Sample Type"), "sampleType.name"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("Quantity"), "quantity"));

    DataTable table = new DataTable("datatable", columns, dataView.getDataProvider(),
            iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue());
    List<String> headers = new ArrayList<String>(0);
    headers.add("BiospecimenUID");
    headers.add("Study");
    headers.add("SubjectUID");
    headers.add("ParentUID");
    headers.add("Collection");
    headers.add("Sample Type");
    headers.add("Quantity");

    String filename = "biospecimens";
    RepeatingView toolbars = new RepeatingView("toolbars");
    ExportToolbar<String> exportToolBar = new ExportToolbar<String>(table, headers, filename);
    toolbars.add(new Component[] { exportToolBar });
    dataViewListWMC.add(toolbars);
    add(dataViewListWMC);
}

From source file:au.org.theark.lims.web.component.global.biospecimen.form.BiospecimenListForm.java

License:Open Source License

private void initialiseDataView() {

    Subject currentUser = SecurityUtils.getSubject();
    ArkUser arkUser;// ww w . ja v  a 2 s .  c o m
    try {
        arkUser = iArkCommonService.getArkUser(currentUser.getPrincipal().toString());
        ArkUserVO arkUserVo = new ArkUserVO();
        arkUserVo.setArkUserEntity(arkUser);
        studyListForUser = iArkCommonService.getStudyListForUser(arkUserVo); //getParentAndChildStudies(sessionStudyId);
    } catch (EntityNotFoundException e) {
        e.printStackTrace();
    }

    dataViewListWMC = new WebMarkupContainer("dataViewListWMC");
    dataViewListWMC.setOutputMarkupId(true);
    // Data provider to paginate resultList
    biospecimenProvider = new ArkDataProvider2<LimsVO, Biospecimen>() {

        private static final long serialVersionUID = 1L;

        public int size() {
            return (int) iLimsService.getBiospecimenCount(criteriaModel.getObject());
        }

        public Iterator<Biospecimen> iterator(int first, int count) {
            List<Biospecimen> biospecimenList = new ArrayList<Biospecimen>();
            if (ArkPermissionHelper.isActionPermitted(au.org.theark.core.Constants.SEARCH)) {
                biospecimenList = iLimsService.searchPageableBiospecimens(criteriaModel.getObject(), first,
                        count);
            }
            return biospecimenList.iterator();
        }
    };
    // Set the criteria into the data provider's model
    biospecimenProvider.setCriteriaModel(cpModel);

    dataView = buildDataView(biospecimenProvider);
    dataView.setItemsPerPage(
            iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue());

    final IModel<String> amountModel = new Model<String>(Integer.toString(biospecimenProvider.size()));
    dataViewListWMC.add(new Label("total", amountModel) {
        private static final long serialVersionUID = 1L;

        protected void onBeforeRender() {
            amountModel.setObject(Integer.toString(biospecimenProvider.size()));
            super.onBeforeRender();
        };
    });

    AjaxPagingNavigator pageNavigator = new AjaxPagingNavigator("navigator", dataView) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onAjaxEvent(AjaxRequestTarget target) {
            target.add(dataViewListWMC);
        }
    };
    dataViewListWMC.add(pageNavigator);
    dataViewListWMC.add(dataView);

    List<IColumn<Biospecimen>> columns = new ArrayList<IColumn<Biospecimen>>();
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("BiospecimenUID"), "biospecimenUid"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("Study"), "study.name"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("SubjectUID"), "linkSubjectStudy.subjectUID"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("ParentUID"), "parentUid"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("Collection"), "bioCollection.name"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("Sample Type"), "sampleType.name"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("Quantity"), "quantity"));

    DataTable table = new DataTable("datatable", columns, dataView.getDataProvider(),
            iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue());
    List<String> headers = new ArrayList<String>(0);
    headers.add("BiospecimenUID");
    headers.add("Study");
    headers.add("SubjectUID");
    headers.add("ParentUID");
    headers.add("Collection");
    headers.add("Sample Type");
    headers.add("Quantity");

    String filename = "biospecimens";
    RepeatingView toolbars = new RepeatingView("toolbars");
    ExportToolbar<String> exportToolBar = new ExportToolbar<String>(table, headers, filename);
    toolbars.add(new Component[] { exportToolBar });
    dataViewListWMC.add(toolbars);
    add(dataViewListWMC);
}

From source file:au.org.theark.lims.web.component.subjectlims.lims.biospecimen.form.BiospecimenListForm.java

License:Open Source License

private void initialiseDataView() {
    dataViewListWMC = new WebMarkupContainer("dataViewListWMC");
    dataViewListWMC.setOutputMarkupId(true);
    // Data provider to paginate resultList
    biospecimenProvider = new ArkDataProvider2<LimsVO, Biospecimen>() {

        private static final long serialVersionUID = 1L;

        public int size() {
            return (int) iLimsService.getBiospecimenCount(criteriaModel.getObject());
        }//from   w  w w .ja  va2 s . co  m

        public Iterator<Biospecimen> iterator(int first, int count) {
            List<Biospecimen> biospecimenList = new ArrayList<Biospecimen>();
            if (ArkPermissionHelper.isActionPermitted(au.org.theark.core.Constants.SEARCH)) {
                biospecimenList = iLimsService.searchPageableBiospecimens(criteriaModel.getObject(), first,
                        count);
            }
            return biospecimenList.iterator();
        }
    };
    // Set the criteria into the data provider's model
    biospecimenProvider.setCriteriaModel(cpModel);

    dataView = buildDataView(biospecimenProvider);
    dataView.setItemsPerPage(
            iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue());

    AjaxPagingNavigator pageNavigator = new AjaxPagingNavigator("navigator", dataView) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onAjaxEvent(AjaxRequestTarget target) {
            target.add(dataViewListWMC);
        }
    };

    dataViewListWMC.add(pageNavigator);
    dataViewListWMC.add(dataView);

    List<IColumn<Biospecimen>> columns = new ArrayList<IColumn<Biospecimen>>();
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("BiospecimenUID"), "biospecimenUid"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("Study"), "study.name"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("SubjectUID"), "linkSubjectStudy.subjectUID"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("ParentUID"), "ParentUid"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("Collection"), "bioCollection.name"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("Sample Type"), "sampleType.name"));
    columns.add(new ExportableTextColumn<Biospecimen>(Model.of("Quantity"), "quantity"));

    DataTable table = new DataTable("datatable", columns, dataView.getDataProvider(),
            iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue());
    List<String> headers = new ArrayList<String>(0);
    headers.add("BiospecimenUID");
    headers.add("Study");
    headers.add("SubjectUID");
    headers.add("ParentUID");
    headers.add("Collection");
    headers.add("Sample Type");
    headers.add("Quantity");

    String filename = "biospecimens";
    RepeatingView toolbars = new RepeatingView("toolbars");
    ExportToolbar<String> exportToolBar = new ExportToolbar<String>(table, headers, filename);
    toolbars.add(new Component[] { exportToolBar });
    dataViewListWMC.add(toolbars);

    add(dataViewListWMC);
}

From source file:au.org.theark.phenotypic.web.component.phenodatacategory.SearchResultListPanel.java

License:Open Source License

private void addToolbars(DataView<PhenoDataSetCategory> phenoDataSetCategoryDataView) {
    List<IColumn<PhenoDataSetCategory>> columns = new ArrayList<IColumn<PhenoDataSetCategory>>();
    columns.add(new ExportableTextColumn<PhenoDataSetCategory>(Model.of("name"), "name"));
    columns.add(new ExportableTextColumn<PhenoDataSetCategory>(Model.of("description"), "description"));
    columns.add(/*from w  w w.  ja va 2  s.c o m*/
            new ExportableTextColumn<PhenoDataSetCategory>(Model.of("parentCategory"), "parentCategory.name"));
    columns.add(new ExportableTextColumn<PhenoDataSetCategory>(Model.of("orderNumber"), "orderNumber"));

    DataTable table = new DataTable("datatable", columns, phenoDataSetCategoryDataView.getDataProvider(),
            iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue());

    List<String> headers = new ArrayList<String>(0);
    headers.add("FIELD_NAME");
    headers.add("DESCRIPTION");
    String filename = "pheno_dataset_category";
    RepeatingView toolbars = new RepeatingView("toolbars");
    ExportToolbar<String> exportToolBar = new ExportToolbar<String>(table, headers, filename);
    toolbars.add(new Component[] { exportToolBar });
    add(toolbars);
}

From source file:au.org.theark.phenotypic.web.component.phenodatadictionary.SearchResultListPanel.java

License:Open Source License

private void addToolbars(DataView<PhenoDataSetField> phenoDataSetFieldDataView) {
    List<IColumn<PhenoDataSetField>> columns = new ArrayList<IColumn<PhenoDataSetField>>();
    columns.add(new ExportableTextColumn<PhenoDataSetField>(Model.of("name"), "name"));
    columns.add(new ExportableTextColumn<PhenoDataSetField>(Model.of("fieldType"), "fieldType.name"));
    columns.add(new ExportableTextColumn<PhenoDataSetField>(Model.of("description"), "description"));
    columns.add(new ExportableTextColumn<PhenoDataSetField>(Model.of("fieldLabel"), "fieldLabel"));
    columns.add(new ExportableTextColumn<PhenoDataSetField>(Model.of("unitTypeInText"), "unitTypeInText"));
    columns.add(new ExportableTextColumn<PhenoDataSetField>(Model.of("encodedValues"), "encodedValues"));
    columns.add(new ExportableTextColumn<PhenoDataSetField>(Model.of("minValue"), "minValue"));
    columns.add(new ExportableTextColumn<PhenoDataSetField>(Model.of("maxValue"), "maxValue"));
    columns.add(new ExportableTextColumn<PhenoDataSetField>(Model.of("missingValue"), "missingValue"));
    columns.add(new ExportableTextColumn<PhenoDataSetField>(Model.of("defaultValue"), "defaultValue"));
    columns.add(new ExportableTextColumn<PhenoDataSetField>(Model.of("required"), "required"));

    DataTable table = new DataTable("datatable", columns, phenoDataSetFieldDataView.getDataProvider(),
            iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue());
    List<String> headers = new ArrayList<String>(0);
    headers.add("FIELD_NAME");
    headers.add("FIELD_TYPE");
    headers.add("DESCRIPTION");
    headers.add("QUESTION");
    headers.add("UNITS");
    headers.add("ENCODED_VALUES");
    headers.add("MINIMUM_VALUE");
    headers.add("MAXIMUM_VALUE");
    headers.add("MISSING_VALUE");
    headers.add("DEFAULT_VALUE");
    headers.add("REQUIRED");

    String filename = "pheno_dataset_dictionary";
    RepeatingView toolbars = new RepeatingView("toolbars");
    ExportToolbar<String> exportToolBar = new ExportToolbar<String>(table, headers, filename);
    toolbars.add(new Component[] { exportToolBar });
    add(toolbars);/*ww  w  .  jav a2 s.c  om*/
}

From source file:au.org.theark.study.web.component.contact.AddressListPanel.java

License:Open Source License

/**
 * Initialize the data view relevant to phone list.
 *//*from www .  ja  va  2 s. c o  m*/
private void initialiseDataview() {
    sessionPersonId = (Long) SecurityUtils.getSubject().getSession()
            .getAttribute(au.org.theark.core.Constants.PERSON_CONTEXT_ID);
    /**
     * This is the address provider to the page able view.
     */
    addressProvider = new ArkDataProvider<Address, IStudyService>(studyService) {
        private static final long serialVersionUID = 1L;
        private List<Address> listAddress;
        private List<Address> listAddressForSize;

        public int size() {
            try {
                if (sessionPersonId != null) {
                    person = studyService.getPerson(sessionPersonId);
                    containerForm.getModelObject().getAddressVo().getAddress().setPerson(person);
                    listAddressForSize = studyService.getPersonAddressList(sessionPersonId,
                            containerForm.getModelObject().getAddressVo().getAddress());
                    return listAddressForSize.size();

                } else {
                    return 0;
                }

            } catch (ArkSystemException e) {
                e.printStackTrace();
                return 0;
            } catch (EntityNotFoundException e) {
                e.printStackTrace();
                return 0;
            }
        }

        public Iterator<? extends Address> iterator(int first, int count) {
            listAddress = studyService.pageablePersonAddressList(sessionPersonId,
                    containerForm.getModelObject().getAddressVo().getAddress(), first, count);
            return listAddress.iterator();
        }
    };
    /**
     * This is the address provider with subject uid. for export report.
     */
    addressSubjectProvider = new ArkDataProvider<AddressSubjectVO, IStudyService>(studyService) {
        private static final long serialVersionUID = 1L;
        private List<Address> listAddress;
        private List<Address> listAddressForSize;

        public int size() {
            try {
                if (sessionPersonId != null) {
                    person = studyService.getPerson(sessionPersonId);
                    containerForm.getModelObject().getAddressVo().getAddress().setPerson(person);
                    listAddressForSize = studyService.getPersonAddressList(sessionPersonId,
                            containerForm.getModelObject().getAddressVo().getAddress());
                    return listAddressForSize.size();
                } else {

                    return 0;
                }

            } catch (ArkSystemException e) {
                e.printStackTrace();
                return 0;
            } catch (EntityNotFoundException e) {
                e.printStackTrace();
                return 0;
            }
        }

        public Iterator<? extends AddressSubjectVO> iterator(int first, int count) {
            listAddress = studyService.pageablePersonAddressList(sessionPersonId,
                    containerForm.getModelObject().getAddressVo().getAddress(), first, count);
            List<AddressSubjectVO> addressVoList = new ArrayList<AddressSubjectVO>();
            for (Address address : listAddress) {
                String sessionSubjectUId = SecurityUtils.getSubject().getSession()
                        .getAttribute(au.org.theark.core.Constants.SUBJECTUID).toString();
                addressVoList.add(new AddressSubjectVO(address, sessionSubjectUId));
            }
            return addressVoList.iterator();
        }
    };

    addressProvider.setModel(Model.of(containerForm.getModelObject().getAddressVo().getAddress()));
    dataViewAddress = buildDataView(addressProvider);
    dataViewAddress.setItemsPerPage(
            iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue());
    dataViewAddressSubjectVO = buildDataViewWithSubjectStudyID(addressSubjectProvider);
    AjaxPagingNavigator pageNavigator = new AjaxPagingNavigator("addressNavigator", dataViewAddress);
    add(pageNavigator);

    List<IColumn<AddressSubjectVO>> columns = new ArrayList<IColumn<AddressSubjectVO>>();
    columns.add(new ExportableTextColumn<AddressSubjectVO>(Model.of("Subjetc UID"), "subjectUID"));
    columns.add(new ExportableTextColumn<AddressSubjectVO>(Model.of("Street Address"), "streetAddress"));
    columns.add(new ExportableTextColumn<AddressSubjectVO>(Model.of("City"), "city"));
    columns.add(new ExportableTextColumn<AddressSubjectVO>(Model.of("State"), "state.name"));
    columns.add(new ExportableTextColumn<AddressSubjectVO>(Model.of("Post Code"), "postCode"));
    columns.add(new ExportableTextColumn<AddressSubjectVO>(Model.of("Country"), "country.name"));
    columns.add(new ExportableTextColumn<AddressSubjectVO>(Model.of("Address Type"), "addressType.name"));
    columns.add(new ExportableTextColumn<AddressSubjectVO>(Model.of("DateReceived"), "dateReceived"));
    columns.add(new ExportableTextColumn<AddressSubjectVO>(Model.of("Preferred Mailing Address"),
            "preferredMailingAddress"));

    DataTable table = new DataTable("datatable", columns, dataViewAddressSubjectVO.getDataProvider(),
            iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue());
    List<String> headers = new ArrayList<String>(0);
    headers.add("Subject UID:");
    headers.add("Street Address:");
    headers.add("City:");
    headers.add("State:");
    headers.add("Post Code:");
    headers.add("Country:");
    headers.add("Address Type:");
    headers.add("DateReceived:");
    headers.add("Preferred Mailing Address:");

    String filename = sessionPersonId != null ? String.valueOf(sessionPersonId) + "_addressList"
            : "unknown" + "_addressList";
    RepeatingView toolbars = new RepeatingView("toolbars");
    //Disable the tool bar if session person not exsists.
    if (sessionPersonId == null) {
        toolbars.setEnabled(false);
    } else {
        toolbars.setEnabled(true);
    }
    ExportToolbar<String> exportToolBar = new ExportToolbar<String>(table, headers, filename);
    toolbars.add(new Component[] { exportToolBar });
    add(toolbars);
    add(dataViewAddress);

}