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.sitemap.client.hoverbar; 029 030import org.opencms.gwt.client.ui.contextmenu.A_CmsContextMenuItem; 031import org.opencms.gwt.client.ui.contextmenu.CmsContextMenuItem; 032import org.opencms.gwt.client.ui.contextmenu.I_CmsContextMenuEntry; 033 034import java.util.List; 035 036/** 037 * Common super class for all sitemap context menu entries.<p> 038 * 039 * @since 8.0.0 040 */ 041public abstract class A_CmsSitemapMenuEntry implements I_CmsContextMenuEntry { 042 043 /** The reason if the entry is de-activated. */ 044 private String m_disabledReason; 045 046 /** The hoverbar. */ 047 private CmsSitemapHoverbar m_hoverbar; 048 049 /** Flag to indicate if this menu entry is active. */ 050 private boolean m_isActive; 051 052 /** Flag to indicate if the menu entry is visible. */ 053 private boolean m_isVisible; 054 055 /** The label (text) for the menu entry. */ 056 private String m_label; 057 058 /** 059 * Constructor.<p> 060 * 061 * @param hoverbar the hoverbar 062 */ 063 public A_CmsSitemapMenuEntry(CmsSitemapHoverbar hoverbar) { 064 065 m_hoverbar = hoverbar; 066 } 067 068 /** 069 * @see org.opencms.gwt.client.ui.contextmenu.I_CmsContextMenuEntry#generateMenuItem() 070 */ 071 public A_CmsContextMenuItem generateMenuItem() { 072 073 return new CmsContextMenuItem(this); 074 } 075 076 /** 077 * @see org.opencms.gwt.client.ui.contextmenu.I_CmsContextMenuEntry#getIconClass() 078 */ 079 public String getIconClass() { 080 081 return null; 082 } 083 084 /** 085 * @see org.opencms.gwt.client.ui.contextmenu.I_CmsContextMenuEntry#getJspPath() 086 */ 087 public String getJspPath() { 088 089 return null; 090 } 091 092 /** 093 * @see org.opencms.gwt.client.ui.contextmenu.I_CmsContextMenuEntry#getLabel() 094 */ 095 public String getLabel() { 096 097 return m_label; 098 } 099 100 /** 101 * @see org.opencms.gwt.client.ui.contextmenu.I_CmsContextMenuEntry#getName() 102 */ 103 public String getName() { 104 105 return null; 106 } 107 108 /** 109 * @see org.opencms.gwt.client.ui.contextmenu.I_CmsContextMenuEntry#getReason() 110 */ 111 public String getReason() { 112 113 return m_disabledReason; 114 } 115 116 /** 117 * @see org.opencms.gwt.client.ui.contextmenu.I_CmsContextMenuEntry#getSubMenu() 118 */ 119 public List<I_CmsContextMenuEntry> getSubMenu() { 120 121 return null; 122 } 123 124 /** 125 * @see org.opencms.gwt.client.ui.contextmenu.I_CmsContextMenuEntry#hasSubMenu() 126 */ 127 public boolean hasSubMenu() { 128 129 return false; 130 } 131 132 /** 133 * @see org.opencms.gwt.client.ui.contextmenu.I_CmsContextMenuEntry#isActive() 134 */ 135 public boolean isActive() { 136 137 return m_isActive; 138 } 139 140 /** 141 * @see org.opencms.gwt.client.ui.contextmenu.I_CmsContextMenuEntry#isSeparator() 142 */ 143 public boolean isSeparator() { 144 145 return false; 146 } 147 148 /** 149 * @see org.opencms.gwt.client.ui.contextmenu.I_CmsContextMenuEntry#isVisible() 150 */ 151 public boolean isVisible() { 152 153 return m_isVisible; 154 } 155 156 /** 157 * Executed when the context-menu is opened.<p> 158 */ 159 public abstract void onShow(); 160 161 /** 162 * Sets if this menu entry is active.<p> 163 * 164 * @param active <code>true</code> to set this menu entry active 165 */ 166 public void setActive(boolean active) { 167 168 m_isActive = active; 169 } 170 171 /** 172 * Sets the reason if the entry is de-activated.<p> 173 * 174 * @param reason the reason if the entry is de-activated 175 */ 176 public void setDisabledReason(String reason) { 177 178 m_disabledReason = reason; 179 } 180 181 /** 182 * Sets the label (text) for the menu entry.<p> 183 * 184 * @param label the label (text) for the menu entry 185 */ 186 public void setLabel(String label) { 187 188 m_label = label; 189 } 190 191 /** 192 * Sets if the menu entry is visible.<p> 193 * 194 * @param visible <code>true</code> to set the entry visible 195 */ 196 public void setVisible(boolean visible) { 197 198 m_isVisible = visible; 199 } 200 201 /** 202 * De-attaches the hoverbar.<p> 203 */ 204 protected void deattachHoverbar() { 205 206 m_hoverbar.hide(); 207 } 208 209 /** 210 * Returns the hoverbar.<p> 211 * 212 * @return the hoverbar 213 */ 214 protected CmsSitemapHoverbar getHoverbar() { 215 216 return m_hoverbar; 217 } 218}