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 027 import javax.faces.component.UIComponent; 028 029 030 public class MenuTag extends TobagoTag 031 implements MenuTagDeclaration { 032 033 private static final Log LOG = LogFactory.getLog(MenuTag.class); 034 035 //public static final String MENU_TYPE = "menu"; 036 037 private String label; 038 private String image; 039 // private String disabled; 040 041 protected void setProperties(UIComponent component) { 042 super.setProperties(component); 043 component.setRendererType(null); 044 ComponentUtil.setStringProperty(component, ATTR_LABEL, label); 045 ComponentUtil.setStringProperty(component, ATTR_IMAGE, image); 046 //ComponentUtil.setStringProperty(component, ATTR_COMMAND_TYPE, "menu"); 047 } 048 049 public String getComponentType() { 050 return UIMenu.COMPONENT_TYPE; 051 } 052 053 054 public void release() { 055 super.release(); 056 label = null; 057 image = null; 058 } 059 060 public String getLabel() { 061 return label; 062 } 063 064 public void setLabel(String label) { 065 this.label = label; 066 } 067 068 public String getImage() { 069 return image; 070 } 071 072 public void setImage(String image) { 073 this.image = image; 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 }