forked from hazukac/DesignPatterns
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathListPage.java
More file actions
27 lines (25 loc) · 828 Bytes
/
Copy pathListPage.java
File metadata and controls
27 lines (25 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package listfactory;
import factory.*;
import java.util.Iterator;
public class ListPage extends Page {
public ListPage(String title, String author) {
super(title, author);
}
public String makeHTML() {
StringBuffer buffer = new StringBuffer();
buffer.append("<html>\n");
buffer.append("<head><title>" + this.title + "</title></head>\n");
buffer.append("<body>\n");
buffer.append("<h1>" + this.title + "</h1>");
buffer.append("<ul>\n");
Iterator itr = this.content.iterator();
while (itr.hasNext()) {
Item item = (Item)itr.next();
buffer.append(item.makeHTML());
}
buffer.append("</ul>\n");
buffer.append("</body>\n");
buffer.append("</html>\n");
return buffer.toString();
}
}