Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.scopemvc.controller.basic
Class ViewContext  view ViewContext download ViewContext.java

java.lang.Object
  extended byorg.scopemvc.controller.basic.ViewContext

public abstract class ViewContext
extends java.lang.Object

ViewContext handles show/hide of views, errors and has some concept of the application's context. eg a Swing implementation would show views inside JFrames or JDialogs and show errors using JOptionPanes. A servlet implementation would know about the HTTP response and push views into its stream.

There's a place in here to store properties per context. This is used in the servlet implementation to maintain state over a single request.

Several static methods are used to set the context for an application either on a global basis (eg Swing) or per-thread (eg servlet): see getViewContext() 55 etc.

Version:
$Revision: 1.5 $ $Date: 2002/01/26 09:46:20 $

Field Summary
private static ViewContext globalContext
           
private static org.apache.commons.logging.Log LOG
           
protected  java.util.Map properties
           
private static java.util.Map threadContexts
           
 
Constructor Summary
ViewContext()
           
 
Method Summary
 void addProperty(java.lang.String inKey, java.lang.Object inObject)
          Store an arbitrary object under a known key.
 void clearProperties()
          Clear all properties from this context.
static void clearThreadContext()
          Clear the ViewContext for the current thread.
abstract  void exit()
           
 java.lang.Object getProperty(java.lang.String inKey)
          Fetch an arbitrary object under a known key.
static ViewContext getViewContext()
          Return the current ViewContext.
abstract  void hideView(org.scopemvc.core.View inView)
           
 java.lang.Object removeProperty(java.lang.String inKey)
          Fetch and remove an arbitrary object under a known key.
static void setGlobalContext(ViewContext inContext)
          Set the global ViewContext, clearing any per-thread contexts.
static void setThreadContext(ViewContext inContext)
          Set a ViewContext for the current thread and clear any global ViewContext that may exist.
abstract  void showError(java.lang.String inErrorTitle, java.lang.String inErrorMessage)
           
abstract  void showView(org.scopemvc.core.View inView)
           
abstract  void startProgress()
           
abstract  void stopProgress()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.commons.logging.Log LOG

properties

protected java.util.Map properties

globalContext

private static ViewContext globalContext

threadContexts

private static java.util.Map threadContexts
Constructor Detail

ViewContext

public ViewContext()
Method Detail

showView

public abstract void showView(org.scopemvc.core.View inView)

hideView

public abstract void hideView(org.scopemvc.core.View inView)

showError

public abstract void showError(java.lang.String inErrorTitle,
                               java.lang.String inErrorMessage)

exit

public abstract void exit()

startProgress

public abstract void startProgress()

stopProgress

public abstract void stopProgress()

addProperty

public void addProperty(java.lang.String inKey,
                        java.lang.Object inObject)
Store an arbitrary object under a known key.


getProperty

public java.lang.Object getProperty(java.lang.String inKey)
Fetch an arbitrary object under a known key.


removeProperty

public java.lang.Object removeProperty(java.lang.String inKey)
Fetch and remove an arbitrary object under a known key.


clearProperties

public void clearProperties()
Clear all properties from this context.


getViewContext

public static ViewContext getViewContext()
Return the current ViewContext. First try the per-thread context and if none, return the global context. May return null if no context set.


setGlobalContext

public static void setGlobalContext(ViewContext inContext)
Set the global ViewContext, clearing any per-thread contexts.


setThreadContext

public static void setThreadContext(ViewContext inContext)
Set a ViewContext for the current thread and clear any global ViewContext that may exist.


clearThreadContext

public static void clearThreadContext()
Clear the ViewContext for the current thread.