001/* 002 * (C) Copyright 2006-2007 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 * <a href="mailto:[email protected]">Anahide Tchertchian</a> 018 * 019 * $Id: LayoutDefinition.java 26053 2007-10-16 01:45:43Z atchertchian $ 020 */ 021 022package org.nuxeo.ecm.platform.forms.layout.api; 023 024import java.io.Serializable; 025import java.util.List; 026import java.util.Map; 027 028/** 029 * Layout definition interface. 030 * 031 * @author <a href="mailto:[email protected]">Anahide Tchertchian</a> 032 */ 033public interface LayoutDefinition extends Serializable { 034 035 /** 036 * Returns the layout name used to identify it within the layout service. 037 */ 038 String getName(); 039 040 /** 041 * @since 5.5 042 */ 043 void setName(String name); 044 045 /** 046 * Return the layout type, or null if not defined. 047 * <p> 048 * Since 6.0, the layout type can hold templates and properties configuration, so that layout does not need to 049 * define them again. 050 * 051 * @since 6.0 052 */ 053 String getType(); 054 055 /** 056 * @since 6.0 057 */ 058 String getTypeCategory(); 059 060 /** 061 * Returns template to use in a given mode. 062 */ 063 String getTemplate(String mode); 064 065 /** 066 * Returns templates by mode 067 */ 068 Map<String, String> getTemplates(); 069 070 /** 071 * @since 5.5 072 */ 073 void setTemplates(Map<String, String> templates); 074 075 /** 076 * Returns the widget definition with given name. 077 * <p> 078 * Returns null if a widget with this name is not found within the layout. 079 */ 080 WidgetDefinition getWidgetDefinition(String name); 081 082 /** 083 * Returns the map of widgets defined inside this layout. 084 * 085 * @since 8.1 086 */ 087 Map<String, WidgetDefinition> getWidgetDefinitions(); 088 089 /** 090 * Returns the list of widget names to use at a given row. 091 * <p> 092 * For instance, this could describe a layout like: [['title'], ['description'], ['creationDate', '', 093 * 'modificationDate'], ['subject']]. 094 */ 095 LayoutRowDefinition[] getRows(); 096 097 /** 098 * @since 5.5 099 */ 100 void setRows(LayoutRowDefinition[] rows); 101 102 /** 103 * Returns the maximum number of columns. 104 */ 105 int getColumns(); 106 107 /** 108 * Returns a map of properties to use in a given mode. 109 */ 110 Map<String, Serializable> getProperties(String layoutMode); 111 112 /** 113 * Returns a map of properties by mode. 114 */ 115 Map<String, Map<String, Serializable>> getProperties(); 116 117 /** 118 * @since 5.5 119 */ 120 void setProperties(Map<String, Map<String, Serializable>> properties); 121 122 /** 123 * Returns the map of rendering information per mode. 124 * <p> 125 * Useful for preview management where some configuration needs to be changed: what's changed can be set as 126 * rendering information here to be displayed. 127 * 128 * @since 5.5 129 */ 130 Map<String, List<RenderingInfo>> getRenderingInfos(); 131 132 /** 133 * Returns the list of rendering information for given mode. 134 * 135 * @since 5.5 136 */ 137 List<RenderingInfo> getRenderingInfos(String mode); 138 139 /** 140 * @since 5.5 141 */ 142 void setRenderingInfos(Map<String, List<RenderingInfo>> renderingInfos); 143 144 /** 145 * Return alias names for this layout definition (useful for compatibility on old layout names). 146 * 147 * @since 6.0 148 */ 149 List<String> getAliases(); 150 151 /** 152 * Returns true if all widget references in this layout are empty 153 * 154 * @since 5.6 155 */ 156 boolean isEmpty(); 157 158 /** 159 * @since 6.0 160 */ 161 boolean isDynamic(); 162 163 /** 164 * Returns a clone instance of this layout definition. 165 * <p> 166 * Useful for conversion of layout definition during export. 167 * 168 * @since 5.5 169 */ 170 LayoutDefinition clone(); 171 172}