|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.getsnappy.snappyj.JavaScriptBean
public abstract class JavaScriptBean
These beans act as the communication channel between javascript and java. In javascript beans are manipulated and saved cookies. Each bean has its own cookie. These cookies must always be maintained to represent the current state, and are used in case of a reload. All variables in all beans can also be passed in through the request which overrides the cookie.
Constructor Summary | |
---|---|
JavaScriptBean()
|
Method Summary | |
---|---|
protected java.lang.Object |
get(java.lang.String attribute)
Used internally to access the variables in this bean. |
protected abstract java.util.Vector<java.lang.String> |
getApplicationVariables()
overide this function to define all variables for this bean |
protected abstract java.util.Vector<java.lang.Class> |
getApplicationVariableTypes()
overide this function to define the variables types. |
java.lang.String |
getAttributeId(java.lang.String attribute)
Works in conjunction with jsPersistForm. |
abstract java.lang.String |
getCookieName()
overide this function to define a cookieName to load cookie state from |
abstract java.lang.String |
getJavaScriptBeanName()
// overide this function to define a bean name. |
protected static JavaScriptBean |
isPersistedInRequest(java.lang.String cookieName,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
void |
jsDeclareObject(java.io.Writer out)
Generate the necassary object definitions to process a bean. |
java.lang.String |
jsGet(java.lang.String attribute)
Outputs inline(single-line) JavaScript that will set and persist the specified attribute immediately, when the javascript is executed |
java.lang.String |
jsPersist()
|
java.lang.String |
jsPersistForm()
Load the html form elements by id for each attribute (see jsAttributeId) and persist changes. |
java.lang.String |
jsSet(java.lang.String attribute,
java.lang.Boolean value)
Outputs inline(single-line) JavaScript that will set and persist the specified attribute immediately, when the javascript is executed |
java.lang.String |
jsSet(java.lang.String attribute,
java.lang.Integer value)
Outputs inline(single-line) JavaScript that will set and persist the specified attribute immediately, when the javascript is executed |
java.lang.String |
jsSet(java.lang.String attribute,
java.lang.Long value)
Outputs inline(single-line) JavaScript that will set and persist the specified attribute immediately, when the javascript is executed |
java.lang.String |
jsSet(java.lang.String attribute,
java.lang.String value)
FIXME: Need to add type safety checks to jsSet |
protected void |
load(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
This method loads the bean variables. |
protected void |
persistToRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Persist this Bean for the duration of the request. |
protected void |
set(java.lang.String attribute,
java.lang.Object value)
Used internally to access the variables in this bean, while also providing access to our useful generic methods. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JavaScriptBean()
Method Detail |
---|
public abstract java.lang.String getJavaScriptBeanName()
protected abstract java.util.Vector<java.lang.String> getApplicationVariables()
protected abstract java.util.Vector<java.lang.Class> getApplicationVariableTypes()
public abstract java.lang.String getCookieName()
protected java.lang.Object get(java.lang.String attribute)
attribute
-
protected void set(java.lang.String attribute, java.lang.Object value)
attribute
- protected void persistToRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
request
- response
- protected static JavaScriptBean isPersistedInRequest(java.lang.String cookieName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
protected void load(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
request
- response
- public void jsDeclareObject(java.io.Writer out) throws java.io.IOException