001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.ade.galleries.shared; 029 030import org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryMode; 031import org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryTabId; 032 033import java.util.List; 034 035import com.google.gwt.user.client.rpc.IsSerializable; 036 037/** 038 * The gallery configuration.<p> 039 */ 040public class CmsGalleryConfiguration implements I_CmsGalleryConfiguration, IsSerializable { 041 042 /** The current element. */ 043 private String m_currentElement; 044 045 /** Flag to enable selection of galleries in the gallery tab. */ 046 private boolean m_galleriesSelectable; 047 048 /** The gallery mode. */ 049 private GalleryMode m_galleryMode; 050 051 /** The gallery path. */ 052 private String m_galleryPath; 053 054 /** The prefix for the key used to store the last selected gallery. */ 055 private String m_galleryStoragePrefix; 056 057 /** The gallery type name. */ 058 private String m_galleryTypeName; 059 060 /** The gallery types. */ 061 private String[] m_galleryTypes; 062 063 /** The image format names. */ 064 private String m_imageFormatNames; 065 066 /** The image formats. */ 067 private String m_imageFormats; 068 069 /** The content locale. */ 070 private String m_locale; 071 072 /** The reference path. */ 073 private String m_referencePath; 074 075 /** The resource types. */ 076 private List<String> m_resourceTypes; 077 078 /** Flag which disables selection of results when set to false. */ 079 private boolean m_resultsSelectable; 080 081 /** The search types. */ 082 private List<String> m_searchTypes; 083 084 /** The show site selector flag. */ 085 private boolean m_showSiteSelector; 086 087 /** The start folder. */ 088 private String m_startFolder; 089 090 /** The start site. */ 091 private String m_startSite; 092 093 /** The tab configuration. */ 094 private CmsGalleryTabConfiguration m_tabConfiguration; 095 096 /** The tree token. */ 097 private String m_treeToken; 098 099 /** The upload folder. */ 100 private String m_uploadFolder; 101 102 /** The use formats flag. */ 103 private boolean m_useFormats; 104 105 /** 106 * Constructor.<p> 107 */ 108 public CmsGalleryConfiguration() { 109 110 // set defaults 111 m_showSiteSelector = true; 112 } 113 114 /** 115 * Constructor.<p> 116 * 117 * @param configuration the initial configuration 118 */ 119 public CmsGalleryConfiguration(I_CmsGalleryConfiguration configuration) { 120 121 m_currentElement = configuration.getCurrentElement(); 122 m_galleryMode = configuration.getGalleryMode(); 123 m_galleryPath = configuration.getGalleryPath(); 124 m_galleryTypes = configuration.getGalleryTypes(); 125 m_imageFormatNames = configuration.getImageFormatNames(); 126 m_imageFormats = configuration.getImageFormats(); 127 m_locale = configuration.getLocale(); 128 m_referencePath = configuration.getReferencePath(); 129 m_resourceTypes = configuration.getResourceTypes(); 130 m_searchTypes = configuration.getSearchTypes(); 131 m_showSiteSelector = configuration.isShowSiteSelector(); 132 m_startFolder = configuration.getStartFolder(); 133 m_startSite = configuration.getStartSite(); 134 m_tabConfiguration = configuration.getTabConfiguration(); 135 m_useFormats = configuration.isUseFormats(); 136 m_treeToken = configuration.getTreeToken(); 137 m_galleryStoragePrefix = configuration.getGalleryStoragePrefix(); 138 m_galleriesSelectable = configuration.isGalleriesSelectable(); 139 m_resultsSelectable = configuration.isResultsSelectable(); 140 } 141 142 /** 143 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#getCurrentElement() 144 */ 145 public String getCurrentElement() { 146 147 return m_currentElement; 148 } 149 150 /** 151 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#getGalleryMode() 152 */ 153 public GalleryMode getGalleryMode() { 154 155 if (m_galleryMode == null) { 156 return GalleryMode.widget; 157 } 158 return m_galleryMode; 159 } 160 161 /** 162 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#getGalleryPath() 163 */ 164 public String getGalleryPath() { 165 166 return m_galleryPath; 167 } 168 169 /** 170 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#getGalleryStoragePrefix() 171 */ 172 public String getGalleryStoragePrefix() { 173 174 return m_galleryStoragePrefix; 175 } 176 177 /** 178 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#getGalleryTypeName() 179 */ 180 public String getGalleryTypeName() { 181 182 return m_galleryTypeName; 183 } 184 185 /** 186 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#getGalleryTypes() 187 */ 188 public String[] getGalleryTypes() { 189 190 return m_galleryTypes; 191 } 192 193 /** 194 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#getImageFormatNames() 195 */ 196 public String getImageFormatNames() { 197 198 return m_imageFormatNames; 199 } 200 201 /** 202 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#getImageFormats() 203 */ 204 public String getImageFormats() { 205 206 return m_imageFormats; 207 } 208 209 /** 210 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#getLocale() 211 */ 212 public String getLocale() { 213 214 return m_locale; 215 } 216 217 /** 218 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#getReferencePath() 219 */ 220 public String getReferencePath() { 221 222 return m_referencePath; 223 } 224 225 /** 226 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#getResourceTypes() 227 */ 228 public List<String> getResourceTypes() { 229 230 return m_resourceTypes; 231 } 232 233 /** 234 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#getSearchTypes() 235 */ 236 public List<String> getSearchTypes() { 237 238 return m_searchTypes; 239 } 240 241 /** 242 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#getStartFolder() 243 */ 244 public String getStartFolder() { 245 246 return m_startFolder; 247 } 248 249 /** 250 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#getStartSite() 251 */ 252 public String getStartSite() { 253 254 return m_startSite; 255 } 256 257 /** 258 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#getTabConfiguration() 259 */ 260 public CmsGalleryTabConfiguration getTabConfiguration() { 261 262 return m_tabConfiguration; 263 } 264 265 /** 266 * Gets the array of tab ids.<p> 267 * 268 * @return the tab ids 269 */ 270 public GalleryTabId[] getTabIds() { 271 272 if (m_tabConfiguration == null) { 273 return null; 274 } 275 return m_tabConfiguration.getTabs().toArray(new GalleryTabId[] {}); 276 } 277 278 /** 279 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#getTreeToken() 280 */ 281 public String getTreeToken() { 282 283 return m_treeToken; 284 } 285 286 /** 287 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#getUploadFolder() 288 */ 289 public String getUploadFolder() { 290 291 return m_uploadFolder; 292 } 293 294 /** 295 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#isGalleriesSelectable() 296 */ 297 public boolean isGalleriesSelectable() { 298 299 return m_galleriesSelectable; 300 } 301 302 /** 303 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#isIncludeFiles() 304 */ 305 public boolean isIncludeFiles() { 306 307 return getTabConfiguration().getTabs().contains(GalleryTabId.cms_tab_results); 308 } 309 310 /** 311 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#isResultsSelectable() 312 */ 313 public boolean isResultsSelectable() { 314 315 return m_resultsSelectable; 316 } 317 318 /** 319 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#isShowSiteSelector() 320 */ 321 public boolean isShowSiteSelector() { 322 323 return m_showSiteSelector; 324 } 325 326 /** 327 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#isUseFormats() 328 */ 329 public boolean isUseFormats() { 330 331 return m_useFormats; 332 } 333 334 /** 335 * @see org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration#setCurrentElement(java.lang.String) 336 */ 337 public void setCurrentElement(String currentElement) { 338 339 m_currentElement = currentElement; 340 } 341 342 /** 343 * Enables or disables selection of galleries in the gallery tab.<p> 344 * 345 * @param galleriesSelectable true if the galleries should be made selectable 346 */ 347 public void setGalleriesSelectable(boolean galleriesSelectable) { 348 349 m_galleriesSelectable = galleriesSelectable; 350 } 351 352 /** 353 * Sets the galleryMode.<p> 354 * 355 * @param galleryMode the galleryMode to set 356 */ 357 public void setGalleryMode(GalleryMode galleryMode) { 358 359 m_galleryMode = galleryMode; 360 } 361 362 /** 363 * Sets the galleryPath.<p> 364 * 365 * @param galleryPath the galleryPath to set 366 */ 367 public void setGalleryPath(String galleryPath) { 368 369 m_galleryPath = galleryPath; 370 } 371 372 /** 373 * Sets the prefix for the key used to store the last selected gallery.<p> 374 * 375 * @param prefix the new prefix 376 */ 377 public void setGalleryStoragePrefix(String prefix) { 378 379 m_galleryStoragePrefix = prefix; 380 } 381 382 /** 383 * Sets the gallery type name.<p> 384 * 385 * @param galleryTypeName the gallery type name 386 */ 387 public void setGalleryTypeName(String galleryTypeName) { 388 389 m_galleryTypeName = galleryTypeName; 390 } 391 392 /** 393 * Sets the galleryTypes.<p> 394 * 395 * @param galleryTypes the galleryTypes to set 396 */ 397 public void setGalleryTypes(String... galleryTypes) { 398 399 m_galleryTypes = galleryTypes; 400 } 401 402 /** 403 * Sets the image format names.<p> 404 * 405 * @param imageFormatNames the imageFormatNames to set 406 */ 407 public void setImageFormatNames(String imageFormatNames) { 408 409 m_imageFormatNames = imageFormatNames; 410 } 411 412 /** 413 * Sets the image formats.<p> 414 * 415 * @param imageFormats the image formats to set 416 */ 417 public void setImageFormats(String imageFormats) { 418 419 m_imageFormats = imageFormats; 420 } 421 422 /** 423 * Sets the locale.<p> 424 * 425 * @param locale the locale to set 426 */ 427 public void setLocale(String locale) { 428 429 m_locale = locale; 430 } 431 432 /** 433 * Sets the referencePath.<p> 434 * 435 * @param referencePath the referencePath to set 436 */ 437 public void setReferencePath(String referencePath) { 438 439 m_referencePath = referencePath; 440 } 441 442 /** 443 * Sets the resourceTypes.<p> 444 * 445 * @param resourceTypes the resourceTypes to set 446 */ 447 public void setResourceTypes(List<String> resourceTypes) { 448 449 m_resourceTypes = resourceTypes; 450 } 451 452 /** 453 * Disables selection of results if the given parameter is 'false'.<p> 454 * 455 * @param resultsSelectable false if result selection should be disabled 456 */ 457 public void setResultsSelectable(boolean resultsSelectable) { 458 459 m_resultsSelectable = resultsSelectable; 460 461 } 462 463 /** 464 * Sets the searchTypes.<p> 465 * 466 * @param searchTypes the searchTypes to set 467 */ 468 public void setSearchTypes(List<String> searchTypes) { 469 470 m_searchTypes = searchTypes; 471 } 472 473 /** 474 * Sets the showSiteSelector.<p> 475 * 476 * @param showSiteSelector the showSiteSelector to set 477 */ 478 public void setShowSiteSelector(boolean showSiteSelector) { 479 480 m_showSiteSelector = showSiteSelector; 481 } 482 483 /** 484 * Sets the start folder.<p> 485 * 486 * @param startFolder the start folder 487 */ 488 public void setStartFolder(String startFolder) { 489 490 m_startFolder = startFolder; 491 } 492 493 /** 494 * Sets the startSite.<p> 495 * 496 * @param startSite the startSite to set 497 */ 498 public void setStartSite(String startSite) { 499 500 m_startSite = startSite; 501 } 502 503 /** 504 * Sets the tab configuration.<p> 505 * 506 * @param tabConfig the gallery tab configuration 507 */ 508 public void setTabConfiguration(CmsGalleryTabConfiguration tabConfig) { 509 510 m_tabConfiguration = tabConfig; 511 } 512 513 /** 514 * Sets the upload folder.<p> 515 * 516 * @param uploadFolder the upload folder 517 */ 518 public void setUploadFolder(String uploadFolder) { 519 520 m_uploadFolder = uploadFolder; 521 } 522 523 /** 524 * Sets the use formats flag.<p> 525 * 526 * @param useFormats the use formats flag to set 527 */ 528 public void setUseFormats(boolean useFormats) { 529 530 m_useFormats = useFormats; 531 } 532}