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