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/InputColorRenderer.java $ $Id: InputColorRenderer.java 105077 2012-02-24 22:54:29Z ottenhoff@longsight.com $ Copyright (c) 2003, 2004, 2005, 2006, 2007, 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:

Render the custom color picker control.

Copyright: Copyright (c) 2004

Organization: Sakai Project

Author(s):
Ed Smiley
Version:
$id: $
 
 
 public class InputColorRenderer extends Renderer
 {
   // icon height and width
   private static final String HEIGHT = "13";
   private static final String WIDTH = "15";
 
   // later we may want to support hidden
   private static final String TYPE = "text";
 
   private static final String CURSORSTYLE;
   private static final String CLICKALT;
   private static final String COLOR_PATH;
   private static final String COLOR_ICON;
 
   static {
     String resources = cr.get("resources");
      = cr.get("picker_style");
      = "/" + resources + "/" + cr.get("inputColorPopup");
      = "/" + resources + "/" + cr.get("inputColorImage");
      = cr.get("color_pick_alt");
   }
 
   public boolean supportsComponentType(UIComponent component)
   {
     return (component instanceof UIInput);
   }

  
decode method

Parameters:
context
component
 
   public void decode(FacesContext contextUIComponent component)
   {
     // we haven't added these attributes--yet--defensive programming...
     if(RendererUtil.isDisabledOrReadonly(contextcomponent))
     {
       return;
     }
 
     String clientId = component.getClientId(context);
     Map requestParameterMap = context.getExternalContext()
                               .getRequestParameterMap();
     String newValue = (StringrequestParameterMap.get(clientId );
     UIInput comp = (UIInputcomponent;
     comp.setSubmittedValue(newValue);
   }

  
no-op

Parameters:
context
component
Throws:
java.io.IOException
  public void encodeBegin(FacesContext context,
    UIComponent componentthrows IOException
  {
    ;
  }

  
no-op

Parameters:
context
component
Throws:
java.io.IOException
  public void encodeChildren(FacesContext context,
    UIComponent componentthrows IOException
  {
    ;
  }

  

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 encodeEnd(FacesContext context,
    UIComponent componentthrows IOException
  {
    if (RendererUtil.isDisabledOrReadonly(contextcomponent) || !component.isRendered())
    {
      return;
    }
    ResponseWriter writer = context.getResponseWriter();
    String contextPath = context.getExternalContext()
                         .getRequestContextPath();
    Object value = null;
    if (component instanceof UIInput)
    {
      value = ( (UIInputcomponent).getSubmittedValue();
    }
    if (value == null && component instanceof ValueHolder)
    {
      value = ( (ValueHoldercomponent).getValue();
    }
    String valString = "";
    if (value != null)
    {
      valString = value.toString();
    }
    String size = (String) RendererUtil.getAttribute(contextcomponent"size");
    if (size == null)
    {
      size = "20";
    }
    String clientId = component.getClientId(context);
    writer.write("\n");
    writer.write(" <input ");
    writer.write("\n");
    writer.write("  value=\"" + valString + "\" \n");
    writer.write("  type=\"" +  + "\" \n");
    writer.write("  size=\"" + size + "\" \n");
    writer.write("  name=\"" + clientId + "\"\n");
    writer.write("  id=\"" + clientId + "\" />&#160;");
    writer.write("<img ");
    writer.write("  id=\"" + clientId + "_colorPickerPopup" + "\"");
    writer.write("  style=\"" +  + "\" ");
    writer.write("  height=\"" +  + "\" ");
    writer.write("  width=\"" +  + "\"");
    writer.write("  src=\"" +  + "\" ");
    writer.write("  border=\"0\"");
    writer.write("  alt=\"" +  + "\" ");
    writer.write("  onclick=\"javascript:TCP.popup(" +
      "document.getElementById('" + clientId + "'),'','" +
       + "')\" />");
    writer.write("&#160;");
  }
New to GrepCode? Check out our FAQ X