com.dynamide.event
Class ScriptEvent

java.lang.Object
  extended by com.dynamide.DynamideObject
      extended by com.dynamide.event.ScriptEvent
All Implemented Interfaces:
IGet, java.io.Serializable

public class ScriptEvent
extends DynamideObject
implements java.io.Serializable

In order to make this class as easy to use as possible from multiple scripting languages supported by events, the important fields are available as public fields and as bean properties with proper getters and setters. That is, foo, getFoo() and setFoo() are all public.

See Also:
Serialized Form

Field Summary
 java.lang.String action
           
 Page currentPage
           
 java.lang.String currentPageID
           
static java.lang.String DUMPHTML_END
           
static java.lang.String DUMPHTML_ROWEND
           
static java.lang.String DUMPHTML_ROWMID
           
static java.lang.String DUMPHTML_ROWSTART
           
static java.lang.String DUMPHTML_START
           
 int errorLineNumber
           
 java.lang.String evalErrorMsg
          The Object returned by the event.
 java.lang.String eventName
          This is informational only.
 java.lang.Object inputObject
           
 java.lang.String nextPageID
           
 java.lang.Object outputObject
           
 boolean prettyPrint
           
static int RA_DEFAULT
          This is the default value, which means dynamide will continue with the default loading of pages according to other page order rules, such as calling onQueryNextPage.
static int RA_JUMP_TO_PAGE
          Use this value for resultAction to jump directly to the page named by nextPageID.
static int RA_RETURN_SOURCE
          If your event generates html/xml and you wish to return exactly the source you generate, set the resultAction to this value, and set the resultSrc to the source.
static int RA_SEND_REDIRECT
          Use this value for resultAction to send the client's web browser to a URL.
static int RA_SHOW_ERRORS
          Use this value for resultAction to re-show the current page, but with errors flagged.
static int RA_THROW_EXCEPTION
          If your event would like to throw an exception to be caught by the error page, you should set resultAction to RA_THROW_EXCEPTION, and set the outputObject to the exception, otherwise dynamide catches all ScriptEvent exceptions, and handles them a little differently, though in most cases you'll end up with the error page anyway.
static int RC_ERROR
          For internal use by dynamide.
static int RC_NO_EVENT_SOURCE
          For internal use by dynamide.
static int RC_OK
          For internal use by dynamide.
 java.lang.String redirectURL
           
 javax.servlet.http.HttpServletRequest request
           
 javax.servlet.http.HttpServletResponse response
           
 int resultAction
           
 int resultCode
          For internal use by dynamide, changes to this field in the event will be ignored.
 java.lang.String resultSrc
           
 java.lang.Object sender
           
 Session session
           
 java.lang.Throwable throwable
           
 
Fields inherited from class com.dynamide.DynamideObject
m_id
 
Constructor Summary
ScriptEvent()
           
ScriptEvent(DynamideObject owner)
           
 
Method Summary
 java.lang.String dump()
          Subclasses can override this with something more descriptive, for logging and debugging.
 java.lang.String dump(java.lang.String dstart, java.lang.String d1, java.lang.String d2, java.lang.String d3, java.lang.String dend, boolean escapeHTML)
           
 java.lang.String dumpHTML()
          Subclasses can override this with something more descriptive, for logging and debugging.
 void finalize()
           
 Page getCurrentPage()
           
 java.lang.String getCurrentPageID()
           
 java.lang.String getDMAction()
           
 int getErrorLineNumber()
           
 java.lang.String getEvalErrorMsg()
           
 java.lang.String getEventName()
          This is informational only.
 HandlerResult getHandlerResult()
           
 java.lang.Object getInputObject()
           
 java.lang.String getNextPageID()
           
 java.lang.Object getOutputObject()
           
 java.lang.String getQueryParam(java.lang.String paramName)
           
 javax.servlet.http.HttpServletRequest getRequest()
           
 javax.servlet.http.HttpServletResponse getResponse()
           
 int getResultAction()
           
 int getResultCode()
           
 java.lang.String getResultSrc()
           
 java.lang.Object getSender()
          If this event is triggered from a specific object, that object will be the sender, e.g.
 Session getSession()
           
 java.lang.Throwable getThrowable()
           
 java.lang.String getURL()
           
 boolean hasQueryParam(java.lang.String paramName)
           
 void jumpToPage(java.lang.String nextPageID)
          Sets the event resultAction to ..., and sets the resultSrc property, but the action will occur when the event returns.
 void print(java.lang.String msg)
           
 void println(java.lang.String msg)
           
 java.lang.String printResultAction()
           
 java.lang.String printResultCode()
           
 void returnError(java.lang.String error, java.lang.Throwable t)
          Sets the event resultCode RC_ERROR, the action will occur when the event returns.
 void returnSource(java.lang.String src)
           
 void returnSource(java.lang.String src, boolean prettyPrint)
          Sets the event resultAction to RA_RETURN_SOURCE, and sets the resultSrc property, but the action will occur when the event returns.
 void sendRedirect(java.lang.String url)
          Send the client a redirect, rather than a rendered page, to avoid POST data being re-posted on a refresh.
 void sendRedirectToPage(java.lang.String pageID)
          Send the client a redirect, to the named page, using the current SESSIONID and applicationPath.
 void sendRedirectToPage(java.lang.String pageID, java.lang.String theAction)
          Send the client a redirect, to the named page, using the current SESSIONID and applicationPath, and the supplied action parameter.
 void sendRedirectToPage(java.lang.String pageID, java.lang.String action, java.lang.String moreParams)
          Send the client a redirect, to the named page, using the current SESSIONID and applicationPath, and the supplied action parameter, but allowing additional parameters to be sent.
 void setCurrentPage(Page new_value)
           
 void setCurrentPageID(java.lang.String new_value)
           
 void setDMAction(java.lang.String new_value)
           
 void setErrorLineNumber(int new_value)
           
 void setEventName(java.lang.String new_value)
           
 void setInputObject(java.lang.Object new_value)
           
 void setNextPageID(java.lang.String new_value)
           
 void setOutputObject(java.lang.Object new_value)
           
 void setRequest(javax.servlet.http.HttpServletRequest new_value)
           
 void setResponse(javax.servlet.http.HttpServletResponse new_value)
           
 void setResultAction(int new_value)
           
 ScriptEvent setResultsFrom(ScriptEvent other)
          Sets all results from the ScriptEvent passed in, so that you can chain events.
 void setResultSrc(java.lang.String new_value)
           
 void setSender(java.lang.Object new_value)
           
 void setSession(Session new_value)
           
 java.lang.String toString()
           
 
Methods inherited from class com.dynamide.DynamideObject
clearProfiler, dump, expand, findParentExpander, findParentPage, findParentSession, findTopParentPage, get, getCategoryID, getDotName, getID, getNextGetter, getObjectID, getOwner, getProfiler, isDebugEnabled, isInfoEnabled, logDebug, logDebug, logDebug, logDebug, logError, logError, logError, logError, logInfo, logInfo, logInfo, logInfo, logWarn, logWarn, logWarn, logWarn, popLogContext, printf, printProfiler, profileEnter, profileLeave, pushLogContext, setDotName, setID, setNextGetter, setObjectID, setOwner, sprintf, useProfiler, walkParents
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RA_DEFAULT

public static final int RA_DEFAULT
This is the default value, which means dynamide will continue with the default loading of pages according to other page order rules, such as calling onQueryNextPage.

See Also:
Constant Field Values

RA_SHOW_ERRORS

public static final int RA_SHOW_ERRORS
Use this value for resultAction to re-show the current page, but with errors flagged. You can set field errors with Field.setError(boolean) and Field.setErrorMessage(String). If you set any errors, the page will automatically be reshown. Clear them to move on, using Widget.clearErrorMessage() or Widget.setErrorMessage(null).

See Also:
Constant Field Values

RA_JUMP_TO_PAGE

public static final int RA_JUMP_TO_PAGE
Use this value for resultAction to jump directly to the page named by nextPageID.

See Also:
Constant Field Values

RA_RETURN_SOURCE

public static final int RA_RETURN_SOURCE
If your event generates html/xml and you wish to return exactly the source you generate, set the resultAction to this value, and set the resultSrc to the source.

See Also:
Constant Field Values

RA_THROW_EXCEPTION

public static final int RA_THROW_EXCEPTION
If your event would like to throw an exception to be caught by the error page, you should set resultAction to RA_THROW_EXCEPTION, and set the outputObject to the exception, otherwise dynamide catches all ScriptEvent exceptions, and handles them a little differently, though in most cases you'll end up with the error page anyway.

See Also:
Constant Field Values

RA_SEND_REDIRECT

public static final int RA_SEND_REDIRECT
Use this value for resultAction to send the client's web browser to a URL. This is useful for clearing the POST parameters from the client, so that they don't get re-submitted when the client does a refresh in the browser (e.g. Ctrl-R).

See Also:
Constant Field Values

resultAction

public int resultAction

prettyPrint

public boolean prettyPrint

redirectURL

public java.lang.String redirectURL

session

public transient Session session

request

public transient javax.servlet.http.HttpServletRequest request

response

public transient javax.servlet.http.HttpServletResponse response

sender

public transient java.lang.Object sender

currentPage

public transient Page currentPage

action

public java.lang.String action

currentPageID

public java.lang.String currentPageID

nextPageID

public java.lang.String nextPageID

resultSrc

public java.lang.String resultSrc

inputObject

public transient java.lang.Object inputObject

outputObject

public transient java.lang.Object outputObject

errorLineNumber

public int errorLineNumber

eventName

public java.lang.String eventName
This is informational only.


evalErrorMsg

public java.lang.String evalErrorMsg
The Object returned by the event.


throwable

public java.lang.Throwable throwable

RC_OK

public static final int RC_OK
For internal use by dynamide.

See Also:
Constant Field Values

RC_ERROR

public static final int RC_ERROR
For internal use by dynamide.

See Also:
Constant Field Values

RC_NO_EVENT_SOURCE

public static final int RC_NO_EVENT_SOURCE
For internal use by dynamide.

See Also:
Constant Field Values

resultCode

public int resultCode
For internal use by dynamide, changes to this field in the event will be ignored. To have the event ignored, return an empty string.


DUMPHTML_START

public static final java.lang.String DUMPHTML_START
See Also:
Constant Field Values

DUMPHTML_ROWSTART

public static final java.lang.String DUMPHTML_ROWSTART
See Also:
Constant Field Values

DUMPHTML_ROWMID

public static final java.lang.String DUMPHTML_ROWMID
See Also:
Constant Field Values

DUMPHTML_ROWEND

public static final java.lang.String DUMPHTML_ROWEND
See Also:
Constant Field Values

DUMPHTML_END

public static final java.lang.String DUMPHTML_END
See Also:
Constant Field Values
Constructor Detail

ScriptEvent

public ScriptEvent()

ScriptEvent

public ScriptEvent(DynamideObject owner)
Method Detail

finalize

public void finalize()
              throws java.lang.Throwable
Overrides:
finalize in class DynamideObject
Throws:
java.lang.Throwable

getResultAction

public int getResultAction()

setResultAction

public void setResultAction(int new_value)

printResultAction

public java.lang.String printResultAction()

sendRedirect

public void sendRedirect(java.lang.String url)
Send the client a redirect, rather than a rendered page, to avoid POST data being re-posted on a refresh.


sendRedirectToPage

public void sendRedirectToPage(java.lang.String pageID)
Send the client a redirect, to the named page, using the current SESSIONID and applicationPath.


sendRedirectToPage

public void sendRedirectToPage(java.lang.String pageID,
                               java.lang.String theAction)
Send the client a redirect, to the named page, using the current SESSIONID and applicationPath, and the supplied action parameter.
 sendRedirectToPage("page1", "display");
 

Parameters:
theAction - contains a single string value that is the action to be sent to the application_onAction or {pageID}_onAction event.

sendRedirectToPage

public void sendRedirectToPage(java.lang.String pageID,
                               java.lang.String action,
                               java.lang.String moreParams)
Send the client a redirect, to the named page, using the current SESSIONID and applicationPath, and the supplied action parameter, but allowing additional parameters to be sent.

Parameters:
action - contains a single string value that is the action to be sent to the application_onAction or {pageID}_onAction event.
moreParams - contains name-value pairs URL encoded. Here are some examples:
 sendRedirectToPage("page1", "display", "category=sales");
 sendRedirectToPage("page1", "display", "topic=My+Preferences");
 
Note that you typically do not send additional parameters, since these would best be set in the Session as Fields before leaving the current event. If you need to send a redirect to another web site or application, use sendRedirect(String url).

jumpToPage

public void jumpToPage(java.lang.String nextPageID)
Sets the event resultAction to ..., and sets the resultSrc property, but the action will occur when the event returns. @return an empty String, just so you can follow this style in events if you like:
   if (condition){
      return event.jumpToPage("page1");
   }
  
Rather than:
   if (condition){
      event.jumpToPage("page1");
      return;
   }
  
Both styles will work, and are exactly equivalent, but the first is easier to read.


returnSource

public void returnSource(java.lang.String src,
                         boolean prettyPrint)
Sets the event resultAction to RA_RETURN_SOURCE, and sets the resultSrc property, but the action will occur when the event returns.


returnSource

public void returnSource(java.lang.String src)

returnError

public void returnError(java.lang.String error,
                        java.lang.Throwable t)
Sets the event resultCode RC_ERROR, the action will occur when the event returns.

Parameters:
t - can be null.

setResultsFrom

public ScriptEvent setResultsFrom(ScriptEvent other)
Sets all results from the ScriptEvent passed in, so that you can chain events. Does not copy references to inputObject or outputObject. Example usage:
  ScriptEvent res = event.setResultsFrom(widget.fireEvent(inputObject, "onClick");
 


getSession

public Session getSession()

setSession

public void setSession(Session new_value)

getRequest

public javax.servlet.http.HttpServletRequest getRequest()

setRequest

public void setRequest(javax.servlet.http.HttpServletRequest new_value)

getResponse

public javax.servlet.http.HttpServletResponse getResponse()

setResponse

public void setResponse(javax.servlet.http.HttpServletResponse new_value)

getHandlerResult

public HandlerResult getHandlerResult()

getSender

public java.lang.Object getSender()
If this event is triggered from a specific object, that object will be the sender, e.g. Widget


setSender

public void setSender(java.lang.Object new_value)

getCurrentPage

public Page getCurrentPage()

setCurrentPage

public void setCurrentPage(Page new_value)

getDMAction

public java.lang.String getDMAction()

setDMAction

public void setDMAction(java.lang.String new_value)

getCurrentPageID

public java.lang.String getCurrentPageID()

setCurrentPageID

public void setCurrentPageID(java.lang.String new_value)

getNextPageID

public java.lang.String getNextPageID()

setNextPageID

public void setNextPageID(java.lang.String new_value)

getResultSrc

public java.lang.String getResultSrc()

setResultSrc

public void setResultSrc(java.lang.String new_value)

getInputObject

public java.lang.Object getInputObject()

setInputObject

public void setInputObject(java.lang.Object new_value)

getOutputObject

public java.lang.Object getOutputObject()

setOutputObject

public void setOutputObject(java.lang.Object new_value)

getErrorLineNumber

public int getErrorLineNumber()

setErrorLineNumber

public void setErrorLineNumber(int new_value)

getEventName

public java.lang.String getEventName()
This is informational only.


setEventName

public void setEventName(java.lang.String new_value)

getEvalErrorMsg

public java.lang.String getEvalErrorMsg()

getThrowable

public java.lang.Throwable getThrowable()

getResultCode

public int getResultCode()

printResultCode

public java.lang.String printResultCode()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

dump

public java.lang.String dump()
Description copied from class: DynamideObject
Subclasses can override this with something more descriptive, for logging and debugging.

Overrides:
dump in class DynamideObject

dumpHTML

public java.lang.String dumpHTML()
Description copied from class: DynamideObject
Subclasses can override this with something more descriptive, for logging and debugging.

Overrides:
dumpHTML in class DynamideObject

dump

public java.lang.String dump(java.lang.String dstart,
                             java.lang.String d1,
                             java.lang.String d2,
                             java.lang.String d3,
                             java.lang.String dend,
                             boolean escapeHTML)

print

public void print(java.lang.String msg)

println

public void println(java.lang.String msg)

getQueryParam

public java.lang.String getQueryParam(java.lang.String paramName)

hasQueryParam

public boolean hasQueryParam(java.lang.String paramName)

getURL

public java.lang.String getURL()


Copyright 2001-2013 DYNAMIDE.COM. All Rights Reserved.