0
votes

I have read the interesting articles about creating custom renderer from Naveen Maurya, Keith Strickland and Martin Rolph and was wondering if it's possible to do the same with custom controls and XPages.

I found the renderer class for custom control is com.ibm.xsp.Include for custom controls and com.ibm.xsp.ViewRootEx for XPages but those classes cannot be found by Eclipse.

What I would like to do if possible, is modify the generated html the same way Martin Rolph and Keith Strickland did in their example but at the custom control and/or xPage level to do my changes once and not for each custom control.

1
You should look at this project: bootstrap4xpages.openntf.orgFrantisek Kossuth
I will check this project. Thanks for the tip.Renaud Thiévent

1 Answers

4
votes

com.ibm.xsp.Include and com.ibm.xsp.ViewRootEx are renderer type of Custom Control and XPage respectively. Renderer type is not a Java class (though from naming convention it may look like one). Renderer's Java class is defined in <renderer-class> tag like in the example given below.

<render-kit>
  <renderer>
    <component-family>javax.faces.SelectOne</component-family>
    <renderer-type>uk.co.pipalia.type.ReadOnlyRenderer</renderer-type>
    <renderer-class>uk.co.pipalia.ReadOnlyRenderer</renderer-class>
  </renderer>
</render-kit>

To get the name of the associated renderer Java class for any control you can use the following piece of code:

getComponent("controlName").getRenderer(facesContext).getRenderer().getClass().getName();

For XPage the renderer class is com.ibm.xsp.renderkit.html_basic.ViewRootRendererEx2 and Custom Control the renderer class is com.ibm.xsp.renderkit.html_basic.IncludeRenderer.

You can now use extend these classes like Martin and Keith do to generate your own custom HTML.