Class SearchableBaseList

    • Constructor Detail

      • SearchableBaseList

        public SearchableBaseList()
        Constructs a SearchableBaseList with an empty, read-only, model.
      • SearchableBaseList

        public SearchableBaseList​(Object[] listData)
        Constructs a SearchableBaseList that displays the elements in the specified array. This constructor creates a read-only model for the given array, and then delegates to the constructor that takes a ListModel.

        Attempts to pass a null value to this method results in undefined behavior and, most likely, exceptions. The created model references the given array directly. Attempts to modify the array after constructing the list results in undefined behavior.

        Parameters:
        listData - the array of Objects to be loaded into the data model, non-null
      • SearchableBaseList

        public SearchableBaseList​(Vector<?> listData)
        Constructs a SearchableBaseList that displays the elements in the specified Vector. This constructor creates a read-only model for the given Vector, and then delegates to the constructor that takes a ListModel.

        Attempts to pass a null value to this method results in undefined behavior and, most likely, exceptions. The created model references the given Vector directly. Attempts to modify the Vector after constructing the list results in undefined behavior.

        Parameters:
        listData - the Vector to be loaded into the data model, non-null
      • SearchableBaseList

        public SearchableBaseList​(ListModel dataModel)
        Constructs a SearchableBaseList that displays elements from the specified, non-null, model. All SearchableBaseList constructors delegate to this one.

        This constructor registers the list with the ToolTipManager, allowing for tooltips to be provided by the cell renderers.

        Parameters:
        dataModel - the model for the list
        Throws:
        IllegalArgumentException - if the model is null
    • Method Detail

      • getListModelClass

        protected Class getListModelClass()
        Returns the class of the list model that the models need to be derived from. The default implementation just returns ListModel.class
        Returns:
        the class the models must be derived from
      • backupModelSettings

        protected Hashtable<String,​Object> backupModelSettings​(ListModel model)
        Backs up the settings from the old model.
        Parameters:
        model - the old model (the model stored within the SortedModel)
        Returns:
        the backed up settings
      • restoreModelSettings

        protected void restoreModelSettings​(ListModel model,
                                            Hashtable<String,​Object> settings)
        Restores the settings previously backed up.
        Parameters:
        model - the new model (the model stored within the SortedModel)
        settings - the old settings, null if no settings were available
      • setActualModel

        public void setActualModel​(ListModel value)
        Sets the model to use.
        Parameters:
        value - the model to use
      • getActualModel

        public ListModel getActualModel()
        returns the underlying model, can be null.
        Returns:
        the current model
      • getActualIndex

        public int getActualIndex​(int index)
        Returns the actual index in the model.
        Specified by:
        getActualIndex in interface SearchableList
        Parameters:
        index - the index of the currently displayed data
        Returns:
        the index in the underlying data
      • getActualSize

        public int getActualSize()
        Returns the actual size of the model.
        Specified by:
        getActualSize in interface SearchableList
        Returns:
        the size in the underlying data
      • search

        public void search​(String searchString,
                           boolean regexp)
        Performs a search for the given string. Limits the display of rows to ones containing the search string.
        Specified by:
        search in interface SearchableList
        Parameters:
        searchString - the string to search for
        regexp - whether to perform regular expression matching or just plain string comparison
      • getSeachString

        public String getSeachString()
        Returns the current search string.
        Specified by:
        getSeachString in interface SearchableList
        Returns:
        the search string, null if not filtered
      • isRegExpSearch

        public boolean isRegExpSearch()
        Returns whether the last search was a regular expression based one.
        Specified by:
        isRegExpSearch in interface SearchableList
        Returns:
        true if last search was a reg exp one