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.ui.apps.shell; 029 030import org.opencms.report.A_CmsReportThread; 031import org.opencms.ui.CmsVaadinUtils; 032import org.opencms.ui.apps.Messages; 033import org.opencms.ui.components.CmsBasicDialog; 034import org.opencms.ui.components.CmsCopyToClipboardButton; 035import org.opencms.ui.report.CmsReportWidget; 036import org.opencms.util.CmsUUID; 037 038import com.vaadin.ui.Button; 039import com.vaadin.ui.Button.ClickEvent; 040import com.vaadin.ui.Window; 041 042/** 043 * Dialog to show shell script output.<p> 044 */ 045public class CmsShellScriptReportDialog extends CmsBasicDialog { 046 047 /**vaadin serial id. */ 048 private static final long serialVersionUID = 4838977228996268018L; 049 050 /** 051 * Public constructor.<p> 052 * 053 * @param thread Thread to be run 054 * @param window holding this dialog 055 */ 056 public CmsShellScriptReportDialog(A_CmsReportThread thread, final Window window) { 057 058 window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_SHELL_SCRIPT_APP_OUTPUT_0)); 059 window.setHeight("600px"); 060 window.center(); 061 setSizeFull(); 062 CmsReportWidget reportWidget = new CmsReportWidget(thread); 063 reportWidget.addStyleName(" o-shell-terminal"); 064 reportWidget.setHeight("100%"); 065 String id = "label" + new CmsUUID().getStringValue(); 066 reportWidget.setId(id); 067 reportWidget.setWidth("100%"); 068 reportWidget.addStyleName("o-sroll-x"); 069 setContent(reportWidget); 070 Button button = createButtonClose(); 071 addButton(button, true); 072 button.addClickListener(new Button.ClickListener() { 073 074 private static final long serialVersionUID = -5567381118325538754L; 075 076 public void buttonClick(ClickEvent event) { 077 078 window.close(); 079 } 080 }); 081 082 Button copy = new CmsCopyToClipboardButton( 083 CmsVaadinUtils.getMessageText(org.opencms.ui.components.Messages.GUI_COPY_TO_CLIPBOARD_0), 084 "#" + id); 085 086 addButton(copy, false); 087 088 } 089 090}