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
FieldsModifier and TypeFieldDescriptionstatic final StringThe key representing the long description of a format bar.static final StringConstant key for Name property.static final StringThe key representing the short description of a format bar.static final StringThe key representing the icon value of an application pane. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertyChangeListener(PropertyChangeListener aListener) Registers the givenPropertyChangeListenerto be notified when this object's properties change.voidaddPropertyChangeListener(String aProperty, PropertyChangeListener aListener) Adds the given listener to the list of listeners, so that it will receive notifications about changes inaProperty.abstract booleancanSetLayer(ILcdLayer aLayer) Returnstrueif the layer can be accepted,falseotherwise.protected voidfirePropertyChange(String aProperty, Object aOldValue, Object aNewValue) Fires the given event to the associated listeners.abstract ComponentReturns 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.voidSets one of this object's properties using the associated key.voidDe-registers the givenPropertyChangeListenerfrom receiving property change events for this object.voidremovePropertyChangeListener(String aProperty, PropertyChangeListener aListener) Removes the given listener for the given property, so that it no longer receives those change events.voidSets the layer to the given layer.protected abstract voidupdateForLayer(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: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:
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: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:
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_ICONdemands that the value is anILcdIcon.If the value has changed, a
PropertyChangeEventis sent to listeners withaKeyas the property name.- Parameters:
aKey- aStringrepresenting the key. This must not benull, but can otherwise be anyString, ie. it is not restricted to being one ofSMALL_ICON,SHORT_DESCRIPTIONorLONG_DESCRIPTION.aValue- anObjectvalue. This may benull.- Since:
- 2013.0
- See Also:
-
getValue
Gets one of this object's properties using the associated key.- Parameters:
aKey- theStringof 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
Objectvalue corresponding toaKey, ornullif no value corresponding toaKeycould be found. The type of this value is determined by the key. For instance, theSMALL_ICONkey 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)returnsfalsefor 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
trueif the layer can be accepted,falseotherwise.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
ALcyFormatBarcannot be reused for other layer instances of the same type, which might simplify the implementation of thisALcyFormatBar.- Parameters:
aLayer- The layer to test.- Returns:
trueif the layer can be accepted,falseotherwise.nullmust 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.
-