Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.richfaces.renderkit.html;
 
 import java.util.Map;
 import  javax.faces.component.UIComponent;
 import  javax.faces.context.FacesContext;
 import  javax.faces.context.ResponseWriter;
import static org.richfaces.renderkit.RenderKitUtils.*;
public class HotKeyRenderer extends HotKeyRendererBase {
	     .generic("key","key")
	     
	     .generic("enabledInInput","enabledInInput")
	     .defaultValue(false)
	     .generic("preventDefault","preventDefault")
	     .defaultValue(true)
	     .generic("onkeydown","onkeydown","keydown")
	     
	     .generic("onkeyup","onkeyup","keyup")
	     
private static String convertToString(Object object
 {
		return object != null ? object.toString() : "";
	}
public void encodeEnd(FacesContext facesContext, UIComponent component
		throws IOException
	 {
		ResponseWriter responseWriter = facesContext.getResponseWriter();
String clientId = component.getClientId(facesContext);
responseWriter.startElement("span"component); 
   {
      String value = clientId;
      if(null != value &&
         value.length()>0
      ) {
        responseWriter.writeAttribute("id",value,null);
      }
      
   }
  responseWriter.writeAttribute("style","display: none;",null);
responseWriter.startElement("script"component); 
  responseWriter.writeAttribute("type","text/javascript",null);
Map<StringObjectoptions = new LinkedHashMap<StringObject>(); 
addToScriptHash(optionsfacesContextcomponentnull);
addToScriptHash(options"selector"this.getEscapedSelector(facesContext,component), nullnull);
	Object text = "new RichFaces.ui.HotKey(\"" + convertToString(clientId) + "\",  " + convertToString(toScriptArgs(options)) + ");";
	if (text != null) {
		responseWriter.writeText(textnull); 
	}
responseWriter.endElement("script"); 
responseWriter.endElement("span"); 
	}
New to GrepCode? Check out our FAQ X