1 17 18 package org.objectweb.jac.aspects.gui.web; 19 20 import java.io.IOException ; 21 import java.io.PrintWriter ; 22 import java.net.URLEncoder ; 23 import java.util.Iterator ; 24 import org.objectweb.jac.aspects.gui.*; 25 26 public class Menu extends AbstractMenu 27 implements MenuView, HTMLViewer, MenuListener 28 { 29 30 public Menu(ViewFactory factory, DisplayContext context) { 31 super(factory,context); 32 logger.debug("new Menu "+this); 33 } 34 35 public void genHTML(PrintWriter out) throws IOException { 37 if (position.equals(org.objectweb.jac.aspects.gui.Menu.TOP)|| 38 position.equals(org.objectweb.jac.aspects.gui.Menu.BOTTOM)) { 39 out.println("<div class=\"menuH\">"); 40 } else if (position.equals(org.objectweb.jac.aspects.gui.Menu.LEFT)|| 41 position.equals(org.objectweb.jac.aspects.gui.Menu.RIGHT)) { 42 out.println("<div class=\"menuV\">"); 43 } 44 Iterator i = keys.iterator(); 45 while (i.hasNext()) { 46 String key = (String )i.next(); 47 Object item = map.get(key); 48 if (item instanceof Menu) { 49 out.println(key); 50 ((HTMLViewer)item).genHTML(out); 51 } else if (item instanceof MenuItem) { 52 out.print("<div><a HREF=\""+eventURL("onMenuClick")+ 53 "&item="+URLEncoder.encode(key,GuiAC.getEncoding())+"\">"); 54 if (((MenuItem)item).icon!=null) 55 out.print(iconElement(((MenuItem)item).icon,"")); 56 out.println(key+"</a></div>"); 57 } 58 } 59 out.println("</div>"); 60 } 61 } 62 | Popular Tags |