com.getsnappy.w20
Class Context

java.lang.Object
  extended by com.getsnappy.w20.Context
Direct Known Subclasses:
DynamicContext, StaticContext

public abstract class Context
extends java.lang.Object

Context's are html element which will be given web 2.0 loading/reloading capabilites. Our library is designed to preserve state so that forward/back browser buttons work as well as page reloads.
StaticContext can be used for most cases. More complex application may desire the functionality of DynamicContexts

Author:
brian
See Also:
StaticContext, DynamicContext

Field Summary
 java.util.Hashtable<java.lang.String,Context> subContexts
           
 
Constructor Summary
Context()
           
 
Method Summary
abstract  java.lang.String getClassName()
           
abstract  java.lang.String getContextId()
           
protected abstract  JavaScriptLoadingIndicator getJavaScriptLoadingIndicator()
           
 void include(java.io.Writer out, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method will output a empty placeholder div of the specified width and height, followed by issueing a jsReload inside a JavaScript block, causing the contents of this context to be loaded asynchronously
 void includeAsync(java.io.Writer out, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, int width, int height)
          This method will output a empty placeholder div of the specified width and height, followed by issueing a jsReload inside a JavaScript block, causing the contents of this context to be loaded asynchronously
 void jsDeclareObject(java.io.Writer out)
          Generate a JavaScript function that returns a JavaScript object representing this context.
 java.lang.String jsReload()
          This method returns inline JavaScript that will reload the context.
protected  void output(java.io.Writer out, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          outputs content for the ApplicationInstance or HttpServlet defined by getClassName() This function basically loads and calls the corresponding method in the
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

subContexts

public java.util.Hashtable<java.lang.String,Context> subContexts
Constructor Detail

Context

public Context()
Method Detail

getContextId

public abstract java.lang.String getContextId()

getClassName

public abstract java.lang.String getClassName()

getJavaScriptLoadingIndicator

protected abstract JavaScriptLoadingIndicator getJavaScriptLoadingIndicator()

output

protected void output(java.io.Writer out,
                      javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws java.io.IOException,
                      javax.servlet.ServletException
outputs content for the ApplicationInstance or HttpServlet defined by getClassName() This function basically loads and calls the corresponding method in the

Parameters:
out -
request -
response -
out -
Throws:
java.io.IOException - In the case of an IOException trying to print an appropriate error message.
javax.servlet.ServletException

include

public void include(java.io.Writer out,
                    javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws java.io.IOException,
                    javax.servlet.ServletException
This method will output a empty placeholder div of the specified width and height, followed by issueing a jsReload inside a JavaScript block, causing the contents of this context to be loaded asynchronously

Parameters:
out -
request -
response -
width -
height -
Throws:
java.io.IOException
javax.servlet.ServletException

includeAsync

public void includeAsync(java.io.Writer out,
                         javax.servlet.http.HttpServletRequest request,
                         javax.servlet.http.HttpServletResponse response,
                         int width,
                         int height)
                  throws java.io.IOException,
                         javax.servlet.ServletException
This method will output a empty placeholder div of the specified width and height, followed by issueing a jsReload inside a JavaScript block, causing the contents of this context to be loaded asynchronously

Parameters:
out -
request -
response -
width -
height -
Throws:
java.io.IOException
javax.servlet.ServletException

jsDeclareObject

public void jsDeclareObject(java.io.Writer out)
                     throws java.io.IOException
Generate a JavaScript function that returns a JavaScript object representing this context. This must be declared prior to creating the Web20Environment. NOTE: like an other js function, this one outputs straight JavaScript and should be nested inside a SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD