www.element4solution.com

e4s.html.ajax
Class E4AjaxElementGeneral

java.lang.Object
  extended by e4s.util.E4Object
      extended by e4s.html.E4HtmlObject
          extended by e4s.html.E4HtmlElementGeneral
              extended by e4s.html.E4HtmlElement
                  extended by e4s.html.E4HtmlContentElement
                      extended by e4s.html.DIV
                          extended by e4s.html.ajax.E4AjaxElementGeneral
All Implemented Interfaces:
E4HtmlElement_Intf
Direct Known Subclasses:
E4AjaxElement, E4AjaxElementInputValueChanger, E4AjaxElementSelectOptionsChanger

public abstract class E4AjaxElementGeneral
extends DIV

Ajax element implementation (bridge between HTML elements and E4AjaxData_Intf


Field Summary
static java.lang.String JS_XML_HTTP_REQUEST
          Java-Script function to get the E4Ajax object.
protected  boolean m_debug
           
protected  java.lang.String m_id
           
protected  java.lang.String m_js_AEP_callback_after
           
protected  java.lang.String m_js_AEP_callback_before
           
protected  java.lang.String m_url
           
protected static int READY_STATE_COMPLETE
           
 
Fields inherited from class e4s.html.DIV
DEFAULTSTYLE, HTML_TAG
 
Fields inherited from class e4s.html.E4HtmlContentElement
BOOL_STR_FALSE, BOOL_STR_TRUE
 
Fields inherited from class e4s.html.E4HtmlElementGeneral
m_elements, m_needed_scripts
 
Fields inherited from class e4s.html.E4HtmlObject
m_parent_e4sID
 
Fields inherited from class e4s.util.E4Object
CRLF, E4S_CORE_SYSTEM_LANGUAGE, NBSP, NULLSTR, URL_ENCODING_CHARSET
 
Constructor Summary
protected E4AjaxElementGeneral(E4AjaxData_Intf data)
           
  E4AjaxElementGeneral(E4AjaxData_Intf data, E4ServletImplementation_Intf servlet)
          Create an E4AjaxElement.
  E4AjaxElementGeneral(E4AjaxData_Intf data, E4ServletImplementation_Intf servlet, boolean debug)
          Create an E4AjaxElement.
  E4AjaxElementGeneral(E4AjaxData_Intf data, E4ServletImplementation_Intf servlet, boolean debug, boolean name_scripts)
          Create an E4AjaxElement.
  E4AjaxElementGeneral(E4AjaxData_Intf data, int width, int height, E4ServletImplementation_Intf servlet)
          Create an E4AjaxElement.
  E4AjaxElementGeneral(E4AjaxData_Intf data, int width, int height, E4ServletImplementation_Intf servlet, boolean debug)
          Create an E4AjaxElement.
protected E4AjaxElementGeneral(java.lang.String div_id)
           
 
Method Summary
static java.lang.String _getSVNVersionString()
          Get version info string from subversion.
 void collectScripts(E4ScriptsVec v, E4ServletImplementation_Intf servlet)
          Get a vector of used scripts from all subelements.
 void collectStylesForEditing(E4StylesHash h, E4ServletImplementation_Intf servlet)
          Build a list (Vector) with style definitions used so far during display of this page.
 void collectTranslationsForEditing(E4TranslationsVec vec, E4ServletImplementation_Intf servlet)
          Build a list (Vector) with translation texts used so far during display of this page.
 boolean getDebug()
          Get the debug mode, which causes some E4JavaScript alert messages to be displayed.
 E4JavaScript getJsCallMethod()
           
 E4Method getMethodDispacher()
          Get the method responsible for handling the E4Ajax request.
 E4EventHandlerInputField getOnChange(FORM form)
          This event handler is intended to be used if activation of the E4Ajax element shall take place on a field's value change.
 E4EventHandlerA getOnClick()
          This event handler is intended to be used if activation of the E4Ajax element shall take place on a user click.
 E4EventHandlerBUTTON getOnClick(FORM form)
          This event handler is intended to be used if activation of the E4Ajax element shall take place on a user click.
protected  E4JavaScript getOnReadyRequest()
          Only internal usage
 E4EventHandlerBODY getOnTimer()
          Create a JavaScript that call's itself several time after a period specified by setTimeout(long), initially this should be called as body-on-load, that is why this script is a bode eventhandler.
 E4EventHandlerBODY getOnTimer(long timeout)
          Create a JavaScript that call's itself several time after a period specified by a given parameter, initially this should be called as body-on-load, that is why this script is a bode eventhandler.
 E4JavaScript getSendReqScript()
           
 E4JavaScript getSendReqScriptGeneric()
           
 boolean getShowOnLoad()
          Enables or disables display of the data content during display of the E4Ajax-Element.
 long getTimeout()
          Get the timeout for the refresh cycle.
 void prepare(BODY body)
          Adds a necessary event handler to the body.
 void setAEPCallbackScript_After(E4JavaScript js)
           
 void setAEPCallbackScript_After(java.lang.String js_name)
           
 void setAEPCallbackScript_Before(E4JavaScript js)
           
 void setAEPCallbackScript_Before(java.lang.String js_name)
           
protected  void setData(E4AjaxData_Intf data, boolean debug, boolean name_scripts, E4ServletImplementation_Intf servlet)
           
protected  void setData(E4AjaxData_Intf data, boolean debug, E4ServletImplementation_Intf servlet)
           
 void setMethodDispacher(E4Method mref, E4ServletImplementation_Intf servlet)
          Set the method responsible for handling the E4Ajax request.
 void setNameScripts(boolean mode)
          Choose, if scripts shall be named according to a prefix and the DIV.getDivId().
 void setShowOnLoad(boolean mode)
          Enables or disables display of the data content during display of the E4Ajax-Element.
 void setTimeout(long ms)
          Set the timeout for the refresh cycle.
 void toHtml(E4StringBufferHtml buf, E4ServletImplementation_Intf servlet)
          Create the HTML output for this element.
 java.lang.String toString()
           
protected  void updateOnReadyReq()
           
protected abstract  void updateOnReadyReqCore(E4JavaScript js)
           
 boolean validate(E4CgiParams params, E4ServletImplementation_Intf servlet)
          Run throught all child elements recursivly, and if those elements implement interface E4InputField_Intf then store the parameter and execute the E4InputField_Intf.validate() function.
 
Methods inherited from class e4s.html.DIV
eventHandlers, getAlign, getDivId, getStyleHide, hide, jsClear, jsHide, jsIsOpen, jsShow, jsWrite, onMouseOut, onMouseOver, setAlign, setEventHandler, setSTYLE, setStyle, setStyleHide, setTitle, show, toHtml
 
Methods inherited from class e4s.html.E4HtmlContentElement
A_Email, A_Email, A_Multiple, A_Popup, A_Popup, A_Popup, A_Popup, A_Popup, A_Popup, A_Popup, A_Reference, A_Reference, A_Reference, A_Reference, A_Reference, A_ReturnValue, A_ReturnValue, A_ReturnValue, A_ReturnValue, A, A, A, A, A, A, A, AjaxElement, AjaxElement, AjaxElement, B, B, BIG, Box, Box, Box, BoxRoundCorners, BoxRoundCorners, BoxRoundCorners, BR, BUTTON, BUTTON, BUTTON, BUTTON, BUTTON, BUTTON, BUTTON, BUTTON, BUTTON, BUTTON, BUTTON, BUTTON, BUTTON, CENTER, DEL, DIV, DIV, DIV, DIV, FONT, FONT, FONT, FONT, FONT, FONT, FONT, FONT, FONT, FONT, FONT, FONT, FONT, FONT, FONT, FullSizeE4Message, H1, H2, H3, H4, Hint, HR, I, I, IMG, IMG, IMG, IMG, IMG, IMG, IMG, IMG, INS, Message, Message, Message, Message, Message, NBSP, NOBR, P_NBSP, P, PRE, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, rem, rem, rem, rem, rem, rem, SMALL, SPAN, STRIKE, strike, SystemError, SystemError, SystemError, SystemError, TABLE, TABLE, trace, trace, trace, trace, trace, trace, translate_Sys, translate, U, UL
 
Methods inherited from class e4s.html.E4HtmlElement
addElement, addElement, addElement, copyElements, print
 
Methods inherited from class e4s.html.E4HtmlElementGeneral
addScript, addScript, addScript, addStyleForEditing, addTranslationForEditing, buildStyleAttribute, buildStyleClassReference, collectStylesForEditing, collectStylesForEditing, collectTranslationsForEditing, createScript, createScript, debugToString, findElement, findElement, findElement, findElement, getElements, getElementsVec, getField, getId, getLastElement, getStringContent, getStyle, getSTYLE, getStyle, hasScripts, hasSTYLE, isContentClass, isE4InputField_Intf, openTag, removeAll, removeElementById, removeElements, removeElements, removeStyle, setId, setReadOnly, setStyle, setStyle, setSTYLE, setValue, Style, Style, toHtml_hidden
 
Methods inherited from class e4s.html.E4HtmlObject
E4ID, E4ID, set_e4sID
 
Methods inherited from class e4s.util.E4Object
Calendar, CName, CName, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelSys, E4LabelSys, e4sCopyright, e4sVersion, encode, encode, encode, encodeHtml, encodeHtml, encodeHtml, encodeURL, encodeURL, encodeURL, finalize, getLINE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTraceMemory, HtmlEncode, HtmlEncode, HtmlEncode, isdecimal, isdigit, isnotok, isnotok, isnumeric, isok, isok, isok, isok, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingStack, mkdirs, null2nbsp, null2nbsp, null2nbsp, ok, ok, ok, ok, outPrintln, setLogFile4Trace, setTraceMemory, STACKTRACE, toDebug, toDouble, toFloat, toFloat, TRACE_CALLS, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, wait
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface e4s.html.E4HtmlElement_Intf
addScript, addScript, addScript, debugToString, findElement, findElement, getElements, getElementsVec, getField, getId, getStringContent, isContentClass, removeAll, removeElementById, removeElements, set_e4sID, setId, setReadOnly, setValue, toHtml_hidden
 

Field Detail

m_js_AEP_callback_before

protected java.lang.String m_js_AEP_callback_before

m_js_AEP_callback_after

protected java.lang.String m_js_AEP_callback_after

m_id

protected java.lang.String m_id

m_url

protected java.lang.String m_url

m_debug

protected boolean m_debug

READY_STATE_COMPLETE

protected static final int READY_STATE_COMPLETE
See Also:
Constant Field Values

JS_XML_HTTP_REQUEST

public static final java.lang.String JS_XML_HTTP_REQUEST
Java-Script function to get the E4Ajax object. Defined in E4AjaxScripts.JS_AJAX.

See Also:
Constant Field Values
Constructor Detail

E4AjaxElementGeneral

protected E4AjaxElementGeneral(java.lang.String div_id)

E4AjaxElementGeneral

public E4AjaxElementGeneral(E4AjaxData_Intf data,
                            E4ServletImplementation_Intf servlet)
Create an E4AjaxElement. This is the part of the E4Ajax mechanism that is bound into the HTML elements rendered by E4S.

Parameters:
data - the E4Ajax-Data references to the data beeing displayed and rendered. It is stored internally and will be used asynchronously
servlet - a valid servlet context (@link e4s.servlet.E4ModuleImplementation#getServlet()}
See Also:
E4HtmlContentElement.AjaxElement(e4s.html.ajax.E4AjaxData_Intf,e4s.servlet.E4ServletImplementation_Intf)

E4AjaxElementGeneral

public E4AjaxElementGeneral(E4AjaxData_Intf data,
                            E4ServletImplementation_Intf servlet,
                            boolean debug)
Create an E4AjaxElement. This is the part of the E4Ajax mechanism that is bound into the HTML elements rendered by E4S.

Parameters:
data - the E4Ajax-Data references to the data beeing displayed and rendered. It is stored internally and will be used asynchronously
debug - if true then an alert with the rendered output will be displayed - only for development environments
servlet - a valid servlet context (@link e4s.servlet.E4ModuleImplementation#getServlet()}
See Also:
e4s.html.E4HtmlContentElement#E4AjaxElement

E4AjaxElementGeneral

public E4AjaxElementGeneral(E4AjaxData_Intf data,
                            E4ServletImplementation_Intf servlet,
                            boolean debug,
                            boolean name_scripts)
Create an E4AjaxElement. This is the part of the E4Ajax mechanism that is bound into the HTML elements rendered by E4S.

Parameters:
data - the E4Ajax-Data references to the data beeing displayed and rendered. It is stored internally and will be used asynchronously
debug - if true then an alert with the rendered output will be displayed - only for development environments
servlet - a valid servlet context (@link e4s.servlet.E4ModuleImplementation#getServlet()}
See Also:
e4s.html.E4HtmlContentElement#E4AjaxElement

E4AjaxElementGeneral

protected E4AjaxElementGeneral(E4AjaxData_Intf data)

E4AjaxElementGeneral

public E4AjaxElementGeneral(E4AjaxData_Intf data,
                            int width,
                            int height,
                            E4ServletImplementation_Intf servlet)
Create an E4AjaxElement. This is the part of the E4Ajax mechanism that is bound into the HTML elements rendered by E4S.

Parameters:
data - the E4Ajax-Data references to the data beeing displayed and rendered. It is stored internally and will be used asynchronously
width - horizontal size of the DIV-element
height - vertical size of the DIV-element
servlet - a valid servlet context (@link e4s.servlet.E4ModuleImplementation#getServlet()}
See Also:
e4s.html.E4HtmlContentElement#E4AjaxElement

E4AjaxElementGeneral

public E4AjaxElementGeneral(E4AjaxData_Intf data,
                            int width,
                            int height,
                            E4ServletImplementation_Intf servlet,
                            boolean debug)
Create an E4AjaxElement. This is the part of the E4Ajax mechanism that is bound into the HTML elements rendered by E4S.

Parameters:
data - the E4Ajax-Data references to the data beeing displayed and rendered. It is stored internally and will be used asynchronously
debug - if true then an alert with the rendered output will be displayed - only for development environments
width - horizontal size of the DIV-element
height - vertical size of the DIV-element
servlet - a valid servlet context (@link e4s.servlet.E4ModuleImplementation#getServlet()}
See Also:
e4s.html.E4HtmlContentElement#E4AjaxElement
Method Detail

setData

protected void setData(E4AjaxData_Intf data,
                       boolean debug,
                       E4ServletImplementation_Intf servlet)

setData

protected void setData(E4AjaxData_Intf data,
                       boolean debug,
                       boolean name_scripts,
                       E4ServletImplementation_Intf servlet)

getJsCallMethod

public E4JavaScript getJsCallMethod()

prepare

public void prepare(BODY body)
Adds a necessary event handler to the body. The event handler is only required in the case a timeout is set (#setTimeout(int).

Parameters:
body - the BODY element
See Also:
#setTimeout(int), getOnTimer()

getOnClick

public E4EventHandlerA getOnClick()
This event handler is intended to be used if activation of the E4Ajax element shall take place on a user click. Note, that this script is just created but not added here as we expect that you use it in an input field where it will be added.

Returns:
the new event handler
See Also:
A, getOnTimer()

getOnChange

public E4EventHandlerInputField getOnChange(FORM form)
This event handler is intended to be used if activation of the E4Ajax element shall take place on a field's value change.

Parameters:
the - form used to generate a script referencing the name of the form if specified, or referenced to document.forms[0] if that form parameter is null.
Returns:
the new event handler
See Also:
FORM, getOnTimer()

getOnClick

public E4EventHandlerBUTTON getOnClick(FORM form)
This event handler is intended to be used if activation of the E4Ajax element shall take place on a user click.

Returns:
the new event handler
See Also:
FORM, getOnTimer()

getOnTimer

public E4EventHandlerBODY getOnTimer()
Create a JavaScript that call's itself several time after a period specified by setTimeout(long), initially this should be called as body-on-load, that is why this script is a bode eventhandler.

Returns:
the JavaScript
See Also:
getOnTimer(long), setTimeout(long)

getOnTimer

public E4EventHandlerBODY getOnTimer(long timeout)
Create a JavaScript that call's itself several time after a period specified by a given parameter, initially this should be called as body-on-load, that is why this script is a bode eventhandler.

Parameters:
timeout - the timeout in milliseconds
Returns:
the JavaScript
See Also:
getOnTimer(), setTimeout(long)

getMethodDispacher

public E4Method getMethodDispacher()
Get the method responsible for handling the E4Ajax request.

See Also:
#setMethodDispacher(e4s.html.E4Method), E4ModuleAjaxDispacher.getAjaxData

setMethodDispacher

public void setMethodDispacher(E4Method mref,
                               E4ServletImplementation_Intf servlet)
Set the method responsible for handling the E4Ajax request. There is no need to set this method, as it will use E4ModuleAjaxDispacher.getAjaxData by default.

Parameters:
mref - the method reflection, null (default) to use the system implementation
See Also:
getMethodDispacher(), E4ModuleAjaxDispacher.getAjaxData

getSendReqScriptGeneric

public E4JavaScript getSendReqScriptGeneric()

getSendReqScript

public E4JavaScript getSendReqScript()

getOnReadyRequest

protected E4JavaScript getOnReadyRequest()
Only internal usage


updateOnReadyReqCore

protected abstract void updateOnReadyReqCore(E4JavaScript js)

updateOnReadyReq

protected void updateOnReadyReq()

setTimeout

public void setTimeout(long ms)
Set the timeout for the refresh cycle.

Parameters:
ms - the timeout period in milliseconds, a value of -1 indicates that there will be no timeout.
See Also:
getTimeout(), getOnTimer(), getOnTimer(long), prepare(e4s.html.BODY)

getTimeout

public long getTimeout()
Get the timeout for the refresh cycle.

Returns:
the timeout period in milliseconds, a value of -1 indicates that there is no timeout (the element will be only refreshed once)
See Also:
setTimeout(long)

toHtml

public void toHtml(E4StringBufferHtml buf,
                   E4ServletImplementation_Intf servlet)
            throws java.lang.Exception
Description copied from interface: E4HtmlElement_Intf
Create the HTML output for this element. Also run throught all child elements, and call their E4HtmlElement_Intf.toHtml(e4s.util.E4StringBufferHtml, e4s.servlet.E4ServletImplementation_Intf) function to generate output of those objects which becomes appended. Normally, there is no need to call this function anyway, and this also might result in side effects of too-early relasing of objects in some cases. This function is called by E4ServletImplementation_Intf.write(e4s.html.E4HtmlElement) on the top level HTML element (common this is a HTML or BODY element) and branches down to all child elements.

Specified by:
toHtml in interface E4HtmlElement_Intf
Overrides:
toHtml in class DIV
servlet - the servlet environment currently running in
Throws:
java.lang.Exception

collectScripts

public void collectScripts(E4ScriptsVec v,
                           E4ServletImplementation_Intf servlet)
Description copied from class: E4HtmlElementGeneral
Get a vector of used scripts from all subelements.

Specified by:
collectScripts in interface E4HtmlElement_Intf
Overrides:
collectScripts in class E4HtmlElementGeneral
Parameters:
v - collect the names of all scripts
servlet - the servlet context
See Also:
E4JavaScript

collectTranslationsForEditing

public void collectTranslationsForEditing(E4TranslationsVec vec,
                                          E4ServletImplementation_Intf servlet)
Description copied from class: E4HtmlElementGeneral
Build a list (Vector) with translation texts used so far during display of this page. Run throught all subclasses elements and collect their texts as well. Note, that a text will only be added one time. The Vector contains elements of class E4Label.

Specified by:
collectTranslationsForEditing in interface E4HtmlElement_Intf
Overrides:
collectTranslationsForEditing in class E4HtmlElementGeneral
Parameters:
vec - the Vector where the styles will be collected, may not be null
servlet - the current servlet instance
See Also:
E4Label_Intf

collectStylesForEditing

public void collectStylesForEditing(E4StylesHash h,
                                    E4ServletImplementation_Intf servlet)
Description copied from class: E4HtmlElementGeneral
Build a list (Vector) with style definitions used so far during display of this page. Run throught all subclasses elements and collect their styles as well. Note, that a style will only be added one time. The Vector contains elements of class E4StyleUsage.

Specified by:
collectStylesForEditing in interface E4HtmlElement_Intf
Overrides:
collectStylesForEditing in class E4HtmlElementGeneral
Parameters:
h - the Vector where the styles will be collected, may not be null
servlet - the servlet context
See Also:
E4ServletImplementation_Intf.sessionCanEditStyles(), #collectStylesForEditing(e4s.html.style.E4StylesHash, STYLE_Name, boolean)

setShowOnLoad

public void setShowOnLoad(boolean mode)
Enables or disables display of the data content during display of the E4Ajax-Element. The idea of E4Ajax is not, to have elements displayed initially instead they shall be displayed on a trigger (timer, on-click) later. Sometimes it makes sense, to display content immediatly, sometimes not.

Parameters:
mode - true = display the content on load, false do not display (default) #see getShowOnLoad

getShowOnLoad

public boolean getShowOnLoad()
Enables or disables display of the data content during display of the E4Ajax-Element. The idea of E4Ajax is not, to have elements displayed initially instead they shall be displayed on a trigger (timer, on-click) later. Sometimes it makes sense, to display content immediatly, sometimes not.

Returns:
true = display the content on load, false do not display (default) #see getShowOnLoad

getDebug

public boolean getDebug()
Get the debug mode, which causes some E4JavaScript alert messages to be displayed.

Returns:
true if debug was activated during construction

toString

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

setAEPCallbackScript_Before

public void setAEPCallbackScript_Before(E4JavaScript js)

setAEPCallbackScript_Before

public void setAEPCallbackScript_Before(java.lang.String js_name)

setAEPCallbackScript_After

public void setAEPCallbackScript_After(E4JavaScript js)

setAEPCallbackScript_After

public void setAEPCallbackScript_After(java.lang.String js_name)

validate

public boolean validate(E4CgiParams params,
                        E4ServletImplementation_Intf servlet)
                 throws java.lang.Exception
Description copied from class: E4HtmlElementGeneral
Run throught all child elements recursivly, and if those elements implement interface E4InputField_Intf then store the parameter and execute the E4InputField_Intf.validate() function. In any case, you can use this function as well to set values out of the E4CgiParams to the E4InputField_Intf objects.

Specified by:
validate in interface E4HtmlElement_Intf
Overrides:
validate in class E4HtmlElementGeneral
Parameters:
params - the current cgi parameters
Returns:
true, if all defined validations will return true. false, if at least one validation returns false. Note, that in any case all validations must be performed to set the fields error-messages.
Throws:
java.lang.Exception
See Also:
E4InputField_Intf.validate(), E4HtmlElementGeneral.setValue(e4s.html.E4CgiParams), e4s.html.input.extended.E4InputField#validate(e4s.html.E4CgiParams)

_getSVNVersionString

public static java.lang.String _getSVNVersionString()
Get version info string from subversion.

Returns:
the version info string.
See Also:
E4Util.getRevisionCodeFromSVN(Class)

setNameScripts

public void setNameScripts(boolean mode)
Choose, if scripts shall be named according to a prefix and the DIV.getDivId().

Parameters:
mode - true: use named scripts, false: use generic names for scripts

www.element4solution.com