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