at.spardat.xma.appshell
Class Task

java.lang.Object
  extended byat.spardat.xma.appshell.Task
All Implemented Interfaces:
ITask, java.lang.Runnable
Direct Known Subclasses:
SimpleTask

public abstract class Task
extends java.lang.Object
implements ITask

Tasks are java objects which implement a workflow in its method ITask.run().

Since:
1.4.0

Field Summary
protected  IAppShell app
          The application shell containing this task.
protected  IMenuItem menu
          The menu item containing this task.
 
Constructor Summary
Task(AppShell app)
          creates a Task
Task(AppShell app, IMenuItem menu)
          creates a Task
Task(ComponentClient comp)
          creates at Task
 
Method Summary
 void call(ITask subTask)
          Calls a Task as subtask of this Task.
 void callBlocking(at.spardat.xma.boot.component.IXMAControl page)
          Calls a component or page and waits until it is closed.
 void callNonBlocking(at.spardat.xma.boot.component.IXMAControl page)
          Calls a component or page and returns imediately.
 boolean closeRequested()
          Closes the Task.
 boolean closeRequested(boolean show)
          Closes the Task.
 boolean contains(IMenuItem item)
          Determine if the given MenuItem is contained directly in the submenu of the MenuItem of this Task.
 ComponentClient getComponent()
          Get the component containing this task.
 java.lang.String getContextString()
          Get the context string of this task.
 IMenuItem getMenu()
          Get the menu item of this Task.
 IEmbeddable getPage()
          Get the page or component embedded or called by this Task
 ITask getParentTask()
          Get the parent Task of this Task.
 ITask getSubTask()
          Get the direct subtask of this Task.
 boolean isAutoDispose()
          Tells if this task will automatically dispose the component started with callBlocking(IXMAControl) or callNonBlocking(IXMAControl).
 boolean isCleanSubmenu()
          Tells if this task will remove the submenu from its MenuItem in closeRequested.
 boolean isRunfinished()
          Tells if the run()-method of this Task is finished, but the Task is still active.
 void pageClosed(boolean show)
          Removes the component or page on top of the call stack.
 void setAppShell(IAppShell appShell)
          Set the AppShell of this Task.
 void setAutoDispose(boolean autoDispose)
          Determine if this task should automatically dispose the component started with callBlocking(IXMAControl) or callNonBlocking(IXMAControl).
 void setCleanSubmenu(boolean cleanSubmenu)
          Determine if this task should remove the submenu from its MenuItem in closeRequested.
 void setMenu(IMenuItem item)
          Set the menu item of this Task.
 void setParentTask(ITask parent)
          Set the parent Task of this Task.
 void setRunfinished()
          Marks the Task after its run()-method has finished.
 void setSubTask(ITask subtask)
          Set the subtask of this Task.
 void showTopPage()
          Refresh the page on top of the call stack to the screen.
 void start(IAppShell appShell)
          Starts the Task by calling it as subtask of the task on top of the callstack of the given appShell.
 void start(ITask parentTask)
          Starts the Task by calling it as subtask of the given parent task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface at.spardat.xma.appshell.ITask
run
 

Field Detail

app

protected IAppShell app
The application shell containing this task.


menu

protected IMenuItem menu
The menu item containing this task.

Constructor Detail

Task

public Task(ComponentClient comp)
creates at Task


Task

public Task(AppShell app)
creates a Task

Parameters:
app - the AppShell containing the Task

Task

public Task(AppShell app,
            IMenuItem menu)
creates a Task

Parameters:
app - the AppShell containing the Task
menu - the MenuItem where this Task adds its submenu.
Method Detail

callBlocking

public void callBlocking(at.spardat.xma.boot.component.IXMAControl page)
Calls a component or page and waits until it is closed. The component or page is embeded in the client area of the application shell.

Specified by:
callBlocking in interface ITask
Parameters:
page - to embedd

callNonBlocking

public void callNonBlocking(at.spardat.xma.boot.component.IXMAControl page)
Calls a component or page and returns imediately. The component or page is embeded in the client area of the application shell.

Specified by:
callNonBlocking in interface ITask
Parameters:
page - to embedd

pageClosed

public void pageClosed(boolean show)
Removes the component or page on top of the call stack.

Specified by:
pageClosed in interface ITask
Parameters:
show - if true refresh the screen if false the screen is not refreshed

showTopPage

public void showTopPage()
Refresh the page on top of the call stack to the screen.

Specified by:
showTopPage in interface ITask

start

public void start(ITask parentTask)
Starts the Task by calling it as subtask of the given parent task.

Specified by:
start in interface ITask
Parameters:
parentTask -

start

public void start(IAppShell appShell)
Starts the Task by calling it as subtask of the task on top of the callstack of the given appShell.

Specified by:
start in interface ITask
Parameters:
appShell -

call

public void call(ITask subTask)
Calls a Task as subtask of this Task. This attaches it on top of the call stack and calls it ITask.run() method.

Specified by:
call in interface ITask
Parameters:
subTask - to call.

closeRequested

public boolean closeRequested()
Closes the Task.

Specified by:
closeRequested in interface ITask
Returns:
true if the Task is closed successfully false if the Task refuses to close

closeRequested

public boolean closeRequested(boolean show)
Closes the Task.

Specified by:
closeRequested in interface ITask
Parameters:
show - if true refresh the screen if false the screen is not refreshed
Returns:
true if the Task is closed successfully false if the Task refuses to close

getParentTask

public ITask getParentTask()
Get the parent Task of this Task. The parent Task is the Task that called this.

Specified by:
getParentTask in interface ITask
Returns:
the parent task

getSubTask

public ITask getSubTask()
Get the direct subtask of this Task. The subtask is the currently active Task called by this.

Specified by:
getSubTask in interface ITask
Returns:
the direct successor on the call stack

getPage

public IEmbeddable getPage()
Get the page or component embedded or called by this Task

Specified by:
getPage in interface ITask
Returns:
the active component of this Task or null.

contains

public boolean contains(IMenuItem item)
Determine if the given MenuItem is contained directly in the submenu of the MenuItem of this Task.

Specified by:
contains in interface ITask
Parameters:
item - to test
Returns:
true if this Task contains the given item.

getContextString

public java.lang.String getContextString()
Get the context string of this task.

Specified by:
getContextString in interface ITask
Returns:
the string to show as context in the enclosing AppShell or dialog.

getMenu

public IMenuItem getMenu()
Get the menu item of this Task. The menu item of this Task calls this Task when selected.

Specified by:
getMenu in interface ITask
Returns:
the menu item of this Task.

setMenu

public void setMenu(IMenuItem item)
Set the menu item of this Task. The menu item of this Task calls this Task when selected.

Specified by:
setMenu in interface ITask
Parameters:
item - where this Task can add its submenu.

setParentTask

public void setParentTask(ITask parent)
Set the parent Task of this Task. The parent Task is the Task that will call this.

Specified by:
setParentTask in interface ITask
Parameters:
parent - task to set.

setSubTask

public void setSubTask(ITask subtask)
Set the subtask of this Task. The subtask is the Task that will be called by this.

Specified by:
setSubTask in interface ITask
Parameters:
subtask - to set.

setAppShell

public void setAppShell(IAppShell appShell)
Set the AppShell of this Task.

Specified by:
setAppShell in interface ITask
Parameters:
appShell -

getComponent

public ComponentClient getComponent()
Get the component containing this task.

Returns:
the component containing this task.

isRunfinished

public boolean isRunfinished()
Tells if the run()-method of this Task is finished, but the Task is still active. This is normal behaviour with nonblocking pages.

Specified by:
isRunfinished in interface ITask

setRunfinished

public void setRunfinished()
Marks the Task after its run()-method has finished. This method is resverved for the runtime. Do not call it directly!

Specified by:
setRunfinished in interface ITask

isCleanSubmenu

public boolean isCleanSubmenu()
Tells if this task will remove the submenu from its MenuItem in closeRequested. The default is true. To change this behaviour see setCleanSubmenu(boolean).


setCleanSubmenu

public void setCleanSubmenu(boolean cleanSubmenu)
Determine if this task should remove the submenu from its MenuItem in closeRequested.

Parameters:
cleanSubmenu - true means remove it, false means do not change the menu while closing.

isAutoDispose

public boolean isAutoDispose()
Tells if this task will automatically dispose the component started with callBlocking(IXMAControl) or callNonBlocking(IXMAControl).

Since:
1.8.4

setAutoDispose

public void setAutoDispose(boolean autoDispose)
Determine if this task should automatically dispose the component started with callBlocking(IXMAControl) or callNonBlocking(IXMAControl).

Parameters:
autoDispose - true means dispose it after usage, false means to not dispose it automatically
Since:
1.8.4