Package es.uma.crudframework.model

Examples of es.uma.crudframework.model.LabelValue


        if (availableCountries == null) {
            final String EMPTY = "";
            final Locale[] available = Locale.getAvailableLocales();

            final List<LabelValue> countries = new ArrayList<LabelValue>();
            countries.add(new LabelValue("", ""));

            for (Locale anAvailable : available) {
                final String iso = anAvailable.getCountry();
                final String name = anAvailable.getDisplayCountry(locale);

                if (!EMPTY.equals(iso) && !EMPTY.equals(name)) {
                    final LabelValue country = new LabelValue(name, iso);

                    if (!countries.contains(country)) {
                        countries.add(new LabelValue(name, iso));
                    }
                }
            }

            Collections.sort(countries, new LabelValueComparator(locale));

            final Map<String, String> options = new LinkedHashMap<String, String>();
            // loop through and convert list to a JSF-Friendly Map for a
            // <select>
            for (Object country : countries) {
                final LabelValue option = (LabelValue) country;
                if (!options.containsValue(option.getValue())) {
                    options.put(option.getLabel(), option.getValue());
                }
            }
            this.availableCountries = options;
        }
View Full Code Here


         * @param o2
         *            The second LabelValue to compare.
         * @return The value returned by comparing the localized labels.
         */
        public final int compare(Object o1, Object o2) {
            final LabelValue lhs = (LabelValue) o1;
            final LabelValue rhs = (LabelValue) o2;

            return c.compare(lhs.getLabel(), rhs.getLabel());
        }
View Full Code Here

TOP

Related Classes of es.uma.crudframework.model.LabelValue

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.