|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | ||||||||
@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...
}
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. |
public abstract java.lang.String value
public abstract java.lang.String id
value()
to improve readability when specifying multiple options. i.e. @SwingWorkerCommand(id="save", glassPane=true)
public abstract boolean disable
true.
public abstract boolean glassPane
false. A suitable GlassPaneStrategy must be installed on the CommandContainer
prior to execution.
public abstract boolean onFinish
public abstract boolean onFailed
public abstract boolean onInterrupted
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | ||||||||