1 package org.jahia.taglibs.button; 2 3 import java.io.IOException ; 4 import java.util.Vector ; 5 6 import javax.servlet.jsp.JspException ; 7 import javax.servlet.jsp.JspTagException ; 8 import javax.servlet.jsp.JspWriter ; 9 import javax.servlet.jsp.tagext.BodyTagSupport ; 10 11 12 18 public class TabButtonsListTag extends BodyTagSupport { 19 20 private static org.apache.log4j.Logger logger = 21 org.apache.log4j.Logger.getLogger(TabButtonsListTag.class); 22 23 private Vector tabButtons; 24 25 public void addTabButton(String url, 26 String label, String labelKey, String labelBundle, 27 boolean isSelected) { 28 if ( url == null ){ 29 url = "#"; 30 } 31 if ( label == null ){ 32 label = "no name"; 33 } 34 35 TabButton tabButton = new TabButton(url,label,labelKey, labelBundle, isSelected); 36 this.tabButtons.add(tabButton); 37 } 39 40 public void addTabButton(TabButton tabButton) { 41 if ( tabButton != null ){ 42 this.tabButtons.add(tabButton); 43 } 44 } 45 46 public int doStartTag() { 47 logger.debug("Started"); 48 this.tabButtons = new Vector (); 49 return EVAL_BODY_BUFFERED; 50 } 51 52 public Vector getTabButtons(){ 53 Vector v = new Vector (); 55 for ( int i=0; i<this.tabButtons.size(); i++ ){ 56 v.add(this.tabButtons.get(i)); 57 } 58 return v; 59 } 60 61 public int doAfterBody() throws JspTagException { 62 logger.debug("Started"); 63 JspWriter out = pageContext.getOut(); 64 try { 65 bodyContent.writeOut(bodyContent.getEnclosingWriter()); 67 } catch (IOException ioe) { 68 logger.debug("Exception : " + ioe.toString()); 69 } 70 return SKIP_BODY; 71 } 72 73 74 public int doEndTag() throws JspException { 75 tabButtons = null; 78 return EVAL_PAGE; 79 } 80 81 82 } 83 | Popular Tags |