001/* 002 * (C) Copyright 2006-2008 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$ 018 */ 019 020package org.nuxeo.ecm.platform.ui.web.tag.handler; 021 022import java.io.IOException; 023 024import javax.el.ELException; 025import javax.faces.FacesException; 026import javax.faces.component.UIComponent; 027import javax.faces.view.facelets.ComponentConfig; 028import javax.faces.view.facelets.FaceletContext; 029 030import org.apache.commons.logging.Log; 031import org.apache.commons.logging.LogFactory; 032 033import com.sun.faces.facelets.tag.jsf.html.HtmlComponentHandler; 034 035/** 036 * Handler for deprecated components. 037 * <p> 038 * Behaves like a {@link HtmlComponentHandler} but issues a deprecation warning log when used. 039 * 040 * @author Anahide Tchertchian 041 */ 042public class DeprecatedComponentHandler extends HtmlComponentHandler { 043 044 private static final Log log = LogFactory.getLog(DeprecatedComponentHandler.class); 045 046 public DeprecatedComponentHandler(ComponentConfig config) { 047 super(config); 048 } 049 050 @Override 051 public void applyNextHandler(FaceletContext ctx, UIComponent c) throws IOException, FacesException, ELException { 052 if (log.isWarnEnabled()) { 053 log.warn("Component '" + c + "' is deprecated and might not work correctly. " 054 + "Try to use an equivalent tag in another library"); 055 } 056 super.applyNextHandler(ctx, c); 057 } 058 059}