Class DetailTab

java.lang.Object
org.apache.juneau.console.views.DetailTab
All Implemented Interfaces:
Handled<DetailTab>

public final class DetailTab extends Object implements Handled<DetailTab>
One tab of a tabbed RowDetail: a fields grid, a nested table, a chart or a client-rendered pane.

The tab is loaded lazily: its content is fetched the first time the user opens it. A tab id is the slug of its title unless id(String) is given.

Example:

RowDetail.inline() .tab(DetailTab.fields("Details", "id", "name", "price").columns(3)) .tab(DetailTab.client("Labels", "pet-labels").endpoint("/pets/{id}/labels"));

Since:
10.0.0
  • Method Details

    • modelBlock

      Description copied from interface: Handled
      Returns the element's model block.
      Specified by:
      modelBlock in interface Handled<DetailTab>
      Returns:
      The block; never null.
    • self

      public DetailTab self()
      Description copied from interface: Handled
      Returns this builder.
      Specified by:
      self in interface Handled<DetailTab>
      Returns:
      This object.
    • fields

      public static DetailTab fields(String title, String... fields)
      Starts a fields-grid tab.
      Parameters:
      title - The tab title. Must not be blank.
      fields - The row field names shown, in order. Unique within the tab.
      Returns:
      A new tab.
    • table

      public static DetailTab table(String title, TableSpec view)
      Starts a nested-table tab.
      Parameters:
      title - The tab title. Must not be blank.
      view - The nested table; it must declare a rows data URL.
      Returns:
      A new tab.
    • chart

      public static DetailTab chart(String title, RegionDef region)
      Starts a chart tab.
      Parameters:
      title - The tab title. Must not be blank.
      region - The chart region.
      Returns:
      A new tab.
    • client

      public static DetailTab client(String title, String renderer)
      Starts a client-rendered tab.
      Parameters:
      title - The tab title. Must not be blank.
      renderer - The name of a renderer registered in the browser; letters, digits, . _ -, at most 64.
      Returns:
      A new tab.
    • id

      public DetailTab id(String value)
      Sets the tab id (default: the slug of the title).
      Parameters:
      value - The id; lower-case letter first, then lower-case letters, digits and -, at most 32.
      Returns:
      This object.
    • icon

      public DetailTab icon(String value)
      Sets the tab icon.
      Parameters:
      value - An icon name.
      Returns:
      This object.
    • endpoint

      public DetailTab endpoint(String value)
      Sets the per-tab GET endpoint.
      Parameters:
      value - A same-origin path template; {id} is replaced by the row id.
      Returns:
      This object.
    • emptyText

      public DetailTab emptyText(String value)
      Sets the text shown when the tab has nothing to show.
      Parameters:
      value - The text.
      Returns:
      This object.
    • columns

      public DetailTab columns(int n)
      Sets the grid column count of a fields tab.
      Parameters:
      n - The count, 1 to 4; 0 inherits the detail's count.
      Returns:
      This object.
    • group

      public DetailTab group(String groupTitle, String... groupFields)
      Groups some of a fields tab's fields under a heading. Fields in no group follow, under no heading.
      Parameters:
      groupTitle - The heading.
      groupFields - The fields; each must be in the tab's field list and in no other group.
      Returns:
      This object.
    • scopeParam

      public DetailTab scopeParam(String value)
      Sets the query parameter carrying the parent row id to a nested table.
      Parameters:
      value - The parameter name (default parentId).
      Returns:
      This object.
    • countFromRows

      Shows the nested table's row count in the tab label once the tab has loaded. Table tabs only.
      Returns:
      This object.
    • count

      Sets a server-side counter shown in the tab label. The value travels in the detail's counts.
      Parameters:
      f - Maps a row id to a count.
      Returns:
      This object.
    • refreshOnPoll

      public DetailTab refreshOnPoll(boolean value)
      Sets whether the tab reloads when the table polls.
      Parameters:
      value - The flag (default false).
      Returns:
      This object.
    • visibleWhen

      Hides the tab unless every rule matches. Presentation only; it never authorises.
      Parameters:
      rules - The rules.
      Returns:
      This object.
    • toMap

      public Map<String,Object> toMap()
      Serializes this tab to its wire shape.
      Returns:
      The tab map.
      Throws:
      IllegalArgumentException - If the tab is invalid.