Package docking.widgets
Interface DropDownTextFieldDataModel<T>
- Type Parameters:
T- The type of object that this model manipulates
- All Known Implementing Classes:
DataTypeDropDownSelectionDataModel,DefaultDropDownSelectionDataModel,FileDropDownSelectionDataModel
public interface DropDownTextFieldDataModel<T>
This interface represents all methods needed by the
DropDownSelectionTextField in order
to search, show, manipulate and select objects.-
Nested Class Summary
Nested Classes -
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 theDropDownSelectionTextFieldwhen the user makes a selection.intgetIndexOfFirstMatchingEntry(List<T> data, 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 bygetMatchingData(String).getMatchingData(String searchText) Returns a list of data that matches the givensearchText.getMatchingData(String searchText, DropDownTextFieldDataModel.SearchMode searchMode) Returns a list of data that matches the givensearchText.Subclasses can override this to return all supported search modes.
-
Method Details
-
getMatchingData
Returns a list of data that matches the givensearchText. A list is returned to allow for multiple matches. The type of matching performed is determined by the currentsearch mode. If the implementation of this model does not support search modes, then it is up the the implementor to determine how matches are found.Implementation Note: a client request for all data will happen using the empty string. If your data model is sufficiently large, then you may choose to not return any data in this case. Smaller data sets should return all data when given the empty string
- Parameters:
searchText- The text used to find matches.- Returns:
- a list of items matching the given text.
- See Also:
-
getMatchingData
default List<T> getMatchingData(String searchText, DropDownTextFieldDataModel.SearchMode searchMode) Returns a list of data that matches the givensearchText. A list is returned to allow for multiple matches. The type of matching performed is determined by the currentsearch mode. If the implementation of this model does not support search modes, then it is up the the implementor to determine how matches are found.Implementation Note: a client request for all data will happen using the empty string. If your data model is sufficiently large, then you may choose to not return any data in this case. Smaller data sets should return all data when given the empty string
- Parameters:
searchText- the text used to find matches.searchMode- the search mode to use- Returns:
- a list of items matching the given text.
- Throws:
IllegalArgumentException- if the given search mode is not supported- See Also:
-
getSupportedSearchModes
Subclasses can override this to return all supported search modes. The order of the modes is the order which they will cycle when requested by the user. The first mode is the default search mode.- Returns:
- the supported search modes
-
getIndexOfFirstMatchingEntry
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.- Parameters:
data- 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
ListCellRenderer<T> getListRenderer()Returns the renderer to be used to paint the contents of the list returned bygetMatchingData(String).- Returns:
- the renderer.
-
getDescription
Returns a description for this item that gives that will be displayed along side of theDropDownSelectionTextField's matching window.- Parameters:
value- the value.- Returns:
- the description.
-
getDisplayText
Returns the text for the given item that will be entered into theDropDownSelectionTextFieldwhen the user makes a selection.- Parameters:
value- the value.- Returns:
- the description.
-