Class TLspCustomizableStyle
- All Implemented Interfaces:
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.- Since:
- 2012.0
- See Also:
-
Constructor Summary
ConstructorDescriptionTLspCustomizableStyle
(ALspStyle aStyle, boolean aEnabled) Create a new, namelessTLspCustomizableStyle
foraStyle
TLspCustomizableStyle
(ALspStyle aStyle, boolean aEnabled, String aIdentifier, String aDisplayName) Create a new, namedTLspCustomizableStyle
foraStyle
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPropertyChangeListener
(PropertyChangeListener aPropertyChangeListener) Registers the givenPropertyChangeListener
to be notified when this object's properties change.Returns a name for this style container which can be presented to the user and can be used in the UI.Returns the identifier associated with this style container.getStyle()
Returns the style contained in this containerboolean
Returns whether this style is enabled or not.void
removePropertyChangeListener
(PropertyChangeListener aPropertyChangeListener) De-registers the givenPropertyChangeListener
from receiving property change events for this object.void
setEnabled
(boolean aEnabled) Set the enabled state of this stylevoid
Set the new style for this container.
-
Constructor Details
-
TLspCustomizableStyle
Create a new, namelessTLspCustomizableStyle
foraStyle
- Parameters:
aStyle
- The style for this container. Must not benull
aEnabled
-true
when the style is enabled,false
when the style is disabled
-
TLspCustomizableStyle
public TLspCustomizableStyle(ALspStyle aStyle, boolean aEnabled, String aIdentifier, String aDisplayName) Create a new, namedTLspCustomizableStyle
foraStyle
- Parameters:
aStyle
- The style for this container. Must not benull
aEnabled
-true
when the style is enabled,false
when the styleaIdentifier
- The identifier for this style. May benull
. SeegetIdentifier()
.aDisplayName
- The display name for this style. May benull
. SeegetDisplayName()
.
-
-
Method Details
-
getIdentifier
Returns the identifier associated with this style container. This identifier does not need to be unique and can be used for multiple purposes. An example use-case is styling a layer representing cities, where one wants to have separate styling for 'big' cities and 'small' cities. In this case this identifier can be used to mark the style which will be used for the 'big' cities and which will be used for 'small' cities.- Returns:
- the name associated with this container. Can be
null
-
getDisplayName
Returns a name for this style container which can be presented to the user and can be used in the UI.- Returns:
- a name for this style container which can be presented to the user and can be used in
the UI. Can be
null
-
getStyle
Returns the style contained in this container- Returns:
- the style contained in this container. Will never be
null
-
setStyle
Set the new style for this container.- Parameters:
aStyle
- the new style. Must not benull
-
addPropertyChangeListener
Description copied from interface: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.- Specified by:
addPropertyChangeListener
in interfaceILcdPropertyChangeSource
- Parameters:
aPropertyChangeListener
- The listener to be notified- See Also:
-
removePropertyChangeListener
Description copied from interface: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.- Specified by:
removePropertyChangeListener
in interfaceILcdPropertyChangeSource
- Parameters:
aPropertyChangeListener
- the listener that should no longer be notified of changes of this object's properties- See Also:
-
isEnabled
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.- Returns:
true
when this style is enabled,false
when the style is disabled.
-
setEnabled
public void setEnabled(boolean aEnabled) Set the enabled state of this style- Parameters:
aEnabled
-true
to enable this style,false
to disable- See Also:
-