public abstract class AbstractDesktopTask extends Object implements Runnable
An abstract base class for action tasks that perform a desktop operation with the currently selected file.
The tutorial application defines some actions for doing something with files
which is implemented by the Desktop
class new in Java 1.6 (e.g.
opening a file or printing it). This abstract base class provides basic
functionality for implementing such functionality. It is initialized with a
reference to the main controller from which the currently selected file can
be obtained. It also takes care for exception handling. A concrete subclass
only has to implement the desired Desktop
operation.
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
log
The logger.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractDesktopTask(MainWndController ctrl)
Creates a new instance of
AbstractDesktopTask and sets the
reference to the main controller. |
Modifier and Type | Method and Description |
---|---|
MainWndController |
getController()
Returns a reference to the main controller.
|
File |
getSelectedFile()
Returns the selected file.
|
protected abstract void |
performDesktopOperation(Desktop desktop)
Performs the desired operation with the selected file.
|
void |
run()
Executes this task.
|
protected AbstractDesktopTask(MainWndController ctrl)
AbstractDesktopTask
and sets the
reference to the main controller.ctrl
- the main controller referencepublic MainWndController getController()
public File getSelectedFile()
public void run()
protected abstract void performDesktopOperation(Desktop desktop) throws Exception
desktop
- the Desktop
instanceException
- if an error occursCopyright © 2016 The JGUIraffe Team. All Rights Reserved.