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.apache.log4j.Logger; 24 import org.objectweb.jac.aspects.gui.*; 25 import org.objectweb.jac.util.Strings; 26 27 public class Container extends AbstractCompositeView 28 implements HTMLViewer 29 { 30 static Logger logger = Logger.getLogger("web.html"); 31 32 int layout; 33 34 public Container(int layout) { 35 super(); 36 this.layout = layout; 37 } 38 39 public void genHTML(PrintWriter out) throws IOException { 40 genDescription(out); 41 genMessage(out); 42 out.println("<div class=\""+type+(!Strings.isEmpty(style)?(" "+style):"")+"\">"); 44 genItemsHTML(out); 45 out.println("</div>"); 46 } 47 48 52 protected void genItemsHTML(PrintWriter out) { 53 Iterator i = components.iterator(); 54 while (i.hasNext()) { 55 HTMLViewer component = (HTMLViewer)i.next(); 56 if (layout==Constants.VERTICAL) { 57 out.println("<div>"); 58 } 59 try { 60 String openBoder = ((AbstractView)component).getOpenBorder(); 61 if (!Strings.isEmpty(openBoder)) 62 out.println(openBoder); 63 component.genHTML(out); 64 String closeBoder = ((AbstractView)component).getCloseBorder(); 65 if (!Strings.isEmpty(closeBoder)) 66 out.println(closeBoder); 67 } catch(Exception e) { 68 logger.error("Container.genHTML(): genHTML of component "+ 69 component+" raised an exception",e); 70 } 71 if (layout==Constants.VERTICAL) 72 out.println("</div>"); 73 } 74 } 75 } 76 | Popular Tags |