Package org.apache.click.control

Examples of org.apache.click.control.Option


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


            public List<Option> getData() {
                List<Option> options = new ArrayList<Option>();
                List<SystemCode> states = getClientService().getStates();
                for (SystemCode state : states) {
                    options.add(new Option(state.getValue(), state.getLabel()));
                }
                return options;
            }
        });
    }
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

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

                if (cityCode.equals("Port Elizabeth")) {
                    optionList.add(new Option("Humewood"));
                    optionList.add(new Option("Summerstrand"));

                } else if (cityCode.equals("East London")) {
                    optionList.add(new Option("Beacon Bay"));
                    optionList.add(new Option("Cinta East"));

                } else if (cityCode.equals("Bloemfontein")) {
                    optionList.add(new Option("Fichardpark"));
                    optionList.add(new Option("Wilgehof"));

                } else if (cityCode.equals("Welkom")) {
                    optionList.add(new Option("Dagbreek"));
                    optionList.add(new Option("Eerstemyn"));

                } else if (cityCode.equals("Johannesburg")) {
                    optionList.add(new Option("Rivonia"));
                    optionList.add(new Option("Sandton"));

                } else if (cityCode.equals("Pretoria")) {
                    optionList.add(new Option("Garsfontein"));
                    optionList.add(new Option("Sunnyside"));

                } else if (cityCode.equals("Cape Town")) {
                    optionList.add(new Option("Milnerton"));
                    optionList.add(new Option("Blaauwberg"));

                } else if (cityCode.equals("George")) {
                    optionList.add(new Option("Panorama"));
                    optionList.add(new Option("Fernridge"));
                }

                return optionList;
            }
        });
View Full Code Here

    protected void loadOptionList() {
        List optionList = getOptionList();

        // Determine whether option list should be loaded
        if (optionList.size() == 1) {
            Option option = (Option) optionList.get(0);
            if (option.getValue().equals(Option.EMPTY_OPTION.getValue())) {
                // Continue and load option list

            } else {
                // Don't load list
                return;
            }

        } else if (optionList.size() > 1) {
            // Don't load list
            return;
        }

        Set<Option> countryList = new TreeSet<Option>(new OptionLabelComparator(getLocale()));

        String[] isoCountries = Locale.getISOCountries();

        Locale userLocale = getLocale();

        for (int i = 0; i < isoCountries.length; i++) {
            Locale tmpLocale = new Locale("en", isoCountries[i]);
            final String iso = tmpLocale.getCountry();
            final String country = tmpLocale.getDisplayCountry(userLocale);

            if (StringUtils.isNotEmpty(iso) && StringUtils.isNotEmpty(country)) {
                countryList.add(new Option(iso, country));
            }
        }

        if (isRequired() && optionList.isEmpty()) {
            add(Option.EMPTY_OPTION);
View Full Code Here

    public void add(String value) {
        if (value == null) {
            String msg = "value parameter cannot be null";
            throw new IllegalArgumentException(msg);
        }
        getOptionList().add(new Option(value));
    }
View Full Code Here

    public void add(Object option) {
        if (option instanceof Option) {
            getOptionList().add((Option) 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 "
                + "CheckList.addAll(Collection, String, String) instead.";
View Full Code Here

        if (options == null) {
            String msg = "options parameter cannot be null";
            throw new IllegalArgumentException(msg);
        }
        for (Map.Entry<?, ?> entry : options.entrySet()) {
            Option option = new Option(entry.getKey().toString(), entry
                    .getValue().toString());
            getOptionList().add(option);
        }
    }
View Full Code Here

        if (options == null) {
            String msg = "options parameter cannot be null";
            throw new IllegalArgumentException(msg);
        }
        for (String option : options) {
            getOptionList().add(new Option(option, option));
        }
    }
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.