001 package org.apache.myfaces.tobago.taglib.component; 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 /* 021 * Created on: 15.02.2002, 16:19:49 022 * $Id: BeanTag.java 474273 2006-11-13 12:15:36Z lofwyr $ 023 */ 024 025 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_REQUIRED; 026 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_VALUE; 027 import org.apache.myfaces.tobago.component.ComponentUtil; 028 029 import javax.faces.component.UIComponent; 030 import javax.faces.component.ValueHolder; 031 032 public abstract class BeanTag extends TobagoTag implements BeanTagDeclaration { 033 034 private String converter; 035 private String value; 036 private String required; 037 038 @Override 039 protected void setProperties(UIComponent component) { 040 super.setProperties(component); 041 if (component instanceof ValueHolder) { 042 ComponentUtil.setConverter((ValueHolder) component, converter); 043 } 044 ComponentUtil.setBooleanProperty(component, ATTR_REQUIRED, required); 045 ComponentUtil.setStringProperty(component, ATTR_VALUE, value); 046 } 047 048 @Override 049 public void release() { 050 super.release(); 051 this.converter = null; 052 this.value = null; 053 this.required = null; 054 } 055 056 public String getConverter() { 057 return converter; 058 } 059 060 public void setConverter(String converter) { 061 this.converter = converter; 062 } 063 064 public String getValue() { 065 return value; 066 } 067 068 public void setValue(String value) { 069 this.value = value; 070 } 071 072 public String getRequired() { 073 return required; 074 } 075 076 public void setRequired(String required) { 077 this.required = required; 078 } 079 }