Holger's Java API

## com.antelmann.util
Class Country

    java.lang.Object
      com.antelmann.db.AbstractDBEntry
          com.antelmann.util.Country

All Implemented Interfaces:
  DBEntry, Localizable, Serializable, Comparable<Country>

    public class Country

extends AbstractDBEntry
implements Comparable<Country>, Localizable

allows to treat a country just like any other DBEntry object and includes useful components to use countries in tables and lists. The ID of a Country is its 2-letter country code based on ISO 3166.

Since:
  8. August 2007, 15:20
Author:
  Holger Antelmann
See Also:
  `I18n`, Serialized Form

Nested Class Summary
`static class` `Country.Store` provides a convenient read-only store for all existing Country objects without having to hold them all in memory constantly

Nested classes/interfaces inherited from interface com.antelmann.util.Localizable
`Localizable.Adapter`

Field Summary

Fields inherited from interface com.antelmann.db.DBEntry
`ENTRY_FLAVOR, ENTRY_LIST_FLAVOR`

Constructor Summary
`Country(String countryCode)`
`Country(String countryCode, boolean showFullNameOnToString)`

Method Summary
`int` `compareTo(Country c)`
`static Country[]` `getAll()`
`static DefaultCellEditor` `getCellEditor(boolean showFullName, boolean showIcon)`
`static JComboBox` `getComboBox()`
`static JComboBox` `getComboBox(boolean showFullName, boolean showIcon, Locale locale, Country... limitToTheseCountries)` uses a `DefaultComboBoxModel` with Country instances
`static JComboBox` `getComboBox(Locale locale)`
`static Country[]` `getCountries(Filter<Country> filter)`
`String` `getCountryCode()` returns `AbstractDBEntry.getID()`
`static DefaultListCellRenderer` `getCountryListRenderer(boolean showFullName, boolean showIcon)`
`static DefaultListCellRenderer` `getCountryListRenderer(boolean showFullName, boolean showIcon, Locale l)`
`static Country` `getDefaultCountry()`
`static Country[]` `getEU()`
`ImageIcon` `getIcon()`
`static ImageIcon` `getIcon(String countryCode)`
`Locale` `getLocale()` represents the 2-letter country code based on ISO 3166
`String` `getName()`
`String` `getName(Locale l)`
`static FormattedCellRenderer` `getRenderer(boolean showFullName, boolean showIcon, Locale l)`
`static DefaultTableCellRenderer` `getTableCellRenderer(boolean showFullName, boolean showIcon)`
`static DefaultTableCellRenderer` `getTableCellRenderer(boolean showFullName, boolean showIcon, Locale l)`
`boolean` `isEUCountry()`
`static DBClassStore<Country>` `makeStore(Database<?> db, boolean readOnly)` returns a collection store containing all countries that is yet to be put into the database
`void` `setLocale(Locale locale)`
`void` `setLocale(Locale locale, Object context)` sets the Locale for this object so that all subsequent return values of method calls to this instance can be localized accordingly until a different Locale is set.
`String` `toString()`

Methods inherited from class com.antelmann.db.AbstractDBEntry
`equals, getID, hashCode, hashEntry, sameEntry`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Country

    public Country(String countryCode)
            throws IllegalArgumentException

Throws:
  `IllegalArgumentException`

### Country

    public Country(String countryCode,
                   boolean showFullNameOnToString)
            throws IllegalArgumentException

Throws:
  `IllegalArgumentException`

Method Detail

### getLocale

    public Locale getLocale()

  represents the 2-letter country code based on ISO 3166

  Specified by:
    `getLocale` in interface `Localizable`
  Returns:
    the current Locale that this instance uses to determine return values for its methods; if null is returned, this instance is expected to use the default Locale of the system.
  See Also:
    `Localizable.setLocale(Locale, Object)`

### setLocale

    public void setLocale(Locale locale,
                          Object context)

  Description copied from interface: `Localizable`
  sets the Locale for this object so that all subsequent return values of method calls to this instance can be localized accordingly until a different Locale is set.

  Specified by:
    `setLocale` in interface `Localizable`
  Parameters:
    `locale` - the Locale that is to be used to determine return values for all methods of this instance; if set to null, the default locale is to be used.
    `context` - a context that may be required for this instance to load the resources for the given locale; this context may be null for objects that do not require an external context. Examples of a context may be a database, a resource file, some map or no context at all.
  See Also:
    `Localizable.getLocale()`

### setLocale

    public void setLocale(Locale locale)

### getCountryCode

    public String getCountryCode()

  returns `AbstractDBEntry.getID()`

### toString

    public String toString()

  Overrides:
    `toString` in class `AbstractDBEntry`

### compareTo

    public int compareTo(Country c)

  Specified by:
    `compareTo` in interface `Comparable<Country>`

### getName

    @Localized
    public String getName()

### getName

    public String getName(Locale l)

### isEUCountry

    public boolean isEUCountry()

  See Also:
    `I18n.getEUCountryCodes()`

### getAll

    public static Country[] getAll()

### getEU

    public static Country[] getEU()

### getCountries

    public static Country[] getCountries(Filter<Country> filter)

### getDefaultCountry

    public static Country getDefaultCountry()

### makeStore

    public static DBClassStore<Country> makeStore(Database<?> db,
                                                  boolean readOnly)

  returns a collection store containing all countries that is yet to be put into the database

### getIcon

    public ImageIcon getIcon()

### getIcon

    public static ImageIcon getIcon(String countryCode)

### getComboBox

    public static JComboBox getComboBox()

### getComboBox

    public static JComboBox getComboBox(Locale locale)

### getComboBox

    public static JComboBox getComboBox(boolean showFullName,
                                        boolean showIcon,
                                        Locale locale,
                                        Country... limitToTheseCountries)

  uses a `DefaultComboBoxModel` with Country instances

### getCountryListRenderer

    public static DefaultListCellRenderer getCountryListRenderer(boolean showFullName,
                                                                 boolean showIcon)

### getCountryListRenderer

    public static DefaultListCellRenderer getCountryListRenderer(boolean showFullName,
                                                                 boolean showIcon,
                                                                 Locale l)

### getRenderer

    public static FormattedCellRenderer getRenderer(boolean showFullName,
                                                    boolean showIcon,
                                                    Locale l)

### getTableCellRenderer

    public static DefaultTableCellRenderer getTableCellRenderer(boolean showFullName,
                                                                boolean showIcon)

### getTableCellRenderer

    public static DefaultTableCellRenderer getTableCellRenderer(boolean showFullName,
                                                                boolean showIcon,
                                                                Locale l)

### getCellEditor

    public static DefaultCellEditor getCellEditor(boolean showFullName,
                                                  boolean showIcon)

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads