Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>We could fix the problem and correctly register our custom renderer.</p> <p>The problem was to find the correct properties for the intended renderer. Our tries were wrong, since I found out how to get the appropriate information. It's a bit of work and searching, but it finally did the trick.</p> <p>Just start your container in debug mode and add a breakpoint on class level into the derived class the custom renderer is based on (in my case com.icesoft.faces.renderkit.dom_html_basic.CheckboxRenderer). </p> <p>During container start-up this breakpoint will be reached and in the stacktrace you'll find a call of the method FacesConfigurator.configureRenderKits().</p> <p>This object contains an ArrayList of registered renderers. I searched the list for the renderer I'd have liked to overwrite and could find the informations I need to register my custom renderer. In my case this is the correct entry in faces-config.xml:</p> <pre><code>&lt;render-kit&gt; &lt;description&gt;The ICEsoft Renderers.&lt;/description&gt; &lt;render-kit-id&gt;ICEfacesRenderKit&lt;/render-kit-id&gt; &lt;render-kit-class&gt;com.icesoft.faces.renderkit.D2DRenderKit&lt;/render-kit-class&gt; &lt;renderer&gt; &lt;component-family&gt;javax.faces.SelectBoolean&lt;/component-family&gt; &lt;renderer-type&gt;com.icesoft.faces.Checkbox&lt;/renderer-type&gt; &lt;renderer-class&gt;com.myapp.web.util.CustomHtmlSelectBooleanCheckbox&lt;/renderer-class&gt; &lt;/renderer&gt; &lt;/render-kit&gt; </code></pre> <p>Now the getAsObject()-method in the converter is called by the custom renderer. Be sure to override the method correctly, in case you don't want a converter on every SelectBooleanCheckbox object:</p> <pre><code>public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException { Converter converter = ((ValueHolder) component).getConverter(); if (converter == null) { if(!(submittedValue instanceof String)) throw new ConverterException("Expecting submittedValue to be String"); else return Boolean.valueOf((String)submittedValue); } return converter.getAsObject(context, component, (String) submittedValue); } </code></pre> <p>Otherwise you'll get a NullPointerException.</p> <p>PS: There surely is a smarter way to achieve this information, but I am not smart enough. ;-)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload