View Javadoc
1 /* 2 * Angkor Web Framework 3 * 4 * Distributable under LGPL license. 5 * See terms of license at gnu.org. 6 */ 7 package com.tirsen.angkor.widget; 8 9 import com.tirsen.angkor.Debug; 10 import com.tirsen.angkor.RenderContext; 11 import com.tirsen.angkor.View; 12 import org.apache.log4j.Category; 13 14 import java.io.IOException; 15 import java.util.Iterator; 16 17 /*** 18 * 19 * 20 * <!-- $Id: SectionLine.java,v 1.5 2002/10/09 21:37:37 tirsen Exp $ --> 21 * <!-- $Author: tirsen $ --> 22 * 23 * @author Jon Tirsén (tirsen@users.sourceforge.net) 24 * @version $Revision: 1.5 $ 25 */ 26 public class SectionLine extends Container 27 { 28 private static final Category logger = Debug.getCategory(); 29 30 public SectionLine() 31 { 32 } 33 34 public SectionLine(View singleElement) 35 { 36 add(singleElement); 37 } 38 39 public void setContainer(View container) 40 { 41 if (!(container instanceof Section)) 42 throw new IllegalArgumentException("Can only add SectionLines to Section."); 43 super.setContainer(container); 44 } 45 46 public void render(RenderContext context) throws IOException 47 { 48 if (isVisible()) 49 { 50 if (getChildren() != null) 51 { 52 boolean firstVisible = true; 53 54 Iterator iterator = getChildren().iterator(); 55 while (iterator.hasNext()) 56 { 57 View view = (View) iterator.next(); 58 if (view.isVisible()) 59 { 60 // output only start-tag if and when we encounter the first visible 61 if (firstVisible) 62 { 63 context.startTag("TR"); 64 firstVisible = false; 65 } 66 context.startTag("TD"); 67 view.render(context); 68 context.endTag("TD"); 69 } 70 } 71 // output only start-tag if we encounterd a visible element 72 if (!firstVisible) 73 { 74 context.endTag("TR"); 75 } 76 } 77 } 78 } 79 }

This page was automatically generated by Maven