Members
(static, constant) TEXT_BUTTON_ICON_GUTTER
Gap between the label's right edge and the icon.
- Default Value
- 12
(static, constant) TEXT_BUTTON_ICON_SIZE
Affordance icon, sized 1:1 with the source bitmaps exactly as TrackDropdown does with the same 24x24 chevron, so the two dropdown affordances match.
- Default Value
- 24
(static, constant) TEXT_BUTTON_INDICATOR_HEIGHT
Selected-state underline. 6px is the same weight the overhang has always used for the selected tab, so the signal reads the same wherever it appears.
The bar is CENTERED in the gap between the label's bottom edge and the button's bottom edge rather than sitting at a fixed offset, and that is the whole reason this lives in one place now. JRTab's original version hard-coded +12 below a padding-derived text bottom, correct only at JRTab's padding of 30 and only while no minHeight is in play. Hand-copied into the subtitle panel at padding 24 it drew the bar 6px from the button's bottom edge and read as colliding with it. Centering makes the geometry correct at any padding and any minHeight, and reproduces JRTab's existing pixels exactly at padding 30.
- Default Value
- 6
Methods
(static) applyIconState() → {void}
applyIconState: URI, size and visibility only. Placement needs the button's measured size and therefore belongs to setSizeAndCenterText.
- Type:
- void
(static) applyLoadingState() → {void}
applyLoadingState: Swap the label for a spinner, or back.
By design it changes no geometry. It reads the background's already-measured rect and never calls setSizeAndCenterText(), so a button cannot resize on its way into or out of a loading state, which matters more here than it does on IconButton, because TextButton now sizes the whole dialog family: JRDialog and QuickConnectDialog derive their panel width, height and row position from a button's isReady size, and dialogLayout.bs / dialogs.bs each hold a hand-copy of its padding arithmetic. A spinner that resized its button would move every dialog in the app.
Hiding the label rather than clearing its text is the same care: setSizeAndCenterText early-returns on empty text, so a cleared label would strand the button at whatever size it last had and never recover it when the text came back.
The selected-state underline is left alone. It only draws while both showSelectedIndicator and isButtonSelected hold, and no button in the app is both a toggle and an action that can be in flight; threading isLoading through layoutSelectedIndicator and onSelectedIndicatorChanged would add two guards for a combination that does not occur.
- Type:
- void
(static) applyTheme() → {void}
- Type:
- void
(static) hasIconSlot() → {boolean}
hasIconSlot: Whether this button reserves the leading/trailing affordance slot.
An icon and the in-flight spinner share it, so the question sizing asks is "is anything in the slot", not "is there an icon". Keeping it one predicate is what guarantees the width the label is measured against and the width the spinner is placed in can never disagree.
- Type:
- boolean
(static) init() → {void}
- Type:
- void
(static) labelLeft(iconSpace) → {float}
labelLeft: Where the label's BOX starts, given the slot the icon reserves.
The counterpart to textCenterOffset: that one says where the text's centre goes, this one says where to put a box of width buttonWidth - iconSpace so the centre lands there. A leading icon takes the left of the button, so the box starts after it; a trailing icon takes the right, so the box starts at 0.
Always >= 0, and that is the point (see setSizeAndCenterText). Offsetting the label node negatively puts a child outside its own component's background, and any LayoutGroup ancestor then silently repositions the whole button.
| Name | Type | Description |
|---|---|---|
iconSpace | float |
- Type:
- float
(static) layoutIcon(buttonWidth, buttonHeight, textWidth, iconSpace) → {void}
layoutIcon: Place the icon for whichever role its side implies.
The two roles differ once minWidth binds the button wider than its content, which is the common case here, not the exception. A leading icon stays glued to the text as it centres; a trailing chevron stays glued to the button's right edge, matching TrackDropdown's trigger.
| Name | Type | Description |
|---|---|---|
buttonWidth | float | |
buttonHeight | float | |
textWidth | float | |
iconSpace | float |
- Type:
- void
(static) layoutSelectedIndicator(buttonHeight, textLeft, textWidth, visibleTextHeight) → {void}
layoutSelectedIndicator: Place the underline under the label's visible box.
The label is vertically centered across the FULL button height, so its bottom edge follows from that centering. Deriving it from the padding instead is what broke once a minHeight (or a smaller padding) was in play.
| Name | Type | Description |
|---|---|---|
buttonHeight | float | |
textLeft | float | |
textWidth | float | |
visibleTextHeight | float |
- Type:
- void
(static) onBackgroundChanged() → {void}
- Type:
- void
(static) onBorderChanged() → {void}
- Type:
- void
(static) onEnabledChanged() → {void}
- Type:
- void
(static) onFocusChanged() → {void}
- Type:
- void
(static) onIconChanged() → {void}
- Type:
- void
(static) onLoadingChanged() → {void}
- Type:
- void
(static) onPaddingChanged() → {void}
- Type:
- void
(static) onRenderComplete() → {void}
Called when the component has rendered and we can measure the label accurately
- Type:
- void
(static) onSelectedIndicatorChanged() → {void}
- Type:
- void
(static) onSizeChanged() → {void}
- Type:
- void
(static) onTextChanged() → {void}
- Type:
- void
(static) onTextColorChanged() → {void}
- Type:
- void
(static) setFocusBorderSize() → {void}
- Type:
- void
(static) setSizeAndCenterText() → {void}
- Type:
- void
(static) textCenterOffset(iconSpace) → {float}
textCenterOffset: How far the label's centre shifts from the button's centre.
A LEADING icon is part of the label ("▶ Play" is one phrase), so the pair is centred as a unit and the text gives up half the icon's space to its left. A TRAILING icon is a disclosure affordance belonging to the button rather than the phrase, so it is pinned to the right edge and the text centres in what's left, shifting the same distance the other way.
| Name | Type | Description |
|---|---|---|
iconSpace | float |
- Type:
- float