Class TLspDataObjectLabelTextProviderStyle

All Implemented Interfaces:
ILcdCloneable, ILspStyler, Cloneable

public class TLspDataObjectLabelTextProviderStyle extends ALspLabelTextProviderStyle
Implementation of ALspLabelTextProviderStyle that retrieves the label content through the ILcdDataObject interface. When the domain object of the given label does not implement ILcdDataObject, object.toString() is used instead.

When the object of the label implements the ILcdDataObject interface, it computes the value of the expression specified in the constructor.

Expressions are converted into strings using this object's data object expression language. The default data object language expression of this label painter is TLcdDataObjectExpressionLanguage.

In many cases, the default data object language is sufficient. For example, the following code specifies two properties that should be used for a label:

TLspDataObjectLabelTextProviderStyle.newBuilder().expressions( "name", "population" ).build();

Since:
2012.0
  • Constructor Details

    • TLspDataObjectLabelTextProviderStyle

      protected TLspDataObjectLabelTextProviderStyle(TLspDataObjectLabelTextProviderStyle.Builder aBuilder)
      Creates a new TLspDataObjectLabelTextProviderStyle based on the provided builder.
      Parameters:
      aBuilder - a builder which provides the necessary data for constructing a TLspDataObjectLabelTextProviderStyle
  • Method Details

    • newBuilder

      public static TLspDataObjectLabelTextProviderStyle.Builder<?> newBuilder()
      Creates a new builder with the default values.
      Returns:
      the new builder.
    • asBuilder

      Creates a new builder initialized with all the properties of this style.
      Overrides:
      asBuilder in class ALspLabelTextProviderStyle
      Returns:
      the new builder.
    • getExpressions

      public String[] getExpressions()
      Returns the expressions that are evaluated to compute the label of the object. The returned expressions can be an empty array, but never null.
      Returns:
      the expressions
    • getDataObjectExpressionLanguage

      public ALcdDataObjectExpressionLanguage getDataObjectExpressionLanguage()
      Returns the data object expression language used by this label painter.
      Returns:
      the data object expression language used by this label painter
    • getText

      public String[] getText(Object aDomainObject, Object aSubLabelID, TLspContext aContext)
      Description copied from class: ALspLabelTextProviderStyle

      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.

      Overrides:
      getText in class ALspLabelTextProviderStyle
      Parameters:
      aDomainObject - a domain object.
      aSubLabelID - a sublabel ID.
      aContext - the context.
      Returns:
      text for the given identifier.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class ALspStyle
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ALspStyle