public static class StyleParser.BorderInfo
- Object
- StyleParser.BorderInfo
Encapsulates information about the border property of a style string.
Constructors
public BorderInfo() |
Methods
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
themeResources- 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
outdouble[]- An out parameter. 4-element array of insets. Indices
Component#TOP,Component#BOTTOM,Component#LEFT, andComponent#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
typeString- 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
spliceImageString- 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
imagesString[]- 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
spliceInsetsString- the spliceInsets to set
setSpliceInsets
public void setSpliceInsets(double[] insets)For a splicedImage border, sets the splice insets as a 4-element array.
Parameters
insetsdouble[]- 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
insetsdouble[]- 4-element array of insets.Indices Component#TOP , Component#BOTTOM, Component#LEFT, and Component#RIGHT.
decimalPlacesint- 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
See also
setWidth
public void setWidth(Float width)For a line/dashed/dotted/underline/round border, gets the thickness value.
Parameters
widthFloat- the width to set
See also
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
widthUnitbyte- the widthUnit to set
See also
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
colorInteger- 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
opacityInteger- 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
strokeColorInteger- 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
strokeOpacityInteger- 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
shadowOpacityInteger- 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
shadowXFloat- 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
shadowYFloat- 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
shadowBlurFloat- 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
shadowSpreadStyleParser.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
rectangleBoolean- 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
topOnlyModeBoolean- 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
bottomOnlyModeBoolean- 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
topLeftModeBoolean- 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
topRightModeBoolean- 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
bottomLeftModeBoolean- 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
bottomRightModeBoolean- 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
cornerRadiusFloat- 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
cornerRadiusString- the cornerRadius to set
setCornerRadius
public void setCornerRadius(StyleParser.ScalarValue sv)Used for roundRect border. Sets the corner radius
Parameters
svStyleParser.ScalarValue- The corner radius to set.