1 14 package org.wings.plaf.css; 15 16 17 import java.io.IOException ; 18 19 import org.wings.SComponent; 20 import org.wings.SIcon; 21 import org.wings.SMenuItem; 22 import org.wings.io.Device; 23 24 public class MenuItemCG extends ButtonCG implements org.wings.plaf.MenuItemCG { 25 26 protected void writeItemContent(final Device device, SMenuItem menuItem) 27 throws IOException { 28 SIcon icon = getIcon(menuItem); 29 if (icon != null) { 30 device.print("<img align=\"middle\""); 31 Utils.optAttribute(device, "src", icon.getURL()); 32 Utils.optAttribute(device, "width", icon.getIconWidth()); 33 Utils.optAttribute(device, "height", icon.getIconHeight()); 34 device.print(" alt=\""); 35 device.print(icon.getIconTitle()); 36 device.print("\"/>"); 37 } 38 String text = menuItem.getText(); 39 if (text != null) { 40 Utils.write(device, text); 41 } 42 } 43 44 protected void writePrefix(Device device, SComponent component) throws IOException { 45 } 46 47 protected void writeSuffix(Device device, SComponent component) throws IOException { 48 } 49 50 public void writeContent(final Device device, final SComponent component) 51 throws IOException { 52 final SMenuItem menuItem = (SMenuItem) component; 53 writeItemContent(device, menuItem); 54 } 55 } 56 | Popular Tags |