001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019 020 package org.apache.myfaces.tobago.taglib.component; 021 022 /* 023 * Created on: 15.02.2002, 16:19:49 024 * $Id: BeanTag.java 1368577 2012-08-02 16:20:31Z lofwyr $ 025 */ 026 027 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_REQUIRED; 028 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_VALUE; 029 import org.apache.myfaces.tobago.component.ComponentUtil; 030 031 import javax.faces.component.UIComponent; 032 import javax.faces.component.ValueHolder; 033 034 public abstract class BeanTag extends TobagoTag implements BeanTagDeclaration { 035 036 private String converter; 037 private String value; 038 private String required; 039 040 @Override 041 protected void setProperties(UIComponent component) { 042 super.setProperties(component); 043 if (component instanceof ValueHolder) { 044 ComponentUtil.setConverter((ValueHolder) component, converter); 045 } 046 ComponentUtil.setBooleanProperty(component, ATTR_REQUIRED, required); 047 ComponentUtil.setStringProperty(component, ATTR_VALUE, value); 048 } 049 050 @Override 051 public void release() { 052 super.release(); 053 this.converter = null; 054 this.value = null; 055 this.required = null; 056 } 057 058 public String getConverter() { 059 return converter; 060 } 061 062 public void setConverter(String converter) { 063 this.converter = converter; 064 } 065 066 public String getValue() { 067 return value; 068 } 069 070 public void setValue(String value) { 071 this.value = value; 072 } 073 074 public String getRequired() { 075 return required; 076 } 077 078 public void setRequired(String required) { 079 this.required = required; 080 } 081 }