at.spardat.xma.appshell.SimpleTask 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: SimpleTask.java 2089 2007-11-28 13:56:13Z s3460 $
*
*
*
*
*/
package at.spardat.xma.appshell;
import at.spardat.xma.boot.component.IXMAControl;
import at.spardat.xma.component.ComponentClient;
/**
* Implementation of a simple task which calls a single page or component.
*
* @author s2877
* @since 1.4.0
*/
public class SimpleTask extends Task {
IXMAControl client;
boolean blocking;
/**
* Creates the simple task.
* @param client the page or component to use.
* @param blocking if true the run()-method blocks until the page or
* component is finished.
*/
public SimpleTask(IXMAControl client,boolean blocking) {
super((ComponentClient)null);
this.client=client;
this.blocking=blocking;
}
/**
* This method does the work. It calls the page or component.
* Do not call this method directly, it may only be called by
* its parent task. Use {@link #start(IAppShell)} or {@link #start(ITask)}
* to run this task.
*/
public void run() {
if(blocking) {
callBlocking(client);
closeRequested(true);
} else {
callNonBlocking(client);
}
}
}