public class TLspDataObjectLabelTextProviderStyle extends ALspLabelTextProviderStyle
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();
Modifier and Type | Class and Description |
---|---|
static class |
TLspDataObjectLabelTextProviderStyle.Builder<B extends TLspDataObjectLabelTextProviderStyle.Builder<B>>
Builder for data object text provider using expressions.
|
Modifier | Constructor and Description |
---|---|
protected |
TLspDataObjectLabelTextProviderStyle(TLspDataObjectLabelTextProviderStyle.Builder aBuilder)
Creates a new
TLspDataObjectLabelTextProviderStyle based on the provided builder. |
Modifier and Type | Method and Description |
---|---|
TLspDataObjectLabelTextProviderStyle.Builder<?> |
asBuilder()
Creates a new builder initialized with all the properties of this style.
|
boolean |
equals(Object o) |
ALcdDataObjectExpressionLanguage |
getDataObjectExpressionLanguage()
Returns the data object expression language used by this label painter.
|
String[] |
getExpressions()
Returns the expressions that are evaluated to compute the label of the object.
|
String[] |
getText(Object aDomainObject,
Object aSubLabelID,
TLspContext aContext)
Returns text (one or more strings) for the given domain object and sublabel ID.
|
int |
hashCode() |
static TLspDataObjectLabelTextProviderStyle.Builder<?> |
newBuilder()
Creates a new builder with the default values.
|
clone, isTransparent
addStyleChangeListener, getZOrder, isCompatible, removeStyleChangeListener, style
protected TLspDataObjectLabelTextProviderStyle(TLspDataObjectLabelTextProviderStyle.Builder aBuilder)
TLspDataObjectLabelTextProviderStyle
based on the provided builder.aBuilder
- a builder which provides the necessary data for constructing a TLspDataObjectLabelTextProviderStyle
public static TLspDataObjectLabelTextProviderStyle.Builder<?> newBuilder()
public TLspDataObjectLabelTextProviderStyle.Builder<?> asBuilder()
asBuilder
in class ALspLabelTextProviderStyle
public String[] getExpressions()
null
.public ALcdDataObjectExpressionLanguage getDataObjectExpressionLanguage()
public String[] getText(Object aDomainObject, Object aSubLabelID, TLspContext aContext)
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.
getText
in class ALspLabelTextProviderStyle
aDomainObject
- a domain object.aSubLabelID
- a sublabel ID.aContext
- the context.