com.pietschy.command.annotation.impl
Class ReflectionSwingWorkerCommand

java.lang.Object
  extended by com.pietschy.command.Command
      extended by com.pietschy.command.ActionCommand
          extended by com.pietschy.command.worker.SwingWorkerCommand<java.lang.Object,java.lang.Object>
              extended by com.pietschy.command.annotation.impl.ReflectionSwingWorkerCommand
All Implemented Interfaces:
ActionCommandExecutor, Bindable, Identifiable

public class ReflectionSwingWorkerCommand
extends SwingWorkerCommand<java.lang.Object,java.lang.Object>

SwingWorkerCommand implementation that uses reflection to invoke a method on another class.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.pietschy.command.worker.SwingWorkerCommand
SwingWorkerCommand.WorkingMode
 
Field Summary
 
Fields inherited from class com.pietschy.command.worker.SwingWorkerCommand
ACTIVATE_GLASS_PANE, DISABLE, DISABLE_AND_ACTIVATE_GLASS_PANE, DO_NOTHING, PROGRESS_PROPERTY, STATE_PROPERTY, WORKING_PROPERTY
 
Fields inherited from class com.pietschy.command.ActionCommand
PARAMETER_ACTION_EVENT, PARAMETER_INVOKER, PARAMETER_INVOKER_WINDOW, PARAMETER_MODIFIERS
 
Fields inherited from class com.pietschy.command.Command
internalLog, PROPERTY_ENABLED, PROPERTY_VISIBLE
 
Constructor Summary
ReflectionSwingWorkerCommand(java.lang.String id, java.lang.Object target, java.lang.reflect.Method method)
          Creates a new instance.
 
Method Summary
protected  java.lang.Object doInBackground()
          Invokes the target method.
protected  java.lang.Object[] getArgs()
          Gets the argument list for the method invocation.
 ArgumentProvider getArgumentProvider()
          Gets the current ArgumentProvider.
 java.lang.reflect.Method getMethod()
          Gets the target method.
 java.lang.Object getTarget()
          Gets the target object.
 void setArgumentProvider(ArgumentProvider argumentProvider)
          Sets the current ArgumentProvider.
 
Methods inherited from class com.pietschy.command.worker.SwingWorkerCommand
beforeStarting, cancel, cancelled, done, failed, finished, get, get, getGlassPaneStrategy, getProgress, getState, getWorkingMode, handleExecute, isActivateGlassPane, isCancelled, isDisableWhileWorking, isDone, isEnabled, isWorking, postExecute, process, publish, setActivateGlassPane, setDisableWhileWorking, setProgress, setWorkingMode
 
Methods inherited from class com.pietschy.command.ActionCommand
addActionCommandListener, addInterceptor, bindToContainer, createButton, createButton, createButton, createButton, createMenuItem, createMenuItem, createMenuItem, createMenuItem, doButtonAttachments, doButtonDetachments, execute, execute, getActionAdapter, getActionAdapter, getActionEvent, getInvoker, getInvokerWindow, getModifiers, getParameter, getParameter, getParameters, installShortCut, installShortCut, preExecute, putParameter, putParameters, removeActionCommandListener, removeInterceptor, requestDefaultIn, unbindFromContainer, uninstallShortCut, uninstallShortCut
 
Methods inherited from class com.pietschy.command.Command
addContainerPropertyListener, addFace, addHoverListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, attach, bind, bind, bind, buttonIterator, configureAppearance, configureAppearances, configureButtonAppearances, configureButtonStates, configureButtonStates, createButton, createButton, createButton, createButton, createComponent, createMenuItem, createMenuItem, createMenuItem, createMenuItem, detach, faceExists, findBestFace, fireHoverEnded, fireHoverStarted, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlternativeFaceContexts, getButtonFactory, getButtonIn, getCommandContainer, getContainerProperty, getDefaultFace, getDefaultFace, getFace, getFace, getId, getMenuFactory, getProperty, getProperty, getPropertyNames, getToolbarFactory, isAnonymous, isAttachedTo, isBound, isVisible, loadConfiguration, notifyCommandContainerHierarchyChanged, putProperties, putProperty, rebind, removeContainerPropertyListener, removeHoverListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, requestFocusIn, setButtonFactory, setEnabled, setMenuFactory, setToolbarFactory, setVisible, toString, unbind, validateId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.pietschy.command.ActionCommandExecutor
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface com.pietschy.command.Identifiable
getId
 

Constructor Detail

ReflectionSwingWorkerCommand

public ReflectionSwingWorkerCommand(java.lang.String id,
                                    java.lang.Object target,
                                    java.lang.reflect.Method method)
Creates a new instance.

Parameters:
id - the command id.
target - the target object to invoke the method on.
method - the target method.
Method Detail

doInBackground

protected java.lang.Object doInBackground()
                                   throws java.lang.Exception
Invokes the target method.

Specified by:
doInBackground in class SwingWorkerCommand<java.lang.Object,java.lang.Object>
Returns:
the result of the target method.
Throws:
java.lang.Exception - if the method call failed.

getArgs

protected java.lang.Object[] getArgs()
Gets the argument list for the method invocation. This method will return the result of the current ArgumentProvider.

Returns:
the arguments provided by the current ArgumentProvider or null if non provider has been configured.
See Also:
setArgumentProvider(ArgumentProvider)

getTarget

public java.lang.Object getTarget()
Gets the target object.

Returns:
the target object.

getMethod

public java.lang.reflect.Method getMethod()
Gets the target method.

Returns:
the target method.

getArgumentProvider

public ArgumentProvider getArgumentProvider()
Gets the current ArgumentProvider.

Returns:
the current ArgumentProvider.

setArgumentProvider

public void setArgumentProvider(ArgumentProvider argumentProvider)
Sets the current ArgumentProvider.

Parameters:
argumentProvider - the new ArgumentProvider.


Copyright © 2006 - 2007 Andrew Pietsch