Package org.apache.click.dataprovider

Examples of org.apache.click.dataprovider.DataProvider


     * @return the Option list
     */
    public List getOptionList() {
        if (optionList == null) {

            DataProvider dp = getDataProvider();

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

                if (iterableData instanceof List) {
                    // Set optionList to data
                    setOptionList((List) 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

    @Override
    public void onInit() {
        super.onInit();

        investmentSelect.setDefaultOption(Option.EMPTY_OPTION);
        investmentSelect.setDataProvider(new DataProvider() {

            public List<Option> getData() {
                List<Option> options = new ArrayList<Option>();
                for (String category : customerService.getInvestmentCategories()) {
                    options.add(new Option(category));
View Full Code Here

        // Test initial value
        assertEquals(expectedValue, select.getValue());
        select.setValue(null);
        select.setOptionList(null);

        select.setDataProvider(new DataProvider() {

            public List getData() {
                List list = new ArrayList();
                list.add(new Option("male"));
                list.add(new Option("female"));
View Full Code Here

     */
    public void testDataProviderValues() {
        // Setup Select
        Select select  = new Select("gender");

        select.setDataProvider(new DataProvider() {

            public List getData() {
                List list = new ArrayList();
                list.add("male");
                return list;
            }
        });

        try {
            // Trigger dataProvider
            select.toString();
            fail("Cannot pass String to dataProvider");
        } catch (IllegalArgumentException expected) {
        }

        select.setDataProvider(new DataProvider() {

            public Set getData() {
                Set set = new LinkedHashSet();
                set.add("male");
                return set;
View Full Code Here

        // Set default non-selecting option
        select.setDefaultOption(new Option("[Select]"));

        // Create dataprovider for Select
        DataProvider dp = new DataProvider() {
            public List getData() {
                return createOptionList(customerService.getCustomers());
            }
        };
        select.setDataProvider(dp);
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

        customerSelect = new Select("Customer");
        customerSelect.setRequired(true);
        form.add(customerSelect);

        customerSelect.setDefaultOption(Option.EMPTY_OPTION);
        customerSelect.setDataProvider(new DataProvider() {

            public List getData() {
                List<Option> optionList = new ArrayList<Option>();
                List<Customer> customerList = customerService.getCustomers();
                for (Customer customer : customerList) {
View Full Code Here

    public void onInit() {
        super.onInit();

        customerSelect.setSize(8);

        customerSelect.setDataProvider(new DataProvider() {

            public List getData() {
                List<Option> optionList = new ArrayList<Option>();
                List<Customer> customerList = customerService.getCustomersSortedByName(8);
                for (Customer customer : customerList) {
View Full Code Here

        return true;
    }

    public DataProvider createDataProvider() {
        DataProvider dp = new DataProvider() {
            public List<Customer> getData() {
                return customerService.getCustomersSortedByName(NUM_ROWS);
            }
        };
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.