Class ISearchboxController<Data>

  • All Implemented Interfaces:
    ItemController<Data,​ListModel<Data>,​ISearchbox,​java.lang.String>

    public class ISearchboxController<Data>
    extends java.lang.Object
    implements ItemController<Data,​ListModel<Data>,​ISearchbox,​java.lang.String>
    An ISearchbox controller to control any operation on the given model.

    Note: this class is not thread-safe, so when it's used in multi-threading environment, the developer should handle the threading issue.

    Author:
    katherine
    • Method Detail

      • of

        public static <D> ISearchboxController<D> of​(ISearchbox owner,
                                                     ListModel<D> model)
        Returns the controller instance with the given searchbox
        Parameters:
        owner - The controller to control with
        model - The list model to associate with the searchbox.
      • of

        public static <D> ISearchboxController<D> of​(ISearchbox owner,
                                                     ListModel<D> model,
                                                     CheckedFunction2<java.lang.Object,​java.lang.Integer,​java.lang.String> renderer)
        Returns the controller instance with the given searchbox
        Parameters:
        owner - The controller to control with
        model - The list model to associate with the searchbox.
        renderer - The renderer of the list model.
      • setItemConverter

        public void setItemConverter​(Converter<java.util.Collection<Data>,​java.lang.String> converter)
        Sets the converter that generates the label text shown in the searchbox from selected items.
        Parameters:
        converter - the converter, or null to use the default implementation.
      • isMultiple

        public boolean isMultiple()
        Returns whether multiple selections are allowed.

        Default: false.

      • setMultiple

        public void setMultiple​(boolean multiple)
        Sets whether multiple selections are allowed.

        Notice that, if a model is assigned, it will change the model's state (by Selectable.setMultiple(boolean)).

      • setSelectedObjects

        public void setSelectedObjects​(java.util.Collection<Data> selectedItems)
        Selects the given items. Must be non-null values.
      • getSelectedObjects

        public <T> java.util.Set<T> getSelectedObjects()
        Returns the selected objects.
      • getSelectedObject

        public Data getSelectedObject()
        Returns the selected item, or null if no item is selected.
      • setSelectedObject

        public void setSelectedObject​(Data item)
        Deselects all the currently selected items and selects the given item.
      • getSelectedCount

        public int getSelectedCount()
        Returns the number of items being selected.
      • clearSelection

        public void clearSelection()
        Clears the selection.