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.updater.dialogs;
029
030import org.opencms.setup.CmsUpdateUI;
031import org.opencms.ui.CmsVaadinUtils;
032
033import com.vaadin.ui.Label;
034import com.vaadin.ui.VerticalLayout;
035import com.vaadin.v7.data.Property.ValueChangeEvent;
036import com.vaadin.v7.data.Property.ValueChangeListener;
037import com.vaadin.v7.ui.CheckBox;
038
039/**
040 * License dialog.<p>
041 */
042public class CmsUpdateStep01LicenseDialog extends A_CmsUpdateDialog {
043
044    /**vaadin serial id. */
045    private static final long serialVersionUID = 1L;
046
047    /**vaadin component.*/
048    VerticalLayout m_licenseContainer;
049
050    /**vaadin component.*/
051    CheckBox m_accept;
052
053    /**
054     * @see org.opencms.setup.updater.dialogs.A_CmsUpdateDialog#init(org.opencms.setup.CmsUpdateUI)
055     */
056    @Override
057    public boolean init(CmsUpdateUI ui) {
058
059        CmsVaadinUtils.readAndLocalizeDesign(this, null, null);
060        super.init(ui, false, true);
061        setCaption("OpenCms Update-Wizard - License Agreement");
062
063        Label label = htmlLabel(readSnippet("license.html"));
064        label.setWidth("100%");
065
066        m_licenseContainer.addComponent(label);
067
068        m_accept.addValueChangeListener(new ValueChangeListener() {
069
070            private static final long serialVersionUID = 1L;
071
072            public void valueChange(ValueChangeEvent event) {
073
074                enableOK(m_accept.getValue().booleanValue());
075            }
076        });
077
078        enableOK(false);
079        return true;
080    }
081
082    /**
083     * @see org.opencms.setup.updater.dialogs.A_CmsUpdateDialog#getNextDialog()
084     */
085    @Override
086    A_CmsUpdateDialog getNextDialog() {
087
088        return new CmsUpdateStep02DBDialog();
089    }
090
091    /**
092     * @see org.opencms.setup.updater.dialogs.A_CmsUpdateDialog#getPreviousDialog()
093     */
094    @Override
095    A_CmsUpdateDialog getPreviousDialog() {
096
097        return null;
098    }
099
100}