Remove Table Tag for RadioGroups in Read Mode for all instances


1a)
package com.uk.oval;

import java.io.IOException;
import java.io.Writer;
import javax.faces.component.UIComponent;
import com.ibm.xsp.component.xp.XspSelectOneRadio;
import javax.faces.context.FacesContext;
import com.ibm.xsp.renderkit.html_basic.RadioRenderer;

public class RadioGroupRenderer extends RadioRenderer {

	public void encodeEnd(FacesContext context, UIComponent component)
			throws IOException {
		Writer writer = context.getResponseWriter();
		XspSelectOneRadio obj = (XspSelectOneRadio) component;
		// if in read mode just print out the value
		if (obj.isReadonly()) {
			writer.write(obj.getValue().toString());
		} else {
			// if in edit mode then call the parent method to output as normal
			super.encodeEnd(context, component);
		}
	}
}

1b)
package com.uk.oval;

import java.io.IOException;
import java.io.Writer;
import javax.faces.component.UIComponent;
import com.ibm.xsp.component.xp.XspInputRadio;
import javax.faces.context.FacesContext;
import com.ibm.xsp.renderkit.html_extended.RadioRenderer;

public class RadioInputRenderer extends RadioRenderer {

	public void encodeEnd(FacesContext context, UIComponent component)
			throws IOException {
		Writer writer = context.getResponseWriter();
		XspInputRadio obj = (XspInputRadio) component;
		// if in read mode just print out the value
		if (obj.isReadonly()) {
			writer.write(obj.getValue().toString());
		} else {
			// if in edit mode then call the parent method to output as normal
			super.encodeEnd(context, component);
		}
	}
}

2)
    <renderer>
      <component-family>javax.faces.SelectOne</component-family>
      <renderer-type>com.uk.oval.type.Radio</renderer-type>
      <renderer-class>com.uk.oval.RadioGroupRenderer</renderer-class>
    </renderer>
    <renderer>
      <component-family>javax.faces.Input</component-family>
      <renderer-type>com.uk.oval.type.Radio</renderer-type>
      <renderer-class>com.uk.oval.RadioInputRenderer</renderer-class>
    </renderer>

3)
<control>
		<name>RadioButton</name>
		<property>
			<name>rendererType</name>
			<value>com.uk.oval.type.Radio</value>
		</property>
	</control>
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
No comments yetLogin first to comment...