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.xml.templatemapper; 029 030import org.opencms.report.A_CmsReportThread; 031import org.opencms.ui.CmsVaadinUtils; 032import org.opencms.ui.I_CmsDialogContext; 033import org.opencms.ui.Messages; 034import org.opencms.ui.components.CmsBasicDialog; 035import org.opencms.ui.report.CmsReportWidget; 036 037import com.vaadin.ui.Button; 038import com.vaadin.v7.ui.VerticalLayout; 039 040/** 041 * Dialog for running the template mapper report thread.<p> 042 */ 043public class CmsTemplateMapperDialog extends CmsBasicDialog { 044 045 /** Serial version id. */ 046 private static final long serialVersionUID = 1L; 047 048 /** The start button. */ 049 private Button m_okButton; 050 051 /** The report thread. */ 052 private A_CmsReportThread m_report; 053 054 /** 055 * Creates a new instance.<p> 056 * 057 * @param context the dialog context 058 */ 059 public CmsTemplateMapperDialog(I_CmsDialogContext context) { 060 061 CmsVaadinUtils.readAndLocalizeDesign(this, CmsVaadinUtils.getWpMessagesForCurrentLocale(), null); 062 displayResourceInfo(context.getResources()); 063 m_okButton.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_TEMPLATEMAPPER_START_0)); 064 VerticalLayout content = new VerticalLayout(); 065 content.setWidth("100%"); 066 content.setHeight("500px"); 067 setContent(content); 068 m_okButton.addClickListener(event -> { 069 CmsReportWidget reportWidget = new CmsReportWidget(m_report); 070 reportWidget.setWidth("100%"); 071 reportWidget.setHeight("100%"); 072 content.addComponent(reportWidget); 073 m_okButton.setEnabled(false); 074 m_report.start(); 075 076 }); 077 } 078 079 /** 080 * Sets the report thread.<p> 081 * 082 * @param report the report thread 083 */ 084 public void setReportThread(A_CmsReportThread report) { 085 086 m_report = report; 087 088 } 089 090}