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