diff --git a/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java index ac2608008..a791aedd9 100644 --- a/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java +++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java @@ -30,33 +30,61 @@ import com.opensymphony.xwork2.util.ValueStack; /** * - * 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. + * This tag generates an HTMl div that loads its content using an XMLHttpRequest call via + * the dojo framework. When the "updateFreq" is set the timer will start automatically and + * reload the div content with the value of "updateFreq" as the refresh period. Topics can + * be used to stop(stopTimerListenTopics) and start(startTimerListenTopics) this timer. *

- *
+ *

+ * When used inside a "tabbedpanel" tag, each div becomes a tab. Some attributes are specific + * to this use case, like: + *

+ *

+ * * - *

Examples - * + *

Examples

+ * + *

Simple div that loads its content once:

*
- *       
- * <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>
- *       
+ * <sx:div href="%{#url}">Initial Content</sx:div>
  * 
- *

- * + * + * + * + *

div that reloads its content every 2 seconds, and shows an indicator while reloading:

+ *
+ * <img id="indicator" src="${pageContext.request.contextPath}/images/indicator.gif" style="display:none"/>
+ * <sx:div href="%{#url}" updateFreq="2000" indicator="indicator">
+ *   Initial Content
+ * </sx:div>
+ * 
+ * + * + * + *

div that uses topics to control the timer, highlights its content in red after reload, and submits + * a form:

+ *
+ * <form id="form">
+ *   <label for="textInput">Text to be submited when div reloads</label>
+ *   <input type=textbox id="textInput" name="data">
+ * </form>
+ * <sx:div 
+ *      href="%{#url}" 
+ *      updateFreq="3000"
+ *      listenTopics="/refresh"
+ *      startTimerListenTopics="/startTimer"
+ *      stopTimerListenTopics="/stopTimer"
+ *      highlightColor="red"
+ *      formId="form">
+ *  Initial Content
+ * </sx:div>
+ * 
+ * */ @StrutsTag(name="div", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.DivTag", description="Render HTML div providing content from remote call via AJAX") public class Div extends AbstractRemoteBean { @@ -71,7 +99,6 @@ public class Div extends AbstractRemoteBean { protected String startTimerListenTopics; protected String stopTimerListenTopics; protected String refreshOnShow; - protected String separateScripts; protected String closable; protected String preload; @@ -140,11 +167,6 @@ public class Div extends AbstractRemoteBean { this.refreshOnShow = refreshOnShow; } - @StrutsTagAttribute(description="Run scripts in a separate scope, unique for each Div", defaultValue="true") - public void setSeparateScripts(String separateScripts) { - this.separateScripts = separateScripts; - } - @StrutsTagAttribute(description="Show a close button when the div is inside a 'tabbedpanel'", defaultValue="false") public void setClosable(String closable) { this.closable = closable;