2 Replies Latest reply on Jan 3, 2008 7:29 PM by Padraig Byrne

    cdk generated renderer extends 'AjaxComponentRendererBase' ,

    Padraig Byrne Newbie

      I want to develop an input component but cdk generated renderer always seems to extend 'AjaxComponentRendererBase' ,

      All inut based examples richfaces components seem to extend 'InputRendererBase' . How can I use InputRendererBase ? or is the richfaces renderer now all replaced by ajax4jsf renderers. If so what support exists in ajax4jsf for input based components ? & are there any examples

      If I change it manually in Renderer class it gets overwritten when I rebuild

      Note: I have changed UIcomponent class to extend UIInput

        • 1. Re: cdk generated renderer extends 'AjaxComponentRendererBas
          Nick Belaevski Master

           

          <f:root
           xmlns:f="http://ajax4jsf.org/cdk/template"
           xmlns:c=" http://java.sun.com/jsf/core"
           xmlns:ui=" http://ajax4jsf.org/cdk/ui"
           xmlns:u=" http://ajax4jsf.org/cdk/u"
           xmlns:x=" http://ajax4jsf.org/cdk/x"
           xmlns:h=" http://ajax4jsf.org/cdk/h"
           xmlns:vcp=" http://ajax4jsf.org/cdk/vcp"
           class="org.richfaces.renderkit.html.TreeRenderer"
           baseclass="org.richfaces.renderkit.TreeRendererBase"
           component="org.richfaces.component.UITree"
           >
          baseclass declaration controls that. You can also specify the class in configuration XML

          • 2. Re: cdk generated renderer extends 'AjaxComponentRendererBas
            Padraig Byrne Newbie

            Thanks Nick, New query

            Thanks Nick, Had just figured this out. I am now onto a new issue. The getter is getting called to initially set the right value in my input field based on EL expression referencing to backing bean
            but the value does not get set/updated in backing bean when I change it in my component & save the enclosing (a4j) form.


            -- code that is referencing my generated component -- ( note I have validated form & backing bean with inputSlider & other components )

            <mylib:colorpicker id="chartBackgroundColourPicker"
            color="#{chartBackgroundColor.value}" />

            I have

            1) changed base class to extend UIInput (See code below)
            2) I notice that if you do not want to save state you can specify transient ="true" so I explicitely set transient ="false" in config xml file (see code below)
            3) I have specified baseclass="org.richfaces.renderkit.InputRendererBase" in .jspx template file

            Is there anything else special that is required for an input component ?

            I have not added any abstract getter/setter methods in base component class. Are they required ?

            I initaly only had a 'value' property

            & could see no a setValue or getValue methods in mylib\target\generated-component\java\html\HtmlColorPicker.java

            but added a 'color' property for debug I notice I now have setColor & getcolor methods & when I run in debug mode with breakpoint sin both f these it stop in getter but never in setter even if I save form

            -- config code -- ( Do I need to specify anything extra ???)


            value
            java.lang.String
            colour represented as string
            "no color"


            color
            java.lang.String
            colour represented as string
            "no color"


            &ui_component_attributes;
            &html_events;
            &html_control_events;
            &html_style_attributes;
            &ajax_component_attributes;
            &ui_input_attributes;
            &ui_output_attributes;
            &html_input_events;

            -- base class in component directory

            // Removed this & relaced with following public abstract class UIColorpicker extends UIComponentBase {
            public abstract class UIColorpicker extends UIInput {

            Have not added any abstract getter/setter methods here. Are they required ?
            --

            -- template code -- (including debug)

            <f:clientid var="clientId" />
            <div id="#{clientId}" x:passThruWithExclusions="value,id,name,type">



            <input id="#{clientId}colorId" name="#{clientId}color" type="text" value="#{component.attributes['color']}" />




            I had some more code ,referencing javascript, but have removed to get a simple version operating as expected first