Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
$URL: https://source.sakaiproject.org/svn/jsf/tags/sakai-10.0/jsf-widgets/src/java/org/sakaiproject/jsf/renderer/ProgressBarRenderer.java $ $Id: ProgressBarRenderer.java 105077 2012-02-24 22:54:29Z ottenhoff@longsight.com $ 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 http://www.opensource.org/licenses/ECL-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. /
 
 
 
 package org.sakaiproject.jsf.renderer;
 
 import java.util.Map;

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

Copyright: Copyright (c) 2004

Organization: Sakai Project

Author(s):
Ed Smiley
(JavaScript) Brian Gosselin of http://scriptasylum.com
Version:
$Id: ProgressBarRenderer.java 105077 2012-02-24 22:54:29Z ottenhoff@longsight.com $
 
 
 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 .

Parameters:
context FacesContext for the current request
component UIComponent being rendered
Throws:
java.io.IOException if an input/output error occurs
 
     public void encodeEnd(FacesContext contextUIComponent component)
       throws IOException {
 
        if (!component.isRendered())
        {
          return;
         }
 
         ResponseWriter writer = context.getResponseWriter();
 
         String clientId = null;
 
         if (component.getId() != null &&
           !component.getId().startsWith(.))
         {
           clientId = component.getClientId(context);
         }
 
        if (clientId != null)
        {
          writer.startElement("span"component);
          writer.writeAttribute("id"clientId"id");
        }
        Map attrMap = component.getAttributes();
        writer.write("\n");
        writer.write("\n<script language=\"javascript\">");
        writer.write("\n// Timer Bar - Version 1.0");
        writer.write(
            "\n// Based on Script by Brian Gosselin of http://scriptasylum.com");
        writer.write(
            "\n  var loadedcolor='blue' ;            // PROGRESS BAR COLOR");
        writer.write(
            "\n  var unloadedcolor='white';         // COLOR OF UNLOADED AREA");
        writer.write(
            "\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// THE FUNCTION BELOW CONTAINS THE ACTION(S) TAKEN ONCE BAR REACHES 100.");
        writer.write("\n");
        writer.write("\n  var action = function()");
        writer.write("\n {");
        writer.write("\n }");
        writer.write("\n</script>");
        writer.write("\n<script language=\"javascript\" src=\"" +
             "/" +  + "/" +  + "\"></script>");
        writer.write("\n");
        if (clientId != null) {
          writer.endElement("span");
        }
    }
New to GrepCode? Check out our FAQ X