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.ui.apps.dbmanager;
029
030import org.opencms.ade.galleries.shared.CmsResourceTypeBean;
031import org.opencms.file.CmsResource;
032import org.opencms.ui.I_CmsDialogContext;
033import org.opencms.ui.dialogs.A_CmsSelectResourceTypeDialog;
034
035import com.vaadin.annotations.DesignRoot;
036import com.vaadin.ui.Button;
037import com.vaadin.v7.ui.ComboBox;
038import com.vaadin.v7.ui.VerticalLayout;
039
040/**
041 * Class for the resource type select dialog.<p>
042 */
043@DesignRoot
044public class CmsSelectResourceTypeDialog extends A_CmsSelectResourceTypeDialog {
045
046    /**vaadin serial id.*/
047    private static final long serialVersionUID = -6944584336945436950L;
048
049    /** The cancel button. */
050    protected Button m_cancelButton;
051
052    /** Container for the type list. */
053    protected VerticalLayout m_typeContainer;
054
055    /** Element view selector. */
056    protected ComboBox m_viewSelector;
057
058    /**
059     * public constructor.<p>
060     *
061     * @param folderResource resource
062     * @param context dialog context
063     */
064    public CmsSelectResourceTypeDialog(CmsResource folderResource, I_CmsDialogContext context) {
065        super(folderResource, context);
066    }
067
068    /**
069     * @see org.opencms.ui.dialogs.A_CmsSelectResourceTypeDialog#getCancelButton()
070     */
071    @Override
072    public Button getCancelButton() {
073
074        return m_cancelButton;
075    }
076
077    /**
078     * Returns selected resource type.<p>
079     *
080     * @return resource type name
081     */
082    public String getSelectedResource() {
083
084        return m_selectedType == null ? "" : m_selectedType.getType();
085    }
086
087    /**
088     * @see org.opencms.ui.dialogs.A_CmsSelectResourceTypeDialog#getVerticalLayout()
089     */
090    @Override
091    public VerticalLayout getVerticalLayout() {
092
093        return m_typeContainer;
094    }
095
096    /**
097     * @see org.opencms.ui.dialogs.A_CmsSelectResourceTypeDialog#getViewSelector()
098     */
099    @Override
100    public ComboBox getViewSelector() {
101
102        return m_viewSelector;
103    }
104
105    /**
106     * @see org.opencms.ui.dialogs.A_CmsSelectResourceTypeDialog#handleSelection(org.opencms.ade.galleries.shared.CmsResourceTypeBean)
107     */
108    @Override
109    public void handleSelection(CmsResourceTypeBean selectedType) {
110
111        m_selectedType = selectedType;
112        finish(null);
113    }
114
115    /**
116     * @see org.opencms.ui.dialogs.A_CmsSelectResourceTypeDialog#useDefault()
117     */
118    @Override
119    public boolean useDefault() {
120
121        return false;
122    }
123}