public final class TLspCustomizableStyle extends Object implements ILcdPropertyChangeSource
ALspStyle
.
In combination with ILspStyledLayer
and TLspCustomizableStyler
, it enables interactive style
customization of existing layers in a view.
The contained ALspStyle
can be inspected, disabled,
or replaced.
Refer to ALspStyle.asBuilder()
to conveniently create style copies with cherry-picked changes.
Most default layer configurations come with customizable styles out of the box.TLspCustomizableStyler
Constructor and Description |
---|
TLspCustomizableStyle(ALspStyle aStyle,
boolean aEnabled)
Create a new, nameless
TLspCustomizableStyle for aStyle |
TLspCustomizableStyle(ALspStyle aStyle,
boolean aEnabled,
String aIdentifier,
String aDisplayName)
Create a new, named
TLspCustomizableStyle for aStyle |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
Registers the given
PropertyChangeListener to be notified when this object's
properties change. |
String |
getDisplayName()
Returns a name for this style container which can be presented to the user and can be used in
the UI.
|
String |
getIdentifier()
Returns the identifier associated with this style container.
|
ALspStyle |
getStyle()
Returns the style contained in this container
|
boolean |
isEnabled()
Returns whether this style is enabled or not.
|
void |
removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
De-registers the given
PropertyChangeListener from receiving property change events
for this object. |
void |
setEnabled(boolean aEnabled)
Set the enabled state of this style
|
void |
setStyle(ALspStyle aStyle)
Set the new style for this container.
|
public TLspCustomizableStyle(ALspStyle aStyle, boolean aEnabled)
TLspCustomizableStyle
for aStyle
aStyle
- The style for this container. Must not be null
aEnabled
- true
when the style is enabled, false
when the style
is disabledpublic TLspCustomizableStyle(ALspStyle aStyle, boolean aEnabled, String aIdentifier, String aDisplayName)
TLspCustomizableStyle
for aStyle
aStyle
- The style for this container. Must not be null
aEnabled
- true
when the style is enabled, false
when the
styleaIdentifier
- The identifier for this style. May be null
. See getIdentifier()
.aDisplayName
- The display name for this style. May be null
. See getDisplayName()
.public String getIdentifier()
null
public String getDisplayName()
null
public ALspStyle getStyle()
null
public void setStyle(ALspStyle aStyle)
aStyle
- the new style. Must not be null
public void addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
ILcdPropertyChangeSource
Registers the given PropertyChangeListener
to be notified when this object's
properties change.
In case you need to register a listener which keeps a reference to an object with a shorter life-time than this change source,
you can use a ALcdWeakPropertyChangeListener
instance as property change listener.
addPropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- The listener to be notifiedALcdWeakPropertyChangeListener
,
ILcdPropertyChangeSource.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
ILcdPropertyChangeSource
De-registers the given PropertyChangeListener
from receiving property change events
for this object.
If the listener was added more than once, it will be notified one less time after being
removed.
If the listener is null
, or was never added, no exception is thrown and no action is taken.
removePropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- the listener that should no longer be notified of changes of
this object's propertiesILcdPropertyChangeSource.addPropertyChangeListener(java.beans.PropertyChangeListener)
public boolean isEnabled()
Returns whether this style is enabled or not. Disable styles will not be set by the TLspCustomizableStyler
.
When using a TLspCustomizableStyler
, toggling this setting allows to switch a style
on/off without the need to add/remove it from the list of styles in the styler.
true
when this style is enabled, false
when the style is
disabled.public void setEnabled(boolean aEnabled)
aEnabled
- true
to enable this style, false
to disableisEnabled()