Package docking.widgets
Class DefaultDropDownSelectionDataModel<T>
java.lang.Object
docking.widgets.DefaultDropDownSelectionDataModel<T>
- All Implemented Interfaces:
DropDownTextFieldDataModel<T>
public class DefaultDropDownSelectionDataModel<T>
extends Object
implements DropDownTextFieldDataModel<T>
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefaultDropDownSelectionDataModel
(List<T> data, DataToStringConverter<T> searchConverter) DefaultDropDownSelectionDataModel
(List<T> data, DataToStringConverter<T> searchConverter, DataToStringConverter<T> descriptionConverter) -
Method Summary
Modifier and TypeMethodDescriptiongetDescription
(T value) Returns a description for this item that gives that will be displayed along side of theDropDownSelectionTextField
's matching window.getDisplayText
(T value) Returns the text for the given item that will be entered into theDropDownSelectionTextField
when the user makes a selection.int
getIndexOfFirstMatchingEntry
(List<T> list, String text) Returns the index in the given list of the first item that matches the given text.Returns the renderer to be used to paint the contents of the list returned byDropDownTextFieldDataModel.getMatchingData(String)
.getMatchingData
(String searchText) Returns a list of data that matches the givensearchText
.getStringModel
(List<String> strings)
-
Field Details
-
data
-
comparator
-
-
Constructor Details
-
DefaultDropDownSelectionDataModel
-
DefaultDropDownSelectionDataModel
public DefaultDropDownSelectionDataModel(List<T> data, DataToStringConverter<T> searchConverter, DataToStringConverter<T> descriptionConverter)
-
-
Method Details
-
getStringModel
-
getMatchingData
Description copied from interface:DropDownTextFieldDataModel
Returns 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:
getMatchingData
in interfaceDropDownTextFieldDataModel<T>
- Parameters:
searchText
- The text used to find matches.- Returns:
- a list of items matching the given text.
-
getIndexOfFirstMatchingEntry
Description copied from interface:DropDownTextFieldDataModel
Returns 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:
getIndexOfFirstMatchingEntry
in interfaceDropDownTextFieldDataModel<T>
- Parameters:
list
- the list to search.text
- 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
Description copied from interface:DropDownTextFieldDataModel
Returns the renderer to be used to paint the contents of the list returned byDropDownTextFieldDataModel.getMatchingData(String)
.- Specified by:
getListRenderer
in interfaceDropDownTextFieldDataModel<T>
- Returns:
- the renderer.
-
getDescription
Description copied from interface:DropDownTextFieldDataModel
Returns a description for this item that gives that will be displayed along side of theDropDownSelectionTextField
's matching window.- Specified by:
getDescription
in interfaceDropDownTextFieldDataModel<T>
- Parameters:
value
- the value.- Returns:
- the description.
-
getDisplayText
Description copied from interface:DropDownTextFieldDataModel
Returns the text for the given item that will be entered into theDropDownSelectionTextField
when the user makes a selection.- Specified by:
getDisplayText
in interfaceDropDownTextFieldDataModel<T>
- Parameters:
value
- the value.- Returns:
- the description.
-