1 /***
2 * The contents of this file are subject to the Mozilla Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/MPL/
6 *
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
11 *
12 * The Original Code is pow2WebGui library.
13 *
14 * The Initial Owner of the Original Code is Power Of Two S.R.L.
15 * Portions created by Power Of Two S.R.L. are Copyright (C) Power Of Two S.R.L.
16 * All Rights Reserved.
17 *
18 * Contributor(s):
19 */
20
21 package com.pow2.webgui.contentprovider;
22
23 import java.util.*;
24 import org.apache.log4j.Category;
25 import com.pow2.webgui.*;
26
27 /***
28 * ContentProvider abstract class.
29 *
30 * @author Luca Fossato
31 * @created 08 July 2002
32 */
33 public abstract class BaseContentProvider extends WidgetStrategy
34 {
35 /*** Log4j category */
36 protected static Category cat = Category.getInstance(BaseContentProvider.class);
37
38
39 protected StringBuffer content;
40 protected Collection collection;
41 protected String template;
42 protected HashMap propertiesMap;
43
44
45 /***
46 * Constructor.
47 *
48 * @param widget the parent widget to provide the content to
49 */
50 public BaseContentProvider(Widget widget)
51 {
52 this.widget = widget;
53
54 content = new StringBuffer();
55 collection = null;
56 template = null;
57 propertiesMap = null;
58 }
59
60
61 /***
62 * Sets the list attribute of the ArrayListContentProvider object
63 *
64 * @param collection The new collection value
65 */
66 public void setCollection(Collection collection)
67 {
68 this.collection = collection;
69 }
70
71
72 /***
73 * Sets the content attribute of the ContentProvider object
74 *
75 * @param content The new content value
76 */
77 public void setContent(StringBuffer content)
78 {
79 this.content = content;
80 }
81
82
83 /***
84 * Sets the template attribute of the ContentProvider object
85 *
86 * @param template The new template value
87 */
88 public void setTemplate(String template)
89 {
90 this.template = template;
91 }
92
93
94 /***
95 * Sets the propertiesMap attribute of the BaseContentProvider object
96 *
97 * @param propertiesMap The new propertiesMap value
98 */
99 public void setPropertiesMap(HashMap propertiesMap)
100 {
101 this.propertiesMap = propertiesMap;
102 }
103
104
105 /***
106 * Gets the list attribute of the ArrayListContentProvider object
107 *
108 * @return The list value
109 */
110 public Collection getCollection()
111 {
112 return collection;
113 }
114
115
116 /***
117 * Gets the ContentProvider content.
118 *
119 * @return the ContentProvider content
120 * @exception Exception if any error occurs
121 */
122 public abstract StringBuffer getContent() throws Exception;
123
124
125 /***
126 * Gets the template attribute of the ContentProvider object
127 *
128 * @return The template value
129 */
130 public String getTemplate()
131 {
132 return template;
133 }
134
135
136 /***
137 * Gets the propertiesMap attribute of the BaseContentProvider object
138 *
139 * @return The propertiesMap value
140 */
141 public HashMap getPropertiesMap()
142 {
143 return propertiesMap;
144 }
145 }