Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
$URL: $ $Id: 105077 2012-02-24 22:54:29Z $ Copyright (c) 2003, 2004, 2005, 2006, 2008 The Sakai Foundation Licensed under the Educational Community 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 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. /
 package org.sakaiproject.jsf.renderer;
 import java.util.Map;

This class is the class that renders the timerBar custom tag.

Copyright: Copyright (c) 2004

Organization: Sakai Project

Ed Smiley
(JavaScript) Brian Gosselin of
$Id: 105077 2012-02-24 22:54:29Z $
 public class ProgressBarRenderer
     extends Renderer
   private static final String SCRIPT_PATH;
   private static final String RESOURCE_PATH;
   // we have static resources for our script path
   static {
      = cr.get("timerBarScript");
      = cr.get("resources");
   public boolean supportsComponentType(UIComponent component)
     return (component instanceof UIOutput);
   public void decode(FacesContext contextUIComponent component)
   public void encodeChildren(FacesContext contextUIComponent component)
     throws IOException


Faces render output method .

context FacesContext for the current request
component UIComponent being rendered
Throws: if an input/output error occurs
     public void encodeEnd(FacesContext contextUIComponent component)
       throws IOException {
        if (!component.isRendered())
         ResponseWriter writer = context.getResponseWriter();
         String clientId = null;
         if (component.getId() != null &&
           clientId = component.getClientId(context);
        if (clientId != null)
        Map attrMap = component.getAttributes();
        writer.write("\n<script language=\"javascript\">");
        writer.write("\n// Timer Bar - Version 1.0");
            "\n// Based on Script by Brian Gosselin of");
            "\n  var loadedcolor='blue' ;            // PROGRESS BAR COLOR");
            "\n  var unloadedcolor='white';         // COLOR OF UNLOADED AREA");
            "\n  var bordercolor='white';            // COLOR OF THE BORDER");
        writer.write("\n  var barheight = 45; // HEIGHT OF PROGRESS BAR IN PIXELS");
        writer.write("\n  var barwidth = 300; // WIDTH OF THE BAR IN PIXELS");
        writer.write("\n  var waitTime = " + attrMap.get("wait") +
                     "; // NUMBER OF SECONDS FOR PROGRESSBAR");
        writer.write("\n  var loaded = 0; // TENTHS OF A SECOND ELAPSED");
        writer.write("\n  var action = function()");
        writer.write("\n {");
        writer.write("\n }");
        writer.write("\n<script language=\"javascript\" src=\"" +
             "/" +  + "/" +  + "\"></script>");
        if (clientId != null) {
New to GrepCode? Check out our FAQ X