Class TLspLabelStyler

All Implemented Interfaces:
ILspCustomizableStyler, ILspStyler

public final class TLspLabelStyler extends ALspLabelStyler implements ILspCustomizableStyler

A label styler that applies the same styling and label location information to all objects.

This styler implements ILspCustomizableStyler. So all styles that are added to this styler are wrapped with a TLspCustomizableStyle, and returned by the getStyles() method. As an alternative, it is possible to explicitly add customizable styles to this styler, see setCustomizableStyles or Builder.customizableStyles.

newBuilder() allows you to easily create a new TLspLabelStyler.

By default, this styler applies a TLspTextStyle to all objects and no specific labeling configuration.

Note that if you don't need any labeling-specific settings, you can also use a regular ILspStyler.

Since:
2012.0
  • Method Details

    • newBuilder

      public static TLspLabelStyler.Builder newBuilder()
      Creates a new builder with the default values:
      Returns:
      the new builder.
    • asBuilder

      public TLspLabelStyler.Builder asBuilder()
      Creates a new builder initialized with all the properties of this styler.
      Returns:
      the new builder.
    • style

      public void style(Collection<?> aDomainObjects, ALspLabelStyleCollector aCollector, TLspContext aContext)
      Description copied from class: ALspLabelStyler

      Convenience method that takes an ALspLabelStyleCollector as argument instead of an ALspStyleCollector. This method is called from ALspLabelStyler.style(Collection, ALspStyleCollector, TLspContext).

      Specified by:
      style in class ALspLabelStyler
      Parameters:
      aDomainObjects - The set of domain objects to provide information for
      aCollector - The label style collector to submit the information to.
      aContext - The context
      See Also:
    • setLocations

      public void setLocations(int aShift, TLspLabelLocationProvider.Location... aLocations)
      Specifies a set of fixed locations to be used for the label(s).
      Parameters:
      aShift - the amount of pixels the labels must be removed from the object anchor point.
      aLocations - a list of possible locations to place the labels.
    • setLocations

      public void setLocations(TLspLabelLocationProvider.Location... aLocations)
      Specifies a set of fixed locations to be used for the label(s).
      Parameters:
      aLocations - a list of possible locations to place the labels.
    • setAlgorithm

      public void setAlgorithm(ILspLabelingAlgorithm aAlgorithm)
      Specifies the labeling algorithm to be used for the label(s).
      Parameters:
      aAlgorithm - The algorithm to be used.
    • getAlgorithm

      public ILspLabelingAlgorithm getAlgorithm()
      Returns the labeling algorithm to be used for the label(s).
      Returns:
      the labeling algorithm to be used for the label(s).
    • setAlgorithmProvider

      public void setAlgorithmProvider(ILspLabelingAlgorithmProvider aAlgorithmProvider)
      Specifies the labeling algorithm provider to be used for the label(s).
      Parameters:
      aAlgorithmProvider - The algorithm provider to be used.
    • getAlgorithmProvider

      public ILspLabelingAlgorithmProvider getAlgorithmProvider()
      Returns the labeling algorithm provider to be used for the label(s).
      Returns:
      the labeling algorithm provider to be used for the label(s).
    • setStyler

      public void setStyler(ILspStyler aDelegateStyler)
      Sets a delegate styler.

      This styler will be called for all objects.

      Parameters:
      aDelegateStyler - the delegate styler.
    • getStyler

      public ILspStyler getStyler()
      Returns the delegate styler.
      Returns:
      the delegate styler.
    • setStyles

      public void setStyles(ALspStyle... aStyles)
      Specifies a list of styles to be applied to all objects.

      Note that getStyles() returns these styles, wrapped with a TLspCustomizableStyle.

      Parameters:
      aStyles - The styles to apply.
    • setCustomizableStyles

      public void setCustomizableStyles(TLspCustomizableStyle... aStyles)
      Specifies a list of styles to be applied to all objects.
      Parameters:
      aStyles - The styles to apply.
    • setGroup

      public void setGroup(String aGroup)
      Specifies the declutter group the label(s) should be in.

      By default, DEFAULT_DECLUTTER_GROUP is used.

      Parameters:
      aGroup - The desired declutter group.
      See Also:
    • getGroup

      public String getGroup()
      Returns the declutter group the label(s) should be in.
      Returns:
      the declutter group the label(s) should be in.
      See Also:
    • setPriority

      public void setPriority(Integer aPriority)
      Specifies a fixed priority for the label(s).

      By default, labels have priority Integer.MAX_VALUE, low priority.

      Parameters:
      aPriority - The desired priority, 0 being highest priority.
    • getPriority

      public Integer getPriority()
      Returns the fixed priority for the label(s).
      Returns:
      the fixed priority for the label(s).
    • setPriorityProvider

      public void setPriorityProvider(ILspLabelPriorityProvider aPriorityProvider)
      Specifies a priority provider for the label(s).
      Parameters:
      aPriorityProvider - The priority provider that can specify priorities.
    • getPriorityProvider

      public ILspLabelPriorityProvider getPriorityProvider()
      Returns the priority provider for the label(s).
      Returns:
      the priority provider for the label(s).
    • getStyles

      public Collection<TLspCustomizableStyle> getStyles()
      Description copied from interface: ILspCustomizableStyler

      Returns the styler's customizable styles. When modifications are made to the styles, the styler will automatically inform its listeners about the change. The following changes can be made:

      • Styles can be enabled or disabled. Only the enabled styles will be set in the style method.
      • The ALspStyle in the TLspCustomizableStyle may be replaced
      The collection is not ordered, but you can use the identifier of the TLspCustomizableStyle to recognize and order the styles.
      Specified by:
      getStyles in interface ILspCustomizableStyler
      Returns:
      An immutable collection containing all styles which will be set in the style method