at.spardat.xma.appshell.ITask Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* s IT Solutions AT Spardat GmbH - initial API and implementation
*******************************************************************************/
/*
* @(#) $Id: ITask.java 9060 2012-03-06 10:06:47Z hoenninger $
*
*
*
*
*/
package at.spardat.xma.appshell;
import at.spardat.xma.boot.component.IXMAControl;
import at.spardat.xma.page.IEmbeddable;
/**
* Interface for {@link Task}.
* Tasks are java objects which implement a workflow in its method {@link #run()}.
*
* @author s2877
* @since 1.4.0
*/
public interface ITask extends Runnable {
/**
* This method is called every time the Task is called.
* Implement the work to do here.
*/
void run();
/**
* Get the context string of this task.
* @return the string to show as context in the enclosing AppShell or dialog.
*/
String getContextString();
/**
* Calls a Task as subtask of this Task.
* This attaches it on top of the call stack and calls it {@link #run()} method.
* @param subTask to call.
*/
void call(ITask subTask);
/**
* Starts the Task by calling it as subtask of the given parent task.
* @param parentTask
*/
void start(ITask parentTask);
/**
* Starts the Task by calling it as subtask of the task on top of the callstack of the
* given appShell.
* @param appShell
*/
void start(IAppShell appShell);
/**
* Closes the Task.
* @return true if the Task is closed successfully
* false if the Task refuses to close
*/
boolean closeRequested();
/**
* Closes the Task.
* @param show if true refresh the screen
* if false the screen is not refreshed
* @return true if the Task is closed successfully
* false if the Task refuses to close
*/
boolean closeRequested(boolean show);
/**
* 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.
* @param page to embedd
*/
void callBlocking(IXMAControl page);
/**
* Calls a component or page and returns imediately.
* The component or page is embeded in the client area of the application shell.
* @param page to embedd
*/
void callNonBlocking(IXMAControl page);
/**
* Removes the component or page on top of the call stack.
* @param show if true refresh the screen
* if false the screen is not refreshed
*/
void pageClosed(boolean show);
/**
* Refresh the page on top of the call stack to the screen.
*/
void showTopPage();
/**
* Determine if the given MenuItem is contained directly in the submenu
* of the MenuItem of this Task.
* @param item to test
* @return true if this Task contains the given item.
*/
boolean contains(IMenuItem item);
/**
* Get the page or component embedded or called by this Task
* @return the active component of this Task or null.
*/
IEmbeddable getPage();
/**
* Get the menu item of this Task. The menu item of this Task calls this
* Task when selected.
* @return the menu item of this Task.
*/
IMenuItem getMenu();
/**
* Set the menu item of this Task. The menu item of this Task calls this
* Task when selected.
* @param item where this Task can add its submenu.
*/
void setMenu(IMenuItem item);
/**
* Get the parent Task of this Task. The parent Task is
* the Task that called this.
* @return the parent task
*/
ITask getParentTask();
/**
* Set the parent Task of this Task. The parent Task is
* the Task that will call this.
* @param parent task to set.
*/
void setParentTask(ITask parent);
/**
* Get the direct subtask of this Task. The subtask is the
* currently active Task called by this.
* @return the direct successor on the call stack
*/
ITask getSubTask();
/**
* Set the subtask of this Task. The subtask is the
* Task that will be called by this.
* @param subtask to set.
*/
void setSubTask(ITask subtask);
/**
* Set the AppShell of this Task.
* @param appShell
*/
void setAppShell(IAppShell appShell);
/**
* Tells if the run()-method of this Task is finished, but the Task is still active.
* This is normal behaviour with nonblocking pages.
*/
boolean isRunfinished();
/**
* Marks the Task after its run()-method has finished.
* This method is resverved for the runtime. Do not call it directly!
*/
void setRunfinished();
/**
* Returns true if the task tries to close itself after it has finished
* its run method.
*/
public boolean isAutoClose();
/**
* When autoClose is set to true, the task tries to close itself after it
* has finished its run method.
*/
public void setAutoClose(boolean autoClose);
}