Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT

## com.pietschy.command.annotation
Annotation Type SwingWorkerCommand_

    @Documented
    @Retention(value=RUNTIME)
    @Target(value=METHOD)
    public @interface SwingWorkerCommand_

The SwingWorkerCommand annotation can be used to mark a method as being an SwingWorkerCommand. These annotated methods can then be automatically converted into action commands using `GuiCommands.bindAnnotatedCommands(CommandContainer, Object)`.

SwingWorkerCommand methods will be executed on a background thread.

The following is an example marking a save method as the implementation of the "save" action command.

        @SwingWorkerCommand_("save")
        public void save()
        {
           // do the save operation...
        }

Swing worker methods can optionally define a single `Map`, `ActionCommand` or `Window` argument. Methods with a Map will be passed the invoking commands parameter map, those with an ActionCommand will be passed the command, and those with a Window will be passed the commands invoker window.

The following example will be passed the commands parameter map and will disable the command and activate the glass pane while the method is running.

        @SwingWorkerCommand_(id="save", glassPane=true, disable=true)
        public void save(Map parameters)
        {
           // fetch a parameter...
           Object invoker = parameters.get(com.pietschy.command.ActionCommand.INVOKER);

           // do the save operation...

        }

See Also:
  `GuiCommands.bindAnnotatedCommands(CommandContainer, Object)`, `GuiCommands.bindAnnotatedCommands(JComponent, Object)`, `GuiCommands.bindAnnotatedCommands(JComponent)`, `ActionCommand_`

Optional Element Summary
`boolean` | `disable` Determines if the command should be disabled while the method is executing.
`boolean` | `glassPane` Determines if the glasspane should be activated while the method is executing.
`java.lang.String` | `id` The id of the action command.
`boolean` | `onFailed`
`boolean` | `onFinish`
`boolean` | `onInterrupted`
`java.lang.String` | `value` The id of the action command.

### value

    public abstract java.lang.String value

  The id of the action command. This attribute is used when the annotation is specified in the generic form i.e. @SwingWorkerCommand("save")

  Default:
    ""

### id

    public abstract java.lang.String id

  The id of the action command. This attribute can be used instead of `value()` to improve readability when specifying multiple options. i.e. @SwingWorkerCommand(id="save", glassPane=true)

  Default:
    ""

### disable

    public abstract boolean disable

  Determines if the command should be disabled while the method is executing. The default is `true`.

  Default:
    true

### glassPane

    public abstract boolean glassPane

  Determines if the glasspane should be activated while the method is executing. The default is `false`. A suitable `GlassPaneStrategy` must be installed on the `CommandContainer` prior to execution.

  Default:
    false

### onFinish

    public abstract boolean onFinish

  Default:
    false

### onFailed

    public abstract boolean onFailed

  Default:
    false

### onInterrupted

    public abstract boolean onInterrupted

  Default:
    false

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT

Copyright © 2006 - 2007 Andrew Pietsch