1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.struts2.components;
19
20 import javax.servlet.http.HttpServletRequest;
21 import javax.servlet.http.HttpServletResponse;
22
23 import com.opensymphony.xwork2.util.ValueStack;
24
25 /***
26 * RemoteCallUIBean is superclass for all components dealing with remote calls.
27 *
28 */
29 public abstract class RemoteCallUIBean extends ClosingUIBean {
30
31 protected String href;
32 protected String errorText;
33 protected String showErrorTransportText;
34 protected String afterLoading;
35
36 public RemoteCallUIBean(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
37 super(stack, request, response);
38 }
39
40 public void evaluateExtraParams() {
41 super.evaluateExtraParams();
42
43 if (href != null) {
44 addParameter("href", findString(href));
45 }
46
47 if (showErrorTransportText != null) {
48 addParameter("showErrorTransportText", findValue(showErrorTransportText, Boolean.class));
49 }
50
51 if (errorText != null) {
52 addParameter("errorText", findString(errorText));
53 }
54
55 if (afterLoading != null) {
56 addParameter("afterLoading", findString(afterLoading));
57 }
58 }
59
60 /***
61 * The theme to use for the element. <b>This tag will usually use the ajax theme.</b>
62 * @s.tagattribute required="false" type="String"
63 */
64 public void setTheme(String theme) {
65 super.setTheme(theme);
66 }
67
68 /***
69 * The URL to call to obtain the content
70 * @s.tagattribute required="false" type="String"
71 */
72 public void setHref(String href) {
73 this.href = href;
74 }
75
76 /***
77 * The text to display to the user if the is an error fetching the content
78 * @s.tagattribute required="false" type="String"
79 */
80 public void setErrorText(String errorText) {
81 this.errorText = errorText;
82 }
83
84 /***
85 * when to show the error message as content when the URL had problems
86 * @s.tagattribute required="false" type="Boolean" default="false"
87 */
88 public void setShowErrorTransportText(String showErrorTransportText) {
89 this.showErrorTransportText = showErrorTransportText;
90 }
91
92 /***
93 * Javascript code that will be executed after the content has been fetched
94 * @s.tagattribute required="false" type="String"
95 */
96 public void setAfterLoading(String afterLoading) {
97 this.afterLoading = afterLoading;
98 }
99 }