1 package org.jahia.taglibs.button; 2 3 import javax.servlet.jsp.JspException ; 4 import javax.servlet.jsp.tagext.TagSupport ; 5 6 12 13 public class TabButtonTag extends TagSupport { 14 15 private static org.apache.log4j.Logger logger = 16 org.apache.log4j.Logger.getLogger(TabButtonTag.class); 17 18 private String label = ""; 19 private String labelKey = null; 20 private String labelBundle = null; 21 private String url = "#"; 22 private boolean isSelected = false; 23 24 public void setLabel(String label) { 25 logger.debug("Setting label.."); 26 this.label = label; 27 } 28 29 public void setLabelKey(String labelKey) { 30 this.labelKey = labelKey; 31 } 32 33 public void setLabelBundle(String labelBundle) { 34 this.labelBundle = labelBundle; 35 } 36 37 public void setUrl(String url) { 38 this.url = url; 39 } 40 41 public void setIsSelected(String val) { 42 try { 43 isSelected = val.toLowerCase().equals("true"); 44 } catch ( Throwable t ){ 45 logger.debug("exception :" + t.getMessage() ); 46 } 47 } 48 49 public String getLabel() { 50 return this.label; 51 } 52 53 public String getLabelKey() { 54 return this.labelKey; 55 } 56 57 public String getLabelBundle() { 58 return this.labelBundle; 59 } 60 61 public String getUrl() { 62 return this.url; 63 } 64 65 public String getIsSelected() { 66 return (isSelected?"true":"false"); 67 } 68 69 public int doStartTag() { 70 71 logger.debug("Started"); 72 73 TabButtonsListTag tabButtonsListTag = (TabButtonsListTag) findAncestorWithClass(this, TabButtonsListTag.class); 75 if (tabButtonsListTag != null) { 76 tabButtonsListTag.addTabButton(getUrl(),getLabel(),getLabelKey(), getLabelBundle(), isSelected); 77 } 78 return SKIP_BODY; 79 } 80 81 public int doEndTag() throws JspException { 82 label = ""; 85 labelKey = null; 86 labelBundle = null; 87 url = "#"; 88 isSelected = false; 89 return EVAL_PAGE; 90 } 91 92 } | Popular Tags |