|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.pietschy.command.delegate.ActionCommandDelegate
public abstract class ActionCommandDelegate
Base class for creating delegates for use with DelegatingCommands.
Its implementation is similar to ActionCommands and supports the same binding options.
DelegatingCommand,
SwingActionDelegate| Field Summary | |
|---|---|
static java.lang.String |
PROPERTY_ENABLED
|
| Constructor Summary | |
|---|---|
protected |
ActionCommandDelegate(java.lang.String id)
Creaets a new delegate with the specified id. |
| Method Summary | |
|---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds the specified property change listener. |
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Adds a property change listener for the specified property. |
void |
bind()
Binds to the global command container. |
void |
bind(CommandContainer container)
Binds to the specified CommandContainer. |
void |
bind(java.awt.Component component)
Binds to the specified component. |
protected void |
bindToContainer(CommandContainer container)
Invoked to add this delegate to the specified container as a result of a binding operation. |
void |
execute(java.util.Map<java.lang.Object,java.lang.Object> parameters)
Standard execute method for ActionCommandExecutor instances. |
protected void |
firePropertyChange(java.beans.PropertyChangeEvent evt)
|
protected void |
firePropertyChange(java.lang.String propertyName,
boolean oldValue,
boolean newValue)
|
protected void |
firePropertyChange(java.lang.String propertyName,
int oldValue,
int newValue)
|
protected void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
|
java.awt.event.ActionEvent |
getActionEvent()
Convenience method for getParameter(ActionCommand.PARAMETER_ACTION_EVENT). |
java.lang.String |
getId()
Gets the Id of this delegate. |
java.lang.Object |
getInvoker()
Convenience method to get the object that invoked the command. |
java.awt.Window |
getInvokerWindow()
Convenience method to get the Window ancestor of the object that invoked the command. |
int |
getModifiers()
Convenience method to get any modifiers that were specified. |
java.lang.Object |
getParameter(java.lang.Object key)
Gets any hints that may have been specified by a call to ActionCommandExecutor.execute(Map) or that have been
explicitly set by putParameter(java.lang.Object, java.lang.Object). |
java.lang.Object |
getParameter(java.lang.Object key,
java.lang.Object defaultValue)
Gets any hints that may have been specified by a call to ActionCommandExecutor.execute(Map) or that have been
explicitly set by putParameter(java.lang.Object, java.lang.Object). |
java.util.Map<java.lang.Object,java.lang.Object> |
getParameters()
Gets any hints that may have been specified by a call to ActionCommandExecutor.execute(Map) or that have
been explicitly set by putParameter(java.lang.Object, java.lang.Object). |
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners()
Returns an array of all the listeners that were added to the delegate with addPropertyChangeListener(). |
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners(java.lang.String propertyName)
Returns an array of all the listeners which have been associated with the named property. |
protected abstract void |
handleExecute()
Subclasses implement this method to define the delegates behaviour. |
boolean |
isEnabled()
Checks if this delegate is enabled. |
protected void |
notifyCommandContainersChanged()
Convience method for subclasses to be notified when their CommandContainer
hierarhcy has changed. |
void |
putParameter(java.lang.Object key,
java.lang.Object value)
Adds the specified parameter to be available the next time ActionCommandExecutor.execute(java.util.Map is called. |
void |
putParameters(java.util.Map<?,?> hints)
Adds the specified hints to be available the next time ActionCommandExecutor.execute(java.util.Map is called. |
void |
rebind()
Re-evaluates the current binding. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes the specified property change listener. |
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Removes the property change listener from the specified property. |
void |
setEnabled(boolean enabled)
Sets the enabled state of the delegate. |
void |
unbind()
Unbinds from the current container or component. |
protected void |
unbindFromContainer(CommandContainer container)
Invoked to remove this delegate from the specified container as a result of a binding operation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String PROPERTY_ENABLED
| Constructor Detail |
|---|
protected ActionCommandDelegate(java.lang.String id)
DelegatingCommand with the same id.
id - the id of the DelegatingCommand to which this delegate should bind.| Method Detail |
|---|
public java.lang.String getId()
getId in interface Identifiablepublic void bind()
Bindable
bind in interface BindableCommandContainer.globalInstance()public void bind(java.awt.Component component)
BindableCommandContainer.
bind in interface Bindablecomponent - the component to bind to.CommandContainer.bind(Component)public void bind(CommandContainer container)
BindableCommandContainer.
bind in interface Bindablecontainer - the container to bind to.public void rebind()
Bindable
rebind in interface Bindablepublic void unbind()
Bindable
unbind in interface Bindableprotected void bindToContainer(CommandContainer container)
container - the container to bind to.protected void unbindFromContainer(CommandContainer container)
container - the container to which the delegate was previously bound.protected void notifyCommandContainersChanged()
CommandContainer
hierarhcy has changed.
public final void execute(java.util.Map<java.lang.Object,java.lang.Object> parameters)
ActionCommandExecutor instances. This method attempts to
updates the parameters with the invoker and then invokes handleExecute().
execute in interface ActionCommandExecutorparameters - any additional execution parameters.protected abstract void handleExecute()
public void putParameter(java.lang.Object key,
java.lang.Object value)
ActionCommandExecutor.execute(java.util.Map) is called.
key - the name of the parameter.value - the parameter value.public void putParameters(java.util.Map<?,?> hints)
ActionCommandExecutor.execute(java.util.Map) is called.
hints - a list of hints to insert.public java.lang.Object getParameter(java.lang.Object key)
ActionCommandExecutor.execute(Map) or that have been
explicitly set by putParameter(java.lang.Object, java.lang.Object).
key - the name of the parameter.
public java.lang.Object getParameter(java.lang.Object key,
java.lang.Object defaultValue)
ActionCommandExecutor.execute(Map) or that have been
explicitly set by putParameter(java.lang.Object, java.lang.Object).
key - the name of the parameter.defaultValue - a default to return if the parameter wasn't provided.
putParameter(java.lang.Object, java.lang.Object)public java.util.Map<java.lang.Object,java.lang.Object> getParameters()
ActionCommandExecutor.execute(Map) or that have
been explicitly set by putParameter(java.lang.Object, java.lang.Object).
putParameter(java.lang.Object, java.lang.Object)public int getModifiers()
public java.lang.Object getInvoker()
AbstractButton that invoked to command. If the command was manually
invoked this will return null unless the parameter ActionCommand.PARAMETER_INVOKER has been
explicitly set.public java.awt.Window getInvokerWindow()
Component then null is returned.
Otherwise, an attempt to find the Window ancestor is made using
SwingUtilities.getWindowAncestor(java.awt.Component) or by traversing the ancestors and invokers of
popup menus.
Component or
doesn't have a Window ancestor. Otherwise the invokers Window ancestor is
returned.getInvoker()public java.awt.event.ActionEvent getActionEvent()
getParameter(ActionCommand.PARAMETER_ACTION_EVENT).
public boolean isEnabled()
isEnabled in interface ActionCommandExecutorpublic void setEnabled(boolean enabled)
enabled - true if the delegate is enabled, false otherwise.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
ActionCommandExecutor
addPropertyChangeListener in interface ActionCommandExecutorlistener - the listener to add.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
ActionCommandExecutor
removePropertyChangeListener in interface ActionCommandExecutorlistener - the listener to remove.public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
public void addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
ActionCommandExecutor
addPropertyChangeListener in interface ActionCommandExecutorpropertyName - the property to listen to.listener - the listener to add.
public void removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
ActionCommandExecutor
removePropertyChangeListener in interface ActionCommandExecutorpropertyName - the property being monitored.listener - the listener to remove.public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String propertyName)
propertyName - the property name.
protected void firePropertyChange(java.lang.String propertyName,
int oldValue,
int newValue)
protected void firePropertyChange(java.beans.PropertyChangeEvent evt)
protected void firePropertyChange(java.lang.String propertyName,
boolean oldValue,
boolean newValue)
protected void firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||