Class RangeSection

java.lang.Object
org.apache.juneau.console.freemarker.Section
org.apache.juneau.console.freemarker.RangeSection

public final class RangeSection extends Section
A rail section of quick time-range presets, with an optional custom from/to.

Publishes {schemaVersion:1, viewId, options:{range}, start, end} on its filter: topic, where range is the preset or "custom" and start/end are ISO-8601 UTC instants. Nd and Nh end at now floored to the minute; ytd starts at January 1, 00:00 UTC.

Example:

RangeSection.quick("7d", "30d", "90d", "ytd").custom(true).defaultPreset("30d") .publishes(Topics.filter("range"));

Since:
10.0.0
  • Method Details

    • quick

      public static RangeSection quick(String... presets)
      Creates a range section.
      Parameters:
      presets - The quick presets, each Nd, Nh or ytd.
      Returns:
      A new section.
    • custom

      public RangeSection custom(boolean value)
      Adds the custom from/to inputs (read as UTC).
      Parameters:
      value - true to show them.
      Returns:
      This object.
    • defaultPreset

      Sets the preset used when nothing is restored.
      Parameters:
      value - One of the presets. Defaults to the first.
      Returns:
      This object.
    • publishes

      public RangeSection publishes(String topic)
      Description copied from class: Section
      Sets the topic this section owns.
      Overrides:
      publishes in class Section
      Parameters:
      topic - A filter:<key> topic, normally Topics.filter(key). <key> becomes the section id.
      Returns:
      This object.
    • label

      public RangeSection label(String label)
      Description copied from class: Section
      Sets the section's legend text.
      Overrides:
      label in class Section
      Parameters:
      label - The label.
      Returns:
      This object.