View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.custom.autoscroll;
20  
21  import java.io.IOException;
22  
23  import javax.faces.component.UIComponent;
24  import javax.faces.context.FacesContext;
25  import javax.faces.context.ResponseWriter;
26  
27  import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
28  import org.apache.myfaces.renderkit.html.util.AddResource;
29  import org.apache.myfaces.renderkit.html.util.AddResourceFactory;
30  import org.apache.myfaces.shared_tomahawk.config.MyfacesConfig;
31  import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRenderer;
32  import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils;
33  
34  /**
35   * 
36   * @since 1.1.10
37   * @author Leonardo Uribe (latest modification by $Author: lu4242 $)
38   * @version $Revision: 691856 $ $Date: 2008-09-03 21:40:30 -0500 (miƩ, 03 sep 2008) $
39   */
40  @JSFRenderer(renderKitId = "HTML_BASIC",
41          family = "org.apache.myfaces.custom.autoscroll.AutoscrollBodyScript",
42          type = "org.apache.myfaces.custom.autoscroll.AutoscrollBodyScript")
43  public class AutoscrollBodyScriptRenderer extends HtmlRenderer
44  {    
45      @Override
46      public void encodeEnd(FacesContext context, UIComponent component)
47              throws IOException
48      {
49          //Check npe
50          super.encodeEnd(context, component);
51          
52          //AddResource addResource = AddResourceFactory.getInstance(context);
53          
54          //Only render it if we are not buffering the request by addResource
55          //if (MyfacesConfig.getCurrentInstance(context.getExternalContext()).isAutoScroll())
56          //{
57              ResponseWriter writer = context.getResponseWriter();
58              HtmlRendererUtils.renderAutoScrollFunction(context, writer);
59              
60              HtmlRendererUtils.renderFormSubmitScript(context);
61          //}
62      }
63  }