01: package com.technoetic.xplanner.tags;
02:
03: import com.technoetic.xplanner.XPlannerProperties;
04: import org.apache.log4j.Logger;
05: import org.apache.commons.lang.StringUtils;
06:
07: import javax.servlet.jsp.JspException;
08: import javax.servlet.jsp.PageContext;
09: import javax.servlet.jsp.tagext.Tag;
10:
11: public class ProgressBarDelegatorTag implements ProgressBarTag {
12: private Logger log = Logger.getLogger(getClass());
13: private ProgressBarTag delegate;
14: private static final String HTML_TYPE = "html";
15: private static final String IMAGE_TYPE = "image";
16:
17: public ProgressBarDelegatorTag() {
18: String type = new XPlannerProperties().getProperty(
19: "xplanner.progressbar.impl", HTML_TYPE);
20: if (StringUtils.equalsIgnoreCase(type, HTML_TYPE)) {
21: delegate = new ProgressBarHtmlTag();
22: } else if (StringUtils.equalsIgnoreCase(type, IMAGE_TYPE)) {
23: delegate = new ProgressBarImageTag();
24: } else {
25: log
26: .error("unrecognized progress bar type, using HTML by default: type="
27: + type);
28: }
29: }
30:
31: public void setActual(double actual) {
32: delegate.setActual(actual);
33: }
34:
35: public void setComplete(boolean complete) {
36: delegate.setComplete(complete);
37: }
38:
39: public void setEstimate(double estimate) {
40: delegate.setEstimate(estimate);
41: }
42:
43: public void setHeight(int height) {
44: delegate.setHeight(height);
45: }
46:
47: public void setWidth(int width) {
48: delegate.setWidth(width);
49: }
50:
51: public int doEndTag() throws JspException {
52: return delegate.doEndTag();
53: }
54:
55: public int doStartTag() throws JspException {
56: return delegate.doStartTag();
57: }
58:
59: public Tag getParent() {
60: return delegate.getParent();
61: }
62:
63: public void release() {
64: delegate.release();
65: }
66:
67: public void setPageContext(PageContext pageContext) {
68: delegate.setPageContext(pageContext);
69: }
70:
71: public void setParent(Tag tag) {
72: delegate.setParent(tag);
73: }
74: }
|