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  org.richfaces.component.Mode;
 import static org.richfaces.renderkit.RenderKitUtils.*;
 
 
 public class DropDownMenuRenderer extends DropDownMenuRendererBase {
 	
 private static final Attributes PASS_THROUGH_ATTRIBUTES21 = 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("title","title")
 	     
 ;
 	
 private static final Attributes ATTRIBUTES_FOR_SCRIPT_HASH21 = attributes()
 	     .generic("onshow","onshow","show")
 	     
 
 	     .generic("onhide","onhide","hide")
 	     
 
 	     .generic("ongroupshow","ongroupshow","groupshow")
 	     
 
 	     .generic("ongrouphide","ongrouphide","grouphide")
 	     
 
 	     .generic("onitemclick","onitemclick","itemclick")
 	     
 ;
 	
 	
 private static boolean isEmpty(Object object
  {
 		if (object == null) {
 		    return true;
 		} else if (object.getClass().isArray()) {
 		    return ((Object[]) object).length == 0;
 		} else if (object instanceof java.util.Collection) {
 		    return ((java.util.Collection<?>) object).isEmpty();
 		} else if (object instanceof java.util.Map) {
 		    return ((java.util.Map<?, ?>) object).isEmpty();
 		} else {
 			return object.toString().length() == 0;
 		}
 	}
 	
 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 style  =  (Object)component.getAttributes().get("style"); 
Object styleClass  =  (Object)((!isEmpty(component.getAttributes().get("styleClass"))) ? component.getAttributes().get("styleClass") : ""); 
UIComponent label  =  (UIComponent)this.getLabelFacet(facesContext,component); 
boolean isDisabled  =  (boolean)this.isDisabled(facesContext,component); 
responseWriter.startElement("div"component); 
   {
      String value = "rf-ddm-lbl " + convertToString((isDisabled ? "rf-ddm-dis" : ("rf-ddm-unsel " + styleClass))) + " ";
      if(null != value &&
         value.length()>0
      ) {
        responseWriter.writeAttribute("class",value,null);
      }
      
   }
   {
      String value = clientId;
      if(null != value &&
         value.length()>0
      ) {
        responseWriter.writeAttribute("id",value,null);
      }
      
   }
   {
      Object value = style;
      if(null != value &&
      shouldRenderAttribute(value)
      ) {
        responseWriter.writeAttribute("style",value,null);
      }
      
   }
renderPassThroughAttributes(facesContextcomponent
responseWriter.startElement("div"component); 
   {
      String value = (isDisabled ? "rf-ddm-lbl-dis" : "rf-ddm-lbl-dec");
      if(null != value &&
         value.length()>0
      ) {
        responseWriter.writeAttribute("class",value,null);
      }
      
   }
   {
      String value = convertToString(clientId) + "_label";
      if(null != value &&
         value.length()>0
      ) {
        responseWriter.writeAttribute("id",value,null);
      }
      
   }
	if (((label != null) && label.isRendered())) {
	label.encodeAll(facesContext);
else if ((!isEmpty(component.getAttributes().get("label"))))  { 
	{
	Object text = component.getAttributes().get("label");
	if (text != null) {
		responseWriter.writeText(textnull); 
	}
else  { 
responseWriter.endElement("div"); 
	if ((!this.isDisabled(facesContext,component))) {
	responseWriter.startElement("div"component); 
	  responseWriter.writeAttribute("class","rf-ddm-pos",null);
	responseWriter.startElement("div"component); 
	  responseWriter.writeAttribute("class","rf-ddm-lst",null);
   {
      String value = convertToString(clientId) + "_list";
      if(null != value &&
         value.length()>0
      ) {
        responseWriter.writeAttribute("id",value,null);
      }
      
   }
   {
      String value = "display:none;min-width:" + convertToString(this.getPopupWidth(component)) + "px;";
      if(null != value &&
         value.length()>0
      ) {
        responseWriter.writeAttribute("style",value,null);
      }
      
   }
	responseWriter.startElement("div"component); 
	  responseWriter.writeAttribute("class","rf-ddm-lst-bg",null);
	renderChildren(facesContextcomponent);
	responseWriter.endElement("div"); 
	responseWriter.endElement("div"); 
	responseWriter.endElement("div"); 
	responseWriter.startElement("script"component); 
	  responseWriter.writeAttribute("type","text/javascript",null);
	Map<StringObjectoptions = new LinkedHashMap<StringObject>(); 
addToScriptHash(options"direction"this.getDirection(component).getValue(), org.richfaces.component.Positioning.DEFAULT.getValue(), null);
addToScriptHash(options"jointPoint"this.getJointPoint(component).getValue(), org.richfaces.component.Positioning.DEFAULT.getValue(), null);
addToScriptHash(options"showEvent"this.getShowEvent(component), this.null);
addToScriptHash(options"mode"this.getMode(component), org.richfaces.component.Mode.server, null);
addToScriptHash(options"horizontalOffset"component.getAttributes().get("horizontalOffset"), 0, null);
addToScriptHash(options"verticalOffset"component.getAttributes().get("verticalOffset"), 0, null);
addToScriptHash(options"hideDelay"component.getAttributes().get("hideDelay"), 300, null);
addToScriptHash(options"showDelay"component.getAttributes().get("showDelay"), 50, null);
	{
	Object text = "new\n                    RichFaces.ui.Menu(" + convertToString(toScriptArgs(clientId,options)) + ").initiateGroups(" + convertToString(toScriptArgs(this.getMenuGroups(facesContext,component))) + ");";
	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