SPT Core API

com.sptci.echo
Class Controller<V>

java.lang.Object
  extended by com.sptci.echo.Controller<V>
All Implemented Interfaces:
Serializable

public abstract class Controller<V>
extends Object
implements Serializable

An abstract base class for all controllers.

Note: It is imperative that sub-classes set application to a valid instance.

©Copyright 2006 Sans Pareil Technologies, Inc.

Version:
$Id: Controller.java 4553 2008-12-24 10:34:16Z rakesh $
Author:
Rakesh Vidyadharan 2006-05-16
See Also:
Serialized Form

Nested Class Summary
 class Controller.Updater<S>
          An abstract updater task used to execute timed tasks in the background and push updates to the UI.
protected  class Controller.Worker<S>
          An abstract worker thread used to execute tasks in the background to avoid locking up the UI.
 
Field Summary
protected  Application application
          The global application instance for each session.
protected static Logger logger
          The logger used to log errors to.
protected  V view
          The view that is controlled by this instance.
 
Constructor Summary
Controller(V view)
          Crete a new instance of the controller for the specified view.
 
Method Summary
 void addPane(FloatingPane pane)
          Add the specified FloatingPane to the ContentPane of Application.window with an appropriate z-index.
static boolean checkText(String text)
          Check the specified string to ensure that it is not null and not empty.
 Application getApplication()
          Returns application.
 String getDataDirectory()
          Convenience method that returns Application.dataDirectory.
 Logger getLogger()
          Return the logger associated with this controller.
 V getView()
          Returns view.
 void processFatalException(String message, Throwable t)
          A global handler for exceptions encountered while updating the display.
 void processFatalException(Throwable t)
          A global handler for exceptions encountered while updating the display.
protected  void setApplication(Application application)
          Set application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final Logger logger
The logger used to log errors to.


application

protected Application application
The global application instance for each session.


view

protected final V view
The view that is controlled by this instance.

Constructor Detail

Controller

public Controller(V view)
Crete a new instance of the controller for the specified view.

Parameters:
view - The view to be controlled.
Method Detail

checkText

public static boolean checkText(String text)
Check the specified string to ensure that it is not null and not empty. Strings that are composed entirely of spaces are also treated as empty.

Parameters:
text - The text that is to be checked.
Returns:
Return true if the string specified is not null or empty.

getApplication

public Application getApplication()
Returns application.

Returns:
Application The value/reference of/to application.

setApplication

protected void setApplication(Application application)
Set application.

Parameters:
application - The value to set.

getView

public V getView()
Returns view.

Returns:
V The value/reference of/to view.

getLogger

public Logger getLogger()
Return the logger associated with this controller.

Returns:
The logger used by the controller.

getDataDirectory

public String getDataDirectory()
Convenience method that returns Application.dataDirectory.

Returns:
The value/reference of/to dataDirectory.

addPane

public void addPane(FloatingPane pane)
Add the specified FloatingPane to the ContentPane of Application.window with an appropriate z-index. Convenience wrapper around Application.addPane(nextapp.echo.app.FloatingPane).

Parameters:
pane - The window pane that is to be added.

processFatalException

public void processFatalException(Throwable t)
A global handler for exceptions encountered while updating the display.

Parameters:
t - The fatal exception
See Also:
Application.processFatalException( Throwable )

processFatalException

public void processFatalException(String message,
                                  Throwable t)
A global handler for exceptions encountered while updating the display.

Parameters:
message - The message to display in the ErrorPane.
t - The fatal exception
See Also:
Application.processFatalException( String, Throwable )

SPT Core API