| 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 41 public class MenuItemRadioRenderer extends MenuItemRenderer { 42 43 protected String getIcon(UIComponent component) { 44 String iconImage = null; 45 if (component instanceof MenuItemRadio) { 46 if (((MenuItemRadio) component).isSelected()) { 47 iconImage = ((MenuItemRadio) component).getSelectedIcon(); 48 } else { 49 iconImage = ((MenuItemRadio) component).getUnselectedIcon(); 50 } 51 } else { 52 throw new InvalidComponentTypeException("MenuItemRadio expected"); 53 } 54 return iconImage; 55 } 56 57 protected String getTextValue(UIComponent component) { 58 String text = null; 59 if (component instanceof MenuItemRadio) { 60 text = ((MenuItem) component).getValue().toString(); 61 } else { 62 throw new InvalidComponentTypeException("MenuItemRadio expected"); 63 } 64 return text; 65 } 66 } 67 | Popular Tags |