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.galleries.client.ui; 029 030import org.opencms.ade.galleries.client.A_CmsTabHandler; 031import org.opencms.ade.galleries.shared.CmsGallerySearchBean; 032 033import java.util.List; 034 035import com.google.gwt.user.client.ui.Composite; 036import com.google.gwt.user.client.ui.HasText; 037 038/** 039 * A tab for the gallery dialog.<p> 040 * 041 * @since 8.0.0 042 */ 043public abstract class A_CmsTab extends Composite { 044 045 /** The tab text accessor. */ 046 protected HasText m_tabTextAccessor; 047 048 /** Flag indicating that the tab is currently selected. */ 049 private boolean m_isSelected; 050 051 /** The tab id. */ 052 private String m_tabId; 053 054 /** 055 * Constructor.<p> 056 * 057 * @param tabId the tab id 058 */ 059 protected A_CmsTab(String tabId) { 060 061 m_tabId = tabId; 062 } 063 064 /** 065 * Clears the selected search parameters on this tab.<p> 066 */ 067 public void clearParams() { 068 069 getTabHandler().clearParams(); 070 } 071 072 /** 073 * Returns the search parameters to display within the result tab.<p> 074 * 075 * @param searchObj the current search object 076 * 077 * @return the parameter panel 078 */ 079 public abstract List<CmsSearchParamPanel> getParamPanels(CmsGallerySearchBean searchObj); 080 081 /** 082 * Returns the height required by this tab.<p> 083 * 084 * @return the height 085 */ 086 public abstract int getRequiredHeight(); 087 088 /** 089 * Returns the tab id.<p> 090 * 091 * @return the tab id 092 */ 093 public String getTabId() { 094 095 return m_tabId; 096 } 097 098 /** 099 * Returns if the tab is currently selected.<p> 100 * 101 * @return <code>true</code> if the tab is currently selected 102 */ 103 public boolean isSelected() { 104 105 return m_isSelected; 106 } 107 108 /** 109 * Will be triggered when a tab is deselected.<p> 110 */ 111 public void onDeselection() { 112 113 getTabHandler().onDeselection(); 114 m_isSelected = false; 115 } 116 117 /** 118 * Adjust content when outer dimensions are changed.<p> 119 */ 120 public void onResize() { 121 122 // implement if required 123 } 124 125 /** 126 * Will be triggered when a tab is selected.<p> 127 */ 128 public void onSelection() { 129 130 getTabHandler().onSelection(); 131 m_isSelected = true; 132 } 133 134 /** 135 * Removes the parameter with the given key from the tab.<p> 136 * 137 * @param paramKey the parameter key 138 */ 139 public void removeParam(String paramKey) { 140 141 getTabHandler().removeParam(paramKey); 142 } 143 144 /** 145 * Sets the tab text accessor for this tab.<p> 146 * 147 * @param tabText the tab text accessor 148 */ 149 public void setTabTextAccessor(HasText tabText) { 150 151 m_tabTextAccessor = tabText; 152 } 153 154 /** 155 * Returns the tab handler.<p> 156 * 157 * @return the tab handler 158 */ 159 protected abstract A_CmsTabHandler getTabHandler(); 160 161}