1 16 package org.apache.myfaces.custom.navmenu; 17 18 import org.apache.myfaces.component.UserRoleAware; 19 import org.apache.myfaces.taglib.core.SelectItemTagBase; 20 21 import javax.faces.component.UIComponent; 22 23 43 public class HtmlNavigationMenuItemTag 44 extends SelectItemTagBase 45 { 46 47 private static final String ICON_ATTR = "icon"; 48 private static final String ACTION_ATTR = "action"; 49 private static final String SPLIT_ATTR = "split"; 50 51 private String _icon = null; 52 private String _action = null; 53 private String _split; 54 55 private String _enabledOnUserRole; 57 private String _visibleOnUserRole; 58 59 public void release() { 60 super.release(); 61 62 _icon = null; 63 _action = null; 64 _split= null; 65 _enabledOnUserRole= null; 66 _visibleOnUserRole= null; 67 } 68 69 public String getComponentType() 70 { 71 return UINavigationMenuItem.COMPONENT_TYPE; 72 } 73 74 public String getRendererType() 75 { 76 return null; 77 } 78 79 protected void setProperties(UIComponent component) 80 { 81 setItemValue("0"); super.setProperties(component); 83 setStringProperty(component, ICON_ATTR, _icon); 84 component.getAttributes().put(ACTION_ATTR, _action); 86 setBooleanProperty(component, SPLIT_ATTR, _split); 87 88 setStringProperty(component, UserRoleAware.ENABLED_ON_USER_ROLE_ATTR, _enabledOnUserRole); 89 setStringProperty(component, UserRoleAware.VISIBLE_ON_USER_ROLE_ATTR, _visibleOnUserRole); 90 } 91 92 93 public void setAction(String action) 94 { 95 _action = action; 96 } 97 98 public void setIcon(String icon) 99 { 100 _icon = icon; 101 } 102 103 public void setSplit(String split) 104 { 105 _split = split; 106 } 107 108 public void setVisibleOnUserRole(String visibleOnUserRole) 109 { 110 _visibleOnUserRole = visibleOnUserRole; 111 } 112 113 public void setEnabledOnUserRole(String enabledOnUserRole) 114 { 115 _enabledOnUserRole = enabledOnUserRole; 116 } 117 } 118 | Popular Tags |