Package org.apache.juneau.console.views
Class QuickStat
java.lang.Object
org.apache.juneau.console.views.QuickStat
One item in a table's quick-stats strip (
quickStats.items[]): a plain tile, a meter (one value against a
maximum) or a segmented tile (a proportional bar of labelled counts).
Example:
- Since:
- 10.0.0
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe most segments one segmented item may carry (one per chart palette colour). -
Method Summary
Modifier and TypeMethodDescriptionstatic QuickStatCreates a meter item: one value drawn against a maximum.static QuickStatCreates a quick-stat tile.Adds an untoned segment to a segmented item.segment(String label, long count, StatusTone tone) Adds a segment to a segmented item.static QuickStatCreates a segmented item: a proportional bar plus a legend of labelled counts.Sets the tone of a tile or meter.Sets a meter's display text, which replaces the default "value / max".toMap()Builds this item'squickStats.items[]entry.Sets this tile's visual tone.
-
Field Details
-
MAX_SEGMENTS
The most segments one segmented item may carry (one per chart palette colour).- See Also:
-
-
Method Details
-
of
Creates a quick-stat tile.- Parameters:
id- This tile's own id, unique within its table. Must not benull or blank.label- The tile's label text.value- The tile's value, serialized as-is.- Returns:
- A new
QuickStat. - Throws:
IllegalArgumentException- Ifidisnull or blank.
-
meter
Creates a meter item: one value drawn against a maximum.A value above the maximum is allowed; it paints a full bar with an over-limit cue.
- Parameters:
id- This item's own id, unique within its table. Must not benull or blank.label- The item's label text; it names the meter for assistive technology. Must not benull or blank.value- The current value. Must be finite and>= 0.max- The maximum. Must be finite and> 0.- Returns:
- A new
QuickStat. - Throws:
IllegalArgumentException- Ifidorlabelis blank, orvalueormaxisnull or out of range.
-
segmented
Creates a segmented item: a proportional bar plus a legend of labelled counts.Add the segments with
segment(String, long); at least one is required by the time the item is built.- Parameters:
id- This item's own id, unique within its table. Must not benull or blank.label- The item's label text; it names the group for assistive technology. Must not benull or blank.- Returns:
- A new
QuickStat. - Throws:
IllegalArgumentException- Ifidorlabelisnull or blank.
-
segment
Adds an untoned segment to a segmented item.- Parameters:
label- The segment label. Must not benull or blank.count- The segment count. Must be>= 0.- Returns:
- This object.
- Throws:
IllegalArgumentException- If this is not a segmented item, the label is blank, the count is negative, or the item already hasMAX_SEGMENTSsegments.
-
segment
Adds a segment to a segmented item.- Parameters:
label- The segment label. Must not benull or blank.count- The segment count. Must be>= 0.tone- The segment tone. Can benull for an untoned segment.- Returns:
- This object.
- Throws:
IllegalArgumentException- If this is not a segmented item, the label is blank, the count is negative, or the item already hasMAX_SEGMENTSsegments.
-
text
Sets a meter's display text, which replaces the default "value / max".- Parameters:
text- The text. Must not benull ; blank means the default text is used.- Returns:
- This object.
- Throws:
IllegalArgumentException- If this is not a meter item, ortextisnull .
-
statusTone
Sets the tone of a tile or meter.Writes the same tone as
tone(Tone); the last call wins.- Parameters:
t- The tone. Can benull to unset.- Returns:
- This object.
- Throws:
IllegalArgumentException- If this is a segmented item (tone each segment instead).
-
tone
Sets this tile's visual tone.- Parameters:
t- The tone. Can benull to unset.- Returns:
- This object.
- Throws:
IllegalArgumentException- If this is a segmented item (tone each segment instead).
-
toMap
Builds this item'squickStats.items[]entry.- Returns:
- A tile
{id, label, value, tone?}(notype); a meter{id, type, label, value, max, text?, tone?}; or a segmented item{id, type, label, segments[{label, count, tone?}]}. - Throws:
IllegalArgumentException- If this is a segmented item with no segments.
-