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/PopupRenderer.java $ $Id: PopupRenderer.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;
 
 
 

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

Copyright: Copyright (c) 2004

Organization: Sakai Project

Author(s):
Ed Smiley
Version:
$Id: PopupRenderer.java 105077 2012-02-24 22:54:29Z ottenhoff@longsight.com $
 
 
 public class PopupRenderer
     extends Renderer {
 
   public boolean supportsComponentType(UIComponent component) {
     return (component instanceof UIOutput);
   }
 
   public void decode(FacesContext contextUIComponent component) {
   }

  
This component renders its children

Returns:
true
 
   public boolean getRendersChildren()
   {
     return true;
   }

  
Do nothing if a button, otherwise, default.

Parameters:
context FacesContext
component UIComponent
Throws:
java.io.IOException
 
   public void encodeChildren(FacesContext contextUIComponent componentthrows
       IOException {
     String buttonSwitch = (String) RendererUtil.getAttribute(contextcomponent"useButton");
     boolean useButton = Boolean.getBoolean(
         RendererUtil.makeSwitchString(buttonSwitchfalsetruetruefalsefalsefalse));
 
     if (useButton)
     {
       return;
     }
     else
     {
       Iterator iter = component.getChildren().iterator();
       while (iter.hasNext()) {
         UIComponent kid = (UIComponentiter.next();
         RendererUtil.encodeRecursive(contextkid);
       }
 
     }
   }

  

Faces render output method .

Method Generator: org.sakaiproject.tool.assessment.devtoolsRenderMaker

Parameters:
context FacesContext for the current request
component UIComponent being rendered
Throws:
java.io.IOException if an input/output error occurs
  public void encodeBegin(FacesContext contextUIComponent componentthrows
      IOException {
    if ( !component.isRendered())
    {
      return;
    }
    ResponseWriter writer = context.getResponseWriter();
    String id = (Stringcomponent.getClientId(context);
    String title = (String) RendererUtil.getAttribute(contextcomponent"title");
    String url = (String) RendererUtil.getAttribute(contextcomponent"url");
    String target = (String) RendererUtil.getAttribute(contextcomponent"target");
    String toolbar = (String) RendererUtil.getAttribute(contextcomponent"toolbar");
    String menubar = (String) RendererUtil.getAttribute(contextcomponent"menubar");
    String personalbar = (String) RendererUtil.getAttribute(contextcomponent"personalbar");
// temporary workaround ClassCastException
    String width = null;//(String) RendererUtil.getAttribute(context, component, "width");
    String height = null//(String) RendererUtil.getAttribute(context, component, "height");
    String scrollbars = (String) RendererUtil.getAttribute(contextcomponent"scrollbars");
    String resizable = (String) RendererUtil.getAttribute(contextcomponent"resizable");
    if (title == null) {
      title = "     ";
    }
    if (target == null) {
      target = "sakai_popup"
todo: put in resourc
    }
    if (width == null) {
      width = "650";
    }
    if (height == null) {
      height = "375";
    }
    toolbar = RendererUtil.makeSwitchString(toolbarfalsetruetruetruefalsefalse);
    menubar = RendererUtil.makeSwitchString(menubarfalsetruetruetruefalsefalse);
    personalbar = RendererUtil.makeSwitchString(personalbarfalsetruetruetruefalsefalse);
    scrollbars = RendererUtil.makeSwitchString(scrollbarsfalsetruetruetruefalsefalse);
    resizable = RendererUtil.makeSwitchString(resizablefalsetruetruetruefalsefalse);
    String buttonSwitch = (String) RendererUtil.getAttribute(contextcomponent"useButton");
    boolean useButton = Boolean.getBoolean(
        RendererUtil.makeSwitchString(buttonSwitchfalsetruetruefalsefalsefalse));
    if (useButton) {
      writer.write("<!-- DEBUG: useButton=true -->");
      writer.write("<input");
      writer.write("  id=\"" + id + "\"");
      writer.write("  type=\"button\"");
      writer.write("  title=\"" + title + "\"");
      writer.write("  value=\"" + title + "\"");
      writer.write("  onclick=\"window.open('" + url + "','" + target +
                   "', 'toolbar=" + toolbar + ",menubar=" + menubar +
                   ",personalbar=" +
                   personalbar + ",width=" + width + ",height=" + height +
                   ",scrollbars=" + scrollbars + ",resizable=" + resizable +
                   "');\" />");
    }
    else {
      writer.write("<!-- DEBUG: useButton=false -->");
      writer.write("<a");
      writer.write("  id=\"" + id + "\"");
      writer.write("  title=\"" + title + "\"");
      writer.write("  href=\"#\"");
      writer.write("  onclick=\"window.open('" + url + "','" + target +
                   "', 'toolbar=" + toolbar + ",menubar=" + menubar +
                   ",personalbar=" +
                   personalbar + ",width=" + width + ",height=" + height +
                   ",scrollbars=" + scrollbars + ",resizable=" + resizable +
                   "');\" >");
      writer.write(title);
    }
  }

  

Render end of ANCHOR.

Parameters:
context FacesContext for the request we are processing
component UIComponent to be rendered
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 componentthrows
      IOException {
    if (!component.isRendered())
    {
      return;
    }
    ResponseWriter writer = context.getResponseWriter();
    String buttonSwitch = (String) RendererUtil.getAttribute(contextcomponent"useButton");
    boolean useButton = Boolean.getBoolean(
        RendererUtil.makeSwitchString(buttonSwitchfalsetruetruefalsefalsefalse));
    if (!useButton) {
      writer.write("</a>");
    }
  }
New to GrepCode? Check out our FAQ X