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_IMAGE; 023 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL; 024 import org.apache.myfaces.tobago.component.ComponentUtil; 025 import org.apache.myfaces.tobago.component.UIMenu; 026 import org.apache.myfaces.tobago.util.Deprecation; 027 028 import javax.faces.component.UIComponent; 029 030 031 public class MenuTag extends TobagoTag 032 implements MenuTagDeclaration { 033 034 private static final Log LOG = LogFactory.getLog(MenuTag.class); 035 036 //public static final String MENU_TYPE = "menu"; 037 038 private String label; 039 private String image; 040 // private String disabled; 041 042 protected void setProperties(UIComponent component) { 043 super.setProperties(component); 044 component.setRendererType(null); 045 ComponentUtil.setStringProperty(component, ATTR_LABEL, label); 046 ComponentUtil.setStringProperty(component, ATTR_IMAGE, image); 047 //ComponentUtil.setStringProperty(component, ATTR_COMMAND_TYPE, "menu"); 048 } 049 050 public String getComponentType() { 051 return UIMenu.COMPONENT_TYPE; 052 } 053 054 055 public void release() { 056 super.release(); 057 label = null; 058 image = null; 059 } 060 061 public String getLabel() { 062 return label; 063 } 064 065 public void setLabel(String label) { 066 this.label = label; 067 } 068 069 public String getImage() { 070 return image; 071 } 072 073 public void setImage(String image) { 074 this.image = image; 075 } 076 077 public String getAccessKey() { 078 return null; 079 } 080 081 public void setAccessKey(String accessKey) { 082 if (Deprecation.LOG.isErrorEnabled()) { 083 Deprecation.LOG.error("Attribute 'accessKey' doesn't work any longer " 084 + "and will removed soon! Please use special syntax of 'label' instead."); 085 } 086 } 087 088 public String getLabelWithAccessKey() { 089 return null; 090 } 091 092 public void setLabelWithAccessKey(String labelWithAccessKey) { 093 if (Deprecation.LOG.isWarnEnabled()) { 094 Deprecation.LOG.warn("Attribute 'labelWithAccessKey' is deprecated, " 095 + "and will removed soon! Please use 'label' instead."); 096 } 097 setLabel(labelWithAccessKey); 098 } 099 }