01: package pygmy.nntp.http;
02:
03: import pygmy.core.HttpRequest;
04:
05: import java.util.List;
06: import java.util.ArrayList;
07: import java.util.Iterator;
08: import java.io.IOException;
09:
10: public class CompositeView extends View {
11:
12: List views = new ArrayList();
13: String seperator;
14:
15: public CompositeView(String urlPrefix, String seperator) {
16: super (urlPrefix);
17: this .seperator = seperator;
18: }
19:
20: public void addView(View view) {
21: views.add(view);
22: }
23:
24: public String render(HttpRequest request) throws IOException {
25: for (Iterator i = views.iterator(); i.hasNext();) {
26: View view = (View) i.next();
27: buffer.append(view.render(request));
28: if (seperator != null && seperator != "") {
29: buffer.append(seperator);
30: }
31: }
32: return buffer.toString();
33: }
34: }
|