# Class StyleParser.StyleInfo

java.lang.Object
com.codename1.ui.plaf.StyleParser.StyleInfo

Enclosing class:
  `StyleParser`

public static class StyleParser.StyleInfo extends Object
Encapculates a style string in structured format.

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Integer`
  `getAlignment()`

  ###### Returns

  `String`
  `getAlignmentAsString()`
  Returns the alignment as a string.
  `Integer`
  `getBgColor()`

  ###### Returns

  `StyleParser.ImageInfo`
  `getBgImage()`

  ###### Returns

  `Integer`
  `getBgType()`
  Gets the background type.
  `String`
  `getBgTypeAsString()`
  Gets the bgType as a string.
  `StyleParser.BorderInfo`
  `getBorder()`

  ###### Returns

  `Integer`
  `getFgColor()`

  ###### Returns

  `StyleParser.FontInfo`
  `getFont()`

  ###### Returns

  `StyleParser.MarginInfo`
  `getMargin()`

  ###### Returns

  `Integer`
  `getOpacity()`

  ###### Returns

  `StyleParser.PaddingInfo`
  `getPadding()`

  ###### Returns

  `Integer`
  `getTextDecoration()`

  ###### Returns

  `String`
  `getTextDecorationAsString()`
  Gets the text decoration as a string.
  `Integer`
  `getTransparency()`

  ###### Returns

  `StyleParser.StyleInfo`
  `setAlignment(int alignment)`
  Sets the alignment for this style.
  `StyleParser.StyleInfo`
  `setAlignment(String alignment)`
  Sets the alignment for this style as a String.
  `StyleParser.StyleInfo`
  `setBgColor(String bgColor)`
  Sets the background color.
  `StyleParser.StyleInfo`
  `setBgImage(String bgImage)`
  Sets the background image.
  `StyleParser.StyleInfo`
  `setBgType(Integer i)`
  Sets the background type as one of the Style.BACKGROUND_XXX constants.
  `StyleParser.StyleInfo`
  `setBgType(String type)`
  Sets the background type as a string.
  `StyleParser.StyleInfo`
  `setBorder(String border)`
  Sets the border
  `StyleParser.StyleInfo`
  `setFgColor(String fgColor)`
  Sets the foreground color.
  `StyleParser.StyleInfo`
  `setFont(String font)`
  Sets the font in the style info.
  `StyleParser.StyleInfo`
  `setFontName(String fontName)`
  Sets the font name.
  `StyleParser.StyleInfo`
  `setFontSize(String fontSize)`
  Sets the font size in the style.
  `StyleParser.StyleInfo`
  `setMargin(String margin)`
  Sets the margin.
  `StyleParser.StyleInfo`
  `setOpacity(String opacity)`
  Sets the opacity.
  `StyleParser.StyleInfo`
  `setPadding(String padding)`
  Sets the padding.
  `StyleParser.StyleInfo`
  `setTransparency(String transparency)`
  Sets the transparency.
  `String`
  `toStyleString()`
  Builds a style string that is encapsulated by this style object.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `final Class`
  `getClass()`
  Returns the runtime class of an object.
  `int`
  `hashCode()`
  Returns a hash code value for the object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `String`
  `toString()`
  Returns a string representation of the object.
  `final void`
  `wait()`
  Causes current thread to wait until another thread invokes the method or the method for this object.
  `final void`
  `wait(long timeout)`
  Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
  `final void`
  `wait(long timeout, int nanos)`
  Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.

- ## Constructor Details

  - ### StyleInfo

    public StyleInfo(String... styleString)

    Parses the given style strings and encapsulates their details in a StyleInfo object.

    ###### Parameters

    - `styleString`: One or more style strings.

  - ### StyleInfo

    public StyleInfo(Map<String,String> values)

    Creates a new StyleInfo given the parsed Map of keys and values.

    ###### Parameters

    - `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`: 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`: 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`: 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`: 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`: 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`: A valid font size. E.g. "2mm"

    ###### Returns

    Self for chaining.

  - ### setFontName

    public StyleParser.StyleInfo setFontName(String fontName)

    Sets the font name.

    ###### Parameters

    - `fontName`: 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`: 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`: 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`: 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`: A valid opacity string (0-255). E.g. "255"

    ###### Returns

    Self for chaining.

  - ### getAlignment

    public Integer getAlignment()

    ###### Returns

    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`: 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.

    ###### Parameters

    - `alignment`

  - ### 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`: 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`: 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`: 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.