001/* 002 * (C) Copyright 2010 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Anahide Tchertchian 016 */ 017package org.nuxeo.ecm.platform.forms.layout.api; 018 019import java.io.Serializable; 020import java.util.List; 021import java.util.Map; 022 023/** 024 * Widget configuration interface 025 * 026 * @author Anahide Tchertchian 027 * @since 5.4 028 */ 029public interface WidgetTypeConfiguration extends Serializable { 030 031 /** 032 * Returns the version name since the widget type has been available (5.4, 5.4.2, etc...) 033 */ 034 String getSinceVersion(); 035 036 /** 037 * Returns the version name since the widget type has been deprecated (5.4, 5.4.2, etc...) 038 * 039 * @since 5.6 040 */ 041 String getDeprecatedVersion(); 042 043 String getTitle(); 044 045 String getDescription(); 046 047 /** 048 * Returns the identifier to be used for the demo, or null if no demo is available. 049 * 050 * @since 5.4.2 051 */ 052 String getDemoId(); 053 054 /** 055 * Returns true is the preview is enabled on the demo. 056 * 057 * @since 5.4.2 058 */ 059 boolean isDemoPreviewEnabled(); 060 061 List<String> getCategories(); 062 063 List<String> getSupportedModes(); 064 065 boolean isAcceptingSubWidgets(); 066 067 /** 068 * Returns true if widget knows how to display its label (some widget types might delegate this to their containing 069 * widget or layout, usually when defining form layouts). 070 * 071 * @since 5.6 072 */ 073 boolean isHandlingLabels(); 074 075 boolean isList(); 076 077 boolean isComplex(); 078 079 /** 080 * Returns true if widget will be containing forms. 081 * <p> 082 * Since forms cannot contains any sub forms, layouts using this widget should not be surrounded by any form. Other 083 * widgets in the same layouts not containing forms may then need a surrounding form that could be added by the 084 * layout template. 085 * 086 * @since 5.6 087 */ 088 boolean isContainingForm(); 089 090 List<String> getSupportedFieldTypes(); 091 092 List<String> getDefaultFieldTypes(); 093 094 List<FieldDefinition> getDefaultFieldDefinitions(); 095 096 /** 097 * Returns configuration properties. 098 * 099 * @since 5.4.2 100 */ 101 Map<String, Serializable> getConfProperties(); 102 103 Serializable getConfProperty(String propName); 104 105 List<LayoutDefinition> getPropertyLayouts(String mode, String additionalMode); 106 107 Map<String, List<LayoutDefinition>> getPropertyLayouts(); 108 109 /** 110 * Returns the list of layouts for given mode and additional modes. 111 * <p> 112 * These layouts are used to document accepted fields on the widget type, depending on the rendering mode. 113 * 114 * @since 5.7.3 115 * @param mode the mode to retrieve layouts for. 116 * @param additionalMode additional mode to take into account, typically {@link BuiltinModes#ANY} 117 */ 118 List<LayoutDefinition> getFieldLayouts(String mode, String additionalMode); 119 120 /** 121 * Returns the map of field layouts per mode. 122 * 123 * @since 5.7.3 124 * @see #getFieldLayouts(String, String) 125 */ 126 Map<String, List<LayoutDefinition>> getFieldLayouts(); 127 128 /** 129 * Returns the default values for the widget type properties, by mode. 130 * 131 * @since 5.7.3 132 */ 133 Map<String, Map<String, Serializable>> getDefaultPropertyValues(); 134 135 /** 136 * Returns the default values for the widget type properties, for given mode. 137 * 138 * @since 5.7.3 139 */ 140 Map<String, Serializable> getDefaultPropertyValues(String mode); 141 142 /** 143 * @since 6.0 144 */ 145 Map<String, Map<String, Serializable>> getDefaultControlValues(); 146 147 /** 148 * @since 6.0 149 */ 150 Map<String, Serializable> getDefaultControlValues(String mode); 151 152 /** 153 * Returns the list of supported controls, e.g. controls that are checked on sub-widgets definitions. 154 * 155 * @since 5.9.1 156 */ 157 List<String> getSupportedControls(); 158 159}