001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.runtime.tag; 020 021import javax.servlet.jsp.JspException; 022 023import lucee.runtime.exp.ApplicationException; 024import lucee.runtime.exp.TagNotSupported; 025import lucee.runtime.ext.tag.TagImpl; 026import lucee.runtime.type.dt.DateTime; 027import lucee.runtime.type.util.ListUtil; 028 029public final class Calendar extends TagImpl { 030 031 private static final String[] DAY_NAMES_DEFAULT = new String[]{"S", "M", "T", "W", "Th", "F", "S"}; 032 033 private static final String[] MONTH_NAMES_DEFAULT = new String[]{"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; 034 035 private String name; 036 private int height=-1; 037 private int width=-1; 038 private DateTime selectedDate; 039 private DateTime startRange; 040 private DateTime endRange; 041 private boolean disabled; 042 private String mask="MM/DD/YYYY"; 043 private int firstDayOfWeek=0; 044 private String[] dayNames=DAY_NAMES_DEFAULT; 045 private String[] monthNames=MONTH_NAMES_DEFAULT; 046 private String style; 047 private boolean enabled=true; 048 private boolean visible=true; 049 private String tooltip; 050 private String onChange; 051 private String onBlur; 052 private String onFocus; 053 054 055 public Calendar() throws ApplicationException { 056 // TODO impl. tag Calendar 057 throw new TagNotSupported("Calendar"); 058 } 059 060 @Override 061 public void release() { 062 super.release(); 063 name=null; 064 height=-1; 065 width=-1; 066 selectedDate=null; 067 startRange=null; 068 endRange=null; 069 disabled=false; 070 mask="MM/DD/YYYY"; 071 firstDayOfWeek=0; 072 dayNames=DAY_NAMES_DEFAULT; 073 monthNames=MONTH_NAMES_DEFAULT; 074 style=null; 075 enabled=true; 076 visible=true; 077 tooltip=null; 078 onChange=null; 079 onBlur=null; 080 onFocus=null; 081 } 082 083 @Override 084 public int doStartTag() throws JspException { 085 return super.doStartTag(); 086 } 087 088 /** 089 * @param dayNames the dayNames to set 090 */ 091 public void setDaynames(String listDayNames) { 092 this.dayNames = ListUtil.listToStringArray(listDayNames,','); 093 } 094 095 /** 096 * @param disabled the disabled to set 097 */ 098 public void setDisabled(boolean disabled) { 099 this.disabled = disabled; 100 } 101 102 /** 103 * @param enabled the enabled to set 104 */ 105 public void setEnabled(boolean enabled) { 106 this.enabled = enabled; 107 } 108 109 /** 110 * @param endRange the endRange to set 111 */ 112 public void setEndrange(DateTime endRange) { 113 this.endRange = endRange; 114 } 115 116 /** 117 * @param firstDayOfWeek the firstDayOfWeek to set 118 */ 119 public void setFirstdayofweek(double firstDayOfWeek) { 120 this.firstDayOfWeek = (int)firstDayOfWeek; 121 } 122 123 /** 124 * @param height the height to set 125 */ 126 public void setHeight(double height) { 127 this.height = (int)height; 128 } 129 130 /** 131 * @param mask the mask to set 132 */ 133 public void setMask(String mask) { 134 this.mask = mask; 135 } 136 137 /** 138 * @param monthNames the monthNames to set 139 */ 140 public void setMonthnames(String listMonthNames) { 141 this.monthNames = monthNames; 142 } 143 144 /** 145 * @param name the name to set 146 */ 147 public void setName(String name) { 148 this.name = name; 149 } 150 151 /** 152 * @param onBlur the onBlur to set 153 */ 154 public void setOnblur(String onBlur) { 155 this.onBlur = onBlur; 156 } 157 158 /** 159 * @param onChange the onChange to set 160 */ 161 public void setOnchange(String onChange) { 162 this.onChange = onChange; 163 } 164 165 /** 166 * @param onFocus the onFocus to set 167 */ 168 public void setOnfocus(String onFocus) { 169 this.onFocus = onFocus; 170 } 171 172 /** 173 * @param selectedDate the selectedDate to set 174 */ 175 public void setSelecteddate(DateTime selectedDate) { 176 this.selectedDate = selectedDate; 177 } 178 179 /** 180 * @param startRange the startRange to set 181 */ 182 public void setStartrange(DateTime startRange) { 183 this.startRange = startRange; 184 } 185 186 /** 187 * @param style the style to set 188 */ 189 public void setStyle(String style) { 190 this.style = style; 191 } 192 193 /** 194 * @param tooltip the tooltip to set 195 */ 196 public void setTooltip(String tooltip) { 197 this.tooltip = tooltip; 198 } 199 200 /** 201 * @param visible the visible to set 202 */ 203 public void setVisible(boolean visible) { 204 this.visible = visible; 205 } 206 207 /** 208 * @param width the width to set 209 */ 210 public void setWidth(double width) { 211 this.width = (int)width; 212 } 213 214}