Class StyleParser.StyleInfo
- Enclosing class:
StyleParser
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new StyleInfo.Creates a new style info by copying styles from existing style info.Parses the given style strings and encapsulates their details in a StyleInfo object.Creates a new StyleInfo given the parsed Map of keys and values. -
Method Summary
Modifier and TypeMethodDescriptionReturns
Returns the alignment as a string.Returns
Returns
Gets the background type.Gets the bgType as a string.Returns
Returns
getFont()Returns
Returns
Returns
Returns
Returns
Gets the text decoration as a string.Returns
setAlignment(int alignment) Sets the alignment for this style.setAlignment(String alignment) Sets the alignment for this style as a String.setBgColor(String bgColor) Sets the background color.setBgImage(String bgImage) Sets the background image.Sets the background type as one of the Style.BACKGROUND_XXX constants.Sets the background type as a string.Sets the bordersetFgColor(String fgColor) Sets the foreground color.Sets the font in the style info.setFontName(String fontName) Sets the font name.setFontSize(String fontSize) Sets the font size in the style.Sets the margin.setOpacity(String opacity) Sets the opacity.setPadding(String padding) Sets the padding.setTransparency(String transparency) Sets the transparency.Builds a style string that is encapsulated by this style object.
-
Constructor Details
-
StyleInfo
Parses the given style strings and encapsulates their details in a StyleInfo object.
Parameters
styleString: One or more style strings.
-
StyleInfo
-
StyleInfo
public StyleInfo()Creates a new StyleInfo. -
StyleInfo
Creates a new style info by copying styles from existing style info.
Parameters
info: Style to copy.
-
-
Method Details
-
getPadding
Returns
The padding of the style. Will return null if padding wasn't specified.
-
setPadding
Sets the padding.
Parameters
padding: A valid padding string. E.g. "1mm", or "2mm 3px 0 5mm"
Returns
Self for chaining.
-
getMargin
Returns
The margin of the style. Will return null if margin wasn't specified.
-
setMargin
Sets the margin.
Parameters
margin: A valid margin string. E.g. "1mm", or "2mm 3px 0 0"
Returns
Self for chaining.
-
getBorder
Returns
The border of the style. Will return null if border wasn't specified.
-
setBorder
Sets the border
Parameters
border: A valid border string. E.g. "1px solid ff0000", or "splicedImage notes.png 0.25 0.25 0.25 0.25"
Returns
Self for chaining.
-
getFont
Returns
The font of the style. Will return null if font wasn't specified.
-
setFont
Sets the font in the style info.
Parameters
font: A valid font style string. E.g. "2mm native:MainRegular"
Returns
Self for chaining.
-
setFontSize
Sets the font size in the style.
Parameters
fontSize: A valid font size. E.g. "2mm"
Returns
Self for chaining.
-
setFontName
Sets the font name.
Parameters
fontName: A valid font name. E.g. "native:MainRegular"
Returns
Self for chaining.
-
getBgColor
Returns
The background color of the style. Will return null if bgColor wasn't specified.
-
setBgColor
Sets the background color.
Parameters
bgColor: A valid color string. E.g. "ff0000"
-
getFgColor
Returns
The foreground color of the style. Will return null if fgColor wasn't specified.
-
setFgColor
Sets the foreground color.
Parameters
fgColor: A valid color string. E.g. "ff0000"
Returns
Self for chaining.
-
getTransparency
Returns
The background transparency of the style. Will return null if transparency wasn't specified.
-
setTransparency
Sets the transparency.
Parameters
transparency: A valid transparency string (0-255). E.g. "255"
Returns
Self for chaining.
-
getOpacity
Returns
The opacity of the style. Will return null if the opacity wasn't specified.
-
setOpacity
Sets the opacity.
Parameters
opacity: A valid opacity string (0-255). E.g. "255"
Returns
Self for chaining.
-
getAlignment
Returns
- Returns:
- The alignment of the style. One of
Component#LEFT,Component#RIGHT,Component#CENTER. Or null if alignment wasn't specified.
-
setAlignment
Sets the alignment for this style. One of
Component#LEFT,Component#RIGHT,Component#CENTERParameters
alignment: One ofComponent#LEFT,Component#RIGHT,Component#CENTER
Returns
Self for chaining.
-
setAlignment
Sets the alignment for this style as a String. Accepts either a string representation of the integer values for
Component#LEFT,Component#RIGHT,Component#CENTER. Or the literal strings "center", "left", or "right". Or null to unset this property.Parameters
alignment
-
getAlignmentAsString
Returns the alignment as a string. "center", "left", "right", or null. -
getBgType
Gets the background type. Will return null if bgType wasn't specified. Returns one of Style.BACKGROUND_XXX constants. -
setBgType
Sets the background type as a string.
Parameters
type: A valid background type string. E.g. "image_scaled_fit"
Returns
Self for chaining.
-
setBgType
Sets the background type as one of the Style.BACKGROUND_XXX constants.
Parameters
i: A background type. One of Style.BACKGROUND_XXX constants.
Returns
Self for chaining.
-
getBgTypeAsString
Gets the bgType as a string. -
getBgImage
Returns
The background image for the style. Will return null if bgImage wasn't specified.
-
setBgImage
Sets the background image.
Parameters
bgImage: A valid image string. E.g. "notes.png" (to refer to the notes.png image in the theme), or "/notes.png" to refer to notes.png in the src directory.
Returns
Self for chaining.
-
getTextDecoration
Returns
The text decoration of the style. Will return null if textDecoration wasn't specified. Returns one of Style.TEXT_DECORATION_XXX constants.
-
getTextDecorationAsString
Gets the text decoration as a string.
Returns
A valid text decoration string or null. Text decoration strings include "3d", "3d_lowered", "3d_shadow_north", "none", "strikethru", "overline", and "underline"
-
toStyleString
Builds a style string that is encapsulated by this style object. The output of this can be passed to methods like
Component#setInlineAllStyles(java.lang.String)Returns
A style string.
-