Package org.apache.click.dataprovider

Examples of org.apache.click.dataprovider.DataProvider


    // Private methods --------------------------------------------------------

    private void setupTitleSelect(Select select) {
        select.setDefaultOption(Option.EMPTY_OPTION);

        select.setDataProvider(new DataProvider() {

            public List<Option> getData() {
                List<Option> options = new ArrayList<Option>();
                List<SystemCode> titles = getClientService().getTitles();
                for (SystemCode title : titles) {
View Full Code Here


    // Private methods --------------------------------------------------------

    private void setupStateSelect(Select select) {
        select.setDefaultOption(Option.EMPTY_OPTION);

        select.setDataProvider(new DataProvider() {

            public List<Option> getData() {
                List<Option> options = new ArrayList<Option>();
                List<SystemCode> states = getClientService().getStates();
                for (SystemCode state : states) {
View Full Code Here

    // Private Methods --------------------------------------------------------

    @SuppressWarnings("serial")
    private void populateStateData() {
        state.setDataProvider(new DataProvider() {

            public List getData() {
                List<Option> optionList = new ArrayList<Option>();
                optionList.add(new Option(EASTERN_CAPE, "Eastern Cape"));
                optionList.add(new Option(FREE_STATE, "Free State"));
View Full Code Here

            }
        });
    }

    private void populateCityData(final String stateCode) {
        city.setDataProvider(new DataProvider() {

            public List getData() {
                List<Option> optionList = new ArrayList<Option>();

                if (EASTERN_CAPE.equals(stateCode)) {
View Full Code Here

            }
        });
    }

    private void populateSuburbData(final String cityCode) {
        suburb.setDataProvider(new DataProvider() {

            public List getData() {
                List<Option> optionList = new ArrayList<Option>();

                if (cityCode.equals("Port Elizabeth")) {
View Full Code Here

    public List getOptionList() {
        if (optionList == null) {

            Option defaultOption = getDefaultOption();

            DataProvider dp = getDataProvider();

            if (dp != null) {
                Iterable iterableData = dp.getData();

                if (iterableData instanceof List) {
                    // Set optionList to data
                    List listData = (List) iterableData;
                    if (defaultOption != null) {
View Full Code Here

        // Gender Select - populated through a DataProvider
        genderSelect = new Select("gender");
        genderSelect.setRequired(true);

        genderSelect.setDefaultOption(new Option("U", ""));
        genderSelect.setDataProvider(new DataProvider() {

            public List getData() {
                List optionList = new ArrayList(3);
                optionList.add(new Option("M", "Male"));
                optionList.add(new Option("F", "Female"));
View Full Code Here

    public List getOptionList() {
        if (optionList == null) {

            optionList = new ArrayList();

            DataProvider dp = getDataProvider();

            if (dp != null) {
                Iterable iterableData = dp.getData();

                // Create and populate the optionList from the Iterable data
                if (iterableData instanceof Collection) {
                    // Popuplate optionList from options
                    addAll((Collection) iterableData);
View Full Code Here

     * is specified the new row list will be populated from the data provider.
     *
     * @return a new table row list
     */
    protected List createRowList() {
        DataProvider dp = getDataProvider();

        List<Object> rowList = null;

        if (dp != null) {

            boolean isPaginating = false;

            if (dp instanceof PagingDataProvider) {
                isPaginating = true;
            }

            if (isPaginating) {
                // rowCount is provided by the paging data provider. Its
                // important to set the rowCount *before* invoking dp.getData
                // since the getData implementation could have a dependency
                // on the methods getFirstRow, getLastRow etc all of which
                // depends on the rowCount value
                this.rowCount = ((PagingDataProvider) dp).size();

                // paginated datasets cannot be sorted by the table since it
                // has access to only a limited number of rows. The dataset has
                // to be sorted by a database or other means. Set the sorted
                // property to true indicating that the data is already in a
                // sorted state
                setSorted(true);
            }

            Iterable iterableData = dp.getData();

            // If dataProvider returns a list, use that as the rowList
            if (iterableData instanceof List) {
                rowList = (List) iterableData;

View Full Code Here

            Option defaultOption = getDefaultOption();
            if (defaultOption != null) {
                optionList.add(defaultOption);
            }

            DataProvider dp = getDataProvider();

            if (dp != null) {
                Iterable iterableData = dp.getData();

                // Create and populate the optionList from the Iterable data
                if (iterableData instanceof Collection) {
                    // Popuplate optionList from options
                    addAll((Collection) iterableData);
View Full Code Here

TOP

Related Classes of org.apache.click.dataprovider.DataProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.