1 14 package org.wings.plaf.css.msie; 15 16 17 import java.io.IOException ; 18 19 import org.wings.SMenu; 20 import org.wings.SMenuItem; 21 import org.wings.io.Device; 22 23 public class MenuCG extends org.wings.plaf.css.MenuCG { 24 25 28 protected void writeListAttributes(Device device, SMenu menu) throws IOException { 29 int maxLength = 0; 31 for (int i = 0; i < menu.getMenuComponentCount(); i++) { 32 if (!(menu.getMenuComponent(i) instanceof SMenuItem)) 33 continue; 34 String text = ((SMenuItem)menu.getMenuComponent(i)).getText(); 35 if (text != null && text.length() > maxLength) { 36 maxLength = text.length(); 37 if (menu.getMenuComponent(i) instanceof SMenu) { 38 maxLength = maxLength + 2; } 40 } 41 } 42 device.print(" style=\"width:"); 43 String stringLength = String.valueOf(maxLength * menu.getWidthScaleFactor()); 44 device.print(stringLength.substring(0,stringLength.lastIndexOf('.')+2)); 45 device.print("em;\""); 46 device.print(" id=\""); 47 device.print(menu.getName()); 48 device.print("_pop\""); 49 } 50 } 51 | Popular Tags |