public static class StyleParser.BorderInfo

  1. Object
  2. StyleParser.BorderInfo
Encapsulates information about the border property of a style string.

Constructors

public BorderInfo()

Methods

public String toString()Returns the border as a style string value.
public String widthString()Returns width as a string, including units.
public String colorString()Returns the border color as a hex string.
public Border createBorder(Resources theme)Creates the border that is described by this border info.
public double[] getSpliceInsets(double[] out)For a splicedImage border, this gets the spliced insets as a 4-element array of double values.
public String getType()The border type.
public void setType(String type)Sets the border type.
public String getSpliceImage()The image to use for a splicedImage border.
public void setSpliceImage(String spliceImage)Sets the image to use for a splicedImage border.
public String[] getImages()Gets the images to use for image, horizontalImage, and verticalImage borders.
public void setImages(String[] images)Sets the images used by image, horizontalImage, and verticalImage borders.
public String getSpliceInsets()For splicedImage border, this gets the splice insets as a single string.
public void setSpliceInsets(String spliceInsets)Sest the splice insets for a splicedImage border.
public void setSpliceInsets(double[] insets)For a splicedImage border, sets the splice insets as a 4-element array.
public void setSpliceInsets(double[] insets, int decimalPlaces)Sets the splicedImage border insets as a 4-element array and rounds each entry to the specified number of decimal places
public Float getWidth()For a line/dashed/dotted/underline/round border, the thickness value.
public void setWidth(Float width)For a line/dashed/dotted/underline/round border, gets the thickness value.
public StyleParser.ScalarValue getThickness()Gets the border thickness as a scalar value.
public Integer getWidthInPixels()For line/dashed/dotted/underline border.
public byte getWidthUnit()For a line/dashed/dotted/underline/round border, gets the unit of the thickness value.
public void setWidthUnit(byte widthUnit)For a line/dashed/dotted/underline/round border, sets the unit of the thickness value.
public Integer getColor()For a line/dashed/dotted/underline/round border, sets the color.
public void setColor(Integer color)For a line/dashed/dotted/underline/round border, gets the color.
public Integer getOpacity()Gets the fill opacity of round border.
public void setOpacity(Integer opacity)Sets teh fill opacity of round border.
public Integer getStrokeColor()Gets the stroke color for round border.
public void setStrokeColor(Integer strokeColor)Sets the stroke color for round border.
public Integer getStrokeOpacity()Gets the stroke opacity for round border.
public void setStrokeOpacity(Integer strokeOpacity)Sets the stroke opacity for round border.
public Integer getShadowOpacity()Sets the shadow opacity for round border.
public void setShadowOpacity(Integer shadowOpacity)Sets the shadow opacity for round border.
public Float getShadowX()Gets the shadowX property of round border.
public void setShadowX(Float shadowX)Sets the shadowX property of round border.
public Float getShadowY()Gets the shadowY property of round border.
public void setShadowY(Float shadowY)Sets the shadowY property of round border.
public Float getShadowBlur()Gets the blur for round border.
public void setShadowBlur(Float shadowBlur)Sets the blur for round border.
public StyleParser.ScalarValue getShadowSpread()Gets the shadow spread for round border.
public void setShadowSpread(StyleParser.ScalarValue shadowSpread)Sets the shadow spread for round border.
public void setShadowSpread(String val)Sets the shadow spread for round border as a string.
public Boolean getRectangle()Checks whether round border should grow to a rectangle.
public void setRectangle(Boolean rectangle)Sets whether round border should grow to a rectangle.
public Boolean getTopOnlyMode()Used only for roundRect border.
public void setTopOnlyMode(Boolean topOnlyMode)Used only for roundRect border.
public Boolean getBottomOnlyMode()Used for roundRect border.
public void setBottomOnlyMode(Boolean bottomOnlyMode)Used for roundRect border.
public Boolean getTopLeftMode()Used for roundRect border.
public void setTopLeftMode(Boolean topLeftMode)Used for roundRect border.
public Boolean getTopRightMode()Used for roundRect border.
public void setTopRightMode(Boolean topRightMode)Used for roundRect border.
public Boolean getBottomLeftMode()Used for roundRect border.
public void setBottomLeftMode(Boolean bottomLeftMode)Used for roundRect border.
public Boolean getBottomRightMode()Used for roundRect border.
public void setBottomRightMode(Boolean bottomRightMode)Used for roundRect border.
public Float getCornerRadius()Used for roundRect border.
public void setCornerRadius(Float cornerRadius)Used for roundRect border.
public void setCornerRadius(String cornerRadius)Used for roundRect border.
public void setCornerRadius(StyleParser.ScalarValue sv)Used for roundRect border.

Inherited methods

Constructor details

BorderInfo

public BorderInfo()

Method details

toString

public String toString()
Returns the border as a style string value. This value is formatted in a way that can be parsed by the StyleParser.

widthString

public String widthString()
Returns width as a string, including units. If the width isn’t set, this outputs “1px”.

colorString

public String colorString()
Returns the border color as a hex string. If no color is set, this returns the empty string.

createBorder

public Border createBorder(Resources theme)
Creates the border that is described by this border info.

Parameters

theme Resources
Theme resource file used to load images that are referenced.

Returns

A Border.

getSpliceInsets

public double[] getSpliceInsets(double[] out)
For a splicedImage border, this gets the spliced insets as a 4-element array of double values.

Parameters

out double[]
An out parameter. 4-element array of insets. Indices Component#TOP, Component#BOTTOM, Component#LEFT, and Component#RIGHT.

Returns

4-element array of insets. Indices Component#TOP, Component#BOTTOM, Component#LEFT, and Component#RIGHT.

getType

public String getType()
The border type. E.g. line, dashed, dotted, underline, image, horizontalImage, verticalImage, splicedImage.

Returns

the type

setType

public void setType(String type)
Sets the border type.

Parameters

type String
the type to set. E.g. line, dashed, dotted, underline, image, horizontalImage, verticalImage, splicedImage.

getSpliceImage

public String getSpliceImage()
The image to use for a splicedImage border.

Returns

the spliceImage

setSpliceImage

public void setSpliceImage(String spliceImage)
Sets the image to use for a splicedImage border.

Parameters

spliceImage String
the spliceImage to set

getImages

public String[] getImages()
Gets the images to use for image, horizontalImage, and verticalImage borders.

Returns

the images

setImages

public void setImages(String[] images)
Sets the images used by image, horizontalImage, and verticalImage borders.

Parameters

images String[]
the images to set

getSpliceInsets

public String getSpliceInsets()
For splicedImage border, this gets the splice insets as a single string.

Returns

the spliceInsets

setSpliceInsets

public void setSpliceInsets(String spliceInsets)
Sest the splice insets for a splicedImage border.

Parameters

spliceInsets String
the spliceInsets to set

setSpliceInsets

public void setSpliceInsets(double[] insets)
For a splicedImage border, sets the splice insets as a 4-element array.

Parameters

insets double[]
4-element array. Indices Component#TOP , Component#BOTTOM, Component#LEFT, and Component#RIGHT.

setSpliceInsets

public void setSpliceInsets(double[] insets, int decimalPlaces)
Sets the splicedImage border insets as a 4-element array and rounds each entry to the specified number of decimal places

Parameters

insets double[]
4-element array of insets.Indices Component#TOP , Component#BOTTOM, Component#LEFT, and Component#RIGHT.
decimalPlaces int
Number of decimal places to round to.

getWidth

public Float getWidth()
For a line/dashed/dotted/underline/round border, the thickness value.

Returns

the width

setWidth

public void setWidth(Float width)
For a line/dashed/dotted/underline/round border, gets the thickness value.

Parameters

width Float
the width to set

getThickness

public StyleParser.ScalarValue getThickness()
Gets the border thickness as a scalar value. This is effectively the same value as returned by #getWidth() and #getWidthUnit()

Returns

The thickness of the border. Used with line, dashed, dotted, underline, and round borders.

getWidthInPixels

public Integer getWidthInPixels()
For line/dashed/dotted/underline border. The thickness in pixels.

Returns

The thickness in pixels of the border line.

See also

getWidthUnit

public byte getWidthUnit()
For a line/dashed/dotted/underline/round border, gets the unit of the thickness value.

Returns

the widthUnit

See also

setWidthUnit

public void setWidthUnit(byte widthUnit)
For a line/dashed/dotted/underline/round border, sets the unit of the thickness value.

Parameters

widthUnit byte
the widthUnit to set

getColor

public Integer getColor()
For a line/dashed/dotted/underline/round border, sets the color. For round border this gets the fill color. For line border variants, it gets the stroke color.

Returns

the color

setColor

public void setColor(Integer color)
For a line/dashed/dotted/underline/round border, gets the color. For round border, this sets the fill color. For line border variants, it sets the stroke color.

Parameters

color Integer
the color to set

getOpacity

public Integer getOpacity()
Gets the fill opacity of round border. Only used for round border

Returns

the opacity The opacity of the round border.

setOpacity

public void setOpacity(Integer opacity)
Sets teh fill opacity of round border. Only used for round border.

Parameters

opacity Integer
the opacity to set

getStrokeColor

public Integer getStrokeColor()
Gets the stroke color for round border. This is only used for round border. Line border variants should use #getColor()

Returns

the strokeColor

setStrokeColor

public void setStrokeColor(Integer strokeColor)
Sets the stroke color for round border. This is only used for round border. Line border variants should use #setColor(java.lang.Integer)

Parameters

strokeColor Integer
the strokeColor to set

getStrokeOpacity

public Integer getStrokeOpacity()
Gets the stroke opacity for round border. This is only used for round border.

Returns

the strokeOpacity

setStrokeOpacity

public void setStrokeOpacity(Integer strokeOpacity)
Sets the stroke opacity for round border. This is only used for round border.

Parameters

strokeOpacity Integer
the strokeOpacity to set

getShadowOpacity

public Integer getShadowOpacity()
Sets the shadow opacity for round border. This is only used for round border.

Returns

the shadowOpacity

setShadowOpacity

public void setShadowOpacity(Integer shadowOpacity)
Sets the shadow opacity for round border. This is only used for round border.

Parameters

shadowOpacity Integer
the shadowOpacity to set

getShadowX

public Float getShadowX()
Gets the shadowX property of round border.

Returns

the shadowX

setShadowX

public void setShadowX(Float shadowX)
Sets the shadowX property of round border.

Parameters

shadowX Float
the shadowX to set

getShadowY

public Float getShadowY()
Gets the shadowY property of round border.

Returns

the shadowY

setShadowY

public void setShadowY(Float shadowY)
Sets the shadowY property of round border.

Parameters

shadowY Float
the shadowY to set

getShadowBlur

public Float getShadowBlur()
Gets the blur for round border.

Returns

the shadowBlur

setShadowBlur

public void setShadowBlur(Float shadowBlur)
Sets the blur for round border.

Parameters

shadowBlur Float
the shadowBlur to set

getShadowSpread

public StyleParser.ScalarValue getShadowSpread()
Gets the shadow spread for round border.

Returns

the shadowSpread

setShadowSpread

public void setShadowSpread(StyleParser.ScalarValue shadowSpread)
Sets the shadow spread for round border.

Parameters

shadowSpread StyleParser.ScalarValue
the shadowSpread to set

setShadowSpread

public void setShadowSpread(String val)
Sets the shadow spread for round border as a string. String must be valid scalar value. E.g. 2mm, or 3px.

getRectangle

public Boolean getRectangle()
Checks whether round border should grow to a rectangle. Only used for round border.

Returns

the rectangle

setRectangle

public void setRectangle(Boolean rectangle)
Sets whether round border should grow to a rectangle. Only used for round border.

Parameters

rectangle Boolean
the rectangle to set

getTopOnlyMode

public Boolean getTopOnlyMode()
Used only for roundRect border. The value to set for RoundRectBorder#topOnlyMode(boolean). Returns null if this flag isn’t set at all.

Returns

the topOnlyMode

setTopOnlyMode

public void setTopOnlyMode(Boolean topOnlyMode)
Used only for roundRect border. The value to set for RoundRectBorder#topOnlyMode(boolean). Set to null to not set this flag at all.

Parameters

topOnlyMode Boolean
the topOnlyMode to set

getBottomOnlyMode

public Boolean getBottomOnlyMode()
Used for roundRect border. The value to set for RoundRectBorder#bottomOnlyMode(boolean). Returns null if this property is ignored.

Returns

the bottomOnlyMode

setBottomOnlyMode

public void setBottomOnlyMode(Boolean bottomOnlyMode)
Used for roundRect border. The value to set for RoundRectBorder#bottomOnlyMode(boolean). Set to null to ignore this property.

Parameters

bottomOnlyMode Boolean
the bottomOnlyMode to set

getTopLeftMode

public Boolean getTopLeftMode()
Used for roundRect border. The value to set for RoundRectBorder#topLeftMode(boolean). Returns null if this property is ignored.

Returns

the topLeftMode

setTopLeftMode

public void setTopLeftMode(Boolean topLeftMode)
Used for roundRect border. The value to set for RoundRectBorder#topLeftMode(boolean). Set null to ignore property.

Parameters

topLeftMode Boolean
the topLeftMode to set

getTopRightMode

public Boolean getTopRightMode()
Used for roundRect border. The value to set for RoundRectBorder#topRightMode(boolean). Returns null if property is ignored.

Returns

the topRightMode

setTopRightMode

public void setTopRightMode(Boolean topRightMode)
Used for roundRect border. The value to set for RoundRectBorder#topRightMode(boolean). Sets null to ignore property.

Parameters

topRightMode Boolean
the topRightMode to set

getBottomLeftMode

public Boolean getBottomLeftMode()
Used for roundRect border. The value to set for RoundRectBorder#bottomLeftMode(boolean). Returns null if property is ignored.

Returns

the bottomLeftMode

setBottomLeftMode

public void setBottomLeftMode(Boolean bottomLeftMode)
Used for roundRect border. The value to set for RoundRectBorder#bottomLeftMode(boolean). Set null to ignore property.

Parameters

bottomLeftMode Boolean
the bottomLeftMode to set

getBottomRightMode

public Boolean getBottomRightMode()
Used for roundRect border. The value to set for RoundRectBorder#bottomRightMode(boolean). Returns null if property is ignored.

Returns

the bottomRightMode

setBottomRightMode

public void setBottomRightMode(Boolean bottomRightMode)
Used for roundRect border. The value to set for RoundRectBorder#bottomRightMode(boolean). Set null to ignore property.

Parameters

bottomRightMode Boolean
the bottomRightMode to set

getCornerRadius

public Float getCornerRadius()
Used for roundRect border. The corner radius.

Returns

the cornerRadius

setCornerRadius

public void setCornerRadius(Float cornerRadius)
Used for roundRect border. Sets the corner radius.

Parameters

cornerRadius Float
the cornerRadius to set

setCornerRadius

public void setCornerRadius(String cornerRadius)
Used for roundRect border. Sets the corner radius as a scalar value. E.g. “2mm” or “2px'

Parameters

cornerRadius String
the cornerRadius to set

setCornerRadius

public void setCornerRadius(StyleParser.ScalarValue sv)
Used for roundRect border. Sets the corner radius

Parameters

sv StyleParser.ScalarValue
The corner radius to set.