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.
Modifier and Type | Class and Description |
---|---|
static class |
ALspLabelTextProviderStyle.Builder<B extends ALspLabelTextProviderStyle.Builder<B>>
Builder for text provider styles.
|
Modifier | Constructor and Description |
---|---|
protected |
ALspLabelTextProviderStyle()
Creates a new ALspLabelTextProviderStyle.
|
Modifier and Type | Method and Description |
---|---|
ALspLabelTextProviderStyle.Builder<?> |
asBuilder()
Creates a new builder initialized with all the properties of this style.
|
ALspLabelTextProviderStyle |
clone()
Makes
Object.clone() public. |
String[] |
getText(Object aDomainObject,
Object aSubLabelID,
TLspContext aContext)
Returns text (one or more strings) for the given domain object and sublabel ID.
|
boolean |
isTransparent()
Determines whether this style is transparent.
|
addStyleChangeListener, equals, getZOrder, hashCode, isCompatible, removeStyleChangeListener, style
protected ALspLabelTextProviderStyle()
public boolean isTransparent()
ALspStyle
isTransparent
in class ALspStyle
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.
aDomainObject
- a domain object.aSubLabelID
- a sublabel ID.aContext
- the context.public ALspLabelTextProviderStyle clone()
ILcdCloneable
Makes Object.clone()
public.
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 );
}
}
clone
in interface ILcdCloneable
clone
in class Object
Object.clone()
public ALspLabelTextProviderStyle.Builder<?> asBuilder()