001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (https://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: https://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: https://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.cacheadmin; 029 030import org.opencms.ui.CmsVaadinUtils; 031import org.opencms.ui.FontOpenCms; 032import org.opencms.ui.apps.cacheadmin.CmsFlushCache.I_CloseableDialog; 033import org.opencms.ui.components.CmsBasicDialog; 034 035import com.vaadin.ui.Button; 036import com.vaadin.ui.Button.ClickEvent; 037import com.vaadin.ui.Button.ClickListener; 038import com.vaadin.v7.shared.ui.label.ContentMode; 039import com.vaadin.v7.ui.Label; 040 041/** 042 * Dialog to confirm flush without any options.<p> 043 */ 044public class CmsConfirmSimpleFlushDialog extends CmsBasicDialog implements I_CloseableDialog { 045 046 /**Vaadin serial id.*/ 047 private static final long serialVersionUID = 6454462284178282427L; 048 049 /**Runnable for close action.*/ 050 Runnable m_closeRunnable; 051 052 /**Runnable for ok action. */ 053 Runnable m_okRunnable; 054 055 /**Vaadin button.*/ 056 private Button m_cancelButton; 057 058 /**Vaadin label.*/ 059 private Label m_icon; 060 061 /**Vaadin label.*/ 062 private Label m_label; 063 064 /**Vaadin button.*/ 065 private Button m_okButton; 066 067 /** 068 * Public constructor.<p> 069 * 070 * @param message to be shown 071 */ 072 public CmsConfirmSimpleFlushDialog(String message) { 073 074 CmsVaadinUtils.readAndLocalizeDesign(this, CmsVaadinUtils.getWpMessagesForCurrentLocale(), null); 075 076 m_label.setValue(message); 077 078 m_icon.setContentMode(ContentMode.HTML); 079 m_icon.setValue(FontOpenCms.WARNING.getHtml()); 080 081 m_okButton.addClickListener(new ClickListener() { 082 083 private static final long serialVersionUID = 1336535963768785962L; 084 085 public void buttonClick(ClickEvent event) { 086 087 m_closeRunnable.run(); 088 if (m_okRunnable != null) { 089 m_okRunnable.run(); 090 } 091 } 092 }); 093 094 m_cancelButton.addClickListener(new ClickListener() { 095 096 private static final long serialVersionUID = 3918008642649054392L; 097 098 public void buttonClick(ClickEvent event) { 099 100 m_closeRunnable.run(); 101 } 102 }); 103 } 104 105 /** 106 * @see org.opencms.ui.apps.cacheadmin.CmsFlushCache.I_CloseableDialog#setCloseRunnable(java.lang.Runnable) 107 */ 108 public void setCloseRunnable(Runnable closeRunnable) { 109 110 m_closeRunnable = closeRunnable; 111 112 } 113 114 /** 115 * @see org.opencms.ui.apps.cacheadmin.CmsFlushCache.I_CloseableDialog#setOkRunnable(java.lang.Runnable) 116 */ 117 public void setOkRunnable(Runnable okRunnable) { 118 119 m_okRunnable = okRunnable; 120 121 } 122}