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.containerpage.shared;
029
030import org.opencms.gwt.shared.CmsListInfoBean;
031import org.opencms.gwt.shared.CmsResourceListInfo;
032
033import java.util.List;
034
035import com.google.gwt.user.client.rpc.IsSerializable;
036
037/**
038 * Information about how an element is reused, to be displayed in a reuse warning dialog before editing.
039 */
040public class CmsReuseInfo implements IsSerializable {
041
042    /** The number of places where the element is used. */
043    private int m_count;
044
045    /** The element info for the container element itself. */
046    private CmsListInfoBean m_elementInfo;
047
048    /** The message to display. */
049    private String m_message;
050
051    /** The dialog title. */
052    private String m_title;
053
054    /** The resources infos for the places where the element is used. */
055    private List<CmsResourceListInfo> m_usageInfos;
056
057    /**
058     * Creates a new instance.
059     */
060    public CmsReuseInfo() {
061
062        // default constructor for serialization
063    }
064
065    /**
066     * Creates a new instance.
067     * @param elementInfo the resource info for the container element itself
068     * @param pageInfos the resource infos for the pages where the element is used
069     * @param message the message to display
070     * @param title the title for the dialog
071     * @param count the number of places where the element is used
072     */
073    public CmsReuseInfo(
074        CmsListInfoBean elementInfo,
075        List<CmsResourceListInfo> pageInfos,
076        String message,
077        String title,
078        int count) {
079
080        m_elementInfo = elementInfo;
081        m_usageInfos = pageInfos;
082        m_message = message;
083        m_title = title;
084        m_count = count;
085    }
086
087    /**
088     * Gets the number of places where the element is used.
089     *
090     * @return the number of places where the element is used
091     */
092    public int getCount() {
093
094        return m_count;
095    }
096
097    /**
098     * Gets the element info for the container element itself.
099     *
100     * @return the element info for the container element
101     */
102    public CmsListInfoBean getElementInfo() {
103
104        return m_elementInfo;
105    }
106
107    /**
108     * Gets the message to display.
109     *
110     * @return the message to display
111     */
112    public String getMessage() {
113
114        return m_message;
115    }
116
117
118    /**
119     * Gets the dialog title.
120     *
121     * @return the dialog title
122     */
123    public String getTitle() {
124
125        return m_title;
126    }
127
128    /**
129     * Gets the resource info beans for the places where the element is used.
130     *
131     * @return the resource info beans for the places where the element is used
132     */
133    public List<CmsResourceListInfo> getUsageInfos() {
134
135        return m_usageInfos;
136    }
137
138}