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.workplace.explorer;
029
030import java.io.Serializable;
031
032/**
033 * An icon configuration rule for an explorer type.<p>
034 *
035 * Each rule consists of a file name extension and (at most) two icon file names for icons which
036 * should be used for resources with that extension.<p>
037 *
038 * @since 8.0.0
039 */
040public class CmsIconRule implements Serializable {
041
042    /** The serial version id. */
043    private static final long serialVersionUID = 1379752428451267503L;
044
045    /** The big icon. */
046    private String m_bigIcon;
047
048    /** The big icon CSS style class. */
049    private String m_bigIconStyle;
050
051    /** The file name extension. */
052    private String m_extension;
053
054    /** The small icon. */
055    private String m_icon;
056
057    /** The small icon CSS style class. */
058    private String m_smallIconStyle;
059
060    /**
061     * Creates a new icon rule.<p>
062     *
063     * @param extension the file name extension
064     * @param icon the small icon's file name
065     * @param bigIcon the big icon's file name
066     * @param smallIconStyle the small icon CSS style class
067     * @param bigIconStyle the big icon CSS style class
068     */
069    public CmsIconRule(String extension, String icon, String bigIcon, String smallIconStyle, String bigIconStyle) {
070
071        m_icon = icon;
072        m_bigIcon = bigIcon;
073        m_extension = extension;
074        m_smallIconStyle = smallIconStyle;
075        m_bigIconStyle = bigIconStyle;
076    }
077
078    /**
079     * @see java.lang.Object#clone()
080     */
081    @Override
082    public Object clone() {
083
084        return new CmsIconRule(m_extension, m_icon, m_bigIcon, m_smallIconStyle, m_bigIconStyle);
085    }
086
087    /**
088     * Returns the big icon's file name.<p>
089     *
090     * @return the big icon's file name
091     */
092    public String getBigIcon() {
093
094        return m_bigIcon;
095    }
096
097    /**
098     * Returns the biggest icon available.<p>
099     *
100     * @return the biggest icon available
101     */
102    public String getBigIconIfAvailable() {
103
104        return m_bigIcon != null ? m_bigIcon : m_icon;
105    }
106
107    /**
108     * Returns the big icon CSS style class.<p>
109     *
110     * @return the big icon style
111     */
112    public String getBigIconStyle() {
113
114        return m_bigIconStyle;
115    }
116
117    /**
118     * Returns the file name extension for this rule.<p>
119     *
120     * @return the file name extension for this rule
121     */
122    public String getExtension() {
123
124        return m_extension;
125
126    }
127
128    /**
129     * Returns the small icon's file name.<p>
130     *
131     * @return the small icon's file name
132     */
133    public String getIcon() {
134
135        return m_icon;
136    }
137
138    /**
139     * Returns the small icon CSS style class.<p>
140     *
141     * @return the small icon style
142     */
143    public String getSmallIconStyle() {
144
145        return m_smallIconStyle;
146    }
147}