Source Code Cross Referenced for Div.java in  » J2EE » webwork-2.2.6 » com » opensymphony » webwork » 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 » J2EE » webwork 2.2.6 » com.opensymphony.webwork.components 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.opensymphony.webwork.components;
002:
003:        import com.opensymphony.xwork.util.OgnlValueStack;
004:        import com.opensymphony.webwork.views.util.UrlHelper;
005:
006:        import javax.servlet.http.HttpServletRequest;
007:        import javax.servlet.http.HttpServletResponse;
008:
009:        import org.apache.commons.logging.Log;
010:        import org.apache.commons.logging.LogFactory;
011:
012:        /**
013:         * <!-- START SNIPPET: javadoc -->
014:         * The div tag is primarily an AJAX tag, providing a remote call from the current page to update a section
015:         * of content without having to refresh the entire page.<p/>
016:         *
017:         * It creates a HTML &lt;DIV /&gt; that obtains it's content via a remote XMLHttpRequest call
018:         * via the dojo framework.<p/>
019:         *
020:         * If a "listenTopics" is supplied, it will listen to that topic and refresh it's content when any message
021:         * is received.<p/>
022:         * <!-- END SNIPPET: javadoc -->
023:         *
024:         * <b>Important:</b> Be sure to setup the page containing this tag to be Configured for AJAX</p>
025:         *
026:         * <p/> <b>Examples</b>
027:         *
028:         * <pre>
029:         * <!-- START SNIPPET: example -->
030:         * &lt;ww:div ... /&gt;
031:         * <!-- END SNIPPET: example -->
032:         * </pre>
033:         *
034:         * @author Ian Roughley
035:         * @author Rene Gielen
036:         * @version $Revision: 2788 $
037:         * @since 2.2
038:         *
039:         * @ww.tag name="div" tld-body-content="JSP" tld-tag-class="com.opensymphony.webwork.views.jsp.ui.DivTag"
040:         * description="Render HTML div providing content from remote call via AJAX"
041:         */
042:        public class Div extends RemoteCallUIBean {
043:            private static final Log _log = LogFactory.getLog(Div.class);
044:
045:            public static final String TEMPLATE = "div";
046:            public static final String TEMPLATE_CLOSE = "div-close";
047:            public static final String COMPONENT_NAME = Div.class.getName();
048:
049:            protected String updateFreq;
050:            protected String delay;
051:            protected String loadingText;
052:            protected String listenTopics;
053:
054:            public Div(OgnlValueStack stack, HttpServletRequest request,
055:                    HttpServletResponse response) {
056:                super (stack, request, response);
057:            }
058:
059:            public String getDefaultOpenTemplate() {
060:                return TEMPLATE;
061:            }
062:
063:            protected String getDefaultTemplate() {
064:                return TEMPLATE_CLOSE;
065:            }
066:
067:            public void evaluateExtraParams() {
068:                super .evaluateExtraParams();
069:
070:                if (null != updateFreq && !"".equals(updateFreq)) {
071:                    addParameter("updateFreq", findString(updateFreq));
072:                } else {
073:                    addParameter("updateFreq", "0");
074:                }
075:
076:                if (null != delay && !"".equals(delay)) {
077:                    addParameter("delay", findString(delay));
078:                } else {
079:                    addParameter("delay", "0");
080:                }
081:
082:                String tmpUpdateFreq = (String) getParameters().get("delay");
083:                String tmpDelay = (String) getParameters().get("updateFreq");
084:                try {
085:                    int _updateFreq = Integer.parseInt(tmpUpdateFreq);
086:                    int _delay = Integer.parseInt(tmpDelay);
087:
088:                    if (_updateFreq <= 0 && _delay <= 0) {
089:                        addParameter("autoStart", "false");
090:                    }
091:                } catch (NumberFormatException e) {
092:                    // too bad, invalid updateFreq or delay provided, we
093:                    // can't determine autoStart mode.
094:                    _log.info("error while parsing updateFreq ["
095:                            + tmpUpdateFreq + "] or delay [" + tmpDelay
096:                            + "] to integer, cannot determine autoStart mode",
097:                            e);
098:                }
099:
100:                if (loadingText != null) {
101:                    addParameter("loadingText", findString(loadingText));
102:                }
103:
104:                if (listenTopics != null) {
105:                    addParameter("listenTopics", findString(listenTopics));
106:                }
107:
108:                if (href != null) {
109:
110:                    // This is needed for portal and DOJO ajax stuff!
111:                    addParameter("href", null);
112:                    addParameter("href", UrlHelper.buildUrl(findString(href),
113:                            request, response, null));
114:                }
115:            }
116:
117:            /**
118:             * How often to re-fetch the content (in milliseconds)
119:             * @ww.tagattribute required="false" type="Integer" default="0"
120:             */
121:            public void setUpdateFreq(String updateFreq) {
122:                this .updateFreq = updateFreq;
123:            }
124:
125:            /**
126:             * How long to wait before fetching the content (in milliseconds)
127:             * @ww.tagattribute required="false" type="Integer" default="0"
128:             */
129:            public void setDelay(String delay) {
130:                this .delay = delay;
131:            }
132:
133:            /**
134:             * The text to display to the user while the new content is being fetched (especially good if the content will take awhile)
135:             * @ww.tagattribute required="false" rtexprvalue="true"
136:             */
137:            public void setLoadingText(String loadingText) {
138:                this .loadingText = loadingText;
139:            }
140:
141:            /**
142:             * Topic name to listen to (comma delimited), that will cause the DIV's content to be re-fetched
143:             * @ww.tagattribute required="false"
144:             */
145:            public void setListenTopics(String listenTopics) {
146:                this.listenTopics = listenTopics;
147:            }
148:
149:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.