Source Code Cross Referenced for Div.java in  » Web-Framework » struts-2.0.11 » org » apache » struts2 » components » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Framework » struts 2.0.11 » org.apache.struts2.components 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: Div.java 511299 2007-02-24 16:39:53Z musachy $
003:         *
004:         * Licensed to the Apache Software Foundation (ASF) under one
005:         * or more contributor license agreements.  See the NOTICE file
006:         * distributed with this work for additional information
007:         * regarding copyright ownership.  The ASF licenses this file
008:         * to you under the Apache License, Version 2.0 (the
009:         * "License"); you may not use this file except in compliance
010:         * with the License.  You may obtain a copy of the License at
011:         *
012:         *  http://www.apache.org/licenses/LICENSE-2.0
013:         *
014:         * Unless required by applicable law or agreed to in writing,
015:         * software distributed under the License is distributed on an
016:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017:         * KIND, either express or implied.  See the License for the
018:         * specific language governing permissions and limitations
019:         * under the License.
020:         */
021:        package org.apache.struts2.components;
022:
023:        import javax.servlet.http.HttpServletRequest;
024:        import javax.servlet.http.HttpServletResponse;
025:
026:        import org.apache.struts2.views.annotations.StrutsTag;
027:        import org.apache.struts2.views.annotations.StrutsTagAttribute;
028:
029:        import com.opensymphony.xwork2.util.ValueStack;
030:
031:        /**
032:         * <!-- START SNIPPET: javadoc -->
033:         * The div tag when used on the ajax theme, provides a remote call
034:         * from the current page to update a section of content without having to refresh the entire page.
035:         * <p>
036:         * It creates a HTML &lt;DIV /&gt; that obtains it's content via a remote XMLHttpRequest call via
037:         * the dojo framework.
038:         * </p>
039:         * <div>
040:         * <!-- START SNIPPET: ajaxJavadoc -->
041:         * <B>THE FOLLOWING IS ONLY VALID WHEN AJAX IS CONFIGURED</B>
042:         * <ul>
043:         *      <li>href</li>
044:         *      <li>errorText</li>
045:         *      <li>afterLoading</li>
046:         *      <li>executeScripts</li>
047:         *      <li>loadingText</li>
048:         *      <li>listenTopics</li>
049:         *      <li>handler</li>
050:         *      <li>formId</li>
051:         *      <li>formFilter</li>
052:         *      <li>targets</li>
053:         *      <li>notifyTopics</li>
054:         *      <li>showErrorTransportText</li>
055:         *      <li>indicator</li>
056:         * </ul>
057:         * 'targets' is a list of element ids whose content will be updated with the
058:         * text returned from request.<p/>
059:         * 'href' needs to be set as an url tag reference value.<p/>
060:         * 'errorText' is the text that will be displayed when there is an error making the request.<p/>
061:         * 'afterLoading' Deprecated. Use 'notifyTopics'.<p/>
062:         * 'executeScripts' if set to true will execute javascript sections in the returned text.<p/>
063:         * 'loadingText' is the text that will be displayed on the 'targets' elements while making the
064:         * request.<p/>
065:         * 'handler' is the name of the function that will take care of making the AJAX request. Dojo's widget
066:         * and dom node are passed as parameters).<p/>
067:         * 'formId' is the id of the html form whose fields will be seralized and passed as parameters
068:         * in the request.<p/>
069:         * 'formFilter' is the name of a function which will be used to filter the fields that will be
070:         * seralized. This function takes as a parameter the element and returns true if the element
071:         * should be included.<p/>
072:         * 'updateFreq' sets(in milliseconds) the update interval.<p/>
073:         * 'autoStart' if set to true(true by default) starts the timer automatically<p/>
074:         * 'startTimerListenTopics' is a comma-separated list of topics used to start the timer<p/>
075:         * 'stopTimerListenTopics' is a comma-separated list of topics used to stop the timer<p/>
076:         * 'listenTopics' comma separated list of topics names, that will trigger a request<p/>
077:         * 'indicator' element to be shown while the request executing<p/>
078:         * 'showErrorTransportText': whether errors should be displayed (on 'targets')</p>
079:         * 'showLoadingText' show loading text on targets</p>
080:         * 'separateScript' Run scripts in a separate scope, unique for each Div<p/>
081:         * 'notifyTopics' comma separated list of topics names, that will be published. Three parameters are passed:<p/>
082:         * <ul>
083:         *      <li>data: html or json object when type='load' or type='error'</li>
084:         *      <li>type: 'before' before the request is made, 'load' when the request succeeds, or 'error' when it fails</li>
085:         *      <li>request: request javascript object, when type='load' or type='error'</li>
086:         * </ul>
087:         * <!-- END SNIPPET: javadoc -->
088:         * </div><p> <b>Examples</b>
089:         *
090:         * <pre>
091:         *       <!-- START SNIPPET: example -->
092:         * &lt;s:url id="url" action="AjaxTest" />
093:         * &lt;s:div
094:         *    id=&quot;once&quot;
095:         *    theme=&quot;ajax&quot;
096:         *    href=&quot;%{url}&quot;
097:         *    loadingText=&quot;Loading...&quot;
098:         *    listenTopics=&quot;/refresh&quot;
099:         *    updateFreq=&quot;3000&quot;
100:         *    autoStart=&quot;true&quot;
101:         *    formId=&quot;form&quot;
102:         *&gt;&lt;/s:div&gt;
103:         *       <!-- END SNIPPET: example -->
104:         * </pre>
105:         * </p>
106:         *
107:         */
108:        @StrutsTag(name="div",tldTagClass="org.apache.struts2.views.jsp.ui.DivTag",description="Render HTML div providing content from remote call via AJAX")
109:        public class Div extends AbstractRemoteCallUIBean {
110:
111:            public static final String TEMPLATE = "div";
112:            public static final String TEMPLATE_CLOSE = "div-close";
113:            public static final String COMPONENT_NAME = Div.class.getName();
114:
115:            protected String updateFreq;
116:            protected String autoStart;
117:            protected String delay;
118:            protected String startTimerListenTopics;
119:            protected String stopTimerListenTopics;
120:            protected String refreshOnShow;
121:            protected String separateScripts;
122:
123:            public Div(ValueStack stack, HttpServletRequest request,
124:                    HttpServletResponse response) {
125:                super (stack, request, response);
126:            }
127:
128:            public String getDefaultOpenTemplate() {
129:                return TEMPLATE;
130:            }
131:
132:            protected String getDefaultTemplate() {
133:                return TEMPLATE_CLOSE;
134:            }
135:
136:            public void evaluateExtraParams() {
137:                super .evaluateExtraParams();
138:
139:                if (updateFreq != null)
140:                    addParameter("updateFreq", findValue(updateFreq,
141:                            Integer.class));
142:                if (autoStart != null)
143:                    addParameter("autoStart", findValue(autoStart,
144:                            Boolean.class));
145:                if (refreshOnShow != null)
146:                    addParameter("refreshOnShow", findValue(refreshOnShow,
147:                            Boolean.class));
148:                if (delay != null)
149:                    addParameter("delay", findValue(delay, Integer.class));
150:                if (startTimerListenTopics != null)
151:                    addParameter("startTimerListenTopics",
152:                            findString(startTimerListenTopics));
153:                if (stopTimerListenTopics != null)
154:                    addParameter("stopTimerListenTopics",
155:                            findString(stopTimerListenTopics));
156:                if (separateScripts != null)
157:                    addParameter("separateScripts", findValue(separateScripts,
158:                            Boolean.class));
159:            }
160:
161:            @StrutsTagAttribute(description="Start timer automatically",type="Boolean",defaultValue="true")
162:            public void setAutoStart(String autoStart) {
163:                this .autoStart = autoStart;
164:            }
165:
166:            @StrutsTagAttribute(description="How long to wait before fetching the content (in milliseconds)",type="Integer")
167:            public void setDelay(String delay) {
168:                this .delay = delay;
169:            }
170:
171:            @StrutsTagAttribute(description="How often to reload the content (in milliseconds)",type="Integer")
172:            public void setUpdateFreq(String updateInterval) {
173:                this .updateFreq = updateInterval;
174:            }
175:
176:            @StrutsTagAttribute(description="Topics that will start the timer (for autoupdate)")
177:            public void setStartTimerListenTopics(String startTimerListenTopic) {
178:                this .startTimerListenTopics = startTimerListenTopic;
179:            }
180:
181:            @StrutsTagAttribute(description="Topics that will stop the timer (for autoupdate)")
182:            public void setStopTimerListenTopics(String stopTimerListenTopic) {
183:                this .stopTimerListenTopics = stopTimerListenTopic;
184:            }
185:
186:            @StrutsTagAttribute(description="Content will be loaded when div becomes visible, used only inside tabbedPanel",type="Boolean",defaultValue="false")
187:            public void setRefreshOnShow(String refreshOnShow) {
188:                this .refreshOnShow = refreshOnShow;
189:            }
190:
191:            @StrutsTagAttribute(description="Deprecated. Use 'notifyTopics'. Javascript code execute after reload")
192:            public void setAfterLoading(String afterLoading) {
193:                this .afterLoading = afterLoading;
194:            }
195:
196:            @StrutsTagAttribute(description="Run scripts in a separate scope, unique for each Div",defaultValue="true")
197:            public void setSeparateScripts(String separateScripts) {
198:                this.separateScripts = separateScripts;
199:            }
200:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.