public class BgTaskCommand extends CommandBase implements FormActionListener
A command class for executing the background task.
This command class simulates the execution of a long-running background task.
The execute()
only sleeps a configurable number of seconds, but it
demonstrates how an information dialog with a progress bar can be used to
give the user feedback about the progress of the background task. This visual
feedback is optional; it can be disabled, then the command only sleeps.
Constructor and Description |
---|
BgTaskCommand(GUISynchronizer sync,
Window infoWindow,
BgTaskData taskData,
ProgressBarHandler handler)
Creates a new instance of
BgTaskCommand and initializes it. |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(FormActionEvent e)
Notifies this object that the cancel button was pressed.
|
void |
execute()
Executes this command.
|
protected void |
performGUIUpdate()
Performs UI-related updates after the execution of the command.
|
getException, getGUIUpdater, getLog, isUpdateGUI, onException, onFinally, setException
public BgTaskCommand(GUISynchronizer sync, Window infoWindow, BgTaskData taskData, ProgressBarHandler handler)
BgTaskCommand
and initializes it.sync
- the GUISynchronizer
infoWindow
- the reference to the information windowtaskData
- the data object with information about the background
taskhandler
- the handler for the progress barpublic void actionPerformed(FormActionEvent e)
actionPerformed
in interface FormActionListener
e
- the action eventpublic void execute() throws Exception
protected void performGUIUpdate()
performGUIUpdate
in class CommandBase
Copyright © 2016 The JGUIraffe Team. All rights reserved.