1 33 34 package com.icesoft.faces.component.menubar; 35 36 import com.icesoft.faces.component.InvalidComponentTypeException; 37 38 import javax.faces.component.UIComponent; 39 40 public class MenuItemCheckboxRenderer extends MenuItemRenderer { 41 42 protected String getIcon(UIComponent component) { 43 String iconImage = ""; 44 if (component instanceof MenuItemCheckbox) { 45 if (((MenuItemCheckbox) component).isSelected()) { 46 iconImage = ((MenuItemCheckbox) component).getSelectedIcon(); 47 } else { 48 iconImage = ((MenuItemCheckbox) component).getUnselectedIcon(); 49 } 50 } else { 51 throw new InvalidComponentTypeException( 52 "MenuItemCheckbox expected"); 53 } 54 return iconImage; 55 } 56 57 protected String getTextValue(UIComponent component) { 58 String text = null; 59 if (component instanceof MenuItemCheckbox) { 60 text = ((MenuItem) component).getValue().toString(); 61 } else { 62 throw new InvalidComponentTypeException( 63 "MenuItemCheckbox expected"); 64 } 65 return text; 66 } 67 68 } 69 | Popular Tags |