Package tripleplay.ui
Class Style<V>
java.lang.Object
tripleplay.ui.Style<V>
- Direct Known Subclasses:
Style.Flag
,Style.GradientTypeStyle
,Style.HAlignStyle
,Style.PosStyle
,Style.TextEffectStyle
,Style.VAlignStyle
Defines style properties for interface elements. Some style properties are inherited, such that
a property not specified in a leaf element will be inherited by the nearest parent for which the
property is specified. Other style properties are not inherited, and a default value will be
used in cases where a leaf element lacks a property. The documentation for each style property
indicates whether or not it is inherited.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Used to configureStyles
instances.static interface
Used to create text effects.static class
A Boolean style, with convenient members for on and off bindings.static class
static enum
Defines horizontal alignment choices.static class
Used to provide concise HAlign style declarations.static enum
Defines element modes which can be used to modify an element's styles.static enum
Defines icon position choices.static class
Used to provide concise Pos style declarations.static enum
Defines supported text effects.static class
Used to provide concise TextEffect style declarations.static enum
Defines vertical alignment choices.static class
Used to provide concise VAlign style declarations. -
Field Summary
Modifier and TypeFieldDescriptionThe sound to be played when this element's action is triggered.static final Style.Flag
Whether or not to automatically shrink a text widget's font size until it fits into the horizontal space it has been allotted.static final Style<Background>
The background for an element.The foreground color for an element.static final Style.Flag
Whether or not to automatically clip a text widget's text to fit into the horizontal space it has been allotted.The font used to render text.The color of the gradient.static final Style.GradientTypeStyle
The type of gradient.static final Style.HAlignStyle
The horizontal alignment of an element.The highlight color for an element.static final Style.Flag
If true, the icon is cuddled to the text, with extra space between icon and border, if false, the icon is placed next to the border with extra space between icon and label.static final Style<IconEffect>
The effect to apply to the icon.The gap between the icon and text in labels, buttons, etc.static final Style.PosStyle
The position relative to the text to render an icon for labels, buttons, etc.final boolean
Indicates whether or not this style property is inherited.The line spacing to use when rendering multiline text.IfAUTO_SHRINK
is enabled, the minimum font size to use when shrinking.static final Style<Canvas.LineCap>
The line cap for the outline, when using a vector outline.static final Style<Canvas.LineJoin>
The line join for the outline, when using a vector outline.The stroke width of the outline, when using a vector outline.The shadow color for an element.The shadow offset in pixels.The shadow offset in pixels.static final Style.TextEffectStyle
The effect to use when rendering text, if any.static final Style.Flag
Whether or not to allow text to wrap.static final Style.Flag
Whether or not to underline text.static final Style.VAlignStyle
The vertical alignment of an element. -
Method Summary
Modifier and TypeMethodDescriptionstatic TextStyle
createTextStyle
(Element<?> elem) Creates a text style instance based on the supplied element's stylings.abstract V
getDefault
(Element<?> mode) Returns the default value for this style for the supplied element.Returns aStyle.Binding
with this style bound to the specified value.static Style.Flag
newFlag
(boolean inherited, boolean defaultValue) Creates a boolean style identifier with the supplied properties.static <V> Style<V>
newStyle
(boolean inherited, V defaultValue) Creates a style identifier with the supplied properties.
-
Field Details
-
COLOR
The foreground color for an element. Inherited. -
HIGHLIGHT
The highlight color for an element. Inherited. -
SHADOW
The shadow color for an element. Inherited. -
SHADOW_X
The shadow offset in pixels. Inherited. -
SHADOW_Y
The shadow offset in pixels. Inherited. -
GRADIENT_COLOR
The color of the gradient. Inherited. -
GRADIENT_TYPE
The type of gradient. Inherited. -
OUTLINE_WIDTH
The stroke width of the outline, when using a vector outline. -
OUTLINE_CAP
The line cap for the outline, when using a vector outline. -
OUTLINE_JOIN
The line join for the outline, when using a vector outline. -
HALIGN
The horizontal alignment of an element. Not inherited. -
VALIGN
The vertical alignment of an element. Not inherited. -
FONT
The font used to render text. Inherited. -
TEXT_WRAP
Whether or not to allow text to wrap. When text cannot wrap and does not fit into the allowed space, it is truncated. Not inherited. -
TEXT_EFFECT
The effect to use when rendering text, if any. Inherited. -
UNDERLINE
Whether or not to underline text. Inherited. -
LINE_SPACING
The line spacing to use when rendering multiline text. This is an adjustment to the default line spacing, not an absolute value. -
AUTO_SHRINK
Whether or not to automatically shrink a text widget's font size until it fits into the horizontal space it has been allotted. Cannot be used withTEXT_WRAP
. Not inherited. -
MIN_FONT_SIZE
IfAUTO_SHRINK
is enabled, the minimum font size to use when shrinking. Not inherited. -
ELLIPSIZE
Whether or not to automatically clip a text widget's text to fit into the horizontal space it has been allotted. Cannot be used withTEXT_WRAP
. Can be combined withAUTO_SHRINK
: In that case, shrinking will be applied first, then if the text still does not fit, it will be clipped. Not inherited. -
BACKGROUND
The background for an element. Not inherited. -
ICON_POS
The position relative to the text to render an icon for labels, buttons, etc. -
ICON_GAP
The gap between the icon and text in labels, buttons, etc. -
ICON_CUDDLE
If true, the icon is cuddled to the text, with extra space between icon and border, if false, the icon is placed next to the border with extra space between icon and label. -
ICON_EFFECT
The effect to apply to the icon. -
ACTION_SOUND
The sound to be played when this element's action is triggered. -
inherited
public final boolean inheritedIndicates whether or not this style property is inherited.
-
-
Method Details
-
createTextStyle
Creates a text style instance based on the supplied element's stylings. -
getDefault
Returns the default value for this style for the supplied element. -
is
Returns aStyle.Binding
with this style bound to the specified value. -
newStyle
Creates a style identifier with the supplied properties. -
newFlag
Creates a boolean style identifier with the supplied properties.
-