Class LabelElement


  • public final class LabelElement
    extends AbstractNode
    Maps the label options of a AnnotationElement at runtime.
    Author:
    Andrea "Stock" Stocchero
    • Method Detail

      • setDisplay

        public void setDisplay​(boolean display)
        Sets true whether the annotation label should be displayed.
        Parameters:
        display - true whether the annotation should be displayed
      • isDisplay

        public boolean isDisplay()
        Returns true whether the annotation label should be displayed.
        Returns:
        true whether the annotation label should be displayed
      • setPosition

        public void setPosition​(LabelPosition position)
        Sets the anchor position of label on line.
        Parameters:
        position - the anchor position of label on line
      • getPosition

        public LabelPosition getPosition()
        Returns the anchor position of label on line.
        Returns:
        the anchor position of label on line
      • setPositionAsPercentage

        public void setPositionAsPercentage​(double percentage)
        Sets the position of label on line by the percentage (value between 0 and 1) of the line dimension.
        Parameters:
        percentage - the position of label on line by the percentage (value between 0 and 1) of the line dimension
      • getPositionAsPercentage

        public double getPositionAsPercentage()
        Returns the position of label on line by the percentage (value between 0 and 1) of the line dimension.
        Returns:
        the position of label on line by the percentage (value between 0 and 1) of the line dimension
      • setAutoRotation

        public void setAutoRotation​(boolean autoRotation)
        Sets true whether the rotation of label must calculates automatically.
        Parameters:
        autoRotation - true whether the rotation of label must calculates automatically
      • isAutoRotation

        public boolean isAutoRotation()
        Returns true whether the rotation of label must calculates automatically.
        Returns:
        true whether the rotation of label must calculates automatically
      • getFont

        public final IsFont getFont()
        Returns the font element.
        Returns:
        the font element.
      • getPadding

        public final IsPadding getPadding()
        Returns the padding element.
        Returns:
        the padding element.
      • getAlignPosition

        public final AlignPositionElement getAlignPosition()
        Returns the anchor position of label on line.
        Returns:
        the anchor position of label on line
      • setBorderColor

        public final void setBorderColor​(IsColor borderColor)
        Sets the color of the border of annotation.
        Parameters:
        borderColor - the color of the border of annotation
      • setBorderColor

        public final void setBorderColor​(String borderColor)
        Sets the color of the border of annotation.
        Parameters:
        borderColor - the color of the border of annotation
      • getBorderColorAsString

        public final String getBorderColorAsString()
        Returns the color of the border of annotation.
        Returns:
        the color of the border of annotation
      • getBorderColor

        public final IsColor getBorderColor()
        Returns the color of the border of annotation.
        Returns:
        the color of the border of annotation
      • setBorderWidth

        public final void setBorderWidth​(int borderWidth)
        Sets the width of the border in pixels.
        Parameters:
        borderWidth - the width of the border in pixels.
      • getBorderWidth

        public final int getBorderWidth()
        Returns the width of the border in pixels.
        Returns:
        the width of the border in pixels.
      • setBorderDash

        public final void setBorderDash​(int... borderDash)
        Sets the line dash pattern used when stroking lines, using an array of values which specify alternating lengths of lines and gaps which describe the pattern.
        Parameters:
        borderDash - the line dash pattern used when stroking lines, using an array of values which specify alternating lengths of lines and gaps which describe the pattern.
      • getBorderDash

        public final List<Integer> getBorderDash()
        Returns the line dash pattern used when stroking lines, using an array of values which specify alternating lengths of lines and gaps which describe the pattern.
        Returns:
        the line dash pattern used when stroking lines, using an array of values which specify alternating lengths of lines and gaps which describe the pattern.
      • setBorderDashOffset

        public final void setBorderDashOffset​(double borderDashOffset)
        Sets the line dash pattern offset.
        Parameters:
        borderDashOffset - the line dash pattern offset.
      • getBorderDashOffset

        public final double getBorderDashOffset()
        Returns the line dash pattern offset.
        Returns:
        the line dash pattern offset.
      • setBorderShadowColor

        public final void setBorderShadowColor​(IsColor borderColor)
        Sets the color of the border shadow of annotation.
        Parameters:
        borderColor - the color of the border shadow of annotation
      • setBorderShadowColor

        public final void setBorderShadowColor​(String borderShadowColor)
        Sets the color of the border shadow of annotation.
        Parameters:
        borderShadowColor - the border shadow of the border of annotation
      • getBorderShadowColorAsString

        public final String getBorderShadowColorAsString()
        Returns the color of the border shadow of annotation.
        Returns:
        the color of the border shadow of annotation
      • setShadowBlur

        public final void setShadowBlur​(double shadowBlur)
        Sets the amount of blur applied to shadows.
        Parameters:
        shadowBlur - the amount of blur applied to shadows
      • getShadowBlur

        public final double getShadowBlur()
        Returns the amount of blur applied to shadows.
        Returns:
        the amount of blur applied to shadows
      • setShadowOffsetX

        public final void setShadowOffsetX​(int shadowOffset)
        Sets the distance that shadows will be offset horizontally.
        Parameters:
        shadowOffset - the distance that shadows will be offset horizontally.
      • getShadowOffsetX

        public final int getShadowOffsetX()
        Returns the distance that shadows will be offset horizontally.
        Returns:
        the distance that shadows will be offset horizontally.
      • setShadowOffsetY

        public final void setShadowOffsetY​(int shadowOffset)
        Sets the distance that shadows will be offset vertically.
        Parameters:
        shadowOffset - the distance that shadows will be offset vertically.
      • getShadowOffsetY

        public final int getShadowOffsetY()
        Returns the distance that shadows will be offset vertically.
        Returns:
        the distance that shadows will be offset vertically.
      • setBackgroundColor

        public final void setBackgroundColor​(IsColor backgroundColor)
        Sets the color of the background of annotation.
        Parameters:
        backgroundColor - the color of the background of annotation
      • setBackgroundColor

        public final void setBackgroundColor​(String backgroundColor)
        Sets the color of the background of annotation.
        Parameters:
        backgroundColor - the color of the background of annotation
      • getBackgroundColorAsString

        public final String getBackgroundColorAsString()
        Returns the color of the background of annotation.
        Returns:
        the color of the background of annotation
      • getBackgroundColor

        public final IsColor getBackgroundColor()
        Returns the color of the background of annotation.
        Returns:
        the color of the background of annotation
      • setBorderRadius

        public final void setBorderRadius​(int radius)
        Sets the border radius.
        Parameters:
        radius - the border radius.
      • setBorderRadius

        public final void setBorderRadius​(BarBorderRadius borderRadius)
        Sets the border radius (in pixels).
        Parameters:
        borderRadius - the border radius (in pixels).
      • getBorderRadius

        public final int getBorderRadius()
        Returns the border radius (in pixels).
        Returns:
        the border radius (in pixels).
      • getBorderRadiusAsObject

        public final BarBorderRadius getBorderRadiusAsObject()
        Returns the border radius (in pixels).
        Returns:
        the border radius (in pixels).
      • setBorderCapStyle

        public final void setBorderCapStyle​(CapStyle borderCapStyle)
        Sets how the end points of every line are drawn.
        Parameters:
        borderCapStyle - how the end points of every line are drawn.
      • getBorderCapStyle

        public final CapStyle getBorderCapStyle()
        Returns how the end points of every line are drawn.
        Returns:
        how the end points of every line are drawn.
      • setBorderJoinStyle

        public final void setBorderJoinStyle​(JoinStyle borderJoinStyle)
        Sets how two connecting segments (of lines, arcs or curves) with non-zero lengths in a shape are joined together (degenerate segments with zero lengths, whose specified end points and control points are exactly at the same position, are skipped).
        Parameters:
        borderJoinStyle - how two connecting segments (of lines, arcs or curves) with non-zero lengths in a shape are joined together
      • getBorderJoinStyle

        public final JoinStyle getBorderJoinStyle()
        Returns how two connecting segments (of lines, arcs or curves) with non-zero lengths in a shape are joined together (degenerate segments with zero lengths, whose specified end points and control points are exactly at the same position, are skipped).
        Returns:
        how two connecting segments (of lines, arcs or curves) with non-zero lengths in a shape are joined together
      • setBackgroundShadowColor

        public final void setBackgroundShadowColor​(IsColor backgroundColor)
        Sets the color of the shadow of annotation.
        Parameters:
        backgroundColor - the color of the shadow of annotation
      • setBackgroundShadowColor

        public final void setBackgroundShadowColor​(String borderShadowColor)
        Sets the color of the shadow of annotation.
        Parameters:
        borderShadowColor - the shadow of the border of annotation
      • getBackgroundShadowColorAsString

        public final String getBackgroundShadowColorAsString()
        Returns the color of the shadow of annotation.
        Returns:
        the color of the shadow of annotation
      • getBackgroundShadowColor

        public final IsColor getBackgroundShadowColor()
        Returns the color of the shadow of annotation.
        Returns:
        the color of the shadow of annotation
      • setColor

        public final void setColor​(String fontColor)
        Sets the color of text as string.
        Parameters:
        fontColor - the color of text
      • setDrawTime

        public final void setDrawTime​(DrawTime drawTime)
        Sets the draw time which defines when the annotations are drawn.
        Parameters:
        drawTime - the draw time which defines when the annotations are drawn
      • getDrawTime

        public final DrawTime getDrawTime()
        Returns the draw time which defines when the annotations are drawn.
        Returns:
        the draw time which defines when the annotations are drawn
      • setColor

        public final void setColor​(IsColor fontColor)
        Sets the color of text.
        Parameters:
        fontColor - the color of text
      • getColorAsString

        public final String getColorAsString()
        Returns the color of text as string.
        Returns:
        the color of text
      • getColor

        public final IsColor getColor()
        Returns the color of text.
        Returns:
        the color of text
      • setContent

        public final void setContent​(List<String> content)
        Sets the text to display in label.
        Provide a list to display values on a new line.
        Parameters:
        content - the text to display in label as multi-line values
      • setContent

        public final void setContent​(String... content)
        Sets the text to display in label.
        Provide an array to display values on a new line.
        Parameters:
        content - the text to display in label
      • setContent

        public final void setContent​(Img content)
        Sets the image to display in label.
        Parameters:
        content - the image to display in label
      • setContent

        public final void setContent​(Canvas content)
        Sets the canvas to display in label.
        Parameters:
        content - the canvas to display in label
      • getContent

        public final List<String> getContent()
        Returns the text to display in label as list.
        Returns:
        the text to display in label as list
      • getContentAsImage

        public final Img getContentAsImage()
        Returns the text to display in label as Img.
        Returns:
        the text to display in label as Img
      • getContentAsCanvas

        public final Canvas getContentAsCanvas()
        Returns the text to display in label as Canvas.
        Returns:
        the text to display in label as Canvas
      • setImageHeight

        public final void setImageHeight​(int height)
        Sets the height of label content, when is set as Img, in pixels in order to scale the image when drawn.
        Parameters:
        height - the height of label content, when is set as Img, in pixels in order to scale the image when drawn
      • setImageHeightAsPercentage

        public final void setImageHeightAsPercentage​(String heightPercentage)
        Sets the height of label content, when is set as Img, in percentage (format is "{n}%") in order to scale the image when drawn.
        Parameters:
        heightPercentage - the height of label content, when is set as Img, in percentage (format is "{n}%") in order to scale the image when drawn
      • getImageHeight

        public final int getImageHeight()
        Returns the height of label content, when is set as Img, in pixels in order to scale the image when drawn.
        Returns:
        the height of label content, when is set as Img, in pixels in order to scale the image when drawn
      • getImageHeightAsPercentage

        public final String getImageHeightAsPercentage()
        Returns the height of label content, when is set as Img, in percentage (format is "{n}%") in order to scale the image when drawn.
        Returns:
        the height of label content, when is set as Img, in percentage (format is "{n}%") in order to scale the image when drawn
      • setImageWidth

        public final void setImageWidth​(int width)
        Sets the width of label content, when is set as Img, in pixels in order to scale the image when drawn.
        Parameters:
        width - the height of label content, when is set as Img, in pixels in order to scale the image when drawn
      • setImageWidthAsPercentage

        public final void setImageWidthAsPercentage​(String widthPercentage)
        Sets the width of label content, when is set as Img, in percentage (format is "{n}%") in order to scale the image when drawn.
        Parameters:
        widthPercentage - the height of label content, when is set as Img, in percentage (format is "{n}%") in order to scale the image when drawn
      • getImageWidth

        public final int getImageWidth()
        Returns the width of label content, when is set as Img, in pixels in order to scale the image when drawn.
        Returns:
        the width of label content, when is set as Img, in pixels in order to scale the image when drawn
      • getImageWidthAsPercentage

        public final String getImageWidthAsPercentage()
        Returns the width of label content, when is set as Img, in percentage (format is "{n}%") in order to scale the image when drawn.
        Returns:
        the width of label content, when is set as Img, in percentage (format is "{n}%") in order to scale the image when drawn
      • setRotation

        public final void setRotation​(double rotation)
        Sets the rotation of annotation in degrees.
        Parameters:
        rotation - the rotation of annotation in degrees
      • getRotation

        public final double getRotation()
        Returns the rotation of annotation in degrees.
        Returns:
        the rotation of annotation in degrees
      • setTextAlign

        public final void setTextAlign​(TextAlign align)
        Sets the horizontal alignment of the label text when multiple lines.
        Parameters:
        align - the horizontal alignment of the label text when multiple lines
      • getTextAlign

        public final TextAlign getTextAlign()
        Returns the horizontal alignment of the label text when multiple lines.
        Returns:
        the horizontal alignment of the label text when multiple lines
      • setYAdjust

        public final void setYAdjust​(double yAdjust)
        Sets the adjustment along y-axis (top-bottom) of annotation relative to above number (can be negative).
        Parameters:
        yAdjust - the adjustment along y-axis (top-bottom) of annotation
      • getYAdjust

        public final double getYAdjust()
        Returns the adjustment along y-axis (top-bottom) of annotation relative to above number (can be negative).
        Returns:
        the adjustment along y-axis (top-bottom) of annotation
      • setXAdjust

        public final void setXAdjust​(double xAdjust)
        Sets the adjustment along x-axis (left-right) of annotation relative to above number (can be negative).
        Parameters:
        xAdjust - the adjustment along x-axis (left-right) of annotation
      • getXAdjust

        public final double getXAdjust()
        Returns the adjustment along x-axis (left-right) of annotation relative to above number (can be negative).
        Returns:
        the adjustment along x-axis (left-right) of annotation