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 ; 8 import javax.servlet.http.HttpServletResponse ; 9 import java.io.Writer ; 10 11 16 public class Panel extends Div { 17 private static final Log LOG = LogFactory.getLog(Panel.class); 18 19 public static final String TEMPLATE = "tab"; 20 public static final String TEMPLATE_CLOSE = "tab-close"; 21 public static final String COMPONENT_NAME = Panel.class.getName(); 22 23 protected String tabName; 24 protected String subscribeTopicName; 25 protected String remote; 26 27 public Panel(OgnlValueStack stack, HttpServletRequest request, HttpServletResponse response) { 28 super(stack, request, response); 29 } 30 31 public String getDefaultOpenTemplate() { 32 return TEMPLATE; 33 } 34 35 protected String getDefaultTemplate() { 36 return TEMPLATE_CLOSE; 37 } 38 39 public void end(Writer 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 getTabName() { 66 return findString(tabName); 67 } 68 69 public String getComponentName() { 70 return COMPONENT_NAME; 71 } 72 73 public void setTabName(String tabName) { 74 this.tabName = tabName; 75 } 76 77 public void setSubscribeTopicName(String subscribeTopicName) { 78 this.subscribeTopicName = subscribeTopicName; 79 } 80 81 public void setRemote(String remote) { 82 this.remote = remote; 83 } 84 } 85 | Popular Tags |