mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
Improve remote div documentation
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@542714 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -30,33 +30,61 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
* 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.
|
||||
* <p>
|
||||
* 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.
|
||||
* </p>
|
||||
* <div>
|
||||
* <p>
|
||||
* When used inside a "tabbedpanel" tag, each div becomes a tab. Some attributes are specific
|
||||
* to this use case, like:
|
||||
* <ul>
|
||||
* <li>refreshOnShow: div content is realoded when tab is selected</li>
|
||||
* <li>closable: Tab will have close button</li>
|
||||
* <li>preload: load div content after page is loaded</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
* <!-- END SNIPPET: javadoc -->
|
||||
*
|
||||
* </div><p> <b>Examples</b>
|
||||
*
|
||||
* <p>Examples</p>
|
||||
* <!-- START SNIPPET: example1 -->
|
||||
* <p>Simple div that loads its content once:</p>
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
* <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>
|
||||
* <!-- END SNIPPET: example -->
|
||||
* <sx:div href="%{#url}">Initial Content</sx:div>
|
||||
* </pre>
|
||||
* </p>
|
||||
*
|
||||
* <!-- END SNIPPET: example1 -->
|
||||
*
|
||||
* <!-- START SNIPPET: example1 -->
|
||||
* <p>div that reloads its content every 2 seconds, and shows an indicator while reloading:</p>
|
||||
* <pre>
|
||||
* <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>
|
||||
* </pre>
|
||||
* <!-- END SNIPPET: example1 -->
|
||||
*
|
||||
* <!-- START SNIPPET: example1 -->
|
||||
* <p>div that uses topics to control the timer, highlights its content in red after reload, and submits
|
||||
* a form:</p>
|
||||
* <pre>
|
||||
* <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>
|
||||
* </pre>
|
||||
* <!-- END SNIPPET: example1 -->
|
||||
*/
|
||||
@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;
|
||||
|
||||
Reference in New Issue
Block a user