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.IsInline; 038 import org.apache.myfaces.tobago.taglib.decl.IsReadonly; 039 import org.apache.myfaces.tobago.taglib.decl.IsRendered; 040 import org.apache.myfaces.tobago.taglib.decl.IsRequired; 041 042 import javax.servlet.jsp.JspException; 043 import javax.servlet.jsp.tagext.BodyTagSupport; 044 045 /* 046 * Created by IntelliJ IDEA. 047 * User: bommel 048 * Date: 16.12.2005 049 * Time: 19:12:33 050 */ 051 052 /** 053 * Render a group of checkboxes. 054 */ 055 056 @Tag(name = "selectManyListbox") 057 @ExtensionTag(baseClassName = "org.apache.myfaces.tobago.taglib.component.SelectManyListboxTag") 058 public class SelectManyListboxExtensionTag extends BodyTagSupport 059 implements HasId, HasValue, HasValueChangeListener, IsDisabled, HasDeprecatedHeight, IsInline, 060 HasLabel, HasLabelWidth, IsRendered, HasBinding, HasTip, HasConverter, HasValidator, HasOnchange, 061 IsReadonly, HasMarkup, IsRequired, HasTabIndex { 062 063 private String required; 064 private String value; 065 private String valueChangeListener; 066 private String disabled; 067 private String readonly; 068 private String onchange; 069 private String inline; 070 private String label; 071 private String rendered; 072 private String binding; 073 private String tip; 074 private String height; 075 private String converter; 076 private String validator; 077 private String labelWidth; 078 private String markup; 079 private String tabIndex; 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.setFocus(inline); 137 } 138 if (id != null) { 139 selectManyListboxTag.setId(id); 140 } 141 if (height != null) { 142 selectManyListboxTag.setHeight(height); 143 } 144 if (readonly != null) { 145 selectManyListboxTag.setReadonly(readonly); 146 } 147 if (required != null) { 148 selectManyListboxTag.setRequired(required); 149 } 150 if (markup != null) { 151 selectManyListboxTag.setMarkup(markup); 152 } 153 if (tabIndex != null) { 154 selectManyListboxTag.setTabIndex(tabIndex); 155 } 156 selectManyListboxTag.setParent(labelTag); 157 selectManyListboxTag.doStartTag(); 158 159 return super.doStartTag(); 160 } 161 162 @Override 163 public int doEndTag() throws JspException { 164 selectManyListboxTag.doEndTag(); 165 labelTag.doEndTag(); 166 return super.doEndTag(); 167 } 168 169 @Override 170 public void release() { 171 super.release(); 172 binding = null; 173 onchange = null; 174 disabled = null; 175 inline = null; 176 label = null; 177 labelWidth = null; 178 height = null; 179 readonly = null; 180 rendered = null; 181 converter = null; 182 validator = null; 183 required = null; 184 tip = null; 185 value = null; 186 valueChangeListener = null; 187 markup = null; 188 tabIndex = null; 189 selectManyListboxTag = null; 190 labelTag = null; 191 } 192 193 public void setRequired(String required) { 194 this.required = required; 195 } 196 197 public void setValue(String value) { 198 this.value = value; 199 } 200 201 public void setValueChangeListener(String valueChangeListener) { 202 this.valueChangeListener = valueChangeListener; 203 } 204 205 public void setDisabled(String disabled) { 206 this.disabled = disabled; 207 } 208 209 public void setReadonly(String readonly) { 210 this.readonly = readonly; 211 } 212 213 public void setOnchange(String onchange) { 214 this.onchange = onchange; 215 } 216 217 public void setInline(String inline) { 218 this.inline = inline; 219 } 220 221 public void setLabel(String label) { 222 this.label = label; 223 } 224 225 public void setHeight(String height) { 226 this.height = height; 227 } 228 229 public void setValidator(String validator) { 230 this.validator = validator; 231 } 232 233 public void setConverter(String converter) { 234 this.converter = converter; 235 } 236 237 public void setRendered(String rendered) { 238 this.rendered = rendered; 239 } 240 241 public void setBinding(String binding) { 242 this.binding = binding; 243 } 244 245 public void setTip(String tip) { 246 this.tip = tip; 247 } 248 249 public void setLabelWidth(String labelWidth) { 250 this.labelWidth = labelWidth; 251 } 252 253 public void setMarkup(String markup) { 254 this.markup = markup; 255 } 256 257 public void setTabIndex(String tabIndex) { 258 this.tabIndex = tabIndex; 259 } 260 }