001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/portal/context/Module.java $
002 /*---------------- FILE HEADER ------------------------------------------
003
004 This file is part of deegree.
005 Copyright (C) 2001-2008 by:
006 EXSE, Department of Geography, University of Bonn
007 http://www.giub.uni-bonn.de/deegree/
008 lat/lon GmbH
009 http://www.lat-lon.de
010
011 This library is free software; you can redistribute it and/or
012 modify it under the terms of the GNU Lesser General Public
013 License as published by the Free Software Foundation; either
014 version 2.1 of the License, or (at your option) any later version.
015
016 This library is distributed in the hope that it will be useful,
017 but WITHOUT ANY WARRANTY; without even the implied warranty of
018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019 Lesser General Public License for more details.
020
021 You should have received a copy of the GNU Lesser General Public
022 License along with this library; if not, write to the Free Software
023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024
025 Contact:
026
027 Andreas Poth
028 lat/lon GmbH
029 Aennchenstr. 19
030 53115 Bonn
031 Germany
032 E-Mail: poth@lat-lon.de
033
034 Prof. Dr. Klaus Greve
035 Department of Geography
036 University of Bonn
037 Meckenheimer Allee 166
038 53115 Bonn
039 Germany
040 E-Mail: greve@giub.uni-bonn.de
041
042
043 ---------------------------------------------------------------------------*/
044 package org.deegree.portal.context;
045
046 import org.deegree.framework.util.Parameter;
047 import org.deegree.framework.util.ParameterList;
048
049 /**
050 * this class encapsulates the basic informations of a module that is part of an area of the GUI.
051 * Other classes may extent this class by adding special attributes for more specialazied GUIs.
052 *
053 * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
054 * @author last edited by: $Author: apoth $
055 *
056 * @version $Revision: 9346 $, $Date: 2007-12-27 17:39:07 +0100 (Do, 27 Dez 2007) $
057 */
058 public class Module {
059 private ModuleConfiguration moduleConfiguration = null;
060
061 private String content = null;
062
063 private String name = null;
064
065 private boolean hidden = false;
066
067 private ParameterList parameterList = null;
068
069 private String type = "content";
070
071 private int width = 0;
072
073 private int height = 0;
074
075 private String[] moduleJSList = new String[0];
076
077 private String scrolling = "auto";
078
079 /**
080 * Creates a new Module_Impl object.
081 *
082 * @param name
083 * name of the module
084 * @param content
085 * the name of the page/class/file etc. containing the content of the module
086 * @param hidden
087 * indicates if the module is visible or not
088 * @param type
089 * @param width
090 * @param height
091 * @param scrolling
092 * @param moduleJSList
093 * @param moduleConfiguration
094 * encapsulates the access to the modules configuration (may be <tt>null</tt>)
095 * @param parameterList
096 */
097 public Module( String name, String content, boolean hidden, String type, int width, int height,
098 String scrolling, String[] moduleJSList,
099 ModuleConfiguration moduleConfiguration, ParameterList parameterList ) {
100 setName( name );
101 setContent( content );
102 setHidden( hidden );
103 setModuleConfiguration( moduleConfiguration );
104 setParameter( parameterList );
105 setType( type );
106 setWidth( width );
107 setHeight( height );
108 setModuleJSList( moduleJSList );
109 setScrolling( scrolling );
110 }
111
112 /**
113 * returns the name of a module
114 *
115 * @return the name of a module
116 */
117 public String getName() {
118 return name;
119 }
120
121 /**
122 * sets the name of a module
123 *
124 * @param name
125 */
126 public void setName( String name ) {
127 this.name = name;
128 }
129
130 /**
131 * returns the name of the page/class/file etc. containing the content of the module
132 *
133 * @return the name of the page/class/file etc. containing the content of the module
134 */
135 public String getContent() {
136 return content;
137 }
138
139 /**
140 * sets the name of the page/class/file etc. containing the content of the module
141 *
142 * @param content
143 */
144 public void setContent( String content ) {
145 this.content = content;
146 }
147
148 /**
149 * returns true if the module is hidden. this will always be the case for modules that just
150 * offers functions to the context. visible modules may offere the capability to be turned to
151 * visible or not.
152 *
153 * @return <code>true</code> if the module is hidden.
154 */
155 public boolean isHidden() {
156 return hidden;
157 }
158
159 /**
160 * sets the module to be hidden or visible. modules that only adds functions to a context will
161 * ignore this because they are always hidden
162 *
163 * @param hidden
164 */
165 public void setHidden( boolean hidden ) {
166 this.hidden = hidden;
167 }
168
169 /**
170 * returns the a specific confguration for a module. This may be <tt>null</tt> if the module
171 * doesn't need to be configured.
172 *
173 * @return the a specific confguration for a module. This may be <code>null</code>if the
174 * module doesn't need to be configured.
175 */
176 public ModuleConfiguration getModuleConfiguration() {
177 return moduleConfiguration;
178 }
179
180 /**
181 * sets the specific configuration for a module.
182 *
183 * @param configuration
184 */
185 public void setModuleConfiguration( ModuleConfiguration configuration ) {
186 this.moduleConfiguration = configuration;
187 }
188
189 /**
190 * returns a list of parameters that will be passed to a class/object etc. that represents a
191 * module
192 *
193 * @return parameters
194 */
195 public ParameterList getParameter() {
196 return parameterList;
197 }
198
199 /**
200 * sets a list of parameters that will be passed to a class/object etc. that represents a module
201 *
202 * @param parameterList
203 */
204 public void setParameter( ParameterList parameterList ) {
205 this.parameterList = parameterList;
206 }
207
208 /**
209 * adds a parameter to the list of parameters that will be passed to a class/object etc. that
210 * represents a module
211 *
212 * @param parameter
213 */
214 public void addParameter( Parameter parameter ) {
215 parameterList.addParameter( parameter );
216 }
217
218 /**
219 * removes a parameter to the list of parameters that will be passed to a class/object etc. that
220 * represents a module
221 *
222 * @param name
223 */
224 public void removeParameter( String name ) {
225 parameterList.removeParameter( name );
226 }
227
228 /**
229 * @see org.deegree.clients.context.Module#setType(java.lang.String)
230 */
231 public void setType( String type ) {
232 if ( type != null ) {
233 this.type = type.toLowerCase();
234 }
235 }
236
237 /**
238 * @see org.deegree.clients.context.Module#getType()
239 */
240 public String getType() {
241 return type;
242 }
243
244 /**
245 * returns the width of the module in the GUI. If '0' will be returned the GUI can set the with
246 * like it is best
247 *
248 * @return the width of the module in the GUI. If '0' will be returned the GUI can set the with
249 * like it is best
250 */
251 public int getWidth() {
252 return this.width;
253 }
254
255 /**
256 * sets the desired width of the module in the GUI. If '0' ist passed the GUI can set the with
257 * like it is best
258 *
259 * @param width
260 * desired width of the module
261 */
262 public void setWidth( int width ) {
263 this.width = width;
264 }
265
266 /**
267 * returns the height of the module in the GUI. If '0' will be returned the GUI can set the with
268 * like it is best
269 *
270 * @return the height of the module in the GUI. If '0' will be returned the GUI can set the with
271 * like it is best
272 */
273 public int getHeight() {
274 return this.height;
275 }
276
277 /**
278 * sets the desired height of the module in the GUI. If '0' ist passed the GUI can set the with
279 * like it is best
280 *
281 * @param height
282 * desired width of the module
283 */
284 public void setHeight( int height ) {
285 this.height = height;
286 }
287
288 /**
289 * @return moduleJSList
290 */
291 public String[] getModuleJSList() {
292 return moduleJSList;
293 }
294
295 /**
296 * @param list
297 */
298 public void setModuleJSList( String[] list ) {
299 this.moduleJSList = list;
300 }
301
302 /**
303 * return true is the module should has scrollbars in the GUI<br>
304 * possible values are
305 * <UL>
306 * <li>no
307 * <li>yes
308 * <li>auto
309 * </UL>
310 * default is auto
311 *
312 * @return <code>true</code> is the module should has scrollbars in the GUI possible values
313 * are
314 */
315 public String getScrolling() {
316 return scrolling;
317 }
318
319 /**
320 * @see #getScrolling()
321 * @param scrollable
322 */
323 public void setScrolling( String scrollable ) {
324 this.scrolling = scrollable;
325 }
326 }