1 64 65 package com.jcorporate.expresso.services.html; 66 67 72 73 import java.io.PrintWriter ; 74 import java.util.Enumeration ; 75 76 77 83 public class ListItem 84 extends HtmlElement { 85 private String thisClass = this.getClass().getName(); 86 87 92 public ListItem() 93 throws HtmlException { 94 super(); 95 } 96 97 104 public ListItem(HtmlElement newElement) 105 throws HtmlException { 106 super(newElement); 107 } 108 109 116 public ListItem(String newString) 117 throws HtmlException { 118 super(newString); 119 } 120 121 128 protected void display(PrintWriter out, int depth) 129 throws HtmlException { 130 String myName = (thisClass + "display(PrintWriter)"); 131 132 if (contents.size() == 0) { 133 throw new HtmlException(myName + ":ListItem " + getName() + 134 " has no contents"); 135 } 136 137 this.padWithTabs(out, depth); 138 out.print("<li"); 139 140 if (cSSClass != null) { 141 out.print(" class=\"" + cSSClass + "\""); 142 } 143 if (cSSID != null) { 144 out.print(" id=\"" + cSSID + "\""); 145 } 146 147 out.print(">"); 148 149 HtmlElement oneElement = null; 150 151 for (Enumeration e = contents.elements(); e.hasMoreElements();) { 152 oneElement = (HtmlElement) e.nextElement(); 153 oneElement.display(out, depth + 1); 154 } 155 156 this.padWithTabs(out, depth); 157 out.print("</li>"); 158 setDisplayed(); 159 } 160 161 162 } 163 164 | Popular Tags |