001/* 002 * (C) Copyright 2011 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.service; 018 019import java.io.Serializable; 020import java.util.List; 021 022import org.nuxeo.ecm.platform.forms.layout.api.LayoutDefinition; 023import org.nuxeo.ecm.platform.forms.layout.api.LayoutTypeDefinition; 024import org.nuxeo.ecm.platform.forms.layout.api.WidgetDefinition; 025import org.nuxeo.ecm.platform.forms.layout.api.WidgetType; 026import org.nuxeo.ecm.platform.forms.layout.api.WidgetTypeDefinition; 027import org.nuxeo.ecm.platform.forms.layout.api.converters.LayoutDefinitionConverter; 028import org.nuxeo.ecm.platform.forms.layout.api.converters.WidgetDefinitionConverter; 029 030/** 031 * Layout store interface. 032 * <p> 033 * It manages registries of layout definitions, widget types, widget definitions and converters. 034 * 035 * @since 5.5 036 */ 037public interface LayoutStore extends Serializable { 038 039 /** 040 * Returns categories of layout and widgets definitions and instances held by this service. 041 */ 042 List<String> getCategories(); 043 044 /** 045 * Returns the registered widget type for this type name. 046 * <p> 047 * If the no widget type is found with this name, return null. 048 */ 049 WidgetType getWidgetType(String category, String typeName); 050 051 /** 052 * Returns the widget type definition with given name, or null if no widget type with this name is found. 053 */ 054 WidgetTypeDefinition getWidgetTypeDefinition(String category, String typeName); 055 056 /** 057 * Returns the widget type definitions for all the registered widget types. 058 */ 059 List<WidgetTypeDefinition> getWidgetTypeDefinitions(String category); 060 061 /** 062 * @since 6.0 063 */ 064 LayoutTypeDefinition getLayoutTypeDefinition(String category, String typeName); 065 066 /** 067 * @since 6.0 068 */ 069 List<LayoutTypeDefinition> getLayoutTypeDefinitions(String category); 070 071 /** 072 * Returns the registered layout definition for this name. 073 * <p> 074 * If the no definition is found with this name, return null. 075 */ 076 LayoutDefinition getLayoutDefinition(String category, String layoutName); 077 078 /** 079 * Returns the names of all the registered layout definitions 080 */ 081 List<String> getLayoutDefinitionNames(String category); 082 083 /** 084 * Returns the registered widget definition for this name. 085 * <p> 086 * If the no definition is found with this name, return null. 087 */ 088 WidgetDefinition getWidgetDefinition(String category, String widgetName); 089 090 List<LayoutDefinitionConverter> getLayoutConverters(String category); 091 092 List<WidgetDefinitionConverter> getWidgetConverters(String category); 093 094 // registry API 095 096 void registerWidgetType(String category, WidgetTypeDefinition desc); 097 098 void unregisterWidgetType(String category, WidgetTypeDefinition desc); 099 100 /** 101 * @since 6.0 102 */ 103 void registerLayoutType(String category, LayoutTypeDefinition desc); 104 105 /** 106 * @since 6.0 107 */ 108 void unregisterLayoutType(String category, LayoutTypeDefinition desc); 109 110 void registerLayout(String category, LayoutDefinition layoutDef); 111 112 void unregisterLayout(String category, LayoutDefinition layoutDef); 113 114 void registerWidget(String category, WidgetDefinition widgetDef); 115 116 void unregisterWidget(String category, WidgetDefinition widgetDef); 117 118}