public class TLspStyler extends ALspStyler
ALspStyleTargetProvider
to specify style targets or basic
filtering.
It is possible to specify multiple ALspStyleTargetProvider
instances together with a corresponding list of styles. In this case, all
providers will be applied to all objects with their corresponding set of
styles.Constructor and Description |
---|
TLspStyler(ALspStyle... aStyles)
Creates a styler that will apply the given styles to all objects.
|
TLspStyler(ALspStyleTargetProvider aStyleTargetProvider,
ALspStyle... aStyles)
Creates a styler that will apply the given style target provider and list of styles
to all objects.
|
TLspStyler(ALspStyleTargetProvider aStyleTargetProvider,
List<? extends ALspStyle> aStyles)
Creates a styler that will apply the given style target provider and list of styles
to all objects.
|
TLspStyler(List<? extends ALspStyle> aStyles)
Creates a styler that will apply the given styles to all objects.
|
TLspStyler(Map<? extends ALspStyleTargetProvider,List<? extends ALspStyle>> aStyles)
Creates a composite styler that will apply the given styles and style target
providers to all objects.
|
Modifier and Type | Method and Description |
---|---|
void |
addStyles(ALspStyleTargetProvider aStyleTargetProvider,
ALspStyle... aStyles)
Adds the given style target provider and a corresponding list of styles to
this composite style.
|
void |
addStyles(ALspStyleTargetProvider aStyleTargetProvider,
List<? extends ALspStyle> aStyles)
Adds the given style target provider and a corresponding list of styles to
this composite style.
|
Map<ALspStyleTargetProvider,List<ALspStyle>> |
getStyles()
Returns all styles that are in use.
|
void |
setStyles(ALspStyle... aStyles)
Replace all currently set styles with
aStyles . |
void |
setStyles(List<? extends ALspStyle> aStyles)
Replace all currently set styles with
aStyles . |
void |
style(Collection<?> aObjects,
ALspStyleCollector aStyleCollector,
TLspContext aContext)
Styles the objects or labels contained in
aObjects using the methods provided
by ALspStyleCollector . |
addStyleChangeListener, fireStyleChangeEvent, fireStyleChangeEvent, removeStyleChangeListener
public TLspStyler(ALspStyle... aStyles)
aStyles
- The set of styles that will be applied.public TLspStyler(List<? extends ALspStyle> aStyles)
aStyles
- The list of styles that will be applied.public TLspStyler(Map<? extends ALspStyleTargetProvider,List<? extends ALspStyle>> aStyles)
aStyles
- A map containing ALspStyleTargetProviders and the styles that
correspond to them.public TLspStyler(ALspStyleTargetProvider aStyleTargetProvider, List<? extends ALspStyle> aStyles)
aStyleTargetProvider
- The style target provider that will be usedaStyles
- The styles that will be applied to the output of the style target providerpublic TLspStyler(ALspStyleTargetProvider aStyleTargetProvider, ALspStyle... aStyles)
aStyleTargetProvider
- The style target provider that will be usedaStyles
- The styles that will be applied to the output of the style target providerpublic void addStyles(ALspStyleTargetProvider aStyleTargetProvider, List<? extends ALspStyle> aStyles)
ALspStyleTargetProvider
, it will be overridden.
The given style target provider will be applied to all objects.aStyleTargetProvider
- A style target provider, can be null.aStyles
- The styles to be set for aStyleTargetProviderpublic void addStyles(ALspStyleTargetProvider aStyleTargetProvider, ALspStyle... aStyles)
ALspStyleTargetProvider
, it will be overridden.
The given style target provider will be applied to all objects.aStyleTargetProvider
- A style target provider, can be null.aStyles
- The styles to be set for aStyleTargetProviderpublic Map<ALspStyleTargetProvider,List<ALspStyle>> getStyles()
public void setStyles(List<? extends ALspStyle> aStyles)
aStyles
.aStyles
- The new set of styles.public void setStyles(ALspStyle... aStyles)
aStyles
.aStyles
- The new set of styles.public void style(Collection<?> aObjects, ALspStyleCollector aStyleCollector, TLspContext aContext)
ILspStyler
Styles the objects or labels contained in aObjects
using the methods provided
by ALspStyleCollector
.
Example usages for object styling:
// Same style for all objects:
aStyleCollector.objects(aObjects).style(myStyle).submit();
// Object specific styling:
aStyleCollector.object(myObject1).style(myStyle1).submit();
aStyleCollector.object(myObject2).style(myStyle2).submit();
Example usages for label styling:
if (aStyleCollector instanceof ALspLabelStyleCollector) {
ALspLabelStyleCollector labelStyleCollector = (ALspLabelStyleCollector)aStyleCollector;
// Specify a priority for all labels of all objects:
labelStyleCollector.objects(aDomainObjects).allLabels().priority(3).styles(...).submit();
// Specify an algorithm for a specific label:
labelStyleCollector.object(myObject1).label(123).algorithm(...).styles(...).submit();
}
The objects that are provided to aStyleCollector
must be objects that are contained in
aObjects
. Note that not all objects have to be styled. Objects that are not submitted in
aStyleCollector
will not be painted.
This method can be called very frequently, depending on the (amount of) data. If this method is not implemented efficiently, painting performance may be affected.
aObjects
- The objects to be styled.aStyleCollector
- A style collector to which all styling information
should be passed, this collector is only valid within this method
call, and can no longer be used afterwards.aContext
- Provides context information that may affect styling, such as view specific properties.