Package docking.widgets
Class DefaultDropDownSelectionDataModel<T>
- java.lang.Object
-
- docking.widgets.DefaultDropDownSelectionDataModel<T>
-
- All Implemented Interfaces:
DropDownTextFieldDataModel<T>
public class DefaultDropDownSelectionDataModel<T> extends java.lang.Object implements DropDownTextFieldDataModel<T>
-
-
Constructor Summary
Constructors Constructor Description DefaultDropDownSelectionDataModel(java.util.List<T> data, DataToStringConverter<T> searchConverter)DefaultDropDownSelectionDataModel(java.util.List<T> data, DataToStringConverter<T> searchConverter, DataToStringConverter<T> descriptionConverter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDescription(T value)Returns a description for this item that gives that will be displayed along side of theDropDownSelectionTextField's matching window.java.lang.StringgetDisplayText(T value)Returns the text for the given item that will be entered into theDropDownSelectionTextFieldwhen the user makes a selection.intgetIndexOfFirstMatchingEntry(java.util.List<T> list, java.lang.String text)Returns the index in the given list of the first item that matches the given text.javax.swing.ListCellRenderer<T>getListRenderer()Returns the renderer to be used to paint the contents of the list returned byDropDownTextFieldDataModel.getMatchingData(String).java.util.List<T>getMatchingData(java.lang.String searchText)Returns a list of data that matches the givensearchText.static DefaultDropDownSelectionDataModel<java.lang.String>getStringModel(java.util.List<java.lang.String> strings)
-
-
-
Field Detail
-
data
protected java.util.List<T> data
-
-
Constructor Detail
-
DefaultDropDownSelectionDataModel
public DefaultDropDownSelectionDataModel(java.util.List<T> data, DataToStringConverter<T> searchConverter)
-
DefaultDropDownSelectionDataModel
public DefaultDropDownSelectionDataModel(java.util.List<T> data, DataToStringConverter<T> searchConverter, DataToStringConverter<T> descriptionConverter)
-
-
Method Detail
-
getStringModel
public static DefaultDropDownSelectionDataModel<java.lang.String> getStringModel(java.util.List<java.lang.String> strings)
-
getMatchingData
public java.util.List<T> getMatchingData(java.lang.String searchText)
Description copied from interface:DropDownTextFieldDataModelReturns a list of data that matches the givensearchText. A match typically means a "startsWith" match. A list is returned to allow for multiple matches.- Specified by:
getMatchingDatain interfaceDropDownTextFieldDataModel<T>- Parameters:
searchText- The text used to find matches.- Returns:
- a list of items matching the given text.
-
getIndexOfFirstMatchingEntry
public int getIndexOfFirstMatchingEntry(java.util.List<T> list, java.lang.String text)
Description copied from interface:DropDownTextFieldDataModelReturns the index in the given list of the first item that matches the given text. For data sets that do not allow duplicates, this is simply the index of the item that matches the text in the list. For items that allow duplicates, the is the index of the first match.- Specified by:
getIndexOfFirstMatchingEntryin interfaceDropDownTextFieldDataModel<T>- Parameters:
list- the list to searchtext- the text to match against the items in the list- Returns:
- the index in the given list of the first item that matches the given text.
-
getListRenderer
public javax.swing.ListCellRenderer<T> getListRenderer()
Description copied from interface:DropDownTextFieldDataModelReturns the renderer to be used to paint the contents of the list returned byDropDownTextFieldDataModel.getMatchingData(String).- Specified by:
getListRendererin interfaceDropDownTextFieldDataModel<T>
-
getDescription
public java.lang.String getDescription(T value)
Description copied from interface:DropDownTextFieldDataModelReturns a description for this item that gives that will be displayed along side of theDropDownSelectionTextField's matching window.- Specified by:
getDescriptionin interfaceDropDownTextFieldDataModel<T>
-
getDisplayText
public java.lang.String getDisplayText(T value)
Description copied from interface:DropDownTextFieldDataModelReturns the text for the given item that will be entered into theDropDownSelectionTextFieldwhen the user makes a selection.- Specified by:
getDisplayTextin interfaceDropDownTextFieldDataModel<T>
-
-