Class ALcyFormatBar
- All Implemented Interfaces:
ILcdPropertyChangeSource
(Swing) component that can be displayed to manipulate a layer of a given format. Manipulation can be anything. A typical use could be to have buttons to start drawing new domain objects into (the model of) the layer.
For an example use of these bars, please refer to the TLcyFormatBarAddOn
.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The key representing the long description of a format bar.static final String
Constant key for Name property.static final String
The key representing the short description of a format bar.static final String
The key representing the icon value of an application pane. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPropertyChangeListener
(PropertyChangeListener aListener) Registers the givenPropertyChangeListener
to be notified when this object's properties change.void
addPropertyChangeListener
(String aProperty, PropertyChangeListener aListener) Adds the given listener to the list of listeners, so that it will receive notifications about changes inaProperty
.abstract boolean
canSetLayer
(ILcdLayer aLayer) Returnstrue
if the layer can be accepted,false
otherwise.protected void
firePropertyChange
(String aProperty, Object aOldValue, Object aNewValue) Fires the given event to the associated listeners.abstract Component
Returns the (Swing) component that can be displayed to the end-user.getLayer()
Returns the associated layer.Gets one of this object's properties using the associated key.void
Sets one of this object's properties using the associated key.void
De-registers the givenPropertyChangeListener
from receiving property change events for this object.void
removePropertyChangeListener
(String aProperty, PropertyChangeListener aListener) Removes the given listener for the given property, so that it no longer receives those change events.void
Sets the layer to the given layer.protected abstract void
updateForLayer
(ILcdLayer aPreviousLayer, ILcdLayer aLayer) Called bysetLayer(com.luciad.view.ILcdLayer)
when a new layer is set.
-
Field Details
-
NAME
Constant key for Name property. Its associated value should be of typeString
.- See Also:
-
SMALL_ICON
The key representing the icon value of an application pane. The value corresponding to this key must be anILcdIcon
.- See Also:
-
SHORT_DESCRIPTION
The key representing the short description of a format bar. The value corresponding to this key must be aString
.- See Also:
-
LONG_DESCRIPTION
The key representing the long description of a format bar. The value corresponding to this key must be aString
.- See Also:
-
-
Constructor Details
-
ALcyFormatBar
protected ALcyFormatBar()Creates a new format bar named "Toolbar"
-
-
Method Details
-
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:
aListener
- The listener to be notified- See Also:
-
addPropertyChangeListener
Adds the given listener to the list of listeners, so that it will receive notifications about changes inaProperty
.- Parameters:
aProperty
- The property to watch for changes.aListener
- The listener to add.
-
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:
aListener
- the listener that should no longer be notified of changes of this object's properties- See Also:
-
removePropertyChangeListener
Removes the given listener for the given property, so that it no longer receives those change events.- Parameters:
aProperty
- The property to stop listening to.aListener
- The listener to remove.
-
putValue
Sets one of this object's properties using the associated key. The keys are defined by the constants in the class, for example
SMALL_ICON
. Implementations of this interface can use these properties to show them in their user interface. For instance the icon set with the SMALL_ICON key could be shown in the tab of a tabbed pane.The type of the value is specified by the key. For instance, the key
SMALL_ICON
demands that the value is anILcdIcon
.If the value has changed, a
PropertyChangeEvent
is sent to listeners withaKey
as the property name.- Parameters:
aKey
- aString
representing the key. This must not benull
, but can otherwise be anyString
, ie. it is not restricted to being one ofSMALL_ICON
,SHORT_DESCRIPTION
orLONG_DESCRIPTION
.aValue
- anObject
value. This may benull
.- Since:
- 2013.0
- See Also:
-
getValue
Gets one of this object's properties using the associated key.- Parameters:
aKey
- theString
of the key for which you want to retrieve the value. This can be anyString
, ie. it is not restricted to being one of SMALL_ICON, SHORT_DESCRIPTION or LONG_DESCRIPTION.- Returns:
- The
Object
value corresponding toaKey
, ornull
if no value corresponding toaKey
could be found. The type of this value is determined by the key. For instance, theSMALL_ICON
key specifies that the returned value is anILcdIcon
. - Since:
- 2013.0
- See Also:
-
firePropertyChange
Fires the given event to the associated listeners.- Parameters:
aProperty
- The property that was changed.aOldValue
- The old value.aNewValue
- The new value.
-
getLayer
Returns the associated layer.- Returns:
- the associated layer.
-
setLayer
Sets the layer to the given layer. InvokesupdateForLayer(com.luciad.view.ILcdLayer, com.luciad.view.ILcdLayer)
so that sub-classes can update their representation for the new layer.- Parameters:
aLayer
- The layer to manipulate. Can benull
, which indicates a (temporary) de-initialization.- Throws:
IllegalArgumentException
- IfcanSetLayer(com.luciad.view.ILcdLayer)
returnsfalse
for the same layer.
-
updateForLayer
Called bysetLayer(com.luciad.view.ILcdLayer)
when a new layer is set.- Parameters:
aPreviousLayer
- The previously set layer. Can benull
. This parameter can for example be useful to remove listeners from it.aLayer
- The new layer, to update this bar for. Can benull
.
-
canSetLayer
Returns
true
if the layer can be accepted,false
otherwise.A typical implementation would verify that only the layers of its own format are accepted.
Another implementation could be to only accept one specific layer instance, so that the
ALcyFormatBar
cannot be reused for other layer instances of the same type, which might simplify the implementation of thisALcyFormatBar
.- Parameters:
aLayer
- The layer to test.- Returns:
true
if the layer can be accepted,false
otherwise.null
must be accepted as this indicates a (temporary) de-initialization.
-
getComponent
Returns the (Swing) component that can be displayed to the end-user.- Returns:
- the (Swing) component that can be displayed to the end-user.
-