001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019 020 package org.apache.myfaces.tobago.component; 021 022 import org.apache.myfaces.tobago.ajax.api.AjaxComponent; 023 import org.apache.myfaces.tobago.ajax.api.AjaxPhaseListener; 024 import org.apache.myfaces.tobago.ajax.api.AjaxUtils; 025 026 import javax.faces.context.FacesContext; 027 import java.io.IOException; 028 029 /* 030 * User: weber 031 * Date: Feb 28, 2005 032 * Time: 3:05:19 PM 033 */ 034 public class UIPanelBase extends javax.faces.component.UIPanel 035 implements AjaxComponent { 036 037 public void encodeBegin(FacesContext facesContext) throws IOException { 038 // TODO change this should be renamed to DimensionUtils.prepare!!! 039 UILayout.getLayout(this).layoutBegin(facesContext, this); 040 super.encodeBegin(facesContext); 041 } 042 043 public void encodeChildren(FacesContext facesContext) throws IOException { 044 if (isRendered()) { 045 UILayout.getLayout(this).encodeChildrenOfComponent(facesContext, this); 046 } 047 } 048 049 public void encodeAjax(FacesContext facesContext) throws IOException { 050 AjaxUtils.encodeAjaxComponent(facesContext, this); 051 } 052 053 public void processAjax(FacesContext facesContext) throws IOException { 054 final String ajaxId = (String) facesContext.getExternalContext() 055 .getRequestParameterMap().get(AjaxPhaseListener.AJAX_COMPONENT_ID); 056 057 if (ajaxId.equals(getClientId(facesContext))) { 058 AjaxUtils.processActiveAjaxComponent(facesContext, this); 059 } else { 060 AjaxUtils.processAjaxOnChildren(facesContext, this); 061 } 062 } 063 }