public class DefaultComboBoxConfigurableLookUpModel extends javax.swing.AbstractListModel implements javax.swing.ComboBoxModel, javax.swing.MutableComboBoxModel, java.io.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:
DefaultComboBoxModel
,
JComboBoxConfigurableLookUp
,
Serialized FormModifier 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 java.lang.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 |
Constructor and Description |
---|
DefaultComboBoxConfigurableLookUpModel() |
DefaultComboBoxConfigurableLookUpModel(java.lang.Object[] items) |
DefaultComboBoxConfigurableLookUpModel(java.util.Vector<java.lang.Object> vector) |
Modifier and Type | Method and Description |
---|---|
void |
addElement(java.lang.Object object) |
java.util.Vector<java.lang.Object> |
getData()
Returns all elements stored in this model, according the order they were added.
|
java.util.Vector<java.lang.Object> |
getDataAccordingItemsOrder()
Gets the data stored in this model according the criterion of the itemsOrder parameter.
|
java.lang.Object |
getElementAt(int index) |
boolean |
getEventNotificationEnabled()
Gets if the notification of events in this model is enabled.
|
int |
getIndexOf(java.lang.Object object) |
int |
getItemsOrder()
Returns the 'itemsOrder' configuration value of this component.
|
java.lang.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.
|
java.lang.Object |
getSelectedItem() |
int |
getSize() |
protected void |
initialize()
Initializes some attributes.
|
void |
insertElementAt(java.lang.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 java.util.List<java.lang.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(java.lang.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(java.lang.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(java.lang.Object anObject) |
void |
setShowAllItemsInListBox(boolean itemsShownInListBox)
Sets the 'showAllItemsInListBox' configuration value for this component.
|
void |
setTextWritten(java.lang.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, removeListDataListener
public 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 java.lang.String DEFAULT_LANGUAGE_RULES_CONFIGURATION
public static final boolean DEFAULT_CASE_SENSITIVE_CONFIGURATION
public DefaultComboBoxConfigurableLookUpModel()
DefaultComboBoxModel.DefaultComboBoxModel()
public DefaultComboBoxConfigurableLookUpModel(java.lang.Object[] items)
DefaultComboBoxModel.DefaultComboBoxModel(java.lang.Object[])
public DefaultComboBoxConfigurableLookUpModel(java.util.Vector<java.lang.Object> vector)
DefaultComboBoxModel.DefaultComboBoxModel(java.util.Vector)
public void addElement(java.lang.Object object)
addElement
in interface javax.swing.MutableComboBoxModel
DefaultComboBoxModel.addElement(java.lang.Object)
public void removeElementAt(int index)
removeElementAt
in interface javax.swing.MutableComboBoxModel
DefaultComboBoxModel.removeElementAt(int)
public void insertElementAt(java.lang.Object object, int index)
insertElementAt
in interface javax.swing.MutableComboBoxModel
DefaultComboBoxModel.insertElementAt(java.lang.Object, int)
public void removeElement(java.lang.Object object)
removeElement
in interface javax.swing.MutableComboBoxModel
DefaultComboBoxModel.removeElement(java.lang.Object)
public void removeAllElements()
DefaultComboBoxModel.removeAllElements()
public int getSize()
getSize
in interface javax.swing.ListModel
DefaultComboBoxModel.getSize()
public void setSelectedItem(java.lang.Object anObject)
setSelectedItem
in interface javax.swing.ComboBoxModel
DefaultComboBoxModel.setSelectedItem(java.lang.Object)
public java.lang.Object getSelectedItem()
getSelectedItem
in interface javax.swing.ComboBoxModel
DefaultComboBoxModel.getSelectedItem()
public java.lang.Object getElementAt(int index)
getElementAt
in interface javax.swing.ListModel
DefaultComboBoxModel.getElementAt(int)
public int getIndexOf(java.lang.Object object)
DefaultComboBoxModel.getIndexOf(java.lang.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 java.lang.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(java.lang.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 java.util.Vector<java.lang.Object> getData()
Returns all elements stored in this model, according the order they were added.
public java.util.Vector<java.lang.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 java.util.List<java.lang.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(java.lang.String text)
IComboBoxLookUp
Sets the text for search items.
setTextWritten
in interface IComboBoxLookUp