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
.
Modifier and Type | Class and Description |
---|---|
static class |
TLspLabelStyler.Builder
Builder for static label styler.
|
Modifier and Type | Method and Description |
---|---|
TLspLabelStyler.Builder |
asBuilder()
Creates a new builder initialized with all the properties of this styler.
|
ILspLabelingAlgorithm |
getAlgorithm()
Returns the labeling algorithm to be used for the label(s).
|
ILspLabelingAlgorithmProvider |
getAlgorithmProvider()
Returns the labeling algorithm provider to be used for the label(s).
|
String |
getGroup()
Returns the declutter group the label(s) should be in.
|
Integer |
getPriority()
Returns the fixed priority for the label(s).
|
ILspLabelPriorityProvider |
getPriorityProvider()
Returns the priority provider for the label(s).
|
ILspStyler |
getStyler()
Returns the delegate styler.
|
Collection<TLspCustomizableStyle> |
getStyles()
Returns the styler's customizable styles.
|
static TLspLabelStyler.Builder |
newBuilder()
Creates a new builder with the default values:
No styles
Default declutter group (
DEFAULT_DECLUTTER_GROUP )
Default labeling algorithm
Default priorities, which is Integer.MAX_VALUE , lowest priority
|
void |
setAlgorithm(ILspLabelingAlgorithm aAlgorithm)
Specifies the labeling algorithm to be used for the label(s).
|
void |
setAlgorithmProvider(ILspLabelingAlgorithmProvider aAlgorithmProvider)
Specifies the labeling algorithm provider to be used for the label(s).
|
void |
setCustomizableStyles(TLspCustomizableStyle... aStyles)
Specifies a list of styles to be applied to all objects.
|
void |
setGroup(String aGroup)
Specifies the declutter group the label(s) should be in.
|
void |
setLocations(int aShift,
TLspLabelLocationProvider.Location... aLocations)
Specifies a set of fixed locations to be used for the label(s).
|
void |
setLocations(TLspLabelLocationProvider.Location... aLocations)
Specifies a set of fixed locations to be used for the label(s).
|
void |
setPriority(Integer aPriority)
Specifies a fixed priority for the label(s).
|
void |
setPriorityProvider(ILspLabelPriorityProvider aPriorityProvider)
Specifies a priority provider for the label(s).
|
void |
setStyler(ILspStyler aDelegateStyler)
Sets a delegate styler.
|
void |
setStyles(ALspStyle... aStyles)
Specifies a list of styles to be applied to all objects.
|
void |
style(Collection<?> aDomainObjects,
ALspLabelStyleCollector aCollector,
TLspContext aContext)
Convenience method that takes an
ALspLabelStyleCollector as argument instead of
an ALspStyleCollector . |
style
addStyleChangeListener, fireStyleChangeEvent, fireStyleChangeEvent, removeStyleChangeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addStyleChangeListener, removeStyleChangeListener, style
public static TLspLabelStyler.Builder newBuilder()
DEFAULT_DECLUTTER_GROUP
)Integer.MAX_VALUE
, lowest prioritypublic TLspLabelStyler.Builder asBuilder()
public void style(Collection<?> aDomainObjects, ALspLabelStyleCollector aCollector, TLspContext aContext)
ALspLabelStyler
Convenience method that takes an ALspLabelStyleCollector
as argument instead of
an ALspStyleCollector
. This method is called from
ALspLabelStyler.style(Collection, ALspStyleCollector, TLspContext)
.
style
in class ALspLabelStyler
aDomainObjects
- The set of domain objects to provide information foraCollector
- The label style collector to submit the information to.aContext
- The contextALspLabelStyleCollector
,
ILspStyler
public void setLocations(int aShift, TLspLabelLocationProvider.Location... aLocations)
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.public void setLocations(TLspLabelLocationProvider.Location... aLocations)
aLocations
- a list of possible locations to place the labels.public void setAlgorithm(ILspLabelingAlgorithm aAlgorithm)
aAlgorithm
- The algorithm to be used.public ILspLabelingAlgorithm getAlgorithm()
public void setAlgorithmProvider(ILspLabelingAlgorithmProvider aAlgorithmProvider)
aAlgorithmProvider
- The algorithm provider to be used.public ILspLabelingAlgorithmProvider getAlgorithmProvider()
public void setStyler(ILspStyler aDelegateStyler)
This styler will be called for all objects.
aDelegateStyler
- the delegate styler.public ILspStyler getStyler()
public void setStyles(ALspStyle... aStyles)
Note that getStyles()
returns these styles, wrapped with a
TLspCustomizableStyle
.
aStyles
- The styles to apply.public void setCustomizableStyles(TLspCustomizableStyle... aStyles)
aStyles
- The styles to apply.public void setGroup(String aGroup)
By default, DEFAULT_DECLUTTER_GROUP
is used.
aGroup
- The desired declutter group.TLspLabelPlacer
public String getGroup()
setGroup(String)
public void setPriority(Integer aPriority)
By default, labels have priority Integer.MAX_VALUE
, low priority.
aPriority
- The desired priority, 0 being highest priority.public Integer getPriority()
public void setPriorityProvider(ILspLabelPriorityProvider aPriorityProvider)
aPriorityProvider
- The priority provider that can specify priorities.public ILspLabelPriorityProvider getPriorityProvider()
public Collection<TLspCustomizableStyle> getStyles()
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:
ALspStyle
in the TLspCustomizableStyle
may be replacedidentifier
of the
TLspCustomizableStyle
to recognize and order the styles.getStyles
in interface ILspCustomizableStyler
style
method