KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.opensymphony.webwork.components;
2
3 import com.opensymphony.xwork.util.OgnlValueStack;
4 import org.apache.commons.logging.Log;
5 import org.apache.commons.logging.LogFactory;
6
7 import javax.servlet.http.HttpServletRequest JavaDoc;
8 import javax.servlet.http.HttpServletResponse JavaDoc;
9 import java.io.Writer JavaDoc;
10
11 /**
12  * User: plightbo
13  * Date: Jul 20, 2005
14  * Time: 7:22:54 AM
15  */

16 public class Panel extends Div {
17     private static final Log LOG = LogFactory.getLog(Panel.class);
18
19     public static final String JavaDoc TEMPLATE = "tab";
20     public static final String JavaDoc TEMPLATE_CLOSE = "tab-close";
21     public static final String JavaDoc COMPONENT_NAME = Panel.class.getName();
22
23     protected String JavaDoc tabName;
24     protected String JavaDoc subscribeTopicName;
25     protected String JavaDoc remote;
26
27     public Panel(OgnlValueStack stack, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) {
28         super(stack, request, response);
29     }
30
31     public String JavaDoc getDefaultOpenTemplate() {
32         return TEMPLATE;
33     }
34
35     protected String JavaDoc getDefaultTemplate() {
36         return TEMPLATE_CLOSE;
37     }
38
39     public void end(Writer JavaDoc writer) {
40         TabbedPanel tabbedPanel = ((TabbedPanel) findLastAncestor(TabbedPanel.class));
41         subscribeTopicName = tabbedPanel.getTopicName();
42         tabbedPanel.addTab(this);
43
44         super.end(writer);
45     }
46
47     public void evaluateExtraParams() {
48         super.evaluateExtraParams();
49
50         if (tabName != null) {
51             addParameter("tabName", findString(tabName));
52         }
53
54         if (subscribeTopicName != null) {
55             addParameter("subscribeTopicName", subscribeTopicName);
56         }
57
58         if (remote != null && "true".equalsIgnoreCase(remote)) {
59             addParameter("remote", "true");
60         } else {
61             addParameter("remote", "false");
62         }
63     }
64
65     public String JavaDoc getTabName() {
66         return findString(tabName);
67     }
68
69     public String JavaDoc getComponentName() {
70         return COMPONENT_NAME;
71     }
72
73     public void setTabName(String JavaDoc tabName) {
74         this.tabName = tabName;
75     }
76
77     public void setSubscribeTopicName(String JavaDoc subscribeTopicName) {
78         this.subscribeTopicName = subscribeTopicName;
79     }
80
81     public void setRemote(String JavaDoc remote) {
82         this.remote = remote;
83     }
84 }
85
Popular Tags