1 package net.sf.uitags.tag.calendar; 2 3 import java.util.ArrayList ; 4 import java.util.List ; 5 6 import javax.servlet.jsp.JspException ; 7 8 import net.sf.uitags.tag.AbstractUiTag; 9 import net.sf.uitags.util.Template; 10 11 public class CalendarTag extends AbstractUiTag { 12 16 19 private static final long serialVersionUID = 100L; 20 21 22 26 private CalendarGridTag calendarGrid; 27 28 32 private List childJsCodeList; 33 34 35 39 public int doStartTag() throws JspException { 40 super.doStartTag(); 41 42 this.childJsCodeList = new ArrayList (); 43 44 makeVisibleToChildren(); 45 return EVAL_BODY_INCLUDE; 46 } 47 48 public int doEndTag() throws JspException { 49 super.doEndTag(); 50 51 printJsCode(); 52 53 makeInvisibleFromChildren(); 54 return EVAL_PAGE; 55 } 56 57 private void printJsCode() throws JspException { 58 Template tpl = Template.forName(Template.CALENDAR); 59 60 tpl.map("gridId", this.calendarGrid.getId()); 61 tpl.map("gridClass", this.calendarGrid.getCssClass()); 62 tpl.map("dayLabels", this.calendarGrid.getDayLabels()); 63 tpl.map("classResolver", this.calendarGrid.getClassResolver()); 64 tpl.map("actionResolver", this.calendarGrid.getActionResolver()); 65 tpl.map("otherAttributes", this.calendarGrid.getCustomHtmlAttributes()); 66 tpl.map("jsCodeList", this.childJsCodeList); 67 68 println(tpl.evalToString()); 69 } 70 71 72 76 void setCalendarGrid(CalendarGridTag calendarGrid) { 77 this.calendarGrid = calendarGrid; 78 } 79 80 void addChildJsCode(String code) { 81 this.childJsCodeList.add(code); 82 } 83 } 84 | Popular Tags |