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.gwt.client.ui.history; 029 030import org.opencms.gwt.client.ui.CmsListItemWidget; 031import org.opencms.gwt.shared.CmsHistoryResourceCollection; 032import org.opencms.gwt.shared.CmsListInfoBean; 033 034import com.google.gwt.core.client.GWT; 035import com.google.gwt.uibinder.client.UiBinder; 036import com.google.gwt.uibinder.client.UiField; 037import com.google.gwt.user.client.ui.Composite; 038import com.google.gwt.user.client.ui.FlowPanel; 039import com.google.gwt.user.client.ui.Widget; 040 041/** 042 * Widget which is used as the container for the table which displays historical versions.<p> 043 */ 044public class CmsResourceHistoryView extends Composite { 045 046 /** 047 * The uiBinder interface for this class.<p> 048 */ 049 interface CmsResourceHistoryViewUiBinder extends UiBinder<Widget, CmsResourceHistoryView> { 050 // empty 051 } 052 053 /** The uiBinder instance for this widget. */ 054 private static CmsResourceHistoryViewUiBinder uiBinder = GWT.create(CmsResourceHistoryViewUiBinder.class); 055 056 /** The box containing the historical version table. */ 057 @UiField 058 protected FlowPanel m_box; 059 060 /** A box containing the file information widget. */ 061 @UiField 062 protected FlowPanel m_infoBox; 063 064 /** Widget used to show that there are no historical versions. */ 065 @UiField 066 protected Widget m_noVersions; 067 068 /** 069 * Creates a new instance.<p> 070 * 071 * @param historyResources the resource history bean 072 * 073 * @param handler the handler class used to perform the list actions 074 */ 075 public CmsResourceHistoryView(CmsHistoryResourceCollection historyResources, I_CmsHistoryActionHandler handler) { 076 077 initWidget(uiBinder.createAndBindUi(this)); 078 CmsListInfoBean contentInfo = historyResources.getContentInfo(); 079 CmsListItemWidget infoWidget = new CmsListItemWidget(contentInfo); 080 m_infoBox.add(infoWidget); 081 if (historyResources.isEmpty()) { 082 m_noVersions.setVisible(true); 083 } else { 084 m_box.add(new CmsResourceHistoryTable(historyResources, handler)); 085 } 086 } 087}