-
1. Re: <rich:progressBar actualValue does not work within for-l
andrei_exadel Oct 16, 2008 4:23 AM (in response to nimo22)I suppose that problem in synchronization of methods calls. Seems that your bean does not return progressBar's actual value before loop will be finished.
You should put job method in an another thread and set actual value by calling setActualValue. -
2. Re: <rich:progressBar actualValue does not work within for-l
panky_p Oct 16, 2008 7:10 AM (in response to nimo22)Hi, I am also having the same scenario.
Now as andrei_exadel suggested I give it try but no success.
What I am doing wrong??<a4j:outputPanel id="progressPanel"> <a4j:commandButton value="Start" action="#{myBean.startCount()}" /> <rich:progressBar value="#{myBean.counts}" enabled="true" label="#{myBean.counts} %" mode="ajax" minValue="-1" maxValue="100"/> </a4j:outputPanel>
and in managed beanpublic class MyBean{ ... public String startCount(){ .... MyThread newTh= MyThread(); newTh.start(); } public int getCount() { return emailSendingProgress; } public void setCount(int count) { this.count = count; } public class MyThread extends Thread{ public void run(){ for(int i=1; i<= 100; i++ ){ .... counts = i+1; ..... } } } }
Is there anything wrong???
Please help!!! -
3. Re: <rich:progressBar actualValue does not work within for-l
panky_p Oct 16, 2008 7:12 AM (in response to nimo22)Hi, I am also having the same scenario.
Now as andrei_exadel suggested I give it try but no success.
What I am doing wrong??<a4j:outputPanel id="progressPanel"> <a4j:commandButton value="Start" action="#{myBean.startCount()}" /> <rich:progressBar value="#{myBean.counts}" enabled="true" label="#{myBean.counts} %" mode="ajax" minValue="-1" maxValue="100"/> </a4j:outputPanel>
and in managed beanpublic class MyBean{ ... public String startCount(){ .... MyThread newTh= MyThread(); newTh.start(); } public int getCount() { return count; } public void setCount(int count) { this.count = count; } public class MyThread extends Thread{ public void run(){ for(int i=1; i<= 100; i++ ){ .... counts = i+1; ..... } } } }
Is there anything wrong???
Please help!!! -
4. Re: <rich:progressBar actualValue does not work within for-l
panky_p Oct 16, 2008 7:14 AM (in response to nimo22)sorry for re posting ...
Is there any way to remove duplicate messages??? -
5. Re: <rich:progressBar actualValue does not work within for-l
nimo22 Oct 16, 2008 11:27 AM (in response to nimo22)Hello,
I have done it without success:public bean() { public void increment(){ this.setActualValue(this.getActualValue+1); } public void doJob() { for (int i=1; i<= 10000; i++) { // call method this.increment(); } } }
andrei_exadel said:Seems that your bean does not return progressBar's actual value before loop will be finished.
In my console, I have logged the actualValue - the incremention works, but the progressBar cannot retrieve that value. I have tried to do it with the rich:poll-component and the same failure occurs. I also tried to set the interval higher or lower, without success.
I guess, a loop increments the actual value too fast, so the progressBar cannot update it properly.
So for what reason do I need the rich:progressBar, when it does NOT work within a loop ???? -
6. Re: <rich:progressBar actualValue does not work within for-l
nimo22 Oct 16, 2008 1:56 PM (in response to nimo22)I have found the reason:
Look at this:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=140796
I have the same failure:ConversationEndedTimedOutOrWasProcessingAnotherRequest
I found in the RichFaces Reference page 44 this:
"Queue and Traffic Flood Protection"
So I assume that I have to declare anything in the eventsQueue...HOW?
The rich:progressBar has the following property:eventsQueue:
Name of requests queue to avoid ...
It is not very comfortable...what (how) should I declare, that this process comes after that?
I cannot give the property such as:<rich:progressBar eventsQueue="doThisFirst, doThisAfter"
-
7. Re: <rich:progressBar actualValue does not work within for-l
panky_p Oct 17, 2008 2:32 AM (in response to nimo22)In for loop if we are not able to make use of rich:progressBar I think experts must have solution on this.
BTW making use of eventsQueue is not good idea as nimo22 saidIt is not very comfortable...what (how) should I declare, that this process comes after that?
By making use of threads also not much comfortable, as what i give in my last post it is not successful implementation.
Is there anyone in the forum who can explain, how to handle this situation??? -
8. Re: <rich:progressBar actualValue does not work within for-l
andrei_exadel Oct 17, 2008 3:22 AM (in response to nimo22)Guys,
Please start from your environment definition.
As I understood you use SEAM + RF.
In this case post your versions & conversation settings. -
9. Re: <rich:progressBar actualValue does not work within for-l
andrei_exadel Oct 17, 2008 3:23 AM (in response to nimo22)Anyway this code works in RF 3.2.2.GA + JSF 1.2_09 + Tomcat.
-
10. Re: <rich:progressBar actualValue does not work within for-l
panky_p Oct 17, 2008 6:12 AM (in response to nimo22)As I am using RF 3.2.1GA Seam 2.0 and JSF 1.2 with Jboss -4.2.0.GA.
I am using as stateful MyBean with the session scope. -
11. Re: <rich:progressBar actualValue does not work within for-l
nimo22 Oct 17, 2008 10:34 AM (in response to nimo22)I am using
- RichFaces 3.2.2.GA
- Seam 2.1
- JBOSS 4.2
All actual versions.
Thank you for helping -
12. Re: <rich:progressBar actualValue does not work within for-l
panky_p Oct 17, 2008 10:47 AM (in response to nimo22)Well but if problem seems to in call of methods which holds control.
What I want is after each iteration in for loop should increment the counter and the updated value should reflect immediately on browser, but it is not doing so.
Any suggestions??? -
13. Re: <rich:progressBar actualValue does not work within for-l
andrei_exadel Oct 17, 2008 11:58 AM (in response to nimo22)My code:
@Local public interface ITest { public void remove(); public Integer getValue(); public void setValue(Integer i); }
@Stateful @Name("testBean") @Scope(ScopeType.SESSION) @AutoCreate @SessionExpired public class Test implements ITest { Integer v; public Test() { MyThread t = new MyThread(); t.start(); } public class MyThread extends Thread { @Override public void run() { for (int i = 0; i < 100; i++) { v = i; try { sleep(1000); }catch (Exception e) { // TODO: handle exception } } } } /* (non-Javadoc) * @see org.richfaces.regressionarea.seam.interfaces.ITest#getValue() */ public Integer getValue() { // TODO Auto-generated method stub return v; } /* (non-Javadoc) * @see org.richfaces.regressionarea.seam.interfaces.ITest#remode() */ @Remove public void remove() { // TODO Auto-generated method stub } /* (non-Javadoc) * @see org.richfaces.regressionarea.seam.interfaces.ITest#setValue(java.lang.Integer) */ public void setValue(Integer i) { v = i; } }
Page:<body id="pgHome"> ... <f:view> <h:form id="_form"> Successfull <rich:progressBar value="#{testBean.value}" enabled="true"> <h:outputText value="{value}%"></h:outputText> </rich:progressBar> </h:form> </f:view> </body> ....
Environment: RF 3.2.2.GA, Seam 2.0.1, JBOSS-4.2.1, JSF 1.2_09
Projects packages as EAR with EJB support.
This code works for me. ProgressBar updates every second and shows value from 0 till 99. -
14. Re: <rich:progressBar actualValue does not work within for-l
nimo22 Oct 19, 2008 1:12 PM (in response to nimo22)Hello Andrei,
yes, your code works (for me, too:-)
The only difference I had, was that I outjected the progressbar s current value:
@Out
Integer v;
you have assigned explicitly getter/setter.
Strange..well, now it works.
thanks.