001 //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.3_testing/src/org/deegree/portal/context/Module.java $ 002 /*---------------------------------------------------------------------------- 003 This file is part of deegree, http://deegree.org/ 004 Copyright (C) 2001-2009 by: 005 Department of Geography, University of Bonn 006 and 007 lat/lon GmbH 008 009 This library is free software; you can redistribute it and/or modify it under 010 the terms of the GNU Lesser General Public License as published by the Free 011 Software Foundation; either version 2.1 of the License, or (at your option) 012 any later version. 013 This library is distributed in the hope that it will be useful, but WITHOUT 014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 015 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 016 details. 017 You should have received a copy of the GNU Lesser General Public License 018 along with this library; if not, write to the Free Software Foundation, Inc., 019 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 020 021 Contact information: 022 023 lat/lon GmbH 024 Aennchenstr. 19, 53177 Bonn 025 Germany 026 http://lat-lon.de/ 027 028 Department of Geography, University of Bonn 029 Prof. Dr. Klaus Greve 030 Postfach 1147, 53001 Bonn 031 Germany 032 http://www.geographie.uni-bonn.de/deegree/ 033 034 e-mail: info@deegree.org 035 ----------------------------------------------------------------------------*/ 036 package org.deegree.portal.context; 037 038 import org.deegree.framework.util.Parameter; 039 import org.deegree.framework.util.ParameterList; 040 041 /** 042 * this class encapsulates the basic informations of a module that is part of an area of the GUI. 043 * Other classes may extent this class by adding special attributes for more specialazied GUIs. 044 * 045 * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a> 046 * @author last edited by: $Author: mschneider $ 047 * 048 * @version $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $ 049 */ 050 public class Module { 051 private ModuleConfiguration moduleConfiguration = null; 052 053 private String content = null; 054 055 private String name = null; 056 057 private boolean hidden = false; 058 059 private ParameterList parameterList = null; 060 061 private String type = "content"; 062 063 private int width = 0; 064 065 private int height = 0; 066 067 private int left = 0; 068 069 private int right = 0; 070 071 private int top = 0; 072 073 private int bottom = 0; 074 075 private boolean header; 076 077 private boolean closable; 078 079 private boolean overlay; 080 081 private String[] moduleJSList = new String[0]; 082 083 private String scrolling = "auto"; 084 085 /** 086 * Creates a new Module_Impl object. 087 * 088 * @param name 089 * name of the module 090 * @param content 091 * the name of the page/class/file etc. containing the content of the module 092 * @param hidden 093 * indicates if the module is visible or not 094 * @param type 095 * @param left 096 * @param top 097 * @param right 098 * @param bottom 099 * @param width 100 * @param height 101 * @param overlay 102 * @param header 103 * @param closable 104 * @param scrolling 105 * @param moduleJSList 106 * @param moduleConfiguration 107 * encapsulates the access to the modules configuration (may be <tt>null</tt>) 108 * @param parameterList 109 */ 110 public Module( String name, String content, boolean hidden, String type, int left, int top, int right, int bottom, 111 int width, int height, boolean overlay, boolean header, boolean closable, String scrolling, 112 String[] moduleJSList, ModuleConfiguration moduleConfiguration, ParameterList parameterList ) { 113 setName( name ); 114 setContent( content ); 115 setHidden( hidden ); 116 setModuleConfiguration( moduleConfiguration ); 117 setParameter( parameterList ); 118 setType( type ); 119 setWidth( width ); 120 setHeight( height ); 121 setLeft( left ); 122 setTop( top ); 123 setRight( right ); 124 setHeader( header ); 125 setClosable( closable ); 126 setOverlay( overlay ); 127 setBottom( bottom ); 128 setModuleJSList( moduleJSList ); 129 setScrolling( scrolling ); 130 } 131 132 /** 133 * returns the name of a module 134 * 135 * @return the name of a module 136 */ 137 public String getName() { 138 return name; 139 } 140 141 /** 142 * sets the name of a module 143 * 144 * @param name 145 */ 146 public void setName( String name ) { 147 this.name = name; 148 } 149 150 /** 151 * returns the name of the page/class/file etc. containing the content of the module 152 * 153 * @return the name of the page/class/file etc. containing the content of the module 154 */ 155 public String getContent() { 156 return content; 157 } 158 159 /** 160 * sets the name of the page/class/file etc. containing the content of the module 161 * 162 * @param content 163 */ 164 public void setContent( String content ) { 165 this.content = content; 166 } 167 168 /** 169 * returns true if the module is hidden. this will always be the case for modules that just 170 * offers functions to the context. visible modules may offere the capability to be turned to 171 * visible or not. 172 * 173 * @return <code>true</code> if the module is hidden. 174 */ 175 public boolean isHidden() { 176 return hidden; 177 } 178 179 /** 180 * sets the module to be hidden or visible. modules that only adds functions to a context will 181 * ignore this because they are always hidden 182 * 183 * @param hidden 184 */ 185 public void setHidden( boolean hidden ) { 186 this.hidden = hidden; 187 } 188 189 /** 190 * returns the a specific confguration for a module. This may be <tt>null</tt> if the module 191 * doesn't need to be configured. 192 * 193 * @return the a specific confguration for a module. This may be <code>null</code>if the 194 * module doesn't need to be configured. 195 */ 196 public ModuleConfiguration getModuleConfiguration() { 197 return moduleConfiguration; 198 } 199 200 /** 201 * sets the specific configuration for a module. 202 * 203 * @param configuration 204 */ 205 public void setModuleConfiguration( ModuleConfiguration configuration ) { 206 this.moduleConfiguration = configuration; 207 } 208 209 /** 210 * returns a list of parameters that will be passed to a class/object etc. that represents a 211 * module 212 * 213 * @return parameters 214 */ 215 public ParameterList getParameter() { 216 return parameterList; 217 } 218 219 /** 220 * sets a list of parameters that will be passed to a class/object etc. that represents a module 221 * 222 * @param parameterList 223 */ 224 public void setParameter( ParameterList parameterList ) { 225 this.parameterList = parameterList; 226 } 227 228 /** 229 * adds a parameter to the list of parameters that will be passed to a class/object etc. that 230 * represents a module 231 * 232 * @param parameter 233 */ 234 public void addParameter( Parameter parameter ) { 235 parameterList.addParameter( parameter ); 236 } 237 238 /** 239 * removes a parameter to the list of parameters that will be passed to a class/object etc. that 240 * represents a module 241 * 242 * @param name 243 */ 244 public void removeParameter( String name ) { 245 parameterList.removeParameter( name ); 246 } 247 248 /** 249 * see also org.deegree.clients.context.Module#setType(java.lang.String) 250 * 251 * @param type 252 * to set 253 */ 254 public void setType( String type ) { 255 if ( type != null ) { 256 this.type = type.toLowerCase(); 257 } 258 } 259 260 /** 261 * see also org.deegree.clients.context.Module#getType() 262 * 263 * @return the type. 264 */ 265 public String getType() { 266 return type; 267 } 268 269 /** 270 * returns the width of the module in the GUI. If '0' will be returned the GUI can set the with 271 * like it is best 272 * 273 * @return the width of the module in the GUI. If '0' will be returned the GUI can set the with 274 * like it is best 275 */ 276 public int getWidth() { 277 return this.width; 278 } 279 280 /** 281 * sets the desired width of the module in the GUI. If '0' ist passed the GUI can set the with 282 * like it is best 283 * 284 * @param width 285 * desired width of the module 286 */ 287 public void setWidth( int width ) { 288 this.width = width; 289 } 290 291 /** 292 * returns the height of the module in the GUI. If '0' will be returned the GUI can set the with 293 * like it is best 294 * 295 * @return the height of the module in the GUI. If '0' will be returned the GUI can set the with 296 * like it is best 297 */ 298 public int getHeight() { 299 return this.height; 300 } 301 302 /** 303 * sets the desired height of the module in the GUI. If '0' ist passed the GUI can set the with 304 * like it is best 305 * 306 * @param height 307 * desired width of the module 308 */ 309 public void setHeight( int height ) { 310 this.height = height; 311 } 312 313 /** 314 * @return the bottom 315 */ 316 public int getBottom() { 317 return bottom; 318 } 319 320 /** 321 * @param bottom 322 * the bottom to set 323 */ 324 public void setBottom( int bottom ) { 325 this.bottom = bottom; 326 } 327 328 /** 329 * @return the left 330 */ 331 public int getLeft() { 332 return left; 333 } 334 335 /** 336 * @param left 337 * the left to set 338 */ 339 public void setLeft( int left ) { 340 this.left = left; 341 } 342 343 /** 344 * @return the right 345 */ 346 public int getRight() { 347 return right; 348 } 349 350 /** 351 * @param right 352 * the right to set 353 */ 354 public void setRight( int right ) { 355 this.right = right; 356 } 357 358 /** 359 * @return the top 360 */ 361 public int getTop() { 362 return top; 363 } 364 365 /** 366 * @param top 367 * the top to set 368 */ 369 public void setTop( int top ) { 370 this.top = top; 371 } 372 373 /** 374 * @return the closable 375 */ 376 public boolean isClosable() { 377 return closable; 378 } 379 380 /** 381 * @param closable 382 * the closable to set 383 */ 384 public void setClosable( boolean closable ) { 385 this.closable = closable; 386 } 387 388 /** 389 * @return the header 390 */ 391 public boolean hasHeader() { 392 return header; 393 } 394 395 /** 396 * @param header 397 * the header to set 398 */ 399 public void setHeader( boolean header ) { 400 this.header = header; 401 } 402 403 /** 404 * @return the overlay 405 */ 406 public boolean isOverlay() { 407 return overlay; 408 } 409 410 /** 411 * @param overlay 412 * the overlay to set 413 */ 414 public void setOverlay( boolean overlay ) { 415 this.overlay = overlay; 416 } 417 418 /** 419 * @return moduleJSList 420 */ 421 public String[] getModuleJSList() { 422 return moduleJSList; 423 } 424 425 /** 426 * @param list 427 */ 428 public void setModuleJSList( String[] list ) { 429 this.moduleJSList = list; 430 } 431 432 /** 433 * return true is the module should has scrollbars in the GUI<br> 434 * possible values are 435 * <UL> 436 * <li>no 437 * <li>yes 438 * <li>auto 439 * </UL> 440 * default is auto 441 * 442 * @return <code>true</code> is the module should has scrollbars in the GUI possible values 443 * are 444 */ 445 public String getScrolling() { 446 return scrolling; 447 } 448 449 /** 450 * @see #getScrolling() 451 * @param scrollable 452 */ 453 public void setScrolling( String scrollable ) { 454 this.scrolling = scrollable; 455 } 456 }