Package su.onno.ui

Class ListSpec.FilterBuilder

java.lang.Object
su.onno.ui.ListSpec.FilterBuilder
Enclosing class:
ListSpec<E>

public static final class ListSpec.FilterBuilder extends Object
Fluent builder for one filter; options/multiple()/multiOptions(java.lang.String...)/ contains()/startsWith()/dateRange() pick the control type.
  • Method Details

    • label

      public ListSpec.FilterBuilder label(String label)
      Override the control's label (defaults to the field name).
    • options

      public ListSpec.FilterBuilder options(String... options)
      A SELECT filter: pick one of options, matched for equality on the field. Each option is shown verbatim (its value is also its label); use options(Map) when the displayed choice should differ from the matched value.
    • options

      public ListSpec.FilterBuilder options(Map<String,String> valueToLabel)
      A SELECT filter with a value→label split: the query matches each map key on the field while the dropdown renders the map value. The choices appear in the map's iteration order, so pass an ordered map (e.g. LinkedHashMap) to control the dropdown order — Map.of(...) is unordered. The answer for a filter over a column whose stored values are codes/English (or an enum text-mirror) in a localized UI.
    • options

      A SELECT filter with fully authored choices, including optional per-option avatars.
    • multiple

      public ListSpec.FilterBuilder multiple()
      Make the current options control multi-select, matched as field IN (…) over the checked values. Useful when options are declared first and multiplicity is a later choice: list.filter("city").options("Madrid", "Paris").multiple().
    • single

      public ListSpec.FilterBuilder single()
      Make the current options control single-select again (the default for options).
    • multiOptions

      public ListSpec.FilterBuilder multiOptions(String... options)
      A multi-select filter: pick any number of options, matched as field IN (…) over the chosen values (an empty selection adds no constraint). Each option is shown verbatim; use multiOptions(Map) for a value→label split.
    • multiOptions

      public ListSpec.FilterBuilder multiOptions(Map<String,String> valueToLabel)
      A multi-select filter with a value→label split: the query matches the map keys as field IN (…) while the dropdown renders the map values. The choices appear in the map's iteration order, so pass an ordered map (e.g. LinkedHashMap) to control the dropdown order — Map.of(...) is unordered.
    • multiOptions

      public ListSpec.FilterBuilder multiOptions(Collection<ListSpec.Option> options)
      A multi-select filter with fully authored choices, including optional per-option avatars.
    • contains

      public ListSpec.FilterBuilder contains()
      A field-scoped typeahead: a debounced text input matched case-insensitively as field LIKE %text%. The high-cardinality answer where a SELECT of every value would be unusable (e.g. filter a roster by a ~1.4k-name doctor column).
    • startsWith

      public ListSpec.FilterBuilder startsWith()
      Like contains() but anchored at the start: matched as field LIKE text%.
    • dateRange

      public ListSpec.FilterBuilder dateRange()
      A from/to date-range filter (two date pickers) over the field.