org.apache.struts2.components
Class Div

java.lang.Object
  extended by org.apache.struts2.components.Component
      extended by org.apache.struts2.components.UIBean
          extended by org.apache.struts2.components.ClosingUIBean
              extended by org.apache.struts2.components.AbstractRemoteCallUIBean
                  extended by org.apache.struts2.components.Div
All Implemented Interfaces:
RemoteUICallBean

public class Div
extends AbstractRemoteCallUIBean

The div tag when used on the ajax theme, provides a remote call from the current page to update a section of content without having to refresh the entire page.

It creates a HTML <DIV /> that obtains it's content via a remote XMLHttpRequest call via the dojo framework.

THE FOLLOWING IS ONLY VALID WHEN AJAX IS CONFIGURED 'targets' is a list of element ids whose content will be updated with the text returned from request.

'href' needs to be set as an url tag reference value.

'errorText' is the text that will be displayed when there is an error making the request.

'afterLoading' Deprecated. Use 'notifyTopics'.

'executeScripts' if set to true will execute javascript sections in the returned text.

'loadingText' is the text that will be displayed on the 'targets' elements while making the request.

'handler' is the name of the function that will take care of making the AJAX request. Dojo's widget and dom node are passed as parameters).

'formId' is the id of the html form whose fields will be seralized and passed as parameters in the request.

'formFilter' is the name of a function which will be used to filter the fields that will be seralized. This function takes as a parameter the element and returns true if the element should be included.

'updateFreq' sets(in milliseconds) the update interval.

'autoStart' if set to true(true by default) starts the timer automatically

'startTimerListenTopics' is a comma-separated list of topics used to start the timer

'stopTimerListenTopics' is a comma-separated list of topics used to stop the timer

'listenTopics' comma separated list of topics names, that will trigger a request

'indicator' element to be shown while the request executing

'showErrorTransportText': whether errors should be displayed (on 'targets')

'showLoadingText' show loading text on targets

'separateScript' Run scripts in a separate scope, unique for each Div

'notifyTopics' comma separated list of topics names, that will be published. Three parameters are passed:

Examples

       
 <s:url id="url" action="AjaxTest" />
 <s:div
    id="once"
    theme="ajax"
    href="%{url}"
    loadingText="Loading..."
    listenTopics="/refresh"
    updateFreq="3000"
    autoStart="true"
    formId="form"
></s:div>
       
 


Field Summary
protected  String autoStart
           
static String COMPONENT_NAME
           
protected  String delay
           
protected  String refreshOnShow
           
protected  String separateScripts
           
protected  String startTimerListenTopics
           
protected  String stopTimerListenTopics
           
static String TEMPLATE
           
static String TEMPLATE_CLOSE
           
protected  String updateFreq
           
 
Fields inherited from class org.apache.struts2.components.AbstractRemoteCallUIBean
afterLoading, beforeLoading, errorText, executeScripts, formFilter, formId, handler, href, indicator, listenTopics, loadingText, notifyTopics, showErrorTransportText, showLoadingText
 
Fields inherited from class org.apache.struts2.components.ClosingUIBean
openTemplate
 
Fields inherited from class org.apache.struts2.components.UIBean
accesskey, cssClass, cssStyle, defaultTemplateDir, defaultUITheme, disabled, key, label, labelPosition, name, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect, request, required, requiredposition, response, tabindex, template, templateDir, templateEngineManager, templateSuffix, theme, title, tooltip, tooltipConfig, value
 
Fields inherited from class org.apache.struts2.components.Component
actionMapper, COMPONENT_STACK, id, parameters, stack
 
Constructor Summary
Div(ValueStack stack, HttpServletRequest request, HttpServletResponse response)
           
 
Method Summary
 void evaluateExtraParams()
           
 String getDefaultOpenTemplate()
           
protected  String getDefaultTemplate()
          A contract that requires each concrete UI Tag to specify which template should be used as a default.
 void setAfterLoading(String afterLoading)
           
 void setAutoStart(String autoStart)
           
 void setDelay(String delay)
           
 void setRefreshOnShow(String refreshOnShow)
           
 void setSeparateScripts(String separateScripts)
           
 void setStartTimerListenTopics(String startTimerListenTopic)
           
 void setStopTimerListenTopics(String stopTimerListenTopic)
           
 void setUpdateFreq(String updateInterval)
           
 
Methods inherited from class org.apache.struts2.components.AbstractRemoteCallUIBean
setBeforeLoading, setErrorText, setExecuteScripts, setFormFilter, setFormId, setHandler, setHref, setIndicator, setListenTopics, setLoadingText, setNotifyTopics, setShowErrorTransportText, setShowLoadingText
 
Methods inherited from class org.apache.struts2.components.ClosingUIBean
setOpenTemplate, start
 
Methods inherited from class org.apache.struts2.components.UIBean
addFormParameter, buildTemplateName, enableAncestorFormCustomOnsubmit, end, ensureAttributeSafelyNotEscaped, escape, evaluateNameValue, evaluateParams, getTemplate, getTemplateDir, getTheme, getTooltipConfig, getValueClassType, mergeTemplate, populateComponentHtmlId, setAccesskey, setCssClass, setCssStyle, setDefaultTemplateDir, setDefaultUITheme, setDisabled, setKey, setLabel, setLabelposition, setName, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setRequired, setRequiredposition, setTabindex, setTemplate, setTemplateDir, setTemplateEngineManager, setTheme, setTitle, setTooltip, setTooltipConfig, setValue
 
Methods inherited from class org.apache.struts2.components.Component
addAllParameters, addParameter, altSyntax, copyParams, determineActionURL, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findValue, findValue, findValue, getComponentStack, getId, getParameters, getStack, popComponentStack, setActionMapper, setId, toString, usesBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMPLATE

public static final String TEMPLATE
See Also:
Constant Field Values

TEMPLATE_CLOSE

public static final String TEMPLATE_CLOSE
See Also:
Constant Field Values

COMPONENT_NAME

public static final String COMPONENT_NAME

updateFreq

protected String updateFreq

autoStart

protected String autoStart

delay

protected String delay

startTimerListenTopics

protected String startTimerListenTopics

stopTimerListenTopics

protected String stopTimerListenTopics

refreshOnShow

protected String refreshOnShow

separateScripts

protected String separateScripts
Constructor Detail

Div

public Div(ValueStack stack,
           HttpServletRequest request,
           HttpServletResponse response)
Method Detail

getDefaultOpenTemplate

public String getDefaultOpenTemplate()
Specified by:
getDefaultOpenTemplate in class ClosingUIBean

getDefaultTemplate

protected String getDefaultTemplate()
Description copied from class: UIBean
A contract that requires each concrete UI Tag to specify which template should be used as a default. For example, the CheckboxTab might return "checkbox.vm" while the RadioTag might return "radio.vm". This value not begin with a '/' unless you intend to make the path absolute rather than relative to the current theme.

Specified by:
getDefaultTemplate in class UIBean
Returns:
The name of the template to be used as the default.

evaluateExtraParams

public void evaluateExtraParams()
Overrides:
evaluateExtraParams in class AbstractRemoteCallUIBean

setAutoStart

public void setAutoStart(String autoStart)

setDelay

public void setDelay(String delay)

setUpdateFreq

public void setUpdateFreq(String updateInterval)

setStartTimerListenTopics

public void setStartTimerListenTopics(String startTimerListenTopic)

setStopTimerListenTopics

public void setStopTimerListenTopics(String stopTimerListenTopic)

setRefreshOnShow

public void setRefreshOnShow(String refreshOnShow)

setAfterLoading

public void setAfterLoading(String afterLoading)
Specified by:
setAfterLoading in interface RemoteUICallBean
Overrides:
setAfterLoading in class AbstractRemoteCallUIBean

setSeparateScripts

public void setSeparateScripts(String separateScripts)


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.