Class ALspLabelTextProviderStyle

All Implemented Interfaces:
ILcdCloneable, ILspStyler, Cloneable
Direct Known Subclasses:
TLspDataObjectLabelTextProviderStyle, TLspRulerDistanceFormatStyle

public abstract class ALspLabelTextProviderStyle extends ALspStyle implements ILcdCloneable

This style provides a method to retrieve the text to use for a label. Styles extending from this class should implement the getText method.

Note that if the text to be painted starts with <html>, TLspLabelPainter uses HTML to format and paint the text.

  • Constructor Details

    • ALspLabelTextProviderStyle

      protected ALspLabelTextProviderStyle()
      Creates a new ALspLabelTextProviderStyle.
  • Method Details

    • isTransparent

      public boolean isTransparent()
      Description copied from class: ALspStyle
      Determines whether this style is transparent.

      Shapes that are transparent can be painted in a different paint phase than shapes that are not transparent.

      Specified by:
      isTransparent in class ALspStyle
      whether or not this style is transparent
    • getText

      public String[] getText(Object aDomainObject, Object aSubLabelID, TLspContext aContext)

      Returns text (one or more strings) for the given domain object and sublabel ID. When no label should be painted, this method should return null or an empty array.

      By default, this method returns an array containing only the result of the toString() method of the given domain object.

      When overriding this method, the implementation should make sure that the returned text is consistent for the given label. I.e. it should not return a different String every time it is called for a given label. Not doing so may lead to worse performance and incorrectly visualized labels.

      aDomainObject - a domain object.
      aSubLabelID - a sublabel ID.
      aContext - the context.
      text for the given identifier.
    • clone

      Description copied from interface: ILcdCloneable

      Makes Object.clone() public.

      When for example extending from java.lang.Object, it can be implemented like this:
       public Object clone() {
         try {
           return super.clone();
         } catch ( CloneNotSupportedException e ) {
           // Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
           throw new RuntimeException( e );
      Specified by:
      clone in interface ILcdCloneable
      clone in class Object
      See Also:
    • asBuilder

      public ALspLabelTextProviderStyle.Builder<?> asBuilder()
      Creates a new builder initialized with all the properties of this style.
      Specified by:
      asBuilder in class ALspStyle
      the new builder.