001: //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/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 08:39:07 -0800 (Thu, 27 Dec 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,
098: String type, int width, int height, String scrolling,
099: String[] moduleJSList,
100: ModuleConfiguration moduleConfiguration,
101: ParameterList parameterList) {
102: setName(name);
103: setContent(content);
104: setHidden(hidden);
105: setModuleConfiguration(moduleConfiguration);
106: setParameter(parameterList);
107: setType(type);
108: setWidth(width);
109: setHeight(height);
110: setModuleJSList(moduleJSList);
111: setScrolling(scrolling);
112: }
113:
114: /**
115: * returns the name of a module
116: *
117: * @return the name of a module
118: */
119: public String getName() {
120: return name;
121: }
122:
123: /**
124: * sets the name of a module
125: *
126: * @param name
127: */
128: public void setName(String name) {
129: this .name = name;
130: }
131:
132: /**
133: * returns the name of the page/class/file etc. containing the content of the module
134: *
135: * @return the name of the page/class/file etc. containing the content of the module
136: */
137: public String getContent() {
138: return content;
139: }
140:
141: /**
142: * sets the name of the page/class/file etc. containing the content of the module
143: *
144: * @param content
145: */
146: public void setContent(String content) {
147: this .content = content;
148: }
149:
150: /**
151: * returns true if the module is hidden. this will always be the case for modules that just
152: * offers functions to the context. visible modules may offere the capability to be turned to
153: * visible or not.
154: *
155: * @return <code>true</code> if the module is hidden.
156: */
157: public boolean isHidden() {
158: return hidden;
159: }
160:
161: /**
162: * sets the module to be hidden or visible. modules that only adds functions to a context will
163: * ignore this because they are always hidden
164: *
165: * @param hidden
166: */
167: public void setHidden(boolean hidden) {
168: this .hidden = hidden;
169: }
170:
171: /**
172: * returns the a specific confguration for a module. This may be <tt>null</tt> if the module
173: * doesn't need to be configured.
174: *
175: * @return the a specific confguration for a module. This may be <code>null</code>if the
176: * module doesn't need to be configured.
177: */
178: public ModuleConfiguration getModuleConfiguration() {
179: return moduleConfiguration;
180: }
181:
182: /**
183: * sets the specific configuration for a module.
184: *
185: * @param configuration
186: */
187: public void setModuleConfiguration(ModuleConfiguration configuration) {
188: this .moduleConfiguration = configuration;
189: }
190:
191: /**
192: * returns a list of parameters that will be passed to a class/object etc. that represents a
193: * module
194: *
195: * @return parameters
196: */
197: public ParameterList getParameter() {
198: return parameterList;
199: }
200:
201: /**
202: * sets a list of parameters that will be passed to a class/object etc. that represents a module
203: *
204: * @param parameterList
205: */
206: public void setParameter(ParameterList parameterList) {
207: this .parameterList = parameterList;
208: }
209:
210: /**
211: * adds a parameter to the list of parameters that will be passed to a class/object etc. that
212: * represents a module
213: *
214: * @param parameter
215: */
216: public void addParameter(Parameter parameter) {
217: parameterList.addParameter(parameter);
218: }
219:
220: /**
221: * removes a parameter to the list of parameters that will be passed to a class/object etc. that
222: * represents a module
223: *
224: * @param name
225: */
226: public void removeParameter(String name) {
227: parameterList.removeParameter(name);
228: }
229:
230: /**
231: * @see org.deegree.clients.context.Module#setType(java.lang.String)
232: */
233: public void setType(String type) {
234: if (type != null) {
235: this .type = type.toLowerCase();
236: }
237: }
238:
239: /**
240: * @see org.deegree.clients.context.Module#getType()
241: */
242: public String getType() {
243: return type;
244: }
245:
246: /**
247: * returns the width of the module in the GUI. If '0' will be returned the GUI can set the with
248: * like it is best
249: *
250: * @return the width of the module in the GUI. If '0' will be returned the GUI can set the with
251: * like it is best
252: */
253: public int getWidth() {
254: return this .width;
255: }
256:
257: /**
258: * sets the desired width of the module in the GUI. If '0' ist passed the GUI can set the with
259: * like it is best
260: *
261: * @param width
262: * desired width of the module
263: */
264: public void setWidth(int width) {
265: this .width = width;
266: }
267:
268: /**
269: * returns the height of the module in the GUI. If '0' will be returned the GUI can set the with
270: * like it is best
271: *
272: * @return the height of the module in the GUI. If '0' will be returned the GUI can set the with
273: * like it is best
274: */
275: public int getHeight() {
276: return this .height;
277: }
278:
279: /**
280: * sets the desired height of the module in the GUI. If '0' ist passed the GUI can set the with
281: * like it is best
282: *
283: * @param height
284: * desired width of the module
285: */
286: public void setHeight(int height) {
287: this .height = height;
288: }
289:
290: /**
291: * @return moduleJSList
292: */
293: public String[] getModuleJSList() {
294: return moduleJSList;
295: }
296:
297: /**
298: * @param list
299: */
300: public void setModuleJSList(String[] list) {
301: this .moduleJSList = list;
302: }
303:
304: /**
305: * return true is the module should has scrollbars in the GUI<br>
306: * possible values are
307: * <UL>
308: * <li>no
309: * <li>yes
310: * <li>auto
311: * </UL>
312: * default is auto
313: *
314: * @return <code>true</code> is the module should has scrollbars in the GUI possible values
315: * are
316: */
317: public String getScrolling() {
318: return scrolling;
319: }
320:
321: /**
322: * @see #getScrolling()
323: * @param scrollable
324: */
325: public void setScrolling(String scrollable) {
326: this.scrolling = scrollable;
327: }
328: }
|