Class SizeTokens

java.lang.Object
limn.components.SizeTokens

public final class SizeTokens extends Object
The numeric size table: one immutable row per ControlSize step.

Hand-authored, five rows, no base * k(step) anywhere. Three independent ramps: type 11/12/14/16/19 (span 1.73x), control height 24/28/32/40/50 (2.08x), spacing 3/4/6/8/10 (3.33x). Reach a row with Theme.tokensFor(limn.scene.Widget); MEDIUM is the default and the nine Theme tokens are initialized from it, so assertSame(theme.body, SizeTokens.MEDIUM.body()) holds.

Quantities that are weights, not sizes (every border, focus ring and its gap, hairline, check-mark pen, caret, AA bleed, damage margin, wheel step, and the WCAG hit floor) live in Strokes and are identical at every step by construction: there is no five-column row for any of them. This class therefore holds no double of any kind, so an animation duration cannot be smuggled in.

padV is a measure-only floor input to max(controlHeight, lineHeight + 2 * padV). The box binds at every step, so this number must never appear as a paint or hit-test coordinate; what a control centres against is the effective padV (height - lineHeight)/2 = 5.554688 / 6.968750 / 7.796875 / 10.625000 / 13.867188.

A class and not a record, with no public constructor: only this class builds its five rows. A record's constructor and its deconstruction pattern would have made today's tokens a contract, so that the size a new widget needs could not join the table in a later 1.x release without breaking every caller that builds or deconstructs a row. An application reads the accessors, reaches a row with of(limn.scene.ControlSize) or Theme.tokensFor(limn.scene.Widget), and compares two rows with equals(java.lang.Object).

  • Field Details

    • MEDIUM

      public static final SizeTokens MEDIUM
      The default step's row. Theme's nine tokens are initialized from this.
  • Method Details

    • of

      public static SizeTokens of(ControlSize step)
      The row for one step.
    • body

      public Font body()
      Returns:
      the font of body text at this step
    • label

      public Font label()
      Returns:
      the font of the label role at this step, a little smaller than the body
    • title

      public Font title()
      Returns:
      the font of the title role at this step
    • spacingSmall

      public float spacingSmall()
      Returns:
      the small step of the spacing ramp
    • spacingMedium

      public float spacingMedium()
      Returns:
      the medium step of the spacing ramp
    • spacingLarge

      public float spacingLarge()
      Returns:
      the large step of the spacing ramp
    • radiusSmall

      public float radiusSmall()
      Returns:
      the small corner radius, multiplied by the palette's corner scale
    • radiusMedium

      public float radiusMedium()
      Returns:
      the medium corner radius, multiplied by the palette's corner scale
    • radiusLarge

      public float radiusLarge()
      Returns:
      the large corner radius, multiplied by the palette's corner scale
    • indicatorRadius

      public float indicatorRadius()
      Returns:
      the corner of a check box's box, multiplied by the palette's corner scale
    • controlHeight

      public float controlHeight()
      Returns:
      the height of a single-line control, the floor resolvedHeight(float) starts from
    • listRowSeed

      public float listRowSeed()
      Returns:
      the row height a list, a table or a tree assumes before it has measured a row
    • popupItemHeight

      public float popupItemHeight()
      Returns:
      the height of a row in a popup list, as a combo box's
    • areaPad

      public float areaPad()
      Returns:
      a text area's padding above and below its text
    • cardPad

      public float cardPad()
      Returns:
      the padding round a card's parts
    • fieldPadH

      public float fieldPadH()
      Returns:
      a text field's padding on either side of its text
    • padH

      public float padH()
      Returns:
      a button's padding on either side of its content
    • padV

      public float padV()
      Returns:
      the vertical padding resolvedHeight(float) measures with: a floor for measuring only, never a paint or hit-test coordinate; effectivePadV(float) is what a control centres against
    • popupPadV

      public float popupPadV()
      Returns:
      a popup list's padding above its first row and below its last
    • popupRowInsetX

      public float popupRowInsetX()
      Returns:
      how far a popup list's rows sit in from its sides
    • segPadH

      public float segPadH()
      Returns:
      the padding on either side of a segmented control's label
    • spinnerFieldPadX

      public float spinnerFieldPadX()
      Returns:
      the padding on either side of a spinner's text
    • tabPadH

      public float tabPadH()
      Returns:
      the padding on either side of a tab's title
    • tabPadV

      public float tabPadV()
      Returns:
      the padding above and below a tab's title
    • toolBarPad

      public float toolBarPad()
      Returns:
      a tool bar's padding round its items
    • tooltipPadH

      public float tooltipPadH()
      Returns:
      a tooltip's padding on either side of its text
    • tooltipPadV

      public float tooltipPadV()
      Returns:
      a tooltip's padding above and below its text
    • colorGap

      public float colorGap()
      Returns:
      the gap between a colour picker's blocks and between its rows
    • gapButtonRow

      public float gapButtonRow()
      Returns:
      the gap between the buttons of a row, as a dialog's
    • gapIcon

      public float gapIcon()
      Returns:
      the gap between an icon and the text beside it: a button's icon and its caption, a field's leading icon and its text, a combo's or a menu row's icon and its label, a label's icon and its words, all one distance at a step
    • gapLabel

      public float gapLabel()
      Returns:
      the gap between a control and its label
    • newlineHint

      public float newlineHint()
      Returns:
      the width of the mark a text area paints where a selected line ends
    • popupGap

      public float popupGap()
      Returns:
      the gap between an anchored popup and its anchor
    • tabIconGap

      public float tabIconGap()
      Returns:
      the gap between a tab's icon and its title
    • tabRevealMargin

      public float tabRevealMargin()
      Returns:
      how much room a tab strip leaves past a tab it scrolls into view
    • toggleColumnGap

      public float toggleColumnGap()
      Returns:
      the gap between a check box's or a radio button's indicator and its label
    • toolBarGap

      public float toolBarGap()
      Returns:
      the gap between a tool bar's items, unless the bar was given one
    • comboCaretCenterX

      public float comboCaretCenterX()
      Returns:
      how far the centre of a combo box's caret sits from its trailing edge
    • fieldDividerInset

      public float fieldDividerInset()
      Returns:
      how far a text field's divider stops short of its top and bottom edges
    • indicatorInset

      public float indicatorInset()
      Returns:
      the gap between a radio button's ring and its dot
    • popupBarInsetX

      public float popupBarInsetX()
      Returns:
      how far a popup list's scroll bar sits from the list's trailing side
    • popupDotCol

      public float popupDotCol()
      Returns:
      how far the dot that marks a popup list's chosen row sits from the row's leading edge
    • popupMarkerCol

      public float popupMarkerCol()
      Returns:
      how far a popup list row's text starts from the row's leading edge
    • segInset

      public float segInset()
      Returns:
      how far a segmented control's selected pill sits inside the track
    • spinnerFieldInset

      public float spinnerFieldInset()
      Returns:
      how far a spinner's text sits inside its border
    • stripBtnHoverInset

      public float stripBtnHoverInset()
      Returns:
      how far the hover fill of a tab strip's buttons sits inside them
    • switchThumbInset

      public float switchThumbInset()
      Returns:
      how far a switch's knob sits inside its track
    • tabHoverInset

      public float tabHoverInset()
      Returns:
      how far a tab's hover fill sits inside the tab
    • toolBarSepInset

      public float toolBarSepInset()
      Returns:
      how far a tool bar's separator stops short of the bar's edges
    • areaHeight

      public float areaHeight()
      Returns:
      a text area's height when its parent does not decide
    • areaWidth

      public float areaWidth()
      Returns:
      a text area's width when its parent does not decide
    • arrowHalf

      public float arrowHalf()
      Returns:
      half the width of a spinner's arrow
    • checkGlyphW

      public float checkGlyphW()
      Returns:
      the width of the check mark in a menu or a popup list
    • chevronHalfW

      public float chevronHalfW()
      Returns:
      half the width of a disclosure chevron
    • colorDialogW

      public float colorDialogW()
      Returns:
      the width of a colour picker inside a dialog
    • colorFieldH

      public float colorFieldH()
      Returns:
      the height of a colour picker's two-axis field
    • colorRailH

      public float colorRailH()
      Returns:
      the height of a colour picker's channel rail; even, so that it centres in its box
    • colorRampW

      public float colorRampW()
      Returns:
      the width of a colour picker's hue ramp
    • colorThumbH

      public float colorThumbH()
      Returns:
      the height of the thumb on a colour picker's rail
    • colorThumbW

      public float colorThumbW()
      Returns:
      the width of the thumb on a colour picker's rail
    • comboCaretGutter

      public float comboCaretGutter()
      Returns:
      the room a combo box keeps at its trailing end for the caret
    • comboTextClip

      public float comboTextClip()
      Returns:
      the strip at a combo box's trailing end that its text is kept out of
    • dialogMaxWidth

      public float dialogMaxWidth()
      Returns:
      the widest a dialog's panel is measured
    • fieldIcon

      public float fieldIcon()
      Returns:
      the size of an icon inside a field
    • fieldTrailing

      public float fieldTrailing()
      Returns:
      the room a field keeps at its trailing end for a button or an icon
    • fieldWidth

      public float fieldWidth()
      Returns:
      a text field's width when its parent does not decide
    • iconBox

      public float iconBox()
      Returns:
      the square an icon is drawn in beside text
    • indicator

      public float indicator()
      Returns:
      the size of a check box's box and of a radio button's ring
    • popupDotRadius

      public float popupDotRadius()
      Returns:
      the radius of the dot that marks a popup list's chosen row
    • progressThickness

      public float progressThickness()
      Returns:
      the thickness of a progress bar
    • scrollChevronHalf

      public float scrollChevronHalf()
      Returns:
      half the width of the chevron that scrolls a long menu
    • separatorBox

      public float separatorBox()
      Returns:
      the box a separator's line is centred in; odd, so that a one-point line sits exactly in its middle
    • sliderKnob

      public float sliderKnob()
      Returns:
      the radius of a slider's knob
    • sliderKnobHover

      public float sliderKnobHover()
      Returns:
      the radius of a slider's knob under the pointer
    • sliderRail

      public float sliderRail()
      Returns:
      the thickness of a slider's rail
    • spinnerButtonW

      public float spinnerButtonW()
      Returns:
      the width of a spinner's buttons
    • switchTrackH

      public float switchTrackH()
      Returns:
      the height of a switch's track
    • switchTrackW

      public float switchTrackW()
      Returns:
      the width of a switch's track
    • tabChevron

      public float tabChevron()
      Returns:
      the size of the chevrons that scroll a tab strip or a segmented control
    • tabIconSize

      public float tabIconSize()
      Returns:
      the size of a tab's icon
    • listWidth

      public float listWidth()
      Returns:
      the width a list or a tree asks for when its parent does not decide
    • spinnerWidth

      public float spinnerWidth()
      Returns:
      a spinner's width when its parent does not decide
    • resolvedHeight

      public float resolvedHeight(float lineHeight)
      The one height formula for every text-bearing control (3.3).
    • effectivePadV

      public float effectivePadV(float lineHeight)
      What a control actually centres against: (h - lineHeight)/2. Fractional by design (3.6).
    • segPillRadius

      public float segPillRadius()
      SegmentedControl's inset pill, concentric with the track at every step.
    • indicatorFocusRadius

      public float indicatorFocusRadius()
      The corner of a checkbox's focus ring at its outer edge: the box's own corner grown by the clear gap and the ring's pen, which is what keeps the ring concentric with the box.
    • sliderPad

      public float sliderPad()
      Slider's half-height: knobHover + the ring's gap + the ring's own stroke, at every step.
    • sliderHeight

      public float sliderHeight()
      Slider's measured height: 24 / 24 / 28 / 33 / 38.
    • calendarCell

      public float calendarCell()
      A calendar's day cell, square: 24 / 28 / 32 / 40 / 50.

      The control height and not a row of its own, which is the point rather than a saving. A day cell is a hit target in a grid of forty-two of them, and making it exactly as tall as every other control at the same density is what keeps a calendar sitting next to a field from looking like it came from somewhere else. Seven of them is 224pt at MEDIUM, which is within a hair of fieldWidth(), so a picker's popup is the width of the field that opened it without either being derived from the other.

      Floored at the minimum hit target, which binds at no step today and would if the control height ever dropped: a day is pointed at, and the ramp's dense end is where that gets tight.

    • calendarWeekColumn

      public float calendarWeekColumn()
      The week-number column, three quarters of a day cell: it holds one or two digits at a smaller type than the days, and a column as wide as a day would read as an eighth weekday.
    • equals

      public boolean equals(@Nullable Object o)
      Equal when every token is, as a record's components would be: a palette's own rows built twice compare equal row by row.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Every token by name, as a record prints its components, for a log line.
      Overrides:
      toString in class Object