Package org.apache.click.control

Examples of org.apache.click.control.Option


        List countries = countrySelect.getOptionList();
        Iterator it = countries.iterator();
       
        Set uniqueChecker = new HashSet();
        while(it.hasNext()) {
            Option option = (Option) it.next();
           
            // Check that no country already exists in checker. If a country
            // already exists, it means that CountrySelect returns duplicate countries
            assertFalse(uniqueChecker.contains(option.getLabel()));

            uniqueChecker.add(option.getLabel());
        }
    }
View Full Code Here


    public void add(Object option) {
        if (option instanceof Option) {
            getOptionList().add(option);

        } else if (option instanceof String) {
            getOptionList().add(new Option(option.toString()));

        } else if (option instanceof Number) {
            getOptionList().add(new Option(option.toString()));

        } else if (option instanceof Boolean) {
            getOptionList().add(new Option(option.toString()));

        } else {
            String message = "Unsupported options class "
                + option.getClass().getName() + ". Please use method "
                + "PickList.addAll(Collection, String, String) instead.";
View Full Code Here

            String msg = "options parameter cannot be null";
            throw new IllegalArgumentException(msg);
        }
        for (Iterator i = options.entrySet().iterator(); i.hasNext();) {
            Map.Entry entry = (Map.Entry) i.next();
            Option option = new Option(entry.getKey().toString(), entry
                    .getValue().toString());
            getOptionList().add(option);
        }
    }
View Full Code Here

            String msg = "options parameter cannot be null";
            throw new IllegalArgumentException(msg);
        }
        for (int i = 0; i < options.length; i++) {
            String option = options[i];
            getOptionList().add(new Option(option, option));
        }
    }
View Full Code Here

                if (optionLabelProperty != null) {
                    labelResult = PropertyUtils.getValue(object,
                        optionLabelProperty, methodCache);
                }

                Option option = null;

                if (labelResult != null) {
                    option = new Option(valueResult, labelResult.toString());
                } else {
                    option = new Option(valueResult.toString());
                }

                getOptionList().add(option);

            } catch (Exception e) {
View Full Code Here

        List optionList     = getOptionList();
        List selectedValues = getSelectedValues();
        List options        = new ArrayList();

        for (int i = 0; i < optionList.size(); i++) {
            Option option = (Option) optionList.get(i);
            Map map = new HashMap();
            map.put("option", option);
            map.put("selected", new Boolean(selectedValues.contains(option.getValue())));
            options.add(map);
        }

        // Add all attributes to buffer
        HtmlStringBuffer attributesBuffer = new HtmlStringBuffer();
View Full Code Here

        investmentSelect.setDataProvider(new DataProvider() {

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

    private List<Option> createOptionsList(int[] values) {
        List<Option> ret = new ArrayList<Option>();
        for(int i=0; i<values.length; i++) {
            String value = Integer.toString(values[i]);
            String label = "Label: "+i;
            ret.add(new Option(value,label));
        }
        return ret;
    }
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

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.