org.opengts.war.tools
Class ComboMap

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by org.opengts.util.OrderedMap<java.lang.String,java.lang.String>
              extended by org.opengts.war.tools.ComboMap
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,java.lang.String>

public class ComboMap
extends OrderedMap<java.lang.String,java.lang.String>

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
ComboMap()
          Constructor
ComboMap(java.util.Collection<I18N.Text> list, java.util.Locale locale)
          Constructor
ComboMap(java.util.Collection<java.lang.String> list)
          Constructor
ComboMap(I18N.Text[] list, java.util.Locale locale)
          Constructor
ComboMap(java.util.Map<java.lang.String,java.lang.String> map)
          Constructor
ComboMap(java.lang.String key)
          Constructor
ComboMap(java.lang.String[] list)
          Constructor
ComboMap(java.lang.String key, java.lang.String desc)
          Constructor
 
Method Summary
 void add(ComboOption option)
          Adds the specified ComboOption to the end (last entry) of the map
 void add(java.lang.String key)
          Adds the specified key to the end (last entry) of the map
 void add(java.lang.String key, java.lang.String desc)
          Adds the specified key/description to the end (last entry) of the map
 boolean containsKey(java.lang.Object key)
          Returns true if this map contains the specified key
 boolean containsKeyIgnoreCase(java.lang.String key)
          Returns true if this map contains the specified case-insensitive key
static ComboOption getComboOption(ComboMap map, java.lang.String key)
          Returns a ComboOption for the specified key
 ComboOption getComboOption(java.lang.String key)
          Returns a ComboOption for the specified key
 ComboOption getDefaultSelection()
          Gets the default selected option
 ComboOption getFirstComboOption()
          Returns this first ComboOption in the list
static ComboMap getTrueFalseMap(java.util.Locale locale)
          Returns a ComboMap containing a mapping of "false"/"true" to the localized text
static ComboMap getYesNoMap(java.util.Locale locale)
          Returns a ComboMap containing a mapping of "no"/"yes" to the localized text
 void insert(ComboOption option)
          Inserts the specified ComboOption as the first entry in the map
 void insert(java.lang.String key)
          Inserts the specified key as the first entry in the map
 void insert(java.lang.String key, java.lang.String desc)
          Inserts the specified key/description as the first entry in the map
 void setDefaultSelection(ComboOption option)
          Sets the default selected option
 java.lang.String toString()
          Returns the String representation of this ComboMap
 
Methods inherited from class org.opengts.util.OrderedMap
clear, entrySet, get, getFirstKey, getFirstValue, getKey, getProperty, getProperty, getValue, indexOfKey, isIgnoreCase, keyArray, keyCaseFilter, keyIterator, keySet, orderedKeySet, put, put, putAll, remove, remove, setIgnoreCase, setProperty, sortKeys, valueArray, valueIterator, values, valueSet
 
Methods inherited from class java.util.HashMap
clone, containsValue, isEmpty, size
 
Methods inherited from class java.util.AbstractMap
equals, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
containsValue, equals, hashCode, isEmpty, size
 

Constructor Detail

ComboMap

public ComboMap()
Constructor


ComboMap

public ComboMap(java.util.Map<java.lang.String,java.lang.String> map)
Constructor

Parameters:
map - The map copied to this ComboMap

ComboMap

public ComboMap(java.util.Collection<java.lang.String> list)
Constructor

Parameters:
list - The list copied to this ComboMap (descriptions will be the same as the corresponding key)

ComboMap

public ComboMap(java.util.Collection<I18N.Text> list,
                java.util.Locale locale)
Constructor

Parameters:
list - The list copied to this ComboMap (descriptions will be the same as the corresponding key)
locale - The locale used to Localize the strings in the list.

ComboMap

public ComboMap(java.lang.String[] list)
Constructor

Parameters:
list - The list copied to this ComboMap (descriptions will be the same as the corresponding key)

ComboMap

public ComboMap(I18N.Text[] list,
                java.util.Locale locale)
Constructor

Parameters:
list - The list copied to this ComboMap (descriptions will be the same as the corresponding key)
locale - The locale used to Localize the strings in the list.

ComboMap

public ComboMap(java.lang.String key)
Constructor

Parameters:
key - A single key copied to this ComboMap (the description will be the same as the key)

ComboMap

public ComboMap(java.lang.String key,
                java.lang.String desc)
Constructor

Parameters:
key - A single key copied to this ComboMap
desc - The description associated with the key
Method Detail

getYesNoMap

public static ComboMap getYesNoMap(java.util.Locale locale)
Returns a ComboMap containing a mapping of "no"/"yes" to the localized text

Parameters:
locale - The Locale
Returns:
The ComboMap

getTrueFalseMap

public static ComboMap getTrueFalseMap(java.util.Locale locale)
Returns a ComboMap containing a mapping of "false"/"true" to the localized text

Parameters:
locale - The Locale
Returns:
The ComboMap

setDefaultSelection

public void setDefaultSelection(ComboOption option)
Sets the default selected option

Parameters:
option - The default selected option

getDefaultSelection

public ComboOption getDefaultSelection()
Gets the default selected option

Returns:
The default selected option (may be null)

insert

public void insert(java.lang.String key,
                   java.lang.String desc)
Inserts the specified key/description as the first entry in the map

Parameters:
key - The key
desc - The description

insert

public void insert(java.lang.String key)
Inserts the specified key as the first entry in the map

Parameters:
key - The key (the description will be the same as the key)

insert

public void insert(ComboOption option)
Inserts the specified ComboOption as the first entry in the map

Parameters:
option - The ComboOption

add

public void add(java.lang.String key,
                java.lang.String desc)
Adds the specified key/description to the end (last entry) of the map

Parameters:
key - The key
desc - The description

add

public void add(java.lang.String key)
Adds the specified key to the end (last entry) of the map

Parameters:
key - The key (the description will be the same as the key)

add

public void add(ComboOption option)
Adds the specified ComboOption to the end (last entry) of the map

Parameters:
option - The ComboOption

containsKeyIgnoreCase

public boolean containsKeyIgnoreCase(java.lang.String key)
Returns true if this map contains the specified case-insensitive key

Overrides:
containsKeyIgnoreCase in class OrderedMap<java.lang.String,java.lang.String>
Parameters:
key - The key
Returns:
True if this map contains the specified case-insensitive key

containsKey

public boolean containsKey(java.lang.Object key)
Returns true if this map contains the specified key

Specified by:
containsKey in interface java.util.Map<java.lang.String,java.lang.String>
Overrides:
containsKey in class OrderedMap<java.lang.String,java.lang.String>
Parameters:
key - The key
Returns:
True if this map contains the specified key

getFirstComboOption

public ComboOption getFirstComboOption()
Returns this first ComboOption in the list

Returns:
The first ComboOption

getComboOption

public ComboOption getComboOption(java.lang.String key)
Returns a ComboOption for the specified key

Parameters:
key - The key
Returns:
A ComboOption

getComboOption

public static ComboOption getComboOption(ComboMap map,
                                         java.lang.String key)
Returns a ComboOption for the specified key

Parameters:
key - The key
Returns:
A ComboOption

toString

public java.lang.String toString()
Returns the String representation of this ComboMap

Overrides:
toString in class java.util.AbstractMap<java.lang.String,java.lang.String>
Returns:
The String representation of this ComboMap