org.richfaces.renderkit.html.DataScrollerRenderer Maven / Gradle / Ivy
package org.richfaces.renderkit.html;
import java.io.IOException;
import java.util.Map;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import org.richfaces.renderkit.DataScrollerBaseRenderer;
public class DataScrollerRenderer extends DataScrollerBaseRenderer {
private static String convertToString(Object object)
{
return object != null ? object.toString() : "";
}
private static boolean convertToBoolean(Object object)
{
if (object == null) {
return false;
}
if (object instanceof Boolean) {
return Boolean.TRUE.equals(object);
}
return Boolean.valueOf(object.toString());
}
@Override
public void encodeEnd(FacesContext facesContext, UIComponent component)
throws IOException
{
ResponseWriter responseWriter = facesContext.getResponseWriter();
String clientId = component.getClientId(facesContext);
org.richfaces.renderkit.ControlsState controlsState = this.getControlsState(facesContext,component);
responseWriter.startElement("span", component);
responseWriter.writeAttribute("class","rf-ds",null);
{
String value = clientId;
if(null != value &&
value.length()>0
) {
responseWriter.writeAttribute("id",value,null);
}
}
if (convertToBoolean(controlsState.getFirstRendered())) {
if (convertToBoolean(controlsState.getFirstEnabled())) {
responseWriter.startElement("a", component);
responseWriter.writeAttribute("class","rf-ds-btn rf-ds-l",null);
responseWriter.writeURIAttribute("href","javascript:void(0)",null);
{
String value = convertToString(clientId) + "_ds_f";
if(null != value &&
value.length()>0
) {
responseWriter.writeAttribute("id",value,null);
}
}
responseWriter.writeText("\u00AB\u00AB",null);
responseWriter.endElement("a");
} else {
responseWriter.startElement("span", component);
responseWriter.writeAttribute("class","rf-ds-btn rf-ds-l rf-ds-dis",null);
{
String value = convertToString(clientId) + "_ds_f";
if(null != value &&
value.length()>0
) {
responseWriter.writeAttribute("id",value,null);
}
}
responseWriter.writeText("\u00AB\u00AB",null);
responseWriter.endElement("span");
}
}
if (convertToBoolean(controlsState.getFastRewindRendered())) {
if (convertToBoolean(controlsState.getFastRewindEnabled())) {
responseWriter.startElement("a", component);
responseWriter.writeAttribute("class","rf-ds-btn rf-ds-l",null);
responseWriter.writeURIAttribute("href","javascript:void(0)",null);
{
String value = convertToString(clientId) + "_ds_fr";
if(null != value &&
value.length()>0
) {
responseWriter.writeAttribute("id",value,null);
}
}
responseWriter.writeText("\u00AB",null);
responseWriter.endElement("a");
} else {
responseWriter.startElement("span", component);
responseWriter.writeAttribute("class","rf-ds-btn rf-ds-l rf-ds-dis",null);
{
String value = convertToString(clientId) + "_ds_fr";
if(null != value &&
value.length()>0
) {
responseWriter.writeAttribute("id",value,null);
}
}
responseWriter.writeText("\u00AB",null);
responseWriter.endElement("span");
}
}
Map digitals = this.renderPager(responseWriter,facesContext,component);
if (convertToBoolean(controlsState.getFastForwardRendered())) {
if (convertToBoolean(controlsState.getFastForwardEnabled())) {
responseWriter.startElement("a", component);
responseWriter.writeAttribute("class","rf-ds-btn rf-ds-r",null);
responseWriter.writeURIAttribute("href","javascript:void(0)",null);
{
String value = convertToString(clientId) + "_ds_ff";
if(null != value &&
value.length()>0
) {
responseWriter.writeAttribute("id",value,null);
}
}
responseWriter.writeText("\u00BB",null);
responseWriter.endElement("a");
} else {
responseWriter.startElement("span", component);
responseWriter.writeAttribute("class","rf-ds-btn rf-ds-r rf-ds-dis",null);
{
String value = convertToString(clientId) + "_ds_ff";
if(null != value &&
value.length()>0
) {
responseWriter.writeAttribute("id",value,null);
}
}
responseWriter.writeText("\u00BB",null);
responseWriter.endElement("span");
}
}
if (convertToBoolean(controlsState.getLastRendered())) {
if (convertToBoolean(controlsState.getLastEnabled())) {
responseWriter.startElement("a", component);
responseWriter.writeAttribute("class","rf-ds-btn rf-ds-r",null);
responseWriter.writeURIAttribute("href","javascript:void(0)",null);
{
String value = convertToString(clientId) + "_ds_l";
if(null != value &&
value.length()>0
) {
responseWriter.writeAttribute("id",value,null);
}
}
responseWriter.writeText("\u00BB\u00BB",null);
responseWriter.endElement("a");
} else {
responseWriter.startElement("span", component);
responseWriter.writeAttribute("class","rf-ds-btn rf-ds-r rf-ds-dis",null);
{
String value = convertToString(clientId) + "_ds_l";
if(null != value &&
value.length()>0
) {
responseWriter.writeAttribute("id",value,null);
}
}
responseWriter.writeText("\u00BB\u00BB",null);
responseWriter.endElement("span");
}
}
Map buttons = this.getControls(facesContext,component,controlsState);
responseWriter.startElement("script", component);
responseWriter.writeAttribute("type","text/javascript",null);
buildScript(responseWriter, facesContext, component, buttons, digitals);;
responseWriter.endElement("script");
responseWriter.endElement("span");
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy