Reputation: 878
The XPages renderer for a radio group put everything into tables and is basically terrible. I'm trying to fix this with a custom renderer. I've tried a lot of things but right now I'm stuck because I simply have no information to go further.
My renderer is declared in faces-config like so:
<renderer>
<component-family>javax.faces.SelectOne</component-family>
<renderer-type>itd.alcs.controller.Radio</renderer-type>
<renderer-class>itd.alcs.controller.RadioGroupRenderer</renderer-class>
</renderer>
<renderer>
<component-family>javax.faces.Input</component-family>
<renderer-type>itd.alcs.controller.Radio</renderer-type>
<renderer-class>itd.alcs.controller.RadioGroupRenderer</renderer-class>
</renderer>
My renderer code is:
public class RadioGroupRenderer extends com.ibm.xsp.renderkit.html_basic.RadioRenderer {
public RadioGroupRenderer() {
System.out.println("RadioGroupRenderer");
}
@Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
System.out.println("encodeBegin");
super.encodeBegin(context, component);
}
@Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
System.out.println("encodeEnd");
Writer writer = context.getResponseWriter();
XspSelectOneRadio tcomponent = component instanceof XspSelectOneRadio ? (XspSelectOneRadio) component : null;
if (tcomponent == null) {
System.out.println("Nothing");
writer.write("Nothing");
}
if (tcomponent.isReadonly()) {
// writer.write(tcomponent.getValue().toString());
System.out.println("Read Only");
writer.write("Read Only");
} else {
//super.encodeEnd(context, component);
System.out.println("Edit");
writer.write("Edit");
}
}
}
Something is happening when I apply this renderer-type. And that something is that I get no output. Nothing in my response. No errors in the console. None of the console messages I put in in the constructor or encodeBegin or encodeEnd.
If I change the name of the renderer-type or renderer-class to something invalid... still nothing. No errors, no output. I don't know if something is trapping my error and handling them silently or.... what?
How can I figure out what I'm doing wrong here? Bonus points if you can TELL me what I'm doing wrong, but what I really want to know is how to get some sort of feedback to troubleshoot this myself.
Upvotes: 1
Views: 139
Reputation: 878
Answering my own question in case anyone else runs into this....
The <renderer>...</renderer>
tags need to go inside <render-kit></render-kit>
tags. You'd think I'd have come across that in 4 hours of searching, but no.
Upvotes: 2