Sweet Home 3D 4.0

com.eteks.sweethome3d.viewcontroller
Class ThreadedTaskController

java.lang.Object
  extended by com.eteks.sweethome3d.viewcontroller.ThreadedTaskController
All Implemented Interfaces:
Controller

public class ThreadedTaskController
extends Object
implements Controller

A MVC controller used to execute a particular task in a separated thread.

Author:
Emmanuel Puybaret

Nested Class Summary
static interface ThreadedTaskController.ExceptionHandler
          Handles exception that may happen during the execution of a threaded task.
 
Constructor Summary
ThreadedTaskController(Callable<Void> threadedTask, String taskMessage, ThreadedTaskController.ExceptionHandler exceptionHandler, UserPreferences preferences, ViewFactory viewFactory)
          Creates a controller that will execute in a separated thread the given task.
 
Method Summary
 void cancelTask()
          Cancels the threaded task if it's running.
 void executeTask(View executingView)
          Executes in a separated thread the task given in constructor.
 ThreadedTaskView getView()
          Returns the view controlled by this controller.
 boolean isTaskRunning()
          Returns true if the threaded task is running.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadedTaskController

public ThreadedTaskController(Callable<Void> threadedTask,
                              String taskMessage,
                              ThreadedTaskController.ExceptionHandler exceptionHandler,
                              UserPreferences preferences,
                              ViewFactory viewFactory)
Creates a controller that will execute in a separated thread the given task. This task shouldn't modify any model objects and should be able to handle interruptions with Thread methods that the user may provoke when he wants to cancel a threaded task.

Method Detail

getView

public ThreadedTaskView getView()
Returns the view controlled by this controller.

Specified by:
getView in interface Controller

executeTask

public void executeTask(View executingView)
Executes in a separated thread the task given in constructor. This task shouldn't modify any model objects shared with other threads.


cancelTask

public void cancelTask()
Cancels the threaded task if it's running.


isTaskRunning

public boolean isTaskRunning()
Returns true if the threaded task is running.


Sweet Home 3D 4.0

© Copyrights 2006-2013 eTeks - All rights reserved
Distributed under GNU General Public License