KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > webwork > components > Div


1 package com.opensymphony.webwork.components;
2
3 import com.opensymphony.webwork.components.ClosingUIBean;
4 import com.opensymphony.xwork.util.OgnlValueStack;
5
6 import javax.servlet.http.HttpServletRequest JavaDoc;
7 import javax.servlet.http.HttpServletResponse JavaDoc;
8
9 /**
10  * User: plightbo
11  * Date: Jul 20, 2005
12  * Time: 7:23:11 AM
13  */

14 public class Div extends ClosingUIBean {
15     public static final String JavaDoc TEMPLATE = "div";
16     public static final String JavaDoc TEMPLATE_CLOSE = "div-close";
17     public static final String JavaDoc COMPONENT_NAME = Div.class.getName();
18
19     protected String JavaDoc href;
20     protected String JavaDoc updateFreq;
21     protected String JavaDoc delay;
22     protected String JavaDoc loadingText;
23     protected String JavaDoc errorText;
24     protected String JavaDoc showErrorTransportText;
25     protected String JavaDoc listenTopics;
26     protected String JavaDoc afterLoading;
27
28     public Div(OgnlValueStack stack, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) {
29         super(stack, request, response);
30     }
31
32     public String JavaDoc getDefaultOpenTemplate() {
33         return TEMPLATE;
34     }
35
36     protected String JavaDoc getDefaultTemplate() {
37         return TEMPLATE_CLOSE;
38     }
39
40     public void evaluateExtraParams() {
41         super.evaluateExtraParams();
42
43         if (href != null) {
44             String JavaDoc stackUrl = findString(href);
45             String JavaDoc contextPath = request.getContextPath();
46             if (stackUrl.startsWith("/") && stackUrl.startsWith(contextPath)) {
47                 contextPath = "";
48             }
49             addParameter("href", contextPath + stackUrl );
50         }
51
52         if (null != updateFreq && !"".equals(updateFreq)) {
53             addParameter("updateFreq", findString(updateFreq));
54         } else {
55             addParameter("updateFreq", "0");
56         }
57
58         if (showErrorTransportText != null) {
59             addParameter("showErrorTransportText", findValue(showErrorTransportText, Boolean JavaDoc.class));
60         }
61
62         if (null != delay && !"".equals(delay)) {
63             addParameter("delay", findString(delay));
64         } else {
65             addParameter("delay", "0");
66         }
67
68         if (loadingText != null) {
69             addParameter("loadingText", findString(loadingText));
70         }
71
72         if (errorText != null) {
73             addParameter("errorText", findString(errorText));
74         }
75
76         if (listenTopics != null) {
77             addParameter("listenTopics", findString(listenTopics));
78         }
79
80         if (afterLoading != null) {
81             addParameter("afterLoading", findString(afterLoading));
82         }
83     }
84
85     public void setHref(String JavaDoc href) {
86         this.href = href;
87     }
88
89     public void setUpdateFreq(String JavaDoc updateFreq) {
90         this.updateFreq = updateFreq;
91     }
92
93     public void setDelay(String JavaDoc delay) {
94         this.delay = delay;
95     }
96
97     public void setLoadingText(String JavaDoc loadingText) {
98         this.loadingText = loadingText;
99     }
100
101     public void setErrorText(String JavaDoc errorText) {
102         this.errorText = errorText;
103     }
104
105     public void setShowErrorTransportText(String JavaDoc showErrorTransportText) {
106         this.showErrorTransportText = showErrorTransportText;
107     }
108
109     public void setListenTopics(String JavaDoc listenTopics) {
110         this.listenTopics = listenTopics;
111     }
112
113     public void setAfterLoading(String JavaDoc afterLoading) {
114         this.afterLoading = afterLoading;
115     }
116 }
117
Popular Tags