4 Replies Latest reply on Aug 21, 2008 7:25 PM by damianharvey.damianharvey.gmail.com

    rich:progressBar not included with seam?

    ganix

      Hi,
      i am using seam-2.0.3.CR1, JBossAS-4.2.3.GA and want to use the richfaces. Have seen the progressBar at the exadel live demo, and this is exactly what i need in my application. now, the problem is, the rich:progressBar tag can not be processed. :( other rich: and a4j: tags work, very strange.


      i found out, that the progressbar is not included in the richfaces-ui and -impl .jars that are shipped with seam. is there a special reason for this or can i upgrade the jars with the newest version in richfaces-ui-3.2.1.GA-bin.zip?


      Then i tried to replace the 3 jars, the tag seems to get rendered, but nothing is visible in the browser. the rendered html document in the browser shows some javascript method where the  progessbar should apear, but nothing visible.


      my .xhtml page is the one shown here:
      livedemo.exadel.com/richfaces-demo/richfaces/progressBar


      of course with adjustment for the name of my bean component.


      So my question is: Is there a way to show this progressbar in my browser using seam?
      What was wrong with my approach?

        • 1. Re: rich:progressBar not included with seam?
          damianharvey.damianharvey.gmail.com

          Show your code. It does work. Chances are that it's just not rendering.


          Cheers,


          Damian.

          • 2. Re: rich:progressBar not included with seam?
            ganix

            the richfaces .jars supplied with seam 2.0.3.CR1 definitively lacks of the rich:progressBar tag. it is simply not included in the rich namespace.


            Can you tell me please, which richfaces version includes the progressBar, and that you know is working with seam?


            the code of the xhtml page is just like the live demo at exadel. i can paste it here:


            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich">
            
                <h:form>
                    <a4j:outputPanel id="progressPanel">
                        <rich:progressBar value="#{progressBarBean.currentValue}"
                            interval="2000" label="#{progressBarBean.currentValue} %"
                            enabled="#{progressBarBean.enabled}" minValue="-1" maxValue="100"
                            reRenderAfterComplete="progressPanel">
                            <f:facet name="initial">
                                <br />
                                <h:outputText value="Process doesn't started yet" />
                                <a4j:commandButton action="#{progressBarBean.startProcess}"
                                    value="Start Process" reRender="progressPanel"
                                    rendered="#{progressBarBean.buttonRendered}"
                                    style="margin: 9px 0px 5px;" />
                            </f:facet>
                            <f:facet name="complete">
                                <br />
                                <h:outputText value="Process Done" />
                                <a4j:commandButton action="#{progressBarBean.startProcess}"
                                    value="Restart Process" reRender="progressPanel"
                                   rendered="#{progressBarBean.buttonRendered}"
                                    style="margin: 9px 0px 5px;" />
                            </f:facet>
                        </rich:progressBar>
                    </a4j:outputPanel>
                </h:form>
            </ui:composition>



            as mentioned above, using richfaces-ui-3.2.1.GA-bin.zip,
            there is no error at the jboss server log.
            my bean method is called, some javascript message gets rendered at the place of the progressBar tag in the rendered html page. but nothing is visible in the browser.
            :(

            • 3. Re: rich:progressBar not included with seam?
              ganix

              Maybe someone has a working example code for the progressBar using seam 2.0.3.CR1. I would be very grateful if someone could post it here.


              Even if it just shows up with a fixed value, without referencing a seam component, this would help me very much.

              • 4. Re: rich:progressBar not included with seam?
                damianharvey.damianharvey.gmail.com

                The following works well for me and I'll be using it in my app. Note that it's a mix of the client and ajax approaches. It seems more logical to me as your progress bar can be somewhere else on the page (eg. in the modal).


                <h:form id="form">
                     <rich:modalPanel
                          tridentIVEngineSelectBehavior="hide"
                          id="progressBarModal"
                          height="50"
                          width="220"
                          zindex="2000">
                          <h:outputText value="Progress:"/>
                          <rich:progressBar id="progressBarTest" value="#{testProgBar.progress}"
                          interval="500" label="#{testProgBar.progress} %"
                          enabled="false" minValue="0" maxValue="100"/>
                     </rich:modalPanel>
                     <a:commandButton 
                          action="#{testProgBar.go()}" 
                          value="Go" 
                          onclick="
                               Richfaces.showModalPanel('progressBarModal');
                               $('form:progressBarTest').component.setValue(0);
                               $('form:progressBarTest').component.enable();" 
                          oncomplete="
                               $('form:progressBarTest').component.disable();
                               Richfaces.hideModalPanel('progressBarModal');"/>
                </h:form>
                


                And a basic Bean:


                @Name("testProgBar")
                @Scope(ScopeType.PAGE)
                public class TestProgBar {
                
                     private int progress = 0;
                     
                     public void go() {
                          System.out.println("Starting Progress Test");
                          progress = 0;
                          
                          while(progress < 100) {
                               try {
                                    Thread.sleep(100);
                               } catch(InterruptedException e) {}
                               
                               progress++;
                               System.out.println("Progress = "+progress);
                          }
                          
                          System.out.println("Finished Progress Test");
                     }
                     
                     public int getProgress() {
                          return this.progress;
                     }
                
                     public void setProgress(int progress) {
                          this.progress = progress;
                     }
                
                     public static void main(String[] args) {
                          new TestProgBar().go();
                     }
                }
                


                Points to note :



                1. Scope your Bean so that the polling is calling the same Bean as what is running (ie. don't use ScopeType.EVENT)

                2. The setValue() javascript method seems to restart the polling so don't do this after you complete the action or your polling will just keep on trucking.

                3. I had some issues with the bar not rendering when the min value is zero and you don't set a value. Setting the min to -1 seemed to clear this up (As you can see I didn't need it in the end).



                Hope this helps.


                Cheers,


                Damian.