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.Tag; 021 import org.apache.myfaces.tobago.apt.annotation.ExtensionTag; 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.HasTip; 029 import org.apache.myfaces.tobago.taglib.decl.HasValidator; 030 import org.apache.myfaces.tobago.taglib.decl.HasValue; 031 import org.apache.myfaces.tobago.taglib.decl.IsDisabled; 032 import org.apache.myfaces.tobago.taglib.decl.IsInline; 033 import org.apache.myfaces.tobago.taglib.decl.IsRendered; 034 import org.apache.myfaces.tobago.taglib.decl.HasOnchange; 035 import org.apache.myfaces.tobago.taglib.decl.HasValueChangeListener; 036 import org.apache.myfaces.tobago.taglib.decl.IsReadonly; 037 import org.apache.myfaces.tobago.taglib.decl.HasLabelWidth; 038 import org.apache.myfaces.tobago.taglib.decl.HasMarkup; 039 import org.apache.myfaces.tobago.taglib.decl.IsRequired; 040 041 import javax.servlet.jsp.JspException; 042 import javax.servlet.jsp.tagext.BodyTagSupport; 043 044 /* 045 * Created by IntelliJ IDEA. 046 * User: bommel 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, IsReadonly, 060 HasMarkup, IsRequired { 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 079 private LabelExtensionTag labelTag; 080 private SelectManyListboxTag selectManyListboxTag; 081 082 @Override 083 public int doStartTag() throws JspException { 084 085 labelTag = new LabelExtensionTag(); 086 labelTag.setPageContext(pageContext); 087 if (label != null) { 088 labelTag.setValue(label); 089 } 090 if (tip != null) { 091 labelTag.setTip(tip); 092 } 093 if (rendered != null) { 094 labelTag.setRendered(rendered); 095 } 096 if (labelWidth != null) { 097 labelTag.setColumns(labelWidth + ";*"); 098 } 099 /* TODO accessKey 100 if (labelWithAccessKey != null) { 101 label.setLabelWithAccessKey(labelWithAccessKey); 102 } 103 if (accessKey !=null) { 104 label.setAccessKey(accessKey); 105 } */ 106 labelTag.setParent(getParent()); 107 labelTag.doStartTag(); 108 109 selectManyListboxTag = new SelectManyListboxTag(); 110 selectManyListboxTag.setPageContext(pageContext); 111 if (value != null) { 112 selectManyListboxTag.setValue(value); 113 } 114 if (valueChangeListener != null) { 115 selectManyListboxTag.setValueChangeListener(valueChangeListener); 116 } 117 if (binding != null) { 118 selectManyListboxTag.setBinding(binding); 119 } 120 if (onchange != null) { 121 selectManyListboxTag.setOnchange(onchange); 122 } 123 if (validator != null) { 124 selectManyListboxTag.setValidator(validator); 125 } 126 if (converter != null) { 127 selectManyListboxTag.setConverter(converter); 128 } 129 if (disabled != null) { 130 selectManyListboxTag.setDisabled(disabled); 131 } 132 if (inline != null) { 133 selectManyListboxTag.setFocus(inline); 134 } 135 if (id != null) { 136 selectManyListboxTag.setId(id); 137 } 138 if (height != null) { 139 selectManyListboxTag.setHeight(height); 140 } 141 if (readonly != null) { 142 selectManyListboxTag.setReadonly(readonly); 143 } 144 if (required != null) { 145 selectManyListboxTag.setRequired(required); 146 } 147 if (markup != null) { 148 selectManyListboxTag.setMarkup(markup); 149 } 150 selectManyListboxTag.setParent(labelTag); 151 selectManyListboxTag.doStartTag(); 152 153 return super.doStartTag(); 154 } 155 156 @Override 157 public int doEndTag() throws JspException { 158 selectManyListboxTag.doEndTag(); 159 labelTag.doEndTag(); 160 return super.doEndTag(); 161 } 162 163 @Override 164 public void release() { 165 super.release(); 166 binding = null; 167 onchange = null; 168 disabled = null; 169 inline = null; 170 label = null; 171 labelWidth = null; 172 height = null; 173 readonly = null; 174 rendered = null; 175 converter = null; 176 validator = null; 177 required = null; 178 tip = null; 179 value = null; 180 valueChangeListener = null; 181 markup = null; 182 selectManyListboxTag = null; 183 labelTag = null; 184 } 185 186 public void setRequired(String required) { 187 this.required = required; 188 } 189 190 public void setValue(String value) { 191 this.value = value; 192 } 193 194 public void setValueChangeListener(String valueChangeListener) { 195 this.valueChangeListener = valueChangeListener; 196 } 197 198 public void setDisabled(String disabled) { 199 this.disabled = disabled; 200 } 201 202 public void setReadonly(String readonly) { 203 this.readonly = readonly; 204 } 205 206 public void setOnchange(String onchange) { 207 this.onchange = onchange; 208 } 209 210 public void setInline(String inline) { 211 this.inline = inline; 212 } 213 214 public void setLabel(String label) { 215 this.label = label; 216 } 217 218 public void setHeight(String height) { 219 this.height = height; 220 } 221 222 public void setValidator(String validator) { 223 this.validator = validator; 224 } 225 226 public void setConverter(String converter) { 227 this.converter = converter; 228 } 229 230 public void setRendered(String rendered) { 231 this.rendered = rendered; 232 } 233 234 public void setBinding(String binding) { 235 this.binding = binding; 236 } 237 238 public void setTip(String tip) { 239 this.tip = tip; 240 } 241 242 public void setLabelWidth(String labelWidth) { 243 this.labelWidth = labelWidth; 244 } 245 246 public void setMarkup(String markup) { 247 this.markup = markup; 248 } 249 }