001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (C) Alkacon Software (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.acacia.shared;
029
030import com.google.gwt.user.client.rpc.IsSerializable;
031
032/**
033 * The attribute configuration. Stating the attribute label, help, widget name and widget configuration.<p>
034 */
035public class CmsAttributeConfiguration implements IsSerializable {
036
037    /** The attribute default value. */
038    private String m_defaultValue;
039
040    /** The widget display type. */
041    private String m_displayType;
042
043    /** The attribute help information. */
044    private String m_help;
045
046    /** The attribute label. */
047    private String m_label;
048
049    /** States if the attribute should be synchronized across all locales. */
050    private boolean m_localeSynchronized;
051
052    /** States if the attribute is loaded dynamically. */
053    private boolean m_dynamicallyLoaded;
054
055    /** The visibility flag. */
056    private boolean m_visible;
057
058    /** The widget configuration. */
059    private String m_widgetConfig;
060
061    /** The widget name. */
062    private String m_widgetName;
063
064    /**
065     * Constructor.<p>
066     *
067     * @param label the attribute label
068     * @param help the attribute help information
069     * @param widgetName the widget name
070     * @param widgetConfig the widget configuration
071     * @param defaultValue the attribute default value
072     * @param displayType the display type
073     * @param visible if the attribute should be visible in the editor
074     * @param localSynchronized if the attribute should be synchronized across all locales
075     * @param dynamicallyLoaded if the attribute should be loaded dynamically
076     */
077    public CmsAttributeConfiguration(
078        String label,
079        String help,
080        String widgetName,
081        String widgetConfig,
082        String defaultValue,
083        String displayType,
084        boolean visible,
085        boolean localSynchronized,
086        boolean dynamicallyLoaded) {
087
088        m_label = label;
089        m_help = help;
090        m_widgetName = widgetName;
091        m_widgetConfig = widgetConfig;
092        m_defaultValue = defaultValue;
093        m_displayType = displayType;
094        m_visible = visible;
095        m_localeSynchronized = localSynchronized;
096        m_dynamicallyLoaded = dynamicallyLoaded;
097    }
098
099    /**
100     * Constructor. Used for serialization only.<p>
101     */
102    protected CmsAttributeConfiguration() {
103
104        // nothing to do
105    }
106
107    /**
108     * Returns the default value.<p>
109     *
110     * @return the default value
111     */
112    public String getDefaultValue() {
113
114        return m_defaultValue;
115    }
116
117    /**
118     * Returns the widget display type.<p>
119     *
120     * @return the widget display type
121     */
122    public String getDisplayType() {
123
124        return m_displayType;
125    }
126
127    /**
128     * Returns the attribute help information.<p>
129     *
130     * @return the attribute help information
131     */
132    public String getHelp() {
133
134        return m_help;
135    }
136
137    /**
138     * Returns the attribute label.<p>
139     *
140     * @return the attribute label
141     */
142    public String getLabel() {
143
144        return m_label;
145    }
146
147    /**
148     * Returns the widget configuration.<p>
149     *
150     * @return the widget configuration
151     */
152    public String getWidgetConfig() {
153
154        return m_widgetConfig;
155    }
156
157    /**
158     * Returns the widget name.<p>
159     *
160     * @return the widget name
161     */
162    public String getWidgetName() {
163
164        return m_widgetName;
165    }
166
167    /**
168     * Returns the if the widget should be displayed in compact view.<p>
169     *
170     * @return <code>true</code> if the widget should be displayed in compact view
171     */
172    public boolean isDisplayColumn() {
173
174        return "column".equals(m_displayType);
175    }
176
177    /**
178     * Returns <code>true</code> if the widget should be displayed in single line view.<p>
179     *
180     * @return <code>true</code> if the widget should be displayed in single line view
181     */
182    public boolean isDisplaySingleLine() {
183
184        return "singleline".equals(m_displayType);
185    }
186
187    /**
188     * Returns <code>true</code> if the attribute is set dynamically and not from the XML content.<p>
189     *
190     * @return <code>true</code> if the attribute is set dynamically and not from the XML content
191     */
192    public boolean isDynamicallyLoaded() {
193
194        return m_dynamicallyLoaded;
195    }
196
197    /**
198     * Returns if the attribute should be synchronized across all locales.<p>
199     *
200     * @return <code>true</code> if the attribute should be synchronized across all locales
201     */
202    public boolean isLocaleSynchronized() {
203
204        return m_localeSynchronized;
205    }
206
207    /**
208     * Returns if the given attribute should be visible in the editor.<p>
209     *
210     * @return <code>true</code> if the given attribute should be visible in the editor
211     */
212    public boolean isVisible() {
213
214        return m_visible;
215    }
216
217    /**
218     * Sets the widget display type.<p>
219     *
220     * @param displayType the widget display type
221     */
222    public void setDisplayType(String displayType) {
223
224        m_displayType = displayType;
225    }
226
227}