import java.util.List;
public class ChartMenuRenderer extends PopupMenuRenderer {
@Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
ChartMenu menu = (ChartMenu) component;
if (menu.getChildren().size() == 0) {
List<UIComponent> menuItems = menu.getChildren();
menuItems.add(new SaveChartMenuItem());
menuItems.add(new PrintChartMenuItem());
}
super.encodeBegin(context, component);