package org.apache.myfaces.tobago.renderkit.fo.standard.standard.tag;
/*
* Copyright 2002-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.renderkit.LayoutManager;
import org.apache.myfaces.tobago.renderkit.RendererBase;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.render.Renderer;
import java.io.IOException;
/**
* Created: Dec 3, 2004 12:07:38 AM
* User: bommel
* $Id: FoRendererBase.java 374936 2006-02-04 21:47:46Z bommel $
*/
public class FoRendererBase extends RendererBase {
private static final Log LOG = LogFactory.getLog(FoRendererBase.class);
private LayoutManager getLayoutManager(
FacesContext facesContext,
UIComponent component) {
LayoutManager layoutManager = null;
Renderer renderer = ComponentUtil.getRenderer(facesContext, component);
if (renderer instanceof LayoutManager) {
return (LayoutManager) renderer;
}
return layoutManager;
}
public void encodeBegin(FacesContext facesContext, UIComponent component)
throws IOException {
if (LOG.isDebugEnabled()) {
LOG.debug("*** begin " + component);
}
try {
// createClassAttribute(component);
encodeBeginTobago(facesContext, component);
} catch (IOException e) {
throw e;
} catch (RuntimeException e) {
LOG.error("catched RuntimeException :", e);
throw e;
} catch (Throwable e) {
LOG.error("catched Throwable :", e);
throw new RuntimeException(e);
}
if (LOG.isDebugEnabled()) {
LOG.debug("* begin " + component);
}
}
public void encodeEnd(FacesContext facesContext, UIComponent component)
throws IOException {
if (LOG.isDebugEnabled()) {
LOG.debug("*** end " + component);
}
try {
encodeEndTobago(facesContext, component);
} catch (IOException e) {
throw e;
} catch (RuntimeException e) {
LOG.error("catched " + e + " :" + e.getMessage(), e);
throw e;
} catch (Throwable e) {
LOG.error("catched Throwable :", e);
throw new RuntimeException(e);
}
if (LOG.isDebugEnabled()) {
LOG.debug("* end " + component);
}
}
}