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.containerpage.client.ui; 029 030import org.opencms.gwt.client.dnd.I_CmsDragHandle; 031import org.opencms.gwt.client.dnd.I_CmsDraggable; 032import org.opencms.gwt.client.ui.CmsPushButton; 033import org.opencms.gwt.client.ui.I_CmsButton.ButtonStyle; 034 035/** 036 * An optional container element button.<p> 037 * 038 * @since 8.0.0 039 */ 040public class CmsElementOptionButton extends CmsPushButton implements I_CmsDragHandle { 041 042 /** The associated container element. */ 043 private CmsContainerPageElementPanel m_dragElement; 044 045 /** The associated tool-bar button. */ 046 private A_CmsToolbarOptionButton m_toolbarButton; 047 048 /** 049 * Constructor.<p> 050 * 051 * @param toolbarButton the tool-bar button associated with this button, providing all necessary information 052 * @param element the element to create this button for 053 */ 054 public CmsElementOptionButton(A_CmsToolbarOptionButton toolbarButton, CmsContainerPageElementPanel element) { 055 056 super(); 057 setImageClass(toolbarButton.getButtonData().getSmallIconClass()); 058 setButtonStyle(ButtonStyle.FONT_ICON, null); 059 setTitle(toolbarButton.getTitle()); 060 m_toolbarButton = toolbarButton; 061 m_dragElement = element; 062 } 063 064 /** 065 * Returns the dragElement.<p> 066 * 067 * @return the dragElement 068 */ 069 public CmsContainerPageElementPanel getContainerElement() { 070 071 return m_dragElement; 072 } 073 074 /** 075 * @see org.opencms.gwt.client.dnd.I_CmsDragHandle#getDraggable() 076 */ 077 public I_CmsDraggable getDraggable() { 078 079 return m_dragElement; 080 } 081 082 /** 083 * Returns the associated tool-bar button.<p> 084 * 085 * @return the associated tool-bar button 086 */ 087 public A_CmsToolbarOptionButton getToolbarButton() { 088 089 return m_toolbarButton; 090 } 091 092}