Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.richfaces.renderkit.html;
  
  import java.util.Map;
  import  javax.faces.application.ResourceDependencies;
  import  javax.faces.application.ResourceDependency;
  import  javax.faces.component.UIComponent;
  import  javax.faces.context.FacesContext;
 import  javax.faces.context.ResponseWriter;
 import  org.richfaces.component.SwitchType;
 import static org.richfaces.renderkit.RenderKitUtils.*;
 
 
 @ResourceDependencies({@ResourceDependency(name="ajax.reslib",library="org.richfaces",target=""),@ResourceDependency(name="base-component.reslib",library="org.richfaces",target=""),@ResourceDependency(name="richfaces-event.js",library="",target=""),@ResourceDependency(name="tree.js",library="org.richfaces",target=""),@ResourceDependency(name="tree.ecss",library="org.richfaces",target="")})
 public class TreeRenderer extends TreeRendererBase {
 	
 private static final Attributes PASS_THROUGH_ATTRIBUTES8 = attributes()
 	     .generic("align","align")
 	     
 
 	     .generic("dir","dir")
 	     
 
 	     .generic("lang","lang")
 	     
 
 	     .generic("onclick","onclick","click")
 	     
 
 	     .generic("ondblclick","ondblclick","dblclick")
 	     
 
 	     .generic("onkeydown","onkeydown","keydown")
 	     
 
 	     .generic("onkeypress","onkeypress","keypress")
 	     
 
 	     .generic("onkeyup","onkeyup","keyup")
 	     
 
 	     .generic("onmousedown","onmousedown","mousedown")
 	     
 
 	     .generic("onmousemove","onmousemove","mousemove")
 	     
 
 	     .generic("onmouseout","onmouseout","mouseout")
 	     
 
 	     .generic("onmouseover","onmouseover","mouseover")
 	     
 
 	     .generic("onmouseup","onmouseup","mouseup")
 	     
 
 	     .generic("role","role")
 	     
 
 	     .generic("style","style")
 	     
 
 	     .generic("title","title")
 	     
 ;
 	
 private static final Attributes ATTRIBUTES_FOR_SCRIPT_HASH11 = attributes()
 	     .generic("toggleType","toggleType")
 	     
 ;
 	
 private static final Attributes ATTRIBUTES_FOR_SCRIPT_HASH12 = attributes()
 	     .generic("onselectionchange","onselectionchange","selectionchange")
 	     
 
 	     .generic("onbeforeselectionchange","onbeforeselectionchange","beforeselectionchange")
 	     
 
 	     .generic("toggleNodeEvent","toggleNodeEvent")
 	     
 ;
 	
 	
 public void doEncodeBegin(ResponseWriter responseWriter, FacesContext facesContext, UIComponent component
 		throws IOException
 	 {
 		String clientId = component.getClientId(facesContext);
 responseWriter.startElement("div"component); 
    {
       Object value = this.concatClasses("rf-tr",component.getAttributes().get("styleClass"));
       if(null != value &&
       shouldRenderAttribute(value)
       ) {
        responseWriter.writeAttribute("class",value,null);
      }
      
   }
   {
      String value = clientId;
      if(null != value &&
         value.length()>0
      ) {
        responseWriter.writeAttribute("id",value,null);
      }
      
   }
renderPassThroughAttributes(facesContextcomponent
createTreeRenderingContext(facesContextcomponent);
	}
public void doEncodeChildren(ResponseWriter responseWriter, FacesContext facesContext, UIComponent component
	 {
		String clientId = component.getClientId(facesContext);
encodeTree(facesContextcomponent);
	}
private static String convertToString(Object object
 {
		return object != null ? object.toString() : "";
	}
public void doEncodeEnd(ResponseWriter responseWriter, FacesContext facesContext, UIComponent component
	 {
		String clientId = component.getClientId(facesContext);
Object clientEventHandlers  =  (Object)this.getClientEventHandlers(facesContext); 
encodeSelectionStateInput(facesContextcomponent);
responseWriter.startElement("script"component); 
  responseWriter.writeAttribute("type","text/javascript",null);
Map<StringObjectoptions = new LinkedHashMap<StringObject>(); 
addToScriptHash(optionsfacesContextcomponentnull);
addToScriptHash(options"selectionType"this.getSelectionType(facesContext,component), SwitchType.client, null);
addToScriptHash(options"ajaxSubmitFunction"this.getAjaxSubmitFunction(facesContext,component), nullnull);
addToScriptHash(optionsfacesContextcomponentnull);
addToScriptHash(options"clientEventHandlers"clientEventHandlersnullnull);
	Object text = "new RichFaces.ui.Tree(" + convertToString(toScriptArgs(clientId,options)) + ");";
	if (text != null) {
		responseWriter.writeText(textnull); 
	}
responseWriter.endElement("script"); 
responseWriter.endElement("div"); 
	}
public boolean getRendersChildren() 
 {
		return true;
	}
New to GrepCode? Check out our FAQ X