public class DefaultComboBoxConfigurableLookUpModel extends AbstractListModel implements ComboBoxModel, MutableComboBoxModel, Serializable, IComboBoxLookUp
Re-implementation of DefaultComboBoxModel adapted for the behavior needed to look up items.
This model has configurable behaviour using flags.
DefaultComboBoxConfigurableLookUpModel represents the model used by a JComboBoxLookUpConfigurable,
according the MVC (Model-View-Controller) pattern.
Flags:
ILookUp agent.ILookUp agent.
ILookUp agent.Default flag values are:
| Modifier and Type | Class and Description |
|---|---|
class |
DefaultComboBoxConfigurableLookUpModel.VectorUtilities
New functionality to work with vectors (of elements).
|
| Modifier and Type | Field and Description |
|---|---|
static int |
ALPHABETICAL_ORDERED |
static boolean |
CASE_INSENSITIVE |
static boolean |
CASE_SENSITIVE |
static boolean |
DEFAULT_CASE_SENSITIVE_CONFIGURATION |
static int |
DEFAULT_ITEMS_ORDER_CONFIGURATION |
static String |
DEFAULT_LANGUAGE_RULES_CONFIGURATION |
static boolean |
DEFAULT_SHOW_ALL_ITEMS_IN_LIST_BOX_CONFIGURATION |
static int |
MAINTAIN_AGENT_POSITIONS |
static int |
MAINTAIN_POSITION |
static boolean |
SHOW_ALL_ITEMS |
static boolean |
SHOW_ONLY_MATCHES |
listenerList| Constructor and Description |
|---|
DefaultComboBoxConfigurableLookUpModel() |
DefaultComboBoxConfigurableLookUpModel(Object[] items) |
DefaultComboBoxConfigurableLookUpModel(Vector<Object> vector) |
| Modifier and Type | Method and Description |
|---|---|
void |
addElement(Object object) |
Vector<Object> |
getData()
Returns all elements stored in this model, according the order they were added.
|
Vector<Object> |
getDataAccordingItemsOrder()
Gets the data stored in this model according the criterion of the itemsOrder parameter.
|
Object |
getElementAt(int index) |
boolean |
getEventNotificationEnabled()
Gets if the notification of events in this model is enabled.
|
int |
getIndexOf(Object object) |
int |
getItemsOrder()
Returns the 'itemsOrder' configuration value of this component.
|
String |
getLocaleRules()
Returns the 'localeRules' configuration value of this component.
|
ILookUp |
getLookUpAgent()
Gets the agent used with the logic for looking up the items of this model, considering
the text written.
|
Object |
getSelectedItem() |
int |
getSize() |
protected void |
initialize()
Initializes some attributes.
|
void |
insertElementAt(Object object,
int index) |
boolean |
isCaseSensitive()
Returns the 'caseSensitive' configuration value of this component.
|
boolean |
isShowAllItemsInListBox()
Returns the 'showAllItemsInListBox' configuration value of this component.
|
protected List<Object> |
lookUp()
Invokes the agent to execute its search on all items alphabetically sort ordered,
considering the text written and the case sensitive configuration.
|
void |
removeAllElements() |
void |
removeElement(Object object) |
void |
removeElementAt(int index) |
void |
setCaseSensitive(boolean caseSensitive)
Sets the 'caseSensitive' configuration value for this component.
|
protected void |
setDefaultBehaviorFlagsConfiguration()
Sets the default values of the flags.
|
void |
setEventNotificationEnabled(boolean b)
Sets enabled or disabled the notification of events in this model.
|
void |
setItemsOrder(int itemsOrder)
Sets the 'itemsOrder' configuration value for this component.
|
void |
setLocaleRules(String localeRules)
Sets the 'localeRules' configuration value for this component.
|
void |
setLookUpAgent(ILookUp agent)
Sets the agent with the logic for looking up the items of this model, considering
the text written.
|
void |
setSelectedItem(Object anObject) |
void |
setShowAllItemsInListBox(boolean itemsShownInListBox)
Sets the 'showAllItemsInListBox' configuration value for this component.
|
void |
setTextWritten(String text)
Sets the text for search items.
|
protected void |
updateVisibleList()
Updates the list with the results of the look up by the agent, and its configuration.
|
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddListDataListener, removeListDataListenerpublic static final int MAINTAIN_POSITION
public static final int ALPHABETICAL_ORDERED
public static final int MAINTAIN_AGENT_POSITIONS
public static final boolean SHOW_ALL_ITEMS
public static final boolean SHOW_ONLY_MATCHES
public static final boolean CASE_SENSITIVE
public static final boolean CASE_INSENSITIVE
public static final int DEFAULT_ITEMS_ORDER_CONFIGURATION
public static final boolean DEFAULT_SHOW_ALL_ITEMS_IN_LIST_BOX_CONFIGURATION
public static final String DEFAULT_LANGUAGE_RULES_CONFIGURATION
public static final boolean DEFAULT_CASE_SENSITIVE_CONFIGURATION
public DefaultComboBoxConfigurableLookUpModel()
public DefaultComboBoxConfigurableLookUpModel(Object[] items)
public void addElement(Object object)
addElement in interface MutableComboBoxModelDefaultComboBoxModel.addElement(java.lang.Object)public void removeElementAt(int index)
removeElementAt in interface MutableComboBoxModelDefaultComboBoxModel.removeElementAt(int)public void insertElementAt(Object object, int index)
insertElementAt in interface MutableComboBoxModelDefaultComboBoxModel.insertElementAt(java.lang.Object, int)public void removeElement(Object object)
removeElement in interface MutableComboBoxModelDefaultComboBoxModel.removeElement(java.lang.Object)public void removeAllElements()
DefaultComboBoxModel.removeAllElements()public int getSize()
getSize in interface ListModelDefaultComboBoxModel.getSize()public void setSelectedItem(Object anObject)
setSelectedItem in interface ComboBoxModelDefaultComboBoxModel.setSelectedItem(java.lang.Object)public Object getSelectedItem()
getSelectedItem in interface ComboBoxModelDefaultComboBoxModel.getSelectedItem()public Object getElementAt(int index)
getElementAt in interface ListModelDefaultComboBoxModel.getElementAt(int)public int getIndexOf(Object object)
public int getItemsOrder()
Returns the 'itemsOrder' configuration value of this component. Configuration values are:
public void setItemsOrder(int itemsOrder)
Sets the 'itemsOrder' configuration value for this component. Configuration values are:
An - integer value for 'itemsOrder' configuration flagpublic boolean isShowAllItemsInListBox()
Returns the 'showAllItemsInListBox' configuration value of this component. Configuration values are:
ILookUp agent.public void setShowAllItemsInListBox(boolean itemsShownInListBox)
Sets the 'showAllItemsInListBox' configuration value for this component. Configuration values are:
ILookUp agent.A - boolean value for 'showAllItemsInListBox' configuration flagpublic String getLocaleRules()
Returns the 'localeRules' configuration value of this component. The language code values could be consulted at:
http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt
http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
{@Locale}public void setLocaleRules(String localeRules)
Sets the 'localeRules' configuration value for this component. Configuration values are:
http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt
http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
An - String value for 'localeRules' configuration flag{@Locale}public boolean isCaseSensitive()
Returns the 'caseSensitive' configuration value of this component. Configuration values are:
public void setCaseSensitive(boolean caseSensitive)
Sets the 'caseSensitive' configuration value for this component. Configuration values are:
A - boolean value for 'caseSensitive' configuration flagprotected void initialize()
Initializes some attributes.
protected void setDefaultBehaviorFlagsConfiguration()
Sets the default values of the flags.
public Vector<Object> getData()
Returns all elements stored in this model, according the order they were added.
public Vector<Object> getDataAccordingItemsOrder()
Gets the data stored in this model according the criterion of the itemsOrder parameter.
Always returns all items stored.
protected void updateVisibleList()
Updates the list with the results of the look up by the agent, and its configuration.
protected List<Object> lookUp()
Invokes the agent to execute its search on all items alphabetically sort ordered, considering the text written and the case sensitive configuration. The agent will use a
Comparator
that includes the locale language rules and the case sensitive in the rule that uses to compare..public ILookUp getLookUpAgent()
Gets the agent used with the logic for looking up the items of this model, considering the text written.
public void setLookUpAgent(ILookUp agent)
Sets the agent with the logic for looking up the items of this model, considering the text written.
agent - the agent used with the logic for looking up the items of this modelpublic void setEventNotificationEnabled(boolean b)
Sets enabled or disabled the notification of events in this model.
b - true to enable, false to disablepublic boolean getEventNotificationEnabled()
Gets if the notification of events in this model is enabled.
true is its enabled; false otherwisepublic void setTextWritten(String text)
IComboBoxLookUpSets the text for search items.
setTextWritten in interface IComboBoxLookUp