Class ALspLabelTextProviderStyle

java.lang.Object
com.luciad.view.lightspeed.style.ALspStyle
com.luciad.view.lightspeed.painter.label.style.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.

Since:
2012.0
  • 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
      Returns:
      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.

      Parameters:
      aDomainObject - a domain object.
      aSubLabelID - a sublabel ID.
      aContext - the context.
      Returns:
      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
      Overrides:
      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
      Returns:
      the new builder.