JIDE 3.5.15

com.jidesoft.combobox
Class ListExComboBoxSearchable

java.lang.Object
  extended by com.jidesoft.swing.Searchable
      extended by com.jidesoft.swing.ComboBoxSearchable
          extended by com.jidesoft.combobox.ExComboBoxSearchable
              extended by com.jidesoft.combobox.ListExComboBoxSearchable
All Implemented Interfaces:
PropertyChangeListener, EventListener, ListDataListener, PopupMenuListener

public class ListExComboBoxSearchable
extends ExComboBoxSearchable

ListSearchable is an concrete implementation of Searchable that enables the search function in ListExComboBox.

It's very simple to use it. Assuming you have a JList, all you need to do is to call

 ListExComboBox ListExComboBox = ....;
 ListExComboBoxSearchable searchable = new ListExComboBoxSearchable(ListExComboBox);
 
Now the ListExComboBox will have the search function.

There is very little customization you need to do to ListExComboBoxSearchable. The only thing you might need is when the element in the ListExComboBox needs a special conversion to convert to string. If so, you can override convertElementToString() to provide you own algorithm to do the conversion.

 ListExComboBox ListExComboBox = ....;
 ListExComboBoxSearchable searchable = new ListExComboBoxSearchable(ListExComboBox) {
      protected String convertElementToString(Object object) {
          ...
      }
 };
 

Additional customization can be done on the base Searchable class such as background and foreground color, keystrokes, case sensitivity.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.jidesoft.swing.Searchable
Searchable.SearchField, Searchable.SearchPopup
 
Field Summary
 
Fields inherited from class com.jidesoft.swing.Searchable
_component, _componentListener, _focusListener, _keyListener, _matchCount, CLIENT_PROPERTY_SEARCHABLE, listenerList, PROPERTY_SEARCH_TEXT
 
Constructor Summary
ListExComboBoxSearchable(ListExComboBox ListExComboBox)
           
ListExComboBoxSearchable(MultiSelectListExComboBox ListExComboBox)
           
 
Method Summary
protected  FocusListener createFocusListener()
          Creates a FocusListener.
protected  void setSelectedIndex(int index, boolean incremental)
          Sets the selected index.
 void showPopup(String searchingText)
          Shows the search popup.
 
Methods inherited from class com.jidesoft.combobox.ExComboBoxSearchable
convertElementToString, getComboBox, popupMenuWillBecomeInvisible
 
Methods inherited from class com.jidesoft.swing.ComboBoxSearchable
contentsChanged, getElementAt, getElementCount, getSelectedIndex, intervalAdded, intervalRemoved, isRefreshPopupDuringSearching, isShowPopupDuringSearching, popupMenuCanceled, popupMenuWillBecomeVisible, propertyChange, setRefreshPopupDuringSearching, setShowPopupDuringSearching, uninstallListeners
 
Methods inherited from class com.jidesoft.swing.Searchable
addPropertyChangeListener, addSearchableListener, adjustSelectedIndex, cancelHighlightAll, compare, compare, convertToString, createComponentListener, createKeyListener, createSearchPopup, findAll, findFirst, findFromCursor, findLast, findNext, findPrevious, firePropertyChangeEvent, fireSearchableEvent, getBackground, getComponent, getCurrentIndex, getCursor, getElementAtAsString, getForeground, getMismatchForeground, getPopupLocation, getPopupLocationRelativeTo, getPopupTimeout, getResourceString, getSearchable, getSearchableListeners, getSearchableProvider, getSearchingDelay, getSearchingText, getSearchLabel, getWildcardSupport, hidePopup, highlightAll, installListeners, isActivateKey, isCaseSensitive, isCountMatch, isDeactivateKey, isFindFirstKey, isFindLastKey, isFindNextKey, isFindPreviousKey, isFromStart, isHeavyweightComponentEnabled, isHideSearchPopupOnEvent, isIncrementalSelectKey, isNavigationKey, isPopupVisible, isProcessModelChangeEvent, isRepeats, isReverseOrder, isSearchableListenerInstalled, isSelectAllKey, isWildcardEnabled, keyTypedOrPressed, removePropertyChangeListener, removeSearchableListener, reverseFindFromCursor, searchingTextEmpty, select, setBackground, setCaseSensitive, setCountMatch, setCursor, setCursor, setForeground, setFromStart, setHeavyweightComponentEnabled, setHideSearchPopupOnEvent, setMismatchForeground, setPopupLocation, setPopupLocationRelativeTo, setPopupTimeout, setProcessModelChangeEvent, setRepeats, setReverseOrder, setSearchableProvider, setSearchingDelay, setSearchLabel, setWildcardEnabled, setWildcardSupport, textChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListExComboBoxSearchable

public ListExComboBoxSearchable(ListExComboBox ListExComboBox)

ListExComboBoxSearchable

public ListExComboBoxSearchable(MultiSelectListExComboBox ListExComboBox)
Method Detail

createFocusListener

protected FocusListener createFocusListener()
Description copied from class: Searchable
Creates a FocusListener. We use it to hide the popup when the component loses focus.

Overrides:
createFocusListener in class Searchable
Returns:
a FocusListener.

showPopup

public void showPopup(String searchingText)
Description copied from class: Searchable
Shows the search popup. By default, the search popup will be visible automatically when user types in the first key (in the case of JList, JTree, JTable) or types in designated keystroke (in the case of JTextComponent). So this method is only used when you want to show the popup manually.

Overrides:
showPopup in class Searchable
Parameters:
searchingText - the searching text

setSelectedIndex

protected void setSelectedIndex(int index,
                                boolean incremental)
Description copied from class: Searchable
Sets the selected index. The concrete implementation should call methods on the component to select the element at the specified index. The incremental flag is used to do multiple select. If the flag is true, the element at the index should be added to current selection. If false, you should clear previous selection and then select the element.

Overrides:
setSelectedIndex in class ComboBoxSearchable
Parameters:
index - the index to be selected
incremental - a flag to enable multiple selection. If the flag is true, the element at the index should be added to current selection. If false, you should clear previous selection and then select the element.

JIDE 3.5.15