public abstract class ALcdActionWrapper extends Object implements ILcdAction
Abstract decorator class for an ILcdAction
.
A typical use-case of this class if you want to add some
extra behavior to an existing action. This can be achieved by using this decorator and
override the actionPerformed
method to include the extra behavior.
DEFAULT, LONG_DESCRIPTION, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SHOW_ACTION_NAME, SMALL_ICON, VISIBLE
Modifier | Constructor and Description |
---|---|
protected |
ALcdActionWrapper(ILcdAction aDelegateAction) |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e) |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Registers the given
PropertyChangeListener to be notified when this object's
properties change. |
Object |
getValue(String key)
Returns one of this object's properties
using the associated key.
|
boolean |
isEnabled() |
void |
putValue(String key,
Object value)
Sets one of this objects properties.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
De-registers the given
PropertyChangeListener from receiving property change events
for this object. |
void |
setEnabled(boolean b)
Sets/tests the enabled state of the
ILcdAction . |
protected ALcdActionWrapper(ILcdAction aDelegateAction)
public Object getValue(String key)
ILcdAction
PropertyChangeEvent
will be sent
to listeners.getValue
in interface ILcdAction
public void putValue(String key, Object value)
ILcdAction
putValue
in interface ILcdAction
key
- one of NAME, SHORT_DESCRIPTION, LONG_DESCRIPTION, SMALL_ICON.value
- the value to be used for this action
to display it textually using the name, short description or long description or
to display it graphically using the icon.
Values for NAME, SHORT_DESCRIPTION and LONG_DESCRIPTION should be String objects,
values for SMALL_ICON should be ILcdIcon implementations.public void setEnabled(boolean b)
ILcdAction
ILcdAction
. When enabled,
any component associated with this object is active and
able to fire this object's actionPerformed
method.setEnabled
in interface ILcdAction
public boolean isEnabled()
isEnabled
in interface ILcdAction
public void addPropertyChangeListener(PropertyChangeListener listener)
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
listener
- The listener to be notifiedALcdWeakPropertyChangeListener
,
ILcdPropertyChangeSource.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener listener)
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
listener
- the listener that should no longer be notified of changes of
this object's propertiesILcdPropertyChangeSource.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener