Package com.onec.ui

Class ListSpec

java.lang.Object
com.onec.ui.ListSpec

public final class ListSpec extends Object
Builder for an entity's list/table surface, used inside EntityView.list(com.onec.ui.ListSpec).

With no calls the list shows the auto-generated columns (built-in system columns + visible custom fields, in their configured order). Call columns(java.lang.String...) to take explicit control of which columns appear and in what order, or hide(java.lang.String...)/label(java.lang.String, java.lang.String) to tweak the defaults. Field names are the entity's Java field names (e.g. "displayName"); "code", "description" (catalogs) and "number", "date", "posted" (documents) address the built-in system columns.

  • Constructor Details

    • ListSpec

      public ListSpec()
  • Method Details

    • title

      public ListSpec title(String title)
    • searchable

      public ListSpec searchable(boolean searchable)
      Whether the list shows a search bar (server-side filter across text columns). Default on.
    • noSearch

      public ListSpec noSearch()
      Turn the search bar off for this list.
    • sortBy

      public ListSpec sortBy(String field)
      The column the list is sorted by initially (a field name); ascending.
    • sortBy

      public ListSpec sortBy(String field, boolean descending)
      The initial sort column + direction.
    • columns

      public ListSpec columns(String... fields)
      Take explicit control: only these fields, in this order.
    • column

      public ListSpec column(String field, String label)
      Add an explicit column with a custom header label.
    • label

      public ListSpec label(String field, String label)
      Override a column's header label.
    • hide

      public ListSpec hide(String... fields)
      Hide fields from the default column set (ignored when columns(java.lang.String...) is used).
    • filter

      public ListSpec.FilterBuilder filter(String field)
      Declare a user-facing filter control bound to field (an entity field name, like the column/sort field names). Unlike a toolbar input — which feeds action handlers — a filter drives the list query itself: its value narrows the rows the grid shows. Returns a ListSpec.FilterBuilder; pick the control with ListSpec.FilterBuilder.options (a SELECT matched for equality), ListSpec.FilterBuilder.multiOptions(java.lang.String...) (a multi-select matched as field IN (…)), ListSpec.FilterBuilder.contains()/ListSpec.FilterBuilder.startsWith() (a field-scoped typeahead for high-cardinality fields, matched case-insensitively as LIKE), or ListSpec.FilterBuilder.dateRange() (from/to pickers, a field >= from AND field <= to range).

      When several filters are declared they combine with AND: each contributes its own WHERE fragment and the row must satisfy all of them. A multiOptions filter is internally an OR/IN over its picked values, but across different filters the combination is always AND. A filter whose control is left empty (no selection, blank text) contributes no constraint, and a filter on a field the entity no longer has degrades to "no constraint" rather than failing the list.

       list.filter("season").options("2024", "2025", "2026");        // SELECT -> season = value
       list.filter("doctorName").label("Doctor").contains();         // typeahead -> doctor_name ILIKE %v%
       list.filter("role").multiOptions("Хирург", "Терапевт");        // multi-select -> role IN (…)
       list.filter("checkIn").dateRange();                           // from/to pickers -> checkIn range
       
    • title

      public String title()
    • include

      public List<String> include()
    • hidden

      public Set<String> hidden()
    • labels

      public Map<String,String> labels()
    • explicit

      public boolean explicit()
    • searchable

      public boolean searchable()
    • sortField

      public String sortField()
    • sortDescending

      public boolean sortDescending()
    • filters

      public List<ListSpec.Filter> filters()
      The declared list filters, in declaration order.