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
ConstructorsConstructorDescriptionTLspCustomizableStyle(ALspStyle aStyle, boolean aEnabled) Create a new, namelessTLspCustomizableStyleforaStyleTLspCustomizableStyle(ALspStyle aStyle, boolean aEnabled, String aIdentifier, String aDisplayName) Create a new, namedTLspCustomizableStyleforaStyle -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertyChangeListener(PropertyChangeListener aPropertyChangeListener) Registers the givenPropertyChangeListenerto 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 containerbooleanReturns whether this style is enabled or not.voidremovePropertyChangeListener(PropertyChangeListener aPropertyChangeListener) De-registers the givenPropertyChangeListenerfrom receiving property change events for this object.voidsetEnabled(boolean aEnabled) Set the enabled state of this stylevoidSet the new style for this container.
-
Constructor Details
-
TLspCustomizableStyle
Create a new, namelessTLspCustomizableStyleforaStyle- Parameters:
aStyle- The style for this container. Must not benullaEnabled-truewhen the style is enabled,falsewhen the style is disabled
-
TLspCustomizableStyle
public TLspCustomizableStyle(ALspStyle aStyle, boolean aEnabled, String aIdentifier, String aDisplayName) Create a new, namedTLspCustomizableStyleforaStyle- Parameters:
aStyle- The style for this container. Must not benullaEnabled-truewhen the style is enabled,falsewhen 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:ILcdPropertyChangeSourceRegisters the given
PropertyChangeListenerto 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
ALcdWeakPropertyChangeListenerinstance as property change listener.- Specified by:
addPropertyChangeListenerin interfaceILcdPropertyChangeSource- Parameters:
aPropertyChangeListener- The listener to be notified- See Also:
-
removePropertyChangeListener
Description copied from interface:ILcdPropertyChangeSourceDe-registers the given
PropertyChangeListenerfrom 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:
removePropertyChangeListenerin 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:
truewhen this style is enabled,falsewhen the style is disabled.
-
setEnabled
public void setEnabled(boolean aEnabled) Set the enabled state of this style- Parameters:
aEnabled-trueto enable this style,falseto disable- See Also:
-