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.preview.ui; 029 030import org.opencms.ade.galleries.client.preview.I_CmsPreviewHandler; 031import org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryMode; 032 033import com.google.gwt.core.client.GWT; 034import com.google.gwt.uibinder.client.UiBinder; 035import com.google.gwt.user.client.ui.Composite; 036import com.google.gwt.user.client.ui.FlowPanel; 037 038/** 039 * Basic preview detail tab layout.<p> 040 * 041 * @since 8.0. 042 */ 043public abstract class A_CmsPreviewDetailTab extends Composite { 044 045 /** 046 * @see com.google.gwt.uibinder.client.UiBinder 047 */ 048 protected interface I_CmsPreviewDetailTabUiBinder extends UiBinder<FlowPanel, A_CmsPreviewDetailTab> { 049 // gwt interface, nothing to do 050 } 051 052 /** The ui-binder instance for this class. */ 053 private static I_CmsPreviewDetailTabUiBinder uiBinder = GWT.create(I_CmsPreviewDetailTabUiBinder.class); 054 055 /** The main panel. */ 056 protected FlowPanel m_main; 057 058 /** The tab height. */ 059 protected int m_tabHeight; 060 061 /** The tab width. */ 062 protected int m_tabWidth; 063 064 /** Flag indicating if tab content has been changed and will need saving. */ 065 private boolean m_changed; 066 067 /** The mode of the gallery. */ 068 private GalleryMode m_dialogMode; 069 070 /** 071 * Constructor.<p> 072 * 073 * @param dialogMode the gallery mode 074 * @param height the tab height 075 * @param width the tab width 076 */ 077 public A_CmsPreviewDetailTab(GalleryMode dialogMode, int height, int width) { 078 079 m_main = uiBinder.createAndBindUi(this); 080 initWidget(m_main); 081 082 m_dialogMode = dialogMode; 083 m_tabHeight = height; 084 m_tabWidth = width; 085 } 086 087 /** 088 * Returns if the given tab has changes that need saving.<p> 089 * 090 * @return <code>true</code> if the given tab has changes that need saving 091 */ 092 public boolean isChanged() { 093 094 return m_changed; 095 } 096 097 /** 098 * Returns the gallery mode.<p> 099 * 100 * @return the gallery mode 101 */ 102 protected GalleryMode getDialogMode() { 103 104 return m_dialogMode; 105 } 106 107 /** 108 * Returns the preview handler.<p> 109 * 110 * @return the preview handler 111 */ 112 protected abstract I_CmsPreviewHandler<?> getHandler(); 113 114 /** 115 * Sets the changed state of the tab.<p> 116 * 117 * @param changed the changed state 118 */ 119 protected void setChanged(boolean changed) { 120 121 m_changed = changed; 122 } 123 124}