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>

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface docking.widgets.DropDownTextFieldDataModel

  `DropDownTextFieldDataModel.SearchMode`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Comparator<Object>`
  `comparator`
  `protected List<T>`
  `data`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultDropDownSelectionDataModel(List<T> data, DataToStringConverter<T> searchConverter)`
  `DefaultDropDownSelectionDataModel(List<T> data, DataToStringConverter<T> searchConverter, DataToStringConverter<T> descriptionConverter)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getDescription(T value)`
  Returns a description for this item that gives that will be displayed along side of the `DropDownSelectionTextField`'s matching window.
  `String`
  `getDisplayText(T value)`
  Returns the text for the given item that will be entered into the `DropDownSelectionTextField` 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.
  `ListCellRenderer<T>`
  `getListRenderer()`
  Returns the renderer to be used to paint the contents of the list returned by `DropDownTextFieldDataModel.getMatchingData(String)`.
  `List<T>`
  `getMatchingData(String searchText)`
  Returns a list of data that matches the given `searchText`.
  `List<T>`
  `getMatchingData(String searchText, DropDownTextFieldDataModel.SearchMode mode)`
  Returns a list of data that matches the given `searchText`.
  `static DefaultDropDownSelectionDataModel<String>`
  `getStringModel(List<String> strings)`
  `List<DropDownTextFieldDataModel.SearchMode>`
  `getSupportedSearchModes()`
  Subclasses can override this to return all supported search modes.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### data

    protected List<T> data

  - ### comparator

    protected Comparator<Object> comparator

- ## Constructor Details

  - ### DefaultDropDownSelectionDataModel

    public DefaultDropDownSelectionDataModel(List<T> data, DataToStringConverter<T> searchConverter)

  - ### DefaultDropDownSelectionDataModel

    public DefaultDropDownSelectionDataModel(List<T> data, DataToStringConverter<T> searchConverter, DataToStringConverter<T> descriptionConverter)

- ## Method Details

  - ### getStringModel

    public static DefaultDropDownSelectionDataModel<String> getStringModel(List<String> strings)

  - ### getSupportedSearchModes

    public List<DropDownTextFieldDataModel.SearchMode> getSupportedSearchModes()
    Description copied from interface: `DropDownTextFieldDataModel`
    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.
    Specified by:
      `getSupportedSearchModes` in interface `DropDownTextFieldDataModel<T>`
    Returns:
      the supported search modes

  - ### getMatchingData

    public List<T> getMatchingData(String searchText)
    Description copied from interface: `DropDownTextFieldDataModel`
    Returns a list of data that matches the given `searchText`. A list is returned to allow for multiple matches. The type of matching performed is determined by the current `search 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

    Specified by:
      `getMatchingData` in interface `DropDownTextFieldDataModel<T>`
    Parameters:
      `searchText` - The text used to find matches.
    Returns:
      a list of items matching the given text.
    See Also:
      - `DropDownTextFieldDataModel.getMatchingData(String, SearchMode)`

  - ### getMatchingData

    public List<T> getMatchingData(String searchText, DropDownTextFieldDataModel.SearchMode mode)
    Description copied from interface: `DropDownTextFieldDataModel`
    Returns a list of data that matches the given `searchText`. A list is returned to allow for multiple matches. The type of matching performed is determined by the current `search 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

    Specified by:
      `getMatchingData` in interface `DropDownTextFieldDataModel<T>`
    Parameters:
      `searchText` - the text used to find matches.
      `mode` - the search mode to use
    Returns:
      a list of items matching the given text.
    See Also:
      - `DropDownTextFieldDataModel.getMatchingData(String, SearchMode)`

  - ### getIndexOfFirstMatchingEntry

    public int getIndexOfFirstMatchingEntry(List<T> list, String text)
    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 interface `DropDownTextFieldDataModel<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

    public ListCellRenderer<T> getListRenderer()
    Description copied from interface: `DropDownTextFieldDataModel`
    Returns the renderer to be used to paint the contents of the list returned by `DropDownTextFieldDataModel.getMatchingData(String)`.
    Specified by:
      `getListRenderer` in interface `DropDownTextFieldDataModel<T>`
    Returns:
      the renderer.

  - ### getDescription

    public String getDescription(T value)
    Description copied from interface: `DropDownTextFieldDataModel`
    Returns a description for this item that gives that will be displayed along side of the `DropDownSelectionTextField`'s matching window.
    Specified by:
      `getDescription` in interface `DropDownTextFieldDataModel<T>`
    Parameters:
      `value` - the value.
    Returns:
      the description.

  - ### getDisplayText

    public String getDisplayText(T value)
    Description copied from interface: `DropDownTextFieldDataModel`
    Returns the text for the given item that will be entered into the `DropDownSelectionTextField` when the user makes a selection.
    Specified by:
      `getDisplayText` in interface `DropDownTextFieldDataModel<T>`
    Parameters:
      `value` - the value.
    Returns:
      the description.