|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.gargoylesoftware.base.gui.AbstractUIController
An abstract superclass for GUI controller classes.
Swing uses an architecture similar to Model-View-Controller (MVC) in which the model, view and controller components are kept seperate from each other. This class provides some common behaviour that is useful for controller objects. This includes support for:
startTask(WorkerTask)
,
taskComplete(WorkerTask)
, taskSuccessful(WorkerTask)
,
taskExceptionThrown(WorkerTask,Exception)
,
taskErrorThrown(WorkerTask,Throwable)
setLocale(Locale)
,
getLocale()
, localeChanged(Locale)
Constructor Summary | |
AbstractUIController()
Create a new controller. |
Method Summary | |
protected void |
assertNotNull(String fieldName,
Object object)
Throw an exception if the specified object is null |
Locale |
getLocale()
Return the current locale. |
protected abstract void |
localeChanged(Locale locale)
The current locale has changed - update all locale specific information. |
void |
run()
The main entry point into this controller |
protected abstract void |
runImpl()
Subclasses will override this to provide the run logic |
void |
setLocale(Locale locale)
Set the current locale |
protected void |
startTask(WorkerTask task)
Start a WorkerTask. |
protected void |
taskComplete(WorkerTask task)
A callback that will be invoked when a task has completed whether it was successful or not. |
protected void |
taskErrorThrown(WorkerTask task,
Throwable throwable)
A callback that will be invoked when a system error is thrown during the processing of a WorkerTask. |
protected void |
taskExceptionThrown(WorkerTask task,
Exception exception)
A callback that will be invoked when an exception is thrown during the processing of a WorkerTask. |
protected void |
taskSuccessful(WorkerTask task)
A callback that will be invoked when a task completed successfully. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AbstractUIController()
Method Detail |
public final void setLocale(Locale locale)
locale
- the new localepublic final Locale getLocale()
public final void run()
protected abstract void runImpl()
protected final void startTask(WorkerTask task)
When the task has completed, one of the following callbacks will be called based on the success of the task.
taskSuccessful()
will be called
taskExceptionThrown()
will be called
taskErrorThrown()
will be called
taskSuccessful()
will be called will be called to signal the completion
of the task
task
- The WorkerTask that is about to execute.protected void taskExceptionThrown(WorkerTask task, Exception exception)
taskErrorThrown(WorkerTask,Throwable)
.The default behaviour is to print the stack trace of the caught exception to System.out. Override this method to provide custom error handling.
task
- The task that failedexception
- The exception that was caught.protected void taskErrorThrown(WorkerTask task, Throwable throwable)
taskExceptionThrown(WorkerTask,Exception)
.
The default behaviour is to print the stack trace of the caught error
to System.out. Override this method to provide custom error handling.
task
- The task that failedthrowable
- The throwable object that was caughtprotected void taskSuccessful(WorkerTask task)
The default behaviour is to do nothing. Override this to provide custom behaviour.
task
- The task that just finished.protected void taskComplete(WorkerTask task)
task
- The task that just finished.protected abstract void localeChanged(Locale locale)
locale
- The new localeprotected final void assertNotNull(String fieldName, Object object)
fieldName
- The name of the paremeter we are checkingobject
- The value of the parameter we are checking
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |