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