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 List 84 extends HtmlElement { 85 private String thisClass = (this.getClass().getName() + "."); 86 private boolean ordered = false; 87 private String listType = (""); 88 89 92 public List() 93 throws HtmlException { 94 super(); 95 } 96 97 102 public List(String newName) 103 throws HtmlException { 104 super(newName); 105 } 106 107 113 protected synchronized void display(PrintWriter out, int depth) 114 throws HtmlException { 115 String myName = (thisClass + "display(PrintWriter)"); 116 117 if (contents.size() == 0) { 118 throw new HtmlException(myName + ":List " + getName() + 119 " has no contents"); 120 } 121 if (ordered) { 122 this.padWithTabs(out, depth); 123 out.print("<ol"); 124 } else { 125 this.padWithTabs(out, depth); 126 out.print("<ul"); 127 } 128 if (cSSClass != null) { 129 out.print(" class=\"" + cSSClass + "\""); 130 } 131 if (cSSID != null) { 132 out.print(" id=\"" + cSSID + "\""); 133 } 134 if (!listType.equals("")) { 135 out.print(" type=\"" + listType + "\">"); 136 } else { 137 out.print(">"); 138 } 139 140 HtmlElement oneElement = null; 141 142 for (Enumeration e = contents.elements(); e.hasMoreElements();) { 143 oneElement = (HtmlElement) e.nextElement(); 144 oneElement.display(out, depth + 1); 145 } 146 if (ordered) { 147 this.padWithTabs(out, depth); 148 out.print("</ol>"); 149 } else { 150 this.padWithTabs(out, depth); 151 out.print("</ul>"); 152 } 153 154 setDisplayed(); 155 } 156 157 158 163 public void setOrdered(boolean newOrdered) 164 throws HtmlException { 165 ordered = newOrdered; 166 } 167 168 169 174 public synchronized void setType(String newType) 175 throws HtmlException { 176 listType = newType; 177 } 178 179 180 } 181 182 | Popular Tags |