001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (https://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: https://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: https://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.widgets;
029
030import org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants;
031import org.opencms.file.CmsObject;
032import org.opencms.file.types.CmsResourceTypePointer;
033import org.opencms.gwt.shared.CmsGwtConstants;
034import org.opencms.i18n.CmsMessages;
035import org.opencms.json.JSONException;
036import org.opencms.json.JSONObject;
037
038/**
039 * ADE link gallery widget implementations.<p>
040 */
041public class CmsLinkGalleryWidget extends A_CmsAdeGalleryWidget {
042
043    /** The gallery name. */
044    private static final String GALLERY_NAME = "link";
045
046    /**
047     * Constructor.<p>
048     */
049    public CmsLinkGalleryWidget() {
050
051        this("");
052    }
053
054    /**
055     * Creates a new gallery widget with the given configuration.<p>
056     *
057     * @param configuration the configuration to use
058     */
059    protected CmsLinkGalleryWidget(String configuration) {
060
061        super(configuration);
062    }
063
064    /**
065     * @see org.opencms.widgets.A_CmsAdeGalleryWidget#getGalleryName()
066     */
067    @Override
068    public String getGalleryName() {
069
070        return GALLERY_NAME;
071    }
072
073    /**
074     * @see org.opencms.widgets.I_CmsADEWidget#getWidgetName()
075     */
076    @Override
077    public String getWidgetName() {
078
079        return CmsGwtConstants.WIDGET_LINKGALLERY;
080
081    }
082
083    /**
084     * @see org.opencms.widgets.I_CmsWidget#newInstance()
085     */
086    public I_CmsWidget newInstance() {
087
088        return new CmsLinkGalleryWidget(getConfiguration());
089    }
090
091    /**
092     * @see org.opencms.widgets.A_CmsAdeGalleryWidget#getAdditionalGalleryInfo(org.opencms.file.CmsObject, java.lang.String, org.opencms.i18n.CmsMessages, org.opencms.widgets.I_CmsWidgetParameter)
093     */
094    @Override
095    protected JSONObject getAdditionalGalleryInfo(
096        CmsObject cms,
097        String resource,
098        CmsMessages messages,
099        I_CmsWidgetParameter param)
100    throws JSONException {
101
102        JSONObject result = new JSONObject();
103        result.put(I_CmsGalleryProviderConstants.CONFIG_TAB_CONFIG, "selectDoc");
104        return result;
105    }
106
107    /**
108     * @see org.opencms.widgets.A_CmsAdeGalleryWidget#getGalleryStoragePrefix()
109     */
110    @Override
111    protected String getGalleryStoragePrefix() {
112
113        return "link";
114    }
115
116    /**
117     * @see org.opencms.widgets.A_CmsAdeGalleryWidget#getGalleryTypes()
118     */
119    @Override
120    protected String getGalleryTypes() {
121
122        return CmsResourceTypePointer.getStaticTypeName();
123    }
124}