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.shared.CmsNewResourceInfo;
031import org.opencms.gwt.client.ui.CmsListItem;
032import org.opencms.gwt.client.ui.CmsListItemWidget;
033import org.opencms.util.CmsUUID;
034
035/**
036 * A list item widget class which also contains a resource type info bean, for use in creating new sitemap entries.<p>
037 *
038 * @since 8.0.0
039 */
040public class CmsCreatableListItem extends CmsListItem {
041
042    /** The types of creatable sitemap entries. */
043    public enum NewEntryType {
044        /** A detail page. */
045        detailpage,
046        /** A redirect entry. */
047        redirect,
048        /** A regular entry. */
049        regular
050    }
051
052    /** The sitemap entry type to create. */
053    private NewEntryType m_newEntryType;
054
055    /** The resource type info bean. */
056    private CmsNewResourceInfo m_typeInfo;
057
058    /**
059     * Creates a new list item with a given resource type info bean.<p>
060     *
061     * @param content the content for the list item widget
062     * @param typeInfo the resource type info bean
063     * @param newEntryType the type of the creatable sitemap entry type
064     */
065    public CmsCreatableListItem(CmsListItemWidget content, CmsNewResourceInfo typeInfo, NewEntryType newEntryType) {
066
067        super(content);
068        m_typeInfo = typeInfo;
069        m_newEntryType = newEntryType;
070    }
071
072    /**
073     * Returns the copy resource structure id.<p>
074     *
075     * @return the copy resource structure id
076     */
077    public CmsUUID getCopyResourceId() {
078
079        return m_typeInfo.getCopyResourceId();
080    }
081
082    /**
083     * Returns the new sitemap entry type.<p>
084     *
085     * @return the new sitemap entry type
086     */
087    public NewEntryType getNewEntryType() {
088
089        return m_newEntryType;
090    }
091
092    /**
093     * Returns the resource type information bean.<p>
094     *
095     * @return the resource type info bean
096     */
097    public CmsNewResourceInfo getResourceTypeInfo() {
098
099        return m_typeInfo;
100    }
101
102    /**
103     * Returns the resource type id.<p>
104     *
105     * @return the resource type id
106     */
107    public int getTypeId() {
108
109        return m_typeInfo.getId();
110    }
111
112    /**
113     * Returns the resource type name.<p>
114     *
115     * @return the resource type name
116     */
117    public String getTypeName() {
118
119        return m_typeInfo.getResourceType();
120    }
121}