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 protected Button m_modeToggle = new Button(); 059 060 /** 061 * public constructor.<p> 062 * 063 * @param folderResource resource 064 * @param context dialog context 065 */ 066 public CmsSelectResourceTypeDialog(CmsResource folderResource, I_CmsDialogContext context) { 067 068 super(folderResource, context); 069 } 070 071 /** 072 * @see org.opencms.ui.dialogs.A_CmsSelectResourceTypeDialog#getCancelButton() 073 */ 074 @Override 075 public Button getCancelButton() { 076 077 return m_cancelButton; 078 } 079 080 @Override 081 public Button getModeToggle() { 082 083 return m_modeToggle; 084 } 085 086 /** 087 * Returns selected resource type.<p> 088 * 089 * @return resource type name 090 */ 091 public String getSelectedResource() { 092 093 return m_selectedType == null ? "" : m_selectedType.getType(); 094 } 095 096 /** 097 * @see org.opencms.ui.dialogs.A_CmsSelectResourceTypeDialog#getVerticalLayout() 098 */ 099 @Override 100 public VerticalLayout getVerticalLayout() { 101 102 return m_typeContainer; 103 } 104 105 /** 106 * @see org.opencms.ui.dialogs.A_CmsSelectResourceTypeDialog#getViewSelector() 107 */ 108 @Override 109 public ComboBox getViewSelector() { 110 111 return m_viewSelector; 112 } 113 114 /** 115 * @see org.opencms.ui.dialogs.A_CmsSelectResourceTypeDialog#handleSelection(org.opencms.ade.galleries.shared.CmsResourceTypeBean) 116 */ 117 @Override 118 public void handleSelection(CmsResourceTypeBean selectedType) { 119 120 m_selectedType = selectedType; 121 finish(null); 122 } 123 124 /** 125 * @see org.opencms.ui.dialogs.A_CmsSelectResourceTypeDialog#useDefault() 126 */ 127 @Override 128 public boolean useDefault() { 129 130 return false; 131 } 132}