KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > pluto > portalImpl > om > page > impl > PortalImpl


1 /*
2  * Copyright 2003,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 /*
17
18  */

19
20 package org.apache.pluto.portalImpl.om.page.impl;
21
22 import java.util.ArrayList JavaDoc;
23 import java.util.Collection JavaDoc;
24 import java.util.Iterator JavaDoc;
25
26 import javax.servlet.ServletConfig JavaDoc;
27
28 import org.apache.pluto.util.StringUtils;
29
30 public class PortalImpl implements java.io.Serializable JavaDoc {
31
32     private ArrayList JavaDoc fragments = new ArrayList JavaDoc();
33
34     public PortalImpl()
35     {
36     }
37
38     // additional methods.
39

40     public Collection JavaDoc getFragments()
41     {
42         return fragments;
43     }
44
45     public org.apache.pluto.portalImpl.aggregation.RootFragment build(ServletConfig JavaDoc config)
46     throws Exception JavaDoc
47     {
48         org.apache.pluto.portalImpl.aggregation.RootFragment root =
49         new org.apache.pluto.portalImpl.aggregation.RootFragment(config);
50
51         Iterator JavaDoc iterator = fragments.iterator();
52
53         while (iterator.hasNext()) {
54             FragmentImpl fragmentimpl = (FragmentImpl)iterator.next();
55
56             org.apache.pluto.portalImpl.aggregation.Fragment _fragment =
57             fragmentimpl.build(config, root);
58             if (_fragment!=null) {
59                 root.addChild(_fragment);
60             }
61         }
62
63         return root;
64     }
65
66     public String JavaDoc toString()
67     {
68         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc(2000);
69         StringUtils.newLine(buffer,0);
70         buffer.append(getClass().toString()); buffer.append(":");
71         StringUtils.newLine(buffer,0);
72         buffer.append("{");
73
74         Iterator JavaDoc iterator = fragments.iterator();
75
76         while (iterator.hasNext()) {
77             buffer.append(((FragmentImpl)iterator.next()).toString(2));
78         }
79
80         StringUtils.newLine(buffer,0);
81         buffer.append("}");
82         return buffer.toString();
83     }
84
85 }
86
Popular Tags