rendered paste bodypackage com.loomis.jsf.component.keystrokevalidatedinput;
import java.io.IOException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
import org.apache.myfaces.custom.ajax.api.AjaxRenderer;
import org.apache.myfaces.renderkit.html.ext.HtmlTextRenderer;
import org.apache.myfaces.renderkit.html.util.AddResource;
import org.apache.myfaces.renderkit.html.util.AddResourceFactory;
import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
public class KeyStrokeValidatedInputRenderer extends HtmlTextRenderer implements AjaxRenderer {
public String getErrorMessageHTML(FacesContext context, UIComponent component) {
KeyStrokeValidatedInput ksv = (KeyStrokeValidatedInput) component;
Boolean ajaxEnabled = ksv.getAjaxEnabled();
MethodBinding mb = ksv.getValidatorMethod();
if (mb == null || !ajaxEnabled) return "";
return "";
}
private void encodeJavascript(FacesContext context, UIComponent component) {
KeyStrokeValidatedInput ksvi = (KeyStrokeValidatedInput) component;
Boolean ajaxEnabled = ksvi.getAjaxEnabled();
MethodBinding mb = ksvi.getValidatorMethod();
String javascriptLocation = (String)component.getAttributes().get(JSFAttr.JAVASCRIPT_LOCATION);
if (ajaxEnabled) {
//DojoUtils.addMainInclude(context, component, javascriptLocation, new DojoConfig());
} else {
AddResource addResource = AddResourceFactory.getInstance(context);
addResource.addJavaScriptToBodyTag(context,
component.getId() + "_" + mb.getExpressionString(),
mb.invoke(context, new Object[] {ksvi}).toString());
}
}
public void encodeAjax(FacesContext context, UIComponent component) throws IOException {
}
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
super.encodeEnd(context, component);
}
public void decode(FacesContext context, UIComponent uiComponent) {
super.decode(context, uiComponent);
}
}