001 //$HeadURL: http://svn.wald.intevation.org/svn/deegree/base/trunk/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. Other classes may 043 * 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: apoth $ 047 * 048 * @version $Revision: 29966 $, $Date: 2011-03-09 15:19:04 +0100 (Wed, 09 Mar 2011) $ 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 String title = null; 058 059 private boolean hidden = false; 060 061 private ParameterList parameterList = null; 062 063 private String type = "content"; 064 065 private String width = "0"; 066 067 private String height = "0"; 068 069 private int left = 0; 070 071 private int right = 0; 072 073 private int top = 0; 074 075 private int bottom = 0; 076 077 private boolean header; 078 079 private boolean closable; 080 081 private boolean overlay; 082 083 private boolean collapsed; 084 085 private String[] moduleJSList = new String[0]; 086 087 private String scrolling = "auto"; 088 089 090 /** 091 * Creates a new Module object. 092 * 093 * @param name 094 * name of the module 095 * @param title 096 * title of the module 097 * @param content 098 * the name of the page/class/file etc. containing the content of the module 099 * @param hidden 100 * indicates if the module is visible or not 101 * @param type 102 * @param left 103 * @param top 104 * @param right 105 * @param bottom 106 * @param width 107 * @param height 108 * @param overlay 109 * @param header 110 * @param closable 111 * @param collapsed 112 * the state of the module in table layout of ExtJS. default is false 113 * @param scrolling 114 * @param moduleJSList 115 * @param moduleConfiguration 116 * encapsulates the access to the modules configuration (may be <tt>null</tt>) 117 * @param parameterList 118 */ 119 public Module( String name, String title, String content, boolean hidden, String type, int left, int top, int right, 120 int bottom, String width, String height, boolean overlay, boolean header, boolean closable, boolean collapsed, 121 String scrolling, String[] moduleJSList, ModuleConfiguration moduleConfiguration, ParameterList parameterList ) { 122 setName( name ); 123 setTitle( title ); 124 setContent( content ); 125 setHidden( hidden ); 126 setModuleConfiguration( moduleConfiguration ); 127 setParameter( parameterList ); 128 setType( type ); 129 setWidth( width ); 130 setHeight( height ); 131 setLeft( left ); 132 setTop( top ); 133 setRight( right ); 134 setHeader( header ); 135 setClosable( closable ); 136 setCollapsed( collapsed ); 137 setOverlay( overlay ); 138 setBottom( bottom ); 139 setModuleJSList( moduleJSList ); 140 setScrolling( scrolling ); 141 } 142 143 /** 144 * returns the name of a module 145 * 146 * @return the name of a module 147 */ 148 public String getName() { 149 return name; 150 } 151 152 /** 153 * sets the name of a module 154 * 155 * @param name 156 */ 157 public void setName( String name ) { 158 this.name = name; 159 } 160 161 /** 162 * @return the title 163 */ 164 public String getTitle() { 165 return title; 166 } 167 168 /** 169 * @param title 170 * the title to set; if <code>title</code> == <code>null</code> the modules name will be used as title 171 */ 172 public void setTitle( String title ) { 173 if ( title == null ) { 174 this.title = name; 175 } else { 176 this.title = title; 177 } 178 } 179 180 /** 181 * returns the name of the page/class/file etc. containing the content of the module 182 * 183 * @return the name of the page/class/file etc. containing the content of the module 184 */ 185 public String getContent() { 186 return content; 187 } 188 189 /** 190 * sets the name of the page/class/file etc. containing the content of the module 191 * 192 * @param content 193 */ 194 public void setContent( String content ) { 195 this.content = content; 196 } 197 198 /** 199 * returns true if the module is hidden. this will always be the case for modules that just offers functions to the 200 * context. visible modules may offere the capability to be turned to visible or not. 201 * 202 * @return <code>true</code> if the module is hidden. 203 */ 204 public boolean isHidden() { 205 return hidden; 206 } 207 208 /** 209 * sets the module to be hidden or visible. modules that only adds functions to a context will ignore this because 210 * they are always hidden 211 * 212 * @param hidden 213 */ 214 public void setHidden( boolean hidden ) { 215 this.hidden = hidden; 216 } 217 218 /** 219 * returns the a specific confguration for a module. This may be <tt>null</tt> if the module doesn't need to be 220 * configured. 221 * 222 * @return the a specific confguration for a module. This may be <code>null</code>if the module doesn't need to be 223 * configured. 224 */ 225 public ModuleConfiguration getModuleConfiguration() { 226 return moduleConfiguration; 227 } 228 229 /** 230 * sets the specific configuration for a module. 231 * 232 * @param configuration 233 */ 234 public void setModuleConfiguration( ModuleConfiguration configuration ) { 235 this.moduleConfiguration = configuration; 236 } 237 238 /** 239 * returns a list of parameters that will be passed to a class/object etc. that represents a module 240 * 241 * @return parameters 242 */ 243 public ParameterList getParameter() { 244 return parameterList; 245 } 246 247 /** 248 * sets a list of parameters that will be passed to a class/object etc. that represents a module 249 * 250 * @param parameterList 251 */ 252 public void setParameter( ParameterList parameterList ) { 253 this.parameterList = parameterList; 254 } 255 256 /** 257 * adds a parameter to the list of parameters that will be passed to a class/object etc. that represents a module 258 * 259 * @param parameter 260 */ 261 public void addParameter( Parameter parameter ) { 262 parameterList.addParameter( parameter ); 263 } 264 265 /** 266 * removes a parameter to the list of parameters that will be passed to a class/object etc. that represents a module 267 * 268 * @param name 269 */ 270 public void removeParameter( String name ) { 271 parameterList.removeParameter( name ); 272 } 273 274 /** 275 * see also org.deegree.clients.context.Module#setType(java.lang.String) 276 * 277 * @param type 278 * to set 279 */ 280 public void setType( String type ) { 281 if ( type != null ) { 282 this.type = type.toLowerCase(); 283 } 284 } 285 286 /** 287 * see also org.deegree.clients.context.Module#getType() 288 * 289 * @return the type. 290 */ 291 public String getType() { 292 return type; 293 } 294 295 /** 296 * returns the width of the module in the GUI. If '0' will be returned the GUI can set the with like it is best 297 * 298 * @return the width of the module in the GUI. If '0' will be returned the GUI can set the with like it is best 299 */ 300 public String getWidth() { 301 return this.width; 302 } 303 304 /** 305 * sets the desired width of the module in the GUI. If '0' ist passed the GUI can set the with like it is best 306 * 307 * @param width 308 * desired width of the module 309 */ 310 public void setWidth( String width ) { 311 this.width = width; 312 } 313 314 /** 315 * returns the height of the module in the GUI. If '0' will be returned the GUI can set the with like it is best 316 * 317 * @return the height of the module in the GUI. If '0' will be returned the GUI can set the with like it is best 318 */ 319 public String getHeight() { 320 return this.height; 321 } 322 323 /** 324 * sets the desired height of the module in the GUI. If '0' ist passed the GUI can set the with like it is best 325 * 326 * @param height 327 * desired width of the module 328 */ 329 public void setHeight( String height ) { 330 this.height = height; 331 } 332 333 /** 334 * @return the bottom 335 */ 336 public int getBottom() { 337 return bottom; 338 } 339 340 /** 341 * @param bottom 342 * the bottom to set 343 */ 344 public void setBottom( int bottom ) { 345 this.bottom = bottom; 346 } 347 348 /** 349 * @return the left 350 */ 351 public int getLeft() { 352 return left; 353 } 354 355 /** 356 * @param left 357 * the left to set 358 */ 359 public void setLeft( int left ) { 360 this.left = left; 361 } 362 363 /** 364 * @return the right 365 */ 366 public int getRight() { 367 return right; 368 } 369 370 /** 371 * @param right 372 * the right to set 373 */ 374 public void setRight( int right ) { 375 this.right = right; 376 } 377 378 /** 379 * @return the top 380 */ 381 public int getTop() { 382 return top; 383 } 384 385 /** 386 * @param top 387 * the top to set 388 */ 389 public void setTop( int top ) { 390 this.top = top; 391 } 392 393 /** 394 * @return the closable 395 */ 396 public boolean isClosable() { 397 return closable; 398 } 399 400 /** 401 * @param closable 402 * the closable to set 403 */ 404 public void setClosable( boolean closable ) { 405 this.closable = closable; 406 } 407 408 /** 409 * @return the header 410 */ 411 public boolean hasHeader() { 412 return header; 413 } 414 415 /** 416 * @param header 417 * the header to set 418 */ 419 public void setHeader( boolean header ) { 420 this.header = header; 421 } 422 423 /** 424 * @return the overlay 425 */ 426 public boolean isOverlay() { 427 return overlay; 428 } 429 430 /** 431 * @param overlay 432 * the overlay to set 433 */ 434 public void setOverlay( boolean overlay ) { 435 this.overlay = overlay; 436 } 437 438 /** 439 * @return moduleJSList 440 */ 441 public String[] getModuleJSList() { 442 return moduleJSList; 443 } 444 445 /** 446 * @param list 447 */ 448 public void setModuleJSList( String[] list ) { 449 this.moduleJSList = list; 450 } 451 452 /** 453 * return true is the module should has scrollbars in the GUI<br> 454 * possible values are 455 * <UL> 456 * <li>no 457 * <li>yes 458 * <li>auto 459 * </UL> 460 * default is auto 461 * 462 * @return <code>true</code> is the module should has scrollbars in the GUI possible values are 463 */ 464 public String getScrolling() { 465 return scrolling; 466 } 467 468 /** 469 * @see #getScrolling() 470 * @param scrollable 471 */ 472 public void setScrolling( String scrollable ) { 473 this.scrolling = scrollable; 474 } 475 476 /** 477 * @param collapsed 478 * default value is false 479 */ 480 public void setCollapsed( boolean collapsed ) { 481 this.collapsed = collapsed; 482 } 483 484 /** 485 * @return collapsed 486 */ 487 public boolean isCollapsed() { 488 return collapsed; 489 } 490 }