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.setup.ui; 029 030import org.opencms.setup.CmsSetupBean; 031import org.opencms.ui.CmsVaadinUtils; 032 033import com.vaadin.ui.Button; 034import com.vaadin.ui.CheckBox; 035import com.vaadin.ui.Label; 036import com.vaadin.ui.VerticalLayout; 037 038public class CmsSetupStep01License extends A_CmsSetupStep { 039 040 /** Forward button. */ 041 private Button m_forwardButton; 042 043 /** License container. */ 044 private VerticalLayout m_licenseContainer; 045 046 /** Main layout. */ 047 private VerticalLayout m_mainLayout; 048 049 /** 050 * Creates a new instance. 051 * 052 * @param context the setup context 053 * 054 * @throws Exception if something goes wrong 055 */ 056 public CmsSetupStep01License(I_SetupUiContext context) 057 throws Exception { 058 059 super(context); 060 CmsVaadinUtils.readAndLocalizeDesign(this, null, null); 061 CmsSetupBean setupBean = context.getSetupBean(); 062 m_forwardButton.setEnabled(false); 063 if (setupBean == null) { 064 m_mainLayout.addComponent(htmlLabel(readSnippet("notInitialized.html"))); 065 } else if (!setupBean.getWizardEnabled()) { 066 m_mainLayout.addComponent(htmlLabel(readSnippet("wizardDisabled.html"))); 067 } else { 068 Label label = htmlLabel(readSnippet("license.html")); 069 label.setWidth("100%"); 070 m_licenseContainer.addComponent(label); 071 072 CheckBox confirmation = new CheckBox(); 073 confirmation.setCaption("I accept all the terms of the preceding license agreement"); 074 m_mainLayout.addComponent(confirmation); 075 confirmation.addValueChangeListener(evt -> { 076 m_forwardButton.setEnabled(evt.getValue().booleanValue()); 077 }); 078 m_forwardButton.addClickListener(evt -> m_context.stepForward()); 079 } 080 081 } 082 083 @Override 084 protected boolean isEnableMaxHeight() { 085 086 return false; 087 } 088 089}