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 ; 7 import javax.servlet.http.HttpServletResponse ; 8 9 14 public class Div extends ClosingUIBean { 15 public static final String TEMPLATE = "div"; 16 public static final String TEMPLATE_CLOSE = "div-close"; 17 public static final String COMPONENT_NAME = Div.class.getName(); 18 19 protected String href; 20 protected String updateFreq; 21 protected String delay; 22 protected String loadingText; 23 protected String errorText; 24 protected String showErrorTransportText; 25 protected String listenTopics; 26 protected String afterLoading; 27 28 public Div(OgnlValueStack stack, HttpServletRequest request, HttpServletResponse response) { 29 super(stack, request, response); 30 } 31 32 public String getDefaultOpenTemplate() { 33 return TEMPLATE; 34 } 35 36 protected String getDefaultTemplate() { 37 return TEMPLATE_CLOSE; 38 } 39 40 public void evaluateExtraParams() { 41 super.evaluateExtraParams(); 42 43 if (href != null) { 44 String stackUrl = findString(href); 45 String 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 .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 href) { 86 this.href = href; 87 } 88 89 public void setUpdateFreq(String updateFreq) { 90 this.updateFreq = updateFreq; 91 } 92 93 public void setDelay(String delay) { 94 this.delay = delay; 95 } 96 97 public void setLoadingText(String loadingText) { 98 this.loadingText = loadingText; 99 } 100 101 public void setErrorText(String errorText) { 102 this.errorText = errorText; 103 } 104 105 public void setShowErrorTransportText(String showErrorTransportText) { 106 this.showErrorTransportText = showErrorTransportText; 107 } 108 109 public void setListenTopics(String listenTopics) { 110 this.listenTopics = listenTopics; 111 } 112 113 public void setAfterLoading(String afterLoading) { 114 this.afterLoading = afterLoading; 115 } 116 } 117 | Popular Tags |