All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.richfaces.renderkit.html.ListRenderer Maven / Gradle / Ivy

There is a newer version: 4.3.7.Final
Show newest version
package org.richfaces.renderkit.html;

import java.io.IOException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import org.richfaces.component.ListType;
import org.richfaces.renderkit.ListRendererBase;
import org.richfaces.renderkit.RenderKitUtils;
import org.richfaces.renderkit.RenderKitUtils.Attributes;
import static org.richfaces.renderkit.RenderKitUtils.*;


public class ListRenderer extends ListRendererBase {
	
private static final Attributes PASS_THROUGH_ATTRIBUTES21 = attributes()
     .bool("compact","compact")
     

     .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("start","start")
     

     .generic("style","style")
     

     .generic("title","title")
     
;
	
private static final Attributes PASS_THROUGH_ATTRIBUTES22 = attributes()
     .bool("compact","compact")
     

     .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("style","style")
     

     .generic("title","title")
     
;
	
private static final Attributes PASS_THROUGH_ATTRIBUTES23 = attributes()
     .bool("compact","compact")
     

     .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("style","style")
     

     .generic("title","title")
     
;
	
	
@Override
public void encodeEnd(FacesContext facesContext, UIComponent component) 
		throws IOException
	 {
		ResponseWriter responseWriter = facesContext.getResponseWriter(); 
String clientId = component.getClientId(facesContext);
ListType listType  = this.getType(component); 
Object styleClass  = this.getStyleClass(component,listType); 
Object elementId  = this.getElementId(facesContext,component); 
switch (listType) {
		case ordered:
	responseWriter.startElement("ol", component); 
	   {
      Object value = styleClass;
      if(null != value &&
      shouldRenderAttribute(value)
      ) {
        responseWriter.writeAttribute("class",value,null);
      }
      
   }

   {
      Object value = elementId;
      if(null != value &&
      shouldRenderAttribute(value)
      ) {
        responseWriter.writeAttribute("id",value,null);
      }
      
   }

renderPassThroughAttributes(facesContext, component, 
	PASS_THROUGH_ATTRIBUTES21);

	encodeListItems(facesContext, component, listType);
	responseWriter.endElement("ol"); 
	
	break;
		case unordered:
	responseWriter.startElement("ul", component); 
	   {
      Object value = styleClass;
      if(null != value &&
      shouldRenderAttribute(value)
      ) {
        responseWriter.writeAttribute("class",value,null);
      }
      
   }

   {
      Object value = elementId;
      if(null != value &&
      shouldRenderAttribute(value)
      ) {
        responseWriter.writeAttribute("id",value,null);
      }
      
   }

renderPassThroughAttributes(facesContext, component, 
	PASS_THROUGH_ATTRIBUTES22);

	encodeListItems(facesContext, component, listType);
	responseWriter.endElement("ul"); 
	
	break;
		case definitions:
	responseWriter.startElement("dl", component); 
	   {
      Object value = styleClass;
      if(null != value &&
      shouldRenderAttribute(value)
      ) {
        responseWriter.writeAttribute("class",value,null);
      }
      
   }

   {
      Object value = elementId;
      if(null != value &&
      shouldRenderAttribute(value)
      ) {
        responseWriter.writeAttribute("id",value,null);
      }
      
   }

renderPassThroughAttributes(facesContext, component, 
	PASS_THROUGH_ATTRIBUTES23);

	encodeListItems(facesContext, component, listType);
	responseWriter.endElement("dl"); 
	
	break;
}

	}
	
@Override
public boolean getRendersChildren() 
 {
		return true;
	}
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy