Class StyleParser.BorderInfo

java.lang.Object
com.codename1.ui.plaf.StyleParser.BorderInfo
Enclosing class:
StyleParser

public static class StyleParser.BorderInfo extends Object
Encapsulates information about the border property of a style string.
  • 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.
      Overrides:
      toString in class Object
    • 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: 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: 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: 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: 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: 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: 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: 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: 4-element array of insets.Indices Component#TOP , Component#BOTTOM, Component#LEFT, and Component#RIGHT.

      • decimalPlaces: 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
      • #getWidthUnit()
    • setWidth

      public void setWidth(Float width)

      For a line/dashed/dotted/underline/round border, gets the thickness value.

      Parameters
      • width: the width to set
      See also
      • #setWidthUnit(byte)
    • 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.
    • getWidthUnit

      public byte getWidthUnit()

      For a line/dashed/dotted/underline/round border, gets the unit of the thickness value.

      Returns

      the widthUnit

      See also
      • #getWidth()
    • setWidthUnit

      public void setWidthUnit(byte widthUnit)

      For a line/dashed/dotted/underline/round border, sets the unit of the thickness value.

      Parameters
      • widthUnit: the widthUnit to set
      See also
      • #setWidth(java.lang.Float)
    • 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: 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: 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: 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: 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: 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: 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: 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: 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: 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.

      Parameters
      • val
    • 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: 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: 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: 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: 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: 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: 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: the bottomRightMode to set
    • getCornerRadius

      public Float getCornerRadius()

      Used for roundRect border. The corner radius.

      Returns

      the cornerRadius

      See also
      • RoundRectBorder#cornerRadius(float)
    • setCornerRadius

      public void setCornerRadius(Float cornerRadius)

      Used for roundRect border. Sets the corner radius.

      Parameters
      • cornerRadius: the cornerRadius to set
      See also
      • RoundRectBorder#cornerRadius(float)
    • 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: the cornerRadius to set
      See also
      • RoundRectBorder#cornerRadius(float)

      • #setCornerRadius(java.lang.Float)

      • #setCornerRadius(com.codename1.ui.plaf.StyleParser.ScalarValue)

      • RoundRectBorder#cornerRadius(float)

    • setCornerRadius

      public void setCornerRadius(StyleParser.ScalarValue sv)

      Used for roundRect border. Sets the corner radius

      Parameters
      • sv: The corner radius to set.
      See also
      • #setCornerRadius(java.lang.Float)

      • #setCornerRadius(java.lang.String)

      • RoundRectBorder#cornerRadius(float)