3 Replies Latest reply on Dec 9, 2009 2:09 PM by Ilya Shaikovsky

    rich:progressBar

    Deb Dutta Novice

      I my application on click of a button some file writting operation will be done.

      I want to implement rich:progressBar for that purpose, so that after each file my progress unit will be incresed [and will be better if i can add the file name also wich currently is getting processed]

      can anybody help me with a sample code to to achive that. In demo site i think the progressbar is increased based on interval.

      Thanks in advance

        • 1. Re: rich:progressBar
          Ilya Shaikovsky Master

           



          can anybody help me with a sample code to to achive that. In demo site i think the progressbar is increased based on interval.


          progressBar just polls the server every interval in milis.. And it fetches some progress value holder. So just manage this property increasing it's value after every file and PB component will reflect it's changes.

          • 2. Re: rich:progressBar
            Deb Dutta Novice

             

            
             public Long getCurrentValue(){
             if (isEnabled()){
             Long current = (new Date().getTime() - startTime)/1000;
             if (current>100){
             setButtonRendered(true);
             }else if (current.equals(0)){
             return new Long(1);
             }
             return (new Date().getTime() - startTime)/1000;
             } if (startTime == null) {
             return Long.valueOf(-1);
             }
             else
             return Long.valueOf(101);
             }
            
            


            This is the method where the progress is getting counted by a time.

            and Long current = (new Date().getTime() - startTime)/1000;
            is the line where my progress value is getting increased. Instade of this how can i check with my files, if a file has been created i want to increased the progress bar. And after generating all the files the progressbar will show 100%...



            • 3. Re: rich:progressBar
              Ilya Shaikovsky Master

              yes.. that's what I meant - you should check some property which getting increased every time file created.