8 Replies Latest reply on May 30, 2014 3:11 AM by Ferdinan Tolentino

    Migrating to RichFaces 4

    deeps p Newbie

      Hi,

       

      My aplplication is currently using RichFaces 3.3.3.Final.But I woul like to move to RF 4.0.0.Final.

       

      I modified my pom file entries.My pom file has the following entries now :

       

      <properties>

              .......

              <org.richfaces.bom.version>4.0.0.Final</org.richfaces.bom.version>

          </properties>

       

       

          <dependencyManagement>

              <dependencies>

                  <dependency>

                      <groupId>org.richfaces</groupId>

                      <artifactId>richfaces-bom</artifactId>

                      <version>${org.richfaces.bom.version}</version>

                      <scope>import</scope>

                      <type>pom</type>

                  </dependency>

              </dependencies>

          </dependencyManagement>

       

       

      <dependency>

                  <groupId>org.richfaces.core</groupId>

                  <artifactId>richfaces-core-impl</artifactId>

              </dependency>

       

              <dependency>

                  <groupId>org.richfaces.ui</groupId>

                  <artifactId>richfaces-components-ui</artifactId>

              </dependency>

       

      I am creating some pages dynamically.But my application is not compiling properly.It is giving errors like :

       

       

      HtmlAjaxCommandLink cannot be resolved to a type   

      HtmlAjaxSupport cannot be resolved to a type   

      HtmlPanel cannot be resolved to a type    

      HtmlSelect cannot be resolved to a type   

      HtmlTab cannot be resolved to a type   

      HtmlTabPanel cannot be resolved to a type

      HtmlTree cannot be resolved to a type   

       

      at places whre I matrying to create these components dynamically.

       

      From the reference pdf I got I could find that the class name and the package names I am using are correct.But these classes could not be found in the libs it seems.I downloaded the jars and I could not find these classes in the etracted jar files also.

       

      Also I would like to know what has happened to the following :

       

      DataProvider cannot be resolved to a type   

      ExtendedTableDataModel cannot be resolved to a type 

      NodeExpandedEvent cannot be resolved to a type

       

      It will be great if you can give me a reply.

       

      Thanks,

      Deeps.

        • 1. Migrating to RichFaces 4
          Ilya Shaikovsky Master

          1) new HtmlXComponent() - is not a good way to create components. JSF declares next official way to do that:

           

          Application.createComponent(FacesContext context, String componentType, String rendererType)

          in that case you could avoid some classloading problems while deploying to EAR and especially important in your case - will not depends on concrete implementation classes.

           

          Reference information such as component-type and renderer-type could be found at component reference documentation.

           

          2) DataProvider cannot be resolved to a type  

          Not implemented now. But in plans. Currently you should inject some own impl to data model.

           

          3) ExtendedTableDataModel cannot be resolved to a type

          use org.ajax4jsf.model.ExtendedDataModel<E> and the models which extends it.

           

          4) NodeExpandedEvent cannot be resolved to a type

          org.richfaces.event.TreeToggleEvent

          • 2. Re: Migrating to RichFaces 4
            deeps p Newbie

            hi,

            Thanks for the fast reply.So You mean to say you dont want to provide the components classes to the users to create these components as new HtmlXComponent().But can you please let me know then why for some classes like HtmlInputNumberSpinner etc. new HtmlInputNumberSpinner() is working in my application.

             

            Also I would like to know in case if we want to give binding to a component , say rich:select what should be the type of the binding component.

             

            I tried

            UIComponent combo = FacesContext.getCurrentInstance().getApplication()

                                                .createComponent("org.richfaces.select");

             

             

            But I will  have to typecast it to HtmlSelect so that I can set HtmlSelect specific attributes to the component like combo.setEnableManualInput(false);But that cannot be done since the class cannot be resolved.

             

            Also

            HtmlSelect menupanel = (HtmlSelect) FacesContext

                                                .getCurrentInstance()

                                                .getApplication()

                                                .createComponent(

                                                        FacesContext.getCurrentInstance(),

                                                        "org.richfaces.select",

                                                        "org.richfaces.renderkit.selectRenderer");

            is not working since the class cannot be resolved and createComponenet(FacesContext,String,String) cannot be found.Only

             

            UIComponent javax.faces.application.Application.createComponent(ValueBinding , FacesContext , String)

            UIComponent javax.faces.application.Application.createComponent(ValueExpression , FacesContext , String)

             

            Please help.

             

            Thanks,

            Deeps.

            • 3. Re: Migrating to RichFaces 4
              Ilya Shaikovsky Master

              ah.. sure.. my comment was mostly related to the creation of the component.  and yup.. in order to store component instance use corresponding UIXXComponent class. htmlComponentclass - renderkit specific and potentially has more chanses to be refactored as appeared during RF 4 migration.

               

              B.t.w. reference should probide that info too like:

               

              Unfortunatelly still could be some mistakes in reference so if something will not be found or you believe will be incorrect - please just notify us. (B.t.w. yup found that commandButton for example contains wrong info) so will rise discussion for that in the team. Thanks!

              • 4. Re: Migrating to RichFaces 4
                deeps p Newbie

                                    Thank you so much for the reply.Hope you will come up with a complete migration guide as soon as possible, which will include all the tag changes, attribute changes and the component usage changes.

                 

                 

                Can you please help me out for the following :

                 

                1)  what should be the parameter type of the Set that holds the ajaxNodeKeys for tree.TreeRowKey seems to be not able to resolve.

                2)  Is there a method which replaces getTreeNodeRowKey(TreeNode).This method is not available I guess.

                3) I could not find the component class corresponding to a4j:ajax. Can you please tell me whcih is the class or how can I add ajax support to a dynamically created component in RF4.

                 

                 

                Thanks,

                 

                Deeps.

                • 5. Re: Migrating to RichFaces 4
                  deeps p Newbie

                  Hi Ilya,

                   

                  Can you please give me a reply ?

                   

                  1)  what should be the parameter type of the Set that holds the ajaxNodeKeys for tree.TreeRowKey seems to be not able to resolve.

                  2)  Is there a method which replaces getTreeNodeRowKey(TreeNode).This method is not available I guess.

                  3) I could not find the component class corresponding to a4j:ajax. Can you please tell me whcih is the class or how can I add ajax support to a dynamically created component in RF4.

                   

                  Thanks,

                  Deeps.

                  • 6. Re: Migrating to RichFaces 4
                    Ilya Shaikovsky Master

                    1)  what should be the parameter type of the Set that holds the ajaxNodeKeys for tree.TreeRowKey seems to be not able to resolve.

                    2)  Is there a method which replaces getTreeNodeRowKey(TreeNode).This method is not available I guess.

                    need additional time to review that.

                     

                    3) I could not find the component class corresponding to a4j:ajax. Can you please tell me whcih is the class or how can I add ajax support to a dynamically created component in RF4.

                    JSF 2 introduced completelly new entity - "behavior" it's not a component so have no component class. http://java.dzone.com/articles/jsf-2-client-behaviors - more info.

                     

                    And you could add it by

                    Applcation.createBehavior(String behaviorId);

                    UIXXXComponent.addClientBehavior(eventName, behaviorInstance);

                    • 7. Re: Migrating to RichFaces 4
                      Nick Belaevski Master

                      Hi Deeps,

                       

                      Please make sure that  you are using FacesContext class from JSF 2.0 API, not 1.2.

                      • 8. Re: Migrating to RichFaces 4
                        Ferdinan Tolentino Newbie

                        How about NodeSelectedEvent in RF4?

                        Thanks!