Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.pietschy.command.worker
Class CancelSwingWorkerCommand

    java.lang.Object
      com.pietschy.command.Command
          com.pietschy.command.ActionCommand
              com.pietschy.command.worker.CancelSwingWorkerCommand

All Implemented Interfaces:
  ActionCommandExecutor, Bindable, Identifiable

    public class CancelSwingWorkerCommand

extends ActionCommand

An action command that tracks and `SwingWorkerCommand` and cancels it when executed. This command will automatically enable and disable while the command is working.

Field Summary

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
`CancelSwingWorkerCommand()` Creates a new anonymous instance.
`CancelSwingWorkerCommand(java.lang.String id)` Creates a new instance with the specified id.
`CancelSwingWorkerCommand(java.lang.String id, SwingWorkerCommand command)` Creates a new instance with the specified id that cancels the specified `SwingWorkerCommand`.
`CancelSwingWorkerCommand(SwingWorkerCommand command)` Creates a new instance that cancels the specified `SwingWorkerCommand`.

Method Summary
`SwingWorkerCommand` | `getWorkerCommand()` Gets the `SwingWorkerCommand` that this command is associated with.
`protected void` | `handleExecute()` Cancels the current worker command.
`boolean` | `isMayInteruptIfRunning()` Checks if this command may interrupt the worker thread to enact the cancel.
`void` | `setMayInteruptIfRunning(boolean mayInteruptIfRunning)` Configures if this command can interrupt the worker thread while it's running.
`void` | `setWorkerCommand(SwingWorkerCommand workerCommand)` Sets the `SwingWorkerCommand` that this instance will track and cancel when executed.

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, postExecute, 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, isEnabled, 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, isEnabled, removePropertyChangeListener, removePropertyChangeListener`

Methods inherited from interface com.pietschy.command.Identifiable
`getId`

Constructor Detail

### CancelSwingWorkerCommand

    public CancelSwingWorkerCommand()

  Creates a new anonymous instance.

  See Also:
    `setWorkerCommand(SwingWorkerCommand)`

### CancelSwingWorkerCommand

    public CancelSwingWorkerCommand(java.lang.String id)

  Creates a new instance with the specified id.

  Parameters:
    `id` - the command id.
  See Also:
    `setWorkerCommand(SwingWorkerCommand)`

### CancelSwingWorkerCommand

    public CancelSwingWorkerCommand(SwingWorkerCommand command)

  Creates a new instance that cancels the specified `SwingWorkerCommand`.

  Parameters:
    `command` - the command to cancel.

### CancelSwingWorkerCommand

    public CancelSwingWorkerCommand(java.lang.String id,
                                    SwingWorkerCommand command)

  Creates a new instance with the specified id that cancels the specified `SwingWorkerCommand`.

  Parameters:
    `id` - the command id.
    `command` - the command to cancel.

Method Detail

### handleExecute

    protected void handleExecute()

  Cancels the current worker command.

  Specified by:
    `handleExecute` in class `ActionCommand`

### getWorkerCommand

    public SwingWorkerCommand getWorkerCommand()

  Gets the `SwingWorkerCommand` that this command is associated with.

  Returns:
    the `SwingWorkerCommand` that this command is associated with.

### setWorkerCommand

    public void setWorkerCommand(SwingWorkerCommand workerCommand)

  Sets the `SwingWorkerCommand` that this instance will track and cancel when executed.

  Parameters:
    `workerCommand` - the command to cancel.

### isMayInteruptIfRunning

    public boolean isMayInteruptIfRunning()

  Checks if this command may interrupt the worker thread to enact the cancel.

  Returns:
    `true` to interrupt the worker, `false` otherwise.

### setMayInteruptIfRunning

    public void setMayInteruptIfRunning(boolean mayInteruptIfRunning)

  Configures if this command can interrupt the worker thread while it's running. This setting translates directly to `SwingWorkerCommand.cancel(boolean)`.

  Parameters:
    `mayInteruptIfRunning` - `true` the cancel operation may interrupt the background thread.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 - 2007 Andrew Pietsch