Package org.apache.click.control

Examples of org.apache.click.control.Option


        // 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"));
                return optionList;
            }
        });

        form.add(genderSelect);

        // Investment Select - populated through Select.add methods
        List investmentOptions = new ArrayList();

        OptionGroup property = new OptionGroup("property");
        property.add(new Option("Commercial Property", "Commercial"));
        property.add(new Option("Residential Property", "Residential"));
        investmentOptions.add(property);

        OptionGroup securities = new OptionGroup("securities");
        securities.add(new Option("Bonds"));
        securities.add(new Option("Options"));
        securities.add(new Option("Stocks"));
        investmentOptions.add(securities);

        investmentSelect = new Select("investment");
        investmentSelect.setOptionList(investmentOptions);
        investmentSelect.setMultiple(true);
View Full Code Here


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

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

            public List<Option> getData() {
                List<Option> options = new ArrayList<Option>();
                List<SystemCode> titles = getClientService().getTitles();
                for (SystemCode title : titles) {
                    options.add(new Option(title.getValue(), title.getLabel()));
                }
                return options;
            }
        });
        return titleSelect;
View Full Code Here

    public PickListDemo() {
        addControl(form);

        pickList.setHeaderLabel("Languages", "Selected");

        pickList.add(new Option("002", "C/C++"));
        pickList.add(new Option("003", "C#"));
        pickList.add(new Option("004", "Fortran"));
        pickList.add(new Option("005", "Java"));
        pickList.add(new Option("006", "Ruby"));
        pickList.add(new Option("007", "Perl"));
        pickList.add(new Option("008", "Visual Basic"));

        pickList.addSelectedValue("004");

        form.add(pickList);
View Full Code Here

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

        // 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());
View Full Code Here

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

    private List createOptionList(List<Customer> customers) {
        List<Option> optionList = new ArrayList<Option>();
        for (Customer customer : customers) {
            optionList.add(new Option(customer.getId(), customer.getName()));
        }
        return optionList;
    }
View Full Code Here

    }

    // Public Methods ---------------------------------------------------------

    public void buildSelects() {
        state.setDefaultOption(new Option("---"));
        city.setDefaultOption(new Option("---"));
        suburb.setDefaultOption(new Option("---"));

        // Populate the States. Do this before binding requests
        populateStateData();

        // Bind the form field request values
View Full Code Here

    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"));
                optionList.add(new Option(GAUTENG_PROVINCE, "Gauteng Province"));
                optionList.add(new Option(WESTERN_CAPE, "Western Cape"));
                return optionList;
            }
        });
    }
View Full Code Here

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

                if (EASTERN_CAPE.equals(stateCode)) {
                    optionList.add(new Option("Port Elizabeth"));
                    optionList.add(new Option("East London"));

                } else if (FREE_STATE.equals(stateCode)) {
                    optionList.add(new Option("Bloemfontein"));
                    optionList.add(new Option("Welkom"));

                } else if (GAUTENG_PROVINCE.equals(stateCode)) {
                    optionList.add(new Option("Johannesburg"));
                    optionList.add(new Option("Pretoria"));

                } else if (WESTERN_CAPE.equals(stateCode)) {
                    optionList.add(new Option("Cape Town"));
                    optionList.add(new Option("George"));
                }
                return optionList;
            }
        });
    }
View Full Code Here

TOP

Related Classes of org.apache.click.control.Option

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.