001/*
002 * (C) Copyright 2006-2013 Nuxeo SAS (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 *     <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a>
016 *
017 * $Id: WidgetTypeHandler.java 27477 2007-11-20 19:55:44Z jcarsique $
018 */
019
020package org.nuxeo.ecm.platform.forms.layout.facelets;
021
022import java.io.Serializable;
023import java.util.Map;
024
025import javax.faces.view.facelets.FaceletContext;
026import javax.faces.view.facelets.FaceletHandler;
027import javax.faces.view.facelets.TagConfig;
028
029import org.nuxeo.ecm.platform.forms.layout.api.Widget;
030import org.nuxeo.ecm.platform.forms.layout.api.exceptions.WidgetException;
031
032/**
033 * Widget type handler interface.
034 *
035 * @author <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a>
036 */
037public interface WidgetTypeHandler extends Serializable {
038
039    /**
040     * Returns the facelet handler that will be applied for given widget and template in this context.
041     *
042     * @param ctx the facelet context in which this handler will be applied.
043     * @param tagConfig the tag configuration this facelet will be applied for.
044     * @param widget the widget giving properties the handler will take into account.
045     * @param subHandlers facelet handlers for sub widgets.
046     * @return a facelet handler.
047     * @throws WidgetException
048     */
049    FaceletHandler getFaceletHandler(FaceletContext ctx, TagConfig tagConfig, Widget widget,
050            FaceletHandler[] subHandlers) throws WidgetException;
051
052    /**
053     * Returns the facelet handler used for dev mode.
054     *
055     * @since 6.0
056     */
057    FaceletHandler getDevFaceletHandler(FaceletContext ctx, TagConfig tagConfig, Widget widget) throws WidgetException;
058
059    /**
060     * Returns a property value given its name.
061     *
062     * @return property with this name.
063     */
064    String getProperty(String name);
065
066    /**
067     * Set properties
068     */
069    void setProperties(Map<String, String> properties);
070
071}