org.richfaces.renderkit.html.HtmlMessageRenderer Maven / Gradle / Ivy
package org.richfaces.renderkit.html;
import java.io.IOException;
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.renderkit.MessageForRender;
import org.richfaces.renderkit.MessageRendererBase;
import org.richfaces.renderkit.RenderKitUtils;
import static org.richfaces.renderkit.RenderKitUtils.*;
import org.richfaces.renderkit.RenderKitUtils.Attributes;
import org.richfaces.renderkit.RenderKitUtils.ScriptHashVariableWrapper;
@ResourceDependencies({@ResourceDependency(name="jsf.js",library="javax.faces",target=""),@ResourceDependency(name="jquery.js",library="org.richfaces",target=""),@ResourceDependency(name="richfaces.js",library="org.richfaces",target=""),@ResourceDependency(name="richfaces-base-component.js",library="org.richfaces",target=""),@ResourceDependency(name="richfaces-event.js",library="org.richfaces",target=""),@ResourceDependency(name="message.js",library="org.richfaces",target=""),@ResourceDependency(name="msg.ecss",library="org.richfaces",target="")})
public class HtmlMessageRenderer extends MessageRendererBase {
private static final Attributes PASS_THROUGH_ATTRIBUTES48 = attributes()
.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 String convertToString(Object object)
{
return object != null ? object.toString() : "";
}
@Override
public void doEncodeEnd(ResponseWriter responseWriter, FacesContext facesContext, UIComponent component)
throws IOException
{
String clientId = component.getClientId(facesContext);
responseWriter.startElement("span", component);
{
String value = "rf-msg " + convertToString(component.getAttributes().get("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);
}
}
renderPassThroughAttributes(facesContext, component,
PASS_THROUGH_ATTRIBUTES48);
for (MessageForRender msg : this.getVisibleMessages(facesContext,component)) {
responseWriter.startElement("span", component);
{
String value = this.getMsgClass(facesContext,component,msg);
if(null != value &&
value.length()>0
) {
responseWriter.writeAttribute("class",value,null);
}
}
{
String value = this.getMsgStyle(facesContext,component,msg);
if(null != value &&
value.length()>0
) {
responseWriter.writeAttribute("style",value,null);
}
}
encodeMessage(facesContext,component,msg);
responseWriter.endElement("span");
}
encodeScript(facesContext,component);
responseWriter.endElement("span");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy