public static class StyleParser.StyleInfo

  1. Object
  2. StyleParser.StyleInfo
Encapculates a style string in structured format.

Constructors

public StyleInfo(String... styleString)Parses the given style strings and encapsulates their details in a StyleInfo object.
public StyleInfo(Map<String, String> values)Creates a new StyleInfo given the parsed Map of keys and values.
public StyleInfo()Creates a new StyleInfo.
public StyleInfo(StyleParser.StyleInfo info)Creates a new style info by copying styles from existing style info.

Methods

public StyleParser.PaddingInfo getPadding()
public StyleParser.StyleInfo setPadding(String padding)Sets the padding.
public StyleParser.MarginInfo getMargin()
public StyleParser.StyleInfo setMargin(String margin)Sets the margin.
public StyleParser.BorderInfo getBorder()
public StyleParser.StyleInfo setBorder(String border)Sets the border
public StyleParser.FontInfo getFont()
public StyleParser.StyleInfo setFont(String font)Sets the font in the style info.
public StyleParser.StyleInfo setFontSize(String fontSize)Sets the font size in the style.
public StyleParser.StyleInfo setFontName(String fontName)Sets the font name.
public Integer getBgColor()
public StyleParser.StyleInfo setBgColor(String bgColor)Sets the background color.
public Integer getFgColor()
public StyleParser.StyleInfo setFgColor(String fgColor)Sets the foreground color.
public Integer getTransparency()
public StyleParser.StyleInfo setTransparency(String transparency)Sets the transparency.
public Integer getOpacity()
public StyleParser.StyleInfo setOpacity(String opacity)Sets the opacity.
public Integer getAlignment()
public StyleParser.StyleInfo setAlignment(int alignment)Sets the alignment for this style.
public StyleParser.StyleInfo setAlignment(String alignment)Sets the alignment for this style as a String.
public String getAlignmentAsString()Returns the alignment as a string.
public Integer getBgType()Gets the background type.
public StyleParser.StyleInfo setBgType(String type)Sets the background type as a string.
public StyleParser.StyleInfo setBgType(Integer i)Sets the background type as one of the Style.BACKGROUND_XXX constants.
public String getBgTypeAsString()Gets the bgType as a string.
public StyleParser.ImageInfo getBgImage()
public StyleParser.StyleInfo setBgImage(String bgImage)Sets the background image.
public Integer getTextDecoration()
public String getTextDecorationAsString()Gets the text decoration as a string.
public String toStyleString()Builds a style string that is encapsulated by this style object.

Inherited methods

Constructor details

StyleInfo

public StyleInfo(String... styleString)
Parses the given style strings and encapsulates their details in a StyleInfo object.

Parameters

styleString String...
One or more style strings.

StyleInfo

public StyleInfo(Map<String, String> values)
Creates a new StyleInfo given the parsed Map of keys and values.

StyleInfo

public StyleInfo()
Creates a new StyleInfo.

StyleInfo

public StyleInfo(StyleParser.StyleInfo info)
Creates a new style info by copying styles from existing style info.

Parameters

info StyleParser.StyleInfo
Style to copy.

Method details

getPadding

public StyleParser.PaddingInfo getPadding()

Returns

The padding of the style. Will return null if padding wasn’t specified.

setPadding

public StyleParser.StyleInfo setPadding(String padding)
Sets the padding.

Parameters

padding String
A valid padding string. E.g. “1mm”, or “2mm 3px 0 5mm”

Returns

Self for chaining.

getMargin

public StyleParser.MarginInfo getMargin()

Returns

The margin of the style. Will return null if margin wasn’t specified.

setMargin

public StyleParser.StyleInfo setMargin(String margin)
Sets the margin.

Parameters

margin String
A valid margin string. E.g. “1mm”, or “2mm 3px 0 0”

Returns

Self for chaining.

getBorder

public StyleParser.BorderInfo getBorder()

Returns

The border of the style. Will return null if border wasn’t specified.

setBorder

public StyleParser.StyleInfo setBorder(String border)
Sets the border

Parameters

border String
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

public StyleParser.FontInfo getFont()

Returns

The font of the style. Will return null if font wasn’t specified.

setFont

public StyleParser.StyleInfo setFont(String font)
Sets the font in the style info.

Parameters

font String
A valid font style string. E.g. “2mm native:MainRegular”

Returns

Self for chaining.

setFontSize

public StyleParser.StyleInfo setFontSize(String fontSize)
Sets the font size in the style.

Parameters

fontSize String
A valid font size. E.g. “2mm”

Returns

Self for chaining.

setFontName

public StyleParser.StyleInfo setFontName(String fontName)
Sets the font name.

Parameters

fontName String
A valid font name. E.g. “native:MainRegular”

Returns

Self for chaining.

getBgColor

public Integer getBgColor()

Returns

The background color of the style. Will return null if bgColor wasn’t specified.

setBgColor

public StyleParser.StyleInfo setBgColor(String bgColor)
Sets the background color.

Parameters

bgColor String
A valid color string. E.g. “ff0000”

getFgColor

public Integer getFgColor()

Returns

The foreground color of the style. Will return null if fgColor wasn’t specified.

setFgColor

public StyleParser.StyleInfo setFgColor(String fgColor)
Sets the foreground color.

Parameters

fgColor String
A valid color string. E.g. “ff0000”

Returns

Self for chaining.

getTransparency

public Integer getTransparency()

Returns

The background transparency of the style. Will return null if transparency wasn’t specified.

setTransparency

public StyleParser.StyleInfo setTransparency(String transparency)
Sets the transparency.

Parameters

transparency String
A valid transparency string (0-255). E.g. “255”

Returns

Self for chaining.

getOpacity

public Integer getOpacity()

Returns

The opacity of the style. Will return null if the opacity wasn’t specified.

setOpacity

public StyleParser.StyleInfo setOpacity(String opacity)
Sets the opacity.

Parameters

opacity String
A valid opacity string (0-255). E.g. “255”

Returns

Self for chaining.

getAlignment

public Integer getAlignment()

Returns

The alignment of the style. One of Component#LEFT, Component#RIGHT, Component#CENTER. Or null if alignment wasn’t specified.

setAlignment

public StyleParser.StyleInfo setAlignment(int alignment)
Sets the alignment for this style. One of Component#LEFT, Component#RIGHT, Component#CENTER

Parameters

alignment int
One of Component#LEFT, Component#RIGHT, Component#CENTER

Returns

Self for chaining.

setAlignment

public StyleParser.StyleInfo setAlignment(String alignment)
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.

getAlignmentAsString

public String getAlignmentAsString()
Returns the alignment as a string. “center”, “left”, “right”, or null.

getBgType

public Integer getBgType()
Gets the background type. Will return null if bgType wasn’t specified. Returns one of Style.BACKGROUND_XXX constants.

setBgType

public StyleParser.StyleInfo setBgType(String type)
Sets the background type as a string.

Parameters

type String
A valid background type string. E.g. “image_scaled_fit”

Returns

Self for chaining.

setBgType

public StyleParser.StyleInfo setBgType(Integer i)
Sets the background type as one of the Style.BACKGROUND_XXX constants.

Parameters

i Integer
A background type. One of Style.BACKGROUND_XXX constants.

Returns

Self for chaining.

getBgTypeAsString

public String getBgTypeAsString()
Gets the bgType as a string.

getBgImage

public StyleParser.ImageInfo getBgImage()

Returns

The background image for the style. Will return null if bgImage wasn’t specified.

setBgImage

public StyleParser.StyleInfo setBgImage(String bgImage)
Sets the background image.

Parameters

bgImage String
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

public Integer 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

public String 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

public String 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.