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 import org.apache.commons.logging.Log; 021 import org.apache.commons.logging.LogFactory; 022 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL; 023 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP; 024 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_VALUE; 025 import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_MENUCOMMAND; 026 import org.apache.myfaces.tobago.component.ComponentUtil; 027 import org.apache.myfaces.tobago.component.UISelectBooleanCommand; 028 029 import javax.faces.component.UIComponent; 030 031 /** 032 * User: weber 033 * Date: Apr 26, 2005 034 * Time: 3:01:45 PM 035 */ 036 public class SelectBooleanCommandTag extends AbstractCommandTag { 037 038 private static final Log LOG = LogFactory.getLog(SelectBooleanCommandTag.class); 039 040 private String label; 041 private String value; 042 private String tip; 043 044 045 public String getComponentType() { 046 return UISelectBooleanCommand.COMPONENT_TYPE; 047 } 048 049 protected void setProperties(UIComponent component) { 050 super.setProperties(component); 051 component.setRendererType(RENDERER_TYPE_MENUCOMMAND); 052 ComponentUtil.setStringProperty(component, ATTR_VALUE, value); 053 ComponentUtil.setStringProperty(component, ATTR_LABEL, label); 054 ComponentUtil.setStringProperty(component, ATTR_TIP, tip); 055 } 056 057 public void release() { 058 super.release(); 059 value = null; 060 label = null; 061 tip = null; 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 void setLabel(String label) { 073 this.label = label; 074 } 075 076 public String getAccessKey() { 077 return null; 078 } 079 080 public void setAccessKey(String accessKey) { 081 LOG.warn("Attibute 'accessKey' is deprecated, " 082 + "and will removed soon!"); 083 } 084 085 public String getLabelWithAccessKey() { 086 return null; 087 } 088 089 public void setLabelWithAccessKey(String labelWithAccessKey) { 090 LOG.warn("Attibute 'labelWithAccessKey' is deprecated, " 091 + "and will removed soon! Please use 'label' instead."); 092 setLabel(labelWithAccessKey); 093 } 094 095 public String getTip() { 096 return tip; 097 } 098 099 public void setTip(String tip) { 100 this.tip = tip; 101 } 102 }