001/* 002 * (C) Copyright 2010 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 * Widget configuration interface 027 * 028 * @author Anahide Tchertchian 029 * @since 5.4 030 */ 031public interface WidgetTypeConfiguration extends Serializable { 032 033 /** 034 * Returns the version name since the widget type has been available (5.4, 5.4.2, etc...) 035 */ 036 String getSinceVersion(); 037 038 /** 039 * Returns the version name since the widget type has been deprecated (5.4, 5.4.2, etc...) 040 * 041 * @since 5.6 042 */ 043 String getDeprecatedVersion(); 044 045 String getTitle(); 046 047 String getDescription(); 048 049 /** 050 * Returns the identifier to be used for the demo, or null if no demo is available. 051 * 052 * @since 5.4.2 053 */ 054 String getDemoId(); 055 056 /** 057 * Returns true is the preview is enabled on the demo. 058 * 059 * @since 5.4.2 060 */ 061 boolean isDemoPreviewEnabled(); 062 063 List<String> getCategories(); 064 065 List<String> getSupportedModes(); 066 067 boolean isAcceptingSubWidgets(); 068 069 /** 070 * Returns true if widget knows how to display its label (some widget types might delegate this to their containing 071 * widget or layout, usually when defining form layouts). 072 * 073 * @since 5.6 074 */ 075 boolean isHandlingLabels(); 076 077 boolean isList(); 078 079 boolean isComplex(); 080 081 /** 082 * Returns true if widget will be containing forms. 083 * <p> 084 * Since forms cannot contains any sub forms, layouts using this widget should not be surrounded by any form. Other 085 * widgets in the same layouts not containing forms may then need a surrounding form that could be added by the 086 * layout template. 087 * 088 * @since 5.6 089 */ 090 boolean isContainingForm(); 091 092 List<String> getSupportedFieldTypes(); 093 094 List<String> getDefaultFieldTypes(); 095 096 List<FieldDefinition> getDefaultFieldDefinitions(); 097 098 /** 099 * Returns configuration properties. 100 * 101 * @since 5.4.2 102 */ 103 Map<String, Serializable> getConfProperties(); 104 105 Serializable getConfProperty(String propName); 106 107 List<LayoutDefinition> getPropertyLayouts(String mode, String additionalMode); 108 109 Map<String, List<LayoutDefinition>> getPropertyLayouts(); 110 111 /** 112 * Returns the list of layouts for given mode and additional modes. 113 * <p> 114 * These layouts are used to document accepted fields on the widget type, depending on the rendering mode. 115 * 116 * @since 5.7.3 117 * @param mode the mode to retrieve layouts for. 118 * @param additionalMode additional mode to take into account, typically {@link BuiltinModes#ANY} 119 */ 120 List<LayoutDefinition> getFieldLayouts(String mode, String additionalMode); 121 122 /** 123 * Returns the map of field layouts per mode. 124 * 125 * @since 5.7.3 126 * @see #getFieldLayouts(String, String) 127 */ 128 Map<String, List<LayoutDefinition>> getFieldLayouts(); 129 130 /** 131 * Returns the default values for the widget type properties, by mode. 132 * 133 * @since 5.7.3 134 */ 135 Map<String, Map<String, Serializable>> getDefaultPropertyValues(); 136 137 /** 138 * Returns the default values for the widget type properties, for given mode. 139 * 140 * @since 5.7.3 141 */ 142 Map<String, Serializable> getDefaultPropertyValues(String mode); 143 144 /** 145 * @since 6.0 146 */ 147 Map<String, Map<String, Serializable>> getDefaultControlValues(); 148 149 /** 150 * @since 6.0 151 */ 152 Map<String, Serializable> getDefaultControlValues(String mode); 153 154 /** 155 * Returns the list of supported controls, e.g. controls that are checked on sub-widgets definitions. 156 * 157 * @since 5.9.1 158 */ 159 List<String> getSupportedControls(); 160 161}