HiRISE

HiRISE.HiPlan.HiWeb
Class MapComboBoxModel

java.lang.Object
  extended by javax.swing.AbstractListModel
      extended by HiRISE.HiPlan.HiWeb.MapComboBoxModel
All Implemented Interfaces:
Serializable, Cloneable, ComboBoxModel, ListModel

public class MapComboBoxModel
extends AbstractListModel
implements Cloneable, ComboBoxModel

Version:
1.8
Author:
Guy McArthur - UA/PIRL
See Also:
Serialized Form

Field Summary
static String ID
          Class identification name with source code version and date.
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
MapComboBoxModel()
          Creates a new empty map ComboBox model.
MapComboBoxModel(Map items)
          Create a new Map ComboBox model with a map of key value pairs.
MapComboBoxModel(Map items, Comparator comparator)
           
 
Method Summary
 void addItem(Object key, Object val)
          Adds a key-value item pair.
 Object clone()
          Returns a clone of this model.
 Object getElementAt(int index)
           
 Object getSelectedItem()
          Get the currently selected item.
 int getSize()
          Gets the size of the model.
 Object getValue()
           
 Object getValue(int index)
           
 Object getValue(Object key)
           
 void setItems(Map items)
          Initializes the model with a map of items.
 void setItems(Map items, Comparator comparator)
          Initializes the model with a map of items.
 void setSelectedItem(Object item)
          Sets the currently selected item.
 void setSelectedValue(Object key)
          Sets the currently selected value.
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.ListModel
addListDataListener, removeListDataListener
 

Field Detail

ID

public static final String ID
Class identification name with source code version and date.

See Also:
Constant Field Values
Constructor Detail

MapComboBoxModel

public MapComboBoxModel()
Creates a new empty map ComboBox model.


MapComboBoxModel

public MapComboBoxModel(Map items)
Create a new Map ComboBox model with a map of key value pairs. The items in the model will be the keys in the map, stored in ascending key order.

Parameters:
items - Key value pairs

MapComboBoxModel

public MapComboBoxModel(Map items,
                        Comparator comparator)
Method Detail

setItems

public void setItems(Map items)
Initializes the model with a map of items. The first item in the map will be selected.

Parameters:
items - Key value pairs.
See Also:
setItems(Map,Comparator)

setItems

public void setItems(Map items,
                     Comparator comparator)
Initializes the model with a map of items. The first item in the map will be selected.

Parameters:
items - Key value pairs.
comparator - a comparator for the keys.

getSelectedItem

public Object getSelectedItem()
Get the currently selected item.

Specified by:
getSelectedItem in interface ComboBoxModel
Returns:
selected

setSelectedItem

public void setSelectedItem(Object item)
Sets the currently selected item.

Specified by:
setSelectedItem in interface ComboBoxModel
Parameters:
item - The item to select.

setSelectedValue

public void setSelectedValue(Object key)
Sets the currently selected value.

Parameters:
key - Key of item to select.

getSize

public int getSize()
Gets the size of the model.

Specified by:
getSize in interface ListModel
Returns:
number of elements

getElementAt

public Object getElementAt(int index)
Specified by:
getElementAt in interface ListModel

getValue

public Object getValue()

getValue

public Object getValue(int index)

getValue

public Object getValue(Object key)

addItem

public void addItem(Object key,
                    Object val)
Adds a key-value item pair.

Parameters:
key - The key.
val - The value.

clone

public Object clone()
Returns a clone of this model.

Overrides:
clone in class Object
Returns:
a clone of this model.

HiRISE

Copyright (C) Arizona Board of Regents on behalf of the Planetary Image Research Laboratory, Lunar and Planetary Laboratory at the University of Arizona