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.ade.sitemap.client.ui;
029
030import org.opencms.ade.sitemap.client.Messages;
031import org.opencms.gwt.shared.CmsListInfoBean;
032
033import com.google.gwt.user.client.rpc.AsyncCallback;
034
035/**
036 * The create new gallery folder dialog.<p>
037 */
038public class CmsCopyModelPageDialog extends A_CmsNewModelPageDialog {
039
040    /** The callbackr. */
041    private AsyncCallback<String> m_callback;
042
043    /**
044     * Constructor.<p>
045     *
046     * @param infoBean the list info bean to display in the dialog
047     * @param isModelGroup if copying as model group
048     * @param callback the callback to call with the title entered by the user
049     */
050    public CmsCopyModelPageDialog(CmsListInfoBean infoBean, boolean isModelGroup, AsyncCallback<String> callback) {
051
052        super(
053            isModelGroup
054            ? Messages.get().key(Messages.GUI_COPY_AS_MODEL_GROUP_PAGE_DIALOG_TITLE_0)
055            : Messages.get().key(Messages.GUI_COPY_MODEL_PAGE_DIALOG_TITLE_0),
056            infoBean);
057        m_callback = callback;
058    }
059
060    /**
061     * Gets the description from the description text box.<p>
062     *
063     * @return the description
064     */
065    public String getDescription() {
066
067        return m_descriptionInput.getFormValueAsString();
068    }
069
070    /**
071     * Creates the new gallery folder.<p>
072     */
073    @Override
074    protected void onOk() {
075
076        m_callback.onSuccess(m_titleInput.getFormValueAsString());
077        hide();
078    }
079
080}