You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mu...@apache.org on 2007/05/30 03:39:01 UTC
svn commit: r542714 -
/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java
Author: musachy
Date: Tue May 29 18:39:00 2007
New Revision: 542714
URL: http://svn.apache.org/viewvc?view=rev&rev=542714
Log:
Improve remote div documentation
Modified:
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java
Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java?view=diff&rev=542714&r1=542713&r2=542714
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java Tue May 29 18:39:00 2007
@@ -30,33 +30,61 @@
/**
* <!-- 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 @@
protected String startTimerListenTopics;
protected String stopTimerListenTopics;
protected String refreshOnShow;
- protected String separateScripts;
protected String closable;
protected String preload;
@@ -138,11 +165,6 @@
@StrutsTagAttribute(description="Content will be loaded when div becomes visible, used only inside the tabbedpanel tag", type="Boolean", defaultValue="false")
public void setRefreshOnShow(String refreshOnShow) {
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")