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;
032import org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.SortParams;
033import org.opencms.gwt.shared.CmsCategoryTreeEntry;
034
035import java.util.HashMap;
036import java.util.List;
037import java.util.Map;
038import java.util.Set;
039
040import com.google.gwt.user.client.rpc.IsSerializable;
041
042/**
043 * This bean holding the gallery dialog information required for displaying the content of the gallery tabs.<p>
044 *
045 * @since 8.0.0
046 */
047public class CmsGalleryDataBean implements IsSerializable {
048
049    /** Name of the used JS variable. */
050    public static final String DICT_NAME = "cms_gallery_data_bean";
051
052    /** The category tree entry to display as tree. */
053    private List<CmsCategoryTreeEntry> m_categoryTreeEntry;
054
055    /** Additional data about the context from which the gallery dialog was started. */
056    private Map<String, String> m_contextParameters = new HashMap<String, String>();
057
058    /** The current element. */
059    private String m_currentElement;
060
061    /** The default search scope. */
062    private CmsGallerySearchScope m_defaultScope = CmsGallerySearchScope.everything;
063
064    /** The galleries to display in the list with available galleries. */
065    private List<CmsGalleryFolderBean> m_galleries;
066
067    /** The prefix for the key used to store the last selected gallery. */
068    private String m_galleryStoragePrefix;
069
070    /** The default value for the 'include expired' option. */
071    private boolean m_includeExpiredDefault;
072
073    /** The content locale. */
074    private String m_locale;
075
076    /** The available workplace locales. */
077    private Map<String, String> m_locales;
078
079    /** The gallery mode. */
080    private GalleryMode m_mode;
081
082    /**
083     * The gallery reference site-path.
084     * In widget, editor and containerpage mode this will be the edited resource, otherwise the opened gallery folder.
085     */
086    private String m_referenceSitePath;
087
088    /** The result view type. */
089    private String m_resultViewType;
090
091    /** The search scope. */
092    private CmsGallerySearchScope m_scope;
093
094    /** The site selector options for the sitemap tab. */
095    private List<CmsSiteSelectorOption> m_sitemapSiteSelectorOptions;
096
097    /** The result sort order. */
098    private SortParams m_sortOrder;
099
100    /** The start folder. */
101    private String m_startFolder;
102
103    /** The folder filter for the initial search. */
104    private Set<String> m_startFolderFilter;
105
106    /** The start gallery folder. */
107    private String m_startGallery;
108
109    /** The start up tab id. */
110    private GalleryTabId m_startTab;
111
112    /** The tab configuration. */
113    private CmsGalleryTabConfiguration m_tabConfiguration;
114
115    /** The configured tabs. */
116    private GalleryTabId[] m_tabIds;
117
118    /** A token used to determine which tree state is loaded/saved . */
119    private String m_treeToken;
120
121    /** The types to display in the list of available categories. */
122    private List<CmsResourceTypeBean> m_types;
123
124    /** Preloaded contents for the VFS tree tab. */
125    private CmsVfsEntryBean m_vfsPreloadData;
126
127    /** A list of beans representing the root folders to display in the VFS tab. */
128    private List<CmsVfsEntryBean> m_vfsRootFolders;
129
130    /** List of site selector options. */
131    private List<CmsSiteSelectorOption> m_vfsSiteSelectorOptions;
132
133    /**
134     * Default constructor.<p>
135     */
136    public CmsGalleryDataBean() {
137
138    }
139
140    /**
141     * Returns the categories.<p>
142     *
143     * @return the categories
144     */
145    public List<CmsCategoryTreeEntry> getCategories() {
146
147        return m_categoryTreeEntry;
148    }
149
150    /**
151     * Gets the context parameters.<p>
152     *
153     * These are additional parameters to store information about the context from which the gallery dialog was
154     * opened.
155     *
156     * @return the context parameters
157     */
158    public Map<String, String> getContextParameters() {
159
160        return m_contextParameters;
161    }
162
163    /**
164     * Returns the current element.<p>
165     *
166     * @return the current element
167     */
168    public String getCurrentElement() {
169
170        return m_currentElement;
171    }
172
173    /**
174     * Gets the default search scope.<p>
175     *
176     * @return the default search scope
177     */
178    public CmsGallerySearchScope getDefaultScope() {
179
180        return m_defaultScope;
181    }
182
183    /**
184     * Returns the galleries map.<p>
185     *
186     * @return the galleries
187     */
188    public List<CmsGalleryFolderBean> getGalleries() {
189
190        return m_galleries;
191
192    }
193
194    /**
195     * Gets the prefix for the key used to store the last selected gallery.<p>
196     *
197     * @return the gallery key prefix
198     */
199    public String getGalleryStoragePrefix() {
200
201        return m_galleryStoragePrefix;
202    }
203
204    /**
205     * Gets the default value for the "include expired" option.<p>
206     *
207     * @return the default value
208     */
209    public boolean getIncludeExpiredDefault() {
210
211        return m_includeExpiredDefault;
212    }
213
214    /**
215     * Returns the locale.<p>
216     *
217     * @return the locale
218     */
219    public String getLocale() {
220
221        return m_locale;
222    }
223
224    /**
225     * Returns the locales map.<p>
226     *
227     * @return the locales
228     */
229    public Map<String, String> getLocales() {
230
231        return m_locales;
232    }
233
234    /**
235     * Returns the gallery mode.<p>
236     *
237     * @return the gallery mode
238     */
239    public GalleryMode getMode() {
240
241        return m_mode;
242    }
243
244    /**
245     * Returns the gallery reference site-path.<p>
246     * In widget, editor and containerpage mode this will be the edited resource, otherwise the opened gallery folder.<p>
247     *
248     * @return the gallery reference site-path
249     */
250    public String getReferenceSitePath() {
251
252        return m_referenceSitePath;
253    }
254
255    /**
256     * Returns the result view type.<p>
257     *
258     * @return the result view type
259     */
260    public String getResultViewType() {
261
262        return m_resultViewType;
263    }
264
265    /**
266     * Returns the search scope.<p>
267     *
268     * @return the search scope
269     */
270    public CmsGallerySearchScope getScope() {
271
272        return m_scope;
273    }
274
275    /**
276     * Returns the site selector options for the sitemap.<p>
277     *
278     * @return the site selector options for the sitemap
279     */
280    public List<CmsSiteSelectorOption> getSitemapSiteSelectorOptions() {
281
282        return m_sitemapSiteSelectorOptions;
283    }
284
285    /**
286     * Gets the result sort order.<p>
287     *
288     * @return the result sort order
289     */
290    public SortParams getSortOrder() {
291
292        return m_sortOrder;
293    }
294
295    /**
296     * Returns the start folder.<p>
297     *
298     * @return the start folder
299     */
300    public String getStartFolder() {
301
302        return m_startFolder;
303    }
304
305    /**
306     * Returns the start folder filter.<p>
307     *
308     * @return the start folder filter
309     */
310    public Set<String> getStartFolderFilter() {
311
312        return m_startFolderFilter;
313    }
314
315    /**
316     * Returns the start gallery folder.<p>
317     *
318     * @return the start gallery folder
319     */
320    public String getStartGallery() {
321
322        return m_startGallery;
323    }
324
325    /**
326     * Returns the start tab.<p>
327     *
328     * @return the startTab
329     */
330    public GalleryTabId getStartTab() {
331
332        return m_startTab;
333    }
334
335    /**
336     * Gets the tab configuration.<p>
337     *
338     * @return the tab configuration
339     */
340    public CmsGalleryTabConfiguration getTabConfiguration() {
341
342        return m_tabConfiguration;
343    }
344
345    /**
346     * Returns the configured tabs.<p>
347     *
348     * @return the configured tabs
349     */
350    public GalleryTabId[] getTabIds() {
351
352        return m_tabIds;
353    }
354
355    /**
356     * Gets the tree token, which is used to  determine which tree state is loaded from the session.<p>
357     *
358     * @return the tree token
359     */
360    public String getTreeToken() {
361
362        return m_treeToken;
363    }
364
365    /**
366     * Returns the types map.<p>
367     *
368     * @return the types
369     */
370    public List<CmsResourceTypeBean> getTypes() {
371
372        return m_types;
373    }
374
375    /**
376     * Returns the vfsPreloadData.<p>
377     *
378     * @return the vfsPreloadData
379     */
380    public CmsVfsEntryBean getVfsPreloadData() {
381
382        return m_vfsPreloadData;
383    }
384
385    /**
386     * Returns the list of root folders to display in the VFS tab.<p>
387     *
388     * @return the list root folders to display in the VFS tab
389     */
390    public List<CmsVfsEntryBean> getVfsRootFolders() {
391
392        return m_vfsRootFolders;
393    }
394
395    /**
396     * Gets the list of site selector options for the VFS tab.<p>
397     *
398     * @return the list of site selector options for the VFS tab
399     */
400    public List<CmsSiteSelectorOption> getVfsSiteSelectorOptions() {
401
402        return m_vfsSiteSelectorOptions;
403    }
404
405    /**
406     * Sets the categories.<p>
407     *
408     * @param categories the categories to set
409     */
410    public void setCategories(List<CmsCategoryTreeEntry> categories) {
411
412        m_categoryTreeEntry = categories;
413    }
414
415    /**
416     * Sets the current element.<p>
417     *
418     * @param currentElement the current element to set
419     */
420    public void setCurrentElement(String currentElement) {
421
422        m_currentElement = currentElement;
423    }
424
425    /**
426     * Sets the default search scope.<p>
427     *
428     * @param scope the default search scope
429     */
430    public void setDefaultScope(CmsGallerySearchScope scope) {
431
432        m_defaultScope = scope;
433    }
434
435    /**
436     * Sets the galleries map.<p>
437     *
438     * @param galleries the galleries to set
439     */
440    public void setGalleries(List<CmsGalleryFolderBean> galleries) {
441
442        m_galleries = galleries;
443    }
444
445    /**
446     * Sets the prefix for the key used to store the last selected gallery.<p>
447     *
448     * @param prefix the prefix for the gallery key
449     */
450    public void setGalleryStoragePrefix(String prefix) {
451
452        m_galleryStoragePrefix = prefix;
453    }
454
455    /**
456     * Sets the default value for the 'include expired' option.<p>
457     *
458     * @param includeExpiredDefault the default value to set
459     */
460    public void setIncludeExpiredDefault(boolean includeExpiredDefault) {
461
462        m_includeExpiredDefault = includeExpiredDefault;
463    }
464
465    /**
466     * Sets the locale.<p>
467     *
468     * @param locale the locale to set
469     */
470    public void setLocale(String locale) {
471
472        m_locale = locale;
473    }
474
475    /**
476     * Sets the locales map.<p>
477     *
478     * @param locales the locales to set
479     */
480    public void setLocales(Map<String, String> locales) {
481
482        m_locales = locales;
483    }
484
485    /**
486     * Sets the gallery mode.<p>
487     *
488     * @param mode the gallery mode to set
489     */
490    public void setMode(GalleryMode mode) {
491
492        m_mode = mode;
493    }
494
495    /**
496     * Sets the gallery reference site-path.<p>
497     * In widget, editor and containerpage mode this will be the edited resource, otherwise the opened gallery folder.<p>
498     *
499     * @param referenceSitePath the gallery reference site-path to set
500     */
501    public void setReferenceSitePath(String referenceSitePath) {
502
503        m_referenceSitePath = referenceSitePath;
504    }
505
506    /**
507     * Sets the result view type.<p>
508     *
509     * @param resultViewType the result view type to set
510     */
511    public void setResultViewType(String resultViewType) {
512
513        m_resultViewType = resultViewType;
514    }
515
516    /**
517     * Sets the search scope.<p>
518     *
519     * @param scope the search scope
520     */
521    public void setScope(CmsGallerySearchScope scope) {
522
523        m_scope = scope;
524    }
525
526    /**
527     * Sets the site selector options for the sitemap tab.<p>
528     *
529     * @param options  the site selector options for the sitemap tab
530     */
531    public void setSitemapSiteSelectorOptions(List<CmsSiteSelectorOption> options) {
532
533        m_sitemapSiteSelectorOptions = options;
534    }
535
536    /**
537     * Sets the result sort order.<p>
538     *
539     * @param sortOrder the result sort order
540     */
541    public void setSortOrder(SortParams sortOrder) {
542
543        m_sortOrder = sortOrder;
544    }
545
546    /**
547     * Sets the start folder.<p>
548     *
549     * @param startFolder the start folder to set
550     */
551    public void setStartFolder(String startFolder) {
552
553        m_startFolder = startFolder;
554    }
555
556    /**
557     * Sets the start folder filter.<p>
558     *
559     * @param startFolderFilter the start folder filter to set
560     */
561    public void setStartFolderFilter(Set<String> startFolderFilter) {
562
563        m_startFolderFilter = startFolderFilter;
564    }
565
566    /**
567     * Sets the start gallery folder.<p>
568     *
569     * @param startGallery the start gallery folder to set
570     */
571    public void setStartGallery(String startGallery) {
572
573        m_startGallery = startGallery;
574    }
575
576    /**
577     * Sets the start tab.<p>
578     *
579     * @param startTab the start tab to set
580     */
581    public void setStartTab(GalleryTabId startTab) {
582
583        m_startTab = startTab;
584    }
585
586    /**
587     * Sets the tab configuration.<p>
588     *
589     * @param tabConfiguration the tab configuration
590     */
591    public void setTabConfiguration(CmsGalleryTabConfiguration tabConfiguration) {
592
593        m_tabConfiguration = tabConfiguration;
594
595    }
596
597    /**
598     * Sets the tab id's.<p>
599     *
600     * @param tabIds the tab id's to set
601     */
602    public void setTabIds(GalleryTabId[] tabIds) {
603
604        m_tabIds = tabIds;
605    }
606
607    /**
608     * Sets the tree token.<p>
609     *
610     * @param treeToken the new tree token
611     */
612    public void setTreeToken(String treeToken) {
613
614        m_treeToken = treeToken;
615    }
616
617    /**
618     * Sets the types map.<p>
619     *
620     * @param types the types to set
621     */
622    public void setTypes(List<CmsResourceTypeBean> types) {
623
624        m_types = types;
625    }
626
627    /**
628     * Sets the vfsPreloadData.<p>
629     *
630     * @param vfsPreloadData the vfsPreloadData to set
631     */
632    public void setVfsPreloadData(CmsVfsEntryBean vfsPreloadData) {
633
634        m_vfsPreloadData = vfsPreloadData;
635    }
636
637    /**
638     * Sets the root folders to be displayed in the VFS folder tab.<p>
639     *
640     * @param rootFolders beans representing the root folders
641     */
642    public void setVfsRootFolders(List<CmsVfsEntryBean> rootFolders) {
643
644        m_vfsRootFolders = rootFolders;
645    }
646
647    /**
648     * Sets the available site selector options.<p>
649     *
650     * @param siteSelectorOptions the available site selector options
651     */
652    public void setVfsSiteSelectorOptions(List<CmsSiteSelectorOption> siteSelectorOptions) {
653
654        m_vfsSiteSelectorOptions = siteSelectorOptions;
655    }
656}