001/*
002 * (C) Copyright 2014 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Anahide Tchertchian
018 */
019package org.nuxeo.ecm.platform.forms.layout.api;
020
021import java.io.Serializable;
022import java.util.List;
023import java.util.Map;
024
025/**
026 * @since 6.0
027 */
028public interface LayoutTypeConfiguration extends Serializable {
029
030    /**
031     * Returns the version name since the widget type has been available (5.4, 5.4.2, etc...)
032     */
033    String getSinceVersion();
034
035    /**
036     * Returns the version name since the widget type has been deprecated (5.4, 5.4.2, etc...)
037     */
038    String getDeprecatedVersion();
039
040    String getTitle();
041
042    String getDescription();
043
044    /**
045     * Returns the identifier to be used for the demo, or null if no demo is available.
046     */
047    String getDemoId();
048
049    /**
050     * Returns true is the preview is enabled on the demo.
051     */
052    boolean isDemoPreviewEnabled();
053
054    List<String> getCategories();
055
056    List<String> getSupportedModes();
057
058    /**
059     * Returns true if widget knows how to display its label (some widget types might delegate this to their containing
060     * widget or layout, usually when defining form layouts).
061     */
062    boolean isHandlingLabels();
063
064    /**
065     * Returns true if widget will be containing forms.
066     * <p>
067     * Since forms cannot contains any sub forms, layouts using this widget should not be surrounded by any form. Other
068     * widgets in the same layouts not containing forms may then need a surrounding form that could be added by the
069     * layout template.
070     */
071    boolean isContainingForm();
072
073    List<LayoutDefinition> getPropertyLayouts(String mode, String additionalMode);
074
075    Map<String, List<LayoutDefinition>> getPropertyLayouts();
076
077    /**
078     * Returns the default values for the layout type properties, by mode.
079     */
080    Map<String, Map<String, Serializable>> getDefaultPropertyValues();
081
082    /**
083     * Returns the default values for the layout type properties, for given mode.
084     */
085    Map<String, Serializable> getDefaultPropertyValues(String mode);
086
087    /**
088     * Returns the list of supported controls, e.g. controls that are checked on sub-widgets definitions.
089     */
090    List<String> getSupportedControls();
091
092}