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.linkvalidation;
029
030import org.opencms.file.CmsResource;
031import org.opencms.ui.CmsVaadinUtils;
032import org.opencms.ui.components.CmsBasicDialog;
033
034import java.util.List;
035
036import com.vaadin.ui.Button;
037import com.vaadin.ui.Button.ClickEvent;
038import com.vaadin.ui.Button.ClickListener;
039
040/**
041 * Dialog to show list of resources.<p>
042 */
043public class CmsResourceListDialog extends CmsBasicDialog {
044
045    /**vaadin serial id.*/
046    private static final long serialVersionUID = 4057378669920436467L;
047
048    /**The close button. */
049    private Button m_cancel;
050
051    /**
052     * Public constructor.<p>
053     *
054     * @param resources List of resources
055     */
056    public CmsResourceListDialog(List<CmsResource> resources) {
057
058        CmsVaadinUtils.readAndLocalizeDesign(this, CmsVaadinUtils.getWpMessagesForCurrentLocale(), null);
059        if (resources.size() < 50) {
060            displayResourceInfo(resources, null);
061            setContentVisibility(false);
062        }
063        m_cancel.addClickListener(new ClickListener() {
064
065            private static final long serialVersionUID = 8446069481164202478L;
066
067            public void buttonClick(ClickEvent event) {
068
069                CmsVaadinUtils.getWindow(CmsResourceListDialog.this).close();
070
071            }
072
073        });
074    }
075}