001 package org.apache.myfaces.tobago.taglib.extension; 002 003 /* 004 * Licensed to the Apache Software Foundation (ASF) under one or more 005 * contributor license agreements. See the NOTICE file distributed with 006 * this work for additional information regarding copyright ownership. 007 * The ASF licenses this file to You under the Apache License, Version 2.0 008 * (the "License"); you may not use this file except in compliance with 009 * the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 */ 019 020 import org.apache.myfaces.tobago.apt.annotation.ExtensionTag; 021 import org.apache.myfaces.tobago.apt.annotation.Tag; 022 import org.apache.myfaces.tobago.taglib.component.SelectManyListboxTag; 023 import org.apache.myfaces.tobago.taglib.decl.HasBinding; 024 import org.apache.myfaces.tobago.taglib.decl.HasConverter; 025 import org.apache.myfaces.tobago.taglib.decl.HasDeprecatedHeight; 026 import org.apache.myfaces.tobago.taglib.decl.HasId; 027 import org.apache.myfaces.tobago.taglib.decl.HasLabel; 028 import org.apache.myfaces.tobago.taglib.decl.HasLabelWidth; 029 import org.apache.myfaces.tobago.taglib.decl.HasMarkup; 030 import org.apache.myfaces.tobago.taglib.decl.HasOnchange; 031 import org.apache.myfaces.tobago.taglib.decl.HasTabIndex; 032 import org.apache.myfaces.tobago.taglib.decl.HasTip; 033 import org.apache.myfaces.tobago.taglib.decl.HasValidator; 034 import org.apache.myfaces.tobago.taglib.decl.HasValue; 035 import org.apache.myfaces.tobago.taglib.decl.HasValueChangeListener; 036 import org.apache.myfaces.tobago.taglib.decl.IsDisabled; 037 import org.apache.myfaces.tobago.taglib.decl.IsFocus; 038 import org.apache.myfaces.tobago.taglib.decl.IsInline; 039 import org.apache.myfaces.tobago.taglib.decl.IsReadonly; 040 import org.apache.myfaces.tobago.taglib.decl.IsRendered; 041 import org.apache.myfaces.tobago.taglib.decl.IsRequired; 042 043 import javax.servlet.jsp.JspException; 044 import javax.servlet.jsp.tagext.BodyTagSupport; 045 046 /* 047 * Date: 16.12.2005 048 * Time: 19:12:33 049 */ 050 051 /** 052 * Render a group of checkboxes. 053 */ 054 055 @Tag(name = "selectManyListbox") 056 @ExtensionTag(baseClassName = "org.apache.myfaces.tobago.taglib.component.SelectManyListboxTag") 057 public class SelectManyListboxExtensionTag extends BodyTagSupport 058 implements HasId, HasValue, HasValueChangeListener, IsDisabled, HasDeprecatedHeight, IsInline, 059 HasLabel, HasLabelWidth, IsRendered, HasBinding, HasTip, HasConverter, HasValidator, HasOnchange, 060 IsReadonly, HasMarkup, IsFocus, IsRequired, HasTabIndex { 061 062 private String required; 063 private String value; 064 private String valueChangeListener; 065 private String disabled; 066 private String readonly; 067 private String onchange; 068 private String inline; 069 private String label; 070 private String rendered; 071 private String binding; 072 private String tip; 073 private String height; 074 private String converter; 075 private String validator; 076 private String labelWidth; 077 private String markup; 078 private String tabIndex; 079 private String focus; 080 081 private LabelExtensionTag labelTag; 082 private SelectManyListboxTag selectManyListboxTag; 083 084 @Override 085 public int doStartTag() throws JspException { 086 087 labelTag = new LabelExtensionTag(); 088 labelTag.setPageContext(pageContext); 089 labelTag.setRows("*"); 090 if (label != null) { 091 labelTag.setValue(label); 092 } 093 if (tip != null) { 094 labelTag.setTip(tip); 095 } 096 if (rendered != null) { 097 labelTag.setRendered(rendered); 098 } 099 if (labelWidth != null) { 100 labelTag.setColumns(labelWidth + ";*"); 101 } 102 /* TODO accessKey 103 if (labelWithAccessKey != null) { 104 label.setLabelWithAccessKey(labelWithAccessKey); 105 } 106 if (accessKey !=null) { 107 label.setAccessKey(accessKey); 108 } */ 109 labelTag.setParent(getParent()); 110 labelTag.doStartTag(); 111 112 selectManyListboxTag = new SelectManyListboxTag(); 113 selectManyListboxTag.setPageContext(pageContext); 114 if (value != null) { 115 selectManyListboxTag.setValue(value); 116 } 117 if (valueChangeListener != null) { 118 selectManyListboxTag.setValueChangeListener(valueChangeListener); 119 } 120 if (binding != null) { 121 selectManyListboxTag.setBinding(binding); 122 } 123 if (onchange != null) { 124 selectManyListboxTag.setOnchange(onchange); 125 } 126 if (validator != null) { 127 selectManyListboxTag.setValidator(validator); 128 } 129 if (converter != null) { 130 selectManyListboxTag.setConverter(converter); 131 } 132 if (disabled != null) { 133 selectManyListboxTag.setDisabled(disabled); 134 } 135 if (inline != null) { 136 selectManyListboxTag.setInline(inline); 137 } 138 if (focus != null) { 139 selectManyListboxTag.setFocus(focus); 140 } 141 if (id != null) { 142 selectManyListboxTag.setId(id); 143 } 144 if (height != null) { 145 selectManyListboxTag.setHeight(height); 146 } 147 if (readonly != null) { 148 selectManyListboxTag.setReadonly(readonly); 149 } 150 if (required != null) { 151 selectManyListboxTag.setRequired(required); 152 } 153 if (markup != null) { 154 selectManyListboxTag.setMarkup(markup); 155 } 156 if (tabIndex != null) { 157 selectManyListboxTag.setTabIndex(tabIndex); 158 } 159 selectManyListboxTag.setParent(labelTag); 160 selectManyListboxTag.doStartTag(); 161 162 return super.doStartTag(); 163 } 164 165 @Override 166 public int doEndTag() throws JspException { 167 selectManyListboxTag.doEndTag(); 168 labelTag.doEndTag(); 169 return super.doEndTag(); 170 } 171 172 @Override 173 public void release() { 174 super.release(); 175 binding = null; 176 onchange = null; 177 disabled = null; 178 inline = null; 179 label = null; 180 labelWidth = null; 181 height = null; 182 readonly = null; 183 rendered = null; 184 converter = null; 185 validator = null; 186 required = null; 187 tip = null; 188 value = null; 189 valueChangeListener = null; 190 markup = null; 191 tabIndex = null; 192 selectManyListboxTag = null; 193 labelTag = null; 194 focus = null; 195 } 196 197 public void setRequired(String required) { 198 this.required = required; 199 } 200 201 public void setValue(String value) { 202 this.value = value; 203 } 204 205 public void setValueChangeListener(String valueChangeListener) { 206 this.valueChangeListener = valueChangeListener; 207 } 208 209 public void setDisabled(String disabled) { 210 this.disabled = disabled; 211 } 212 213 public void setReadonly(String readonly) { 214 this.readonly = readonly; 215 } 216 217 public void setOnchange(String onchange) { 218 this.onchange = onchange; 219 } 220 221 public void setInline(String inline) { 222 this.inline = inline; 223 } 224 225 public void setLabel(String label) { 226 this.label = label; 227 } 228 229 public void setHeight(String height) { 230 this.height = height; 231 } 232 233 public void setValidator(String validator) { 234 this.validator = validator; 235 } 236 237 public void setConverter(String converter) { 238 this.converter = converter; 239 } 240 241 public void setRendered(String rendered) { 242 this.rendered = rendered; 243 } 244 245 public void setBinding(String binding) { 246 this.binding = binding; 247 } 248 249 public void setTip(String tip) { 250 this.tip = tip; 251 } 252 253 public void setLabelWidth(String labelWidth) { 254 this.labelWidth = labelWidth; 255 } 256 257 public void setMarkup(String markup) { 258 this.markup = markup; 259 } 260 261 public void setTabIndex(String tabIndex) { 262 this.tabIndex = tabIndex; 263 } 264 265 public void setFocus(String focus) { 266 this.focus = focus; 267 } 268 }