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