-
1. How to show progress value on rich:modalPanel
ilya40umov Jan 20, 2011 10:23 AM (in response to topfan)Look at these links:
http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/a4j_poll.html
http://livedemo.exadel.com/richfaces-demo/richfaces/poll.jsf?c=poll
I guess it should help.
-
2. How to show progress value on rich:modalPanel
topfan Jan 21, 2011 9:43 AM (in response to ilya40umov)Thanks a lot :-)
-
3. How to show progress value on rich:modalPanel
topfan Jan 28, 2011 9:47 AM (in response to ilya40umov)Another problem, i'm afraid.
If i set to "true" the enabled attribute of a4j:poll, it work but the poll never stop.
But if i set the enabled attribute to bean property, the poll start only at the end of request. Belowe my code:
xhtml page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html 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:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j">
<ui:composition>
<f:view>
<h:form>
<a4j:poll id="poll" interval="500" enabled="#{pc_Prova.enabled}"
reRender="clock" timeout="20000" />
</h:form>
<h:form>
<h:panelGrid columns="2">
<h:panelGrid columns="2">
<a4j:commandButton value="Start Clock"
action="#{pc_Prova.startClock}" reRender="poll"
status="waitStatus" ajaxSingle="true">
<a4j:actionparam name="disabled" value="true"
assignTo="#{pc_Prova.enabled}"></a4j:actionparam>
</a4j:commandButton>
</h:panelGrid>
</h:panelGrid>
<a4j:status id="waitStatus" forceId="true" layout="block"
onstart="javascript:Richfaces.showModalPanel('waitModalPanel');"
onstop="javascript:Richfaces.hideModalPanel('waitModalPanel');" />
<rich:modalPanel id="waitModalPanel" autosized="true" width="300"
height="70" moveable="true" resizeable="false"
style="text-align: center;">
<f:facet name="header">
<h:outputText id="txtHeaderWait" value="Attendere" />
</f:facet>
<h:outputText id="label" value="Secondi trascorsi: "></h:outputText>
<h:outputText id="clock" value="#{pc_Prova.counter}" />
<a4j:commandButton value="Stop Clock" action="#{pc_Prova.stopClock}"
reRender="poll">
<a4j:actionparam name="enabled" value="false"
assignTo="#{pc_Prova.enabled}"></a4j:actionparam>
</a4j:commandButton>
</rich:modalPanel>
</h:form>
</f:view>
</ui:composition>
</html>
Java code:
=======
package pagecode;
public class Prova extends PageCodeBase {
protected String counter;
private boolean enabled;
public boolean isEnabled() {
return enabled;
}
public String getCounter() {
return counter;
}
public void setCounter(String counter) {
this.counter = counter;
}
public String stopClock() {
enabled = false;
counter = null;
return null;
}
public String startClock() throws InterruptedException {
enabled = true;
for (int i = 0; i < 20; i++) {
counter = String.valueOf(i);
Thread.sleep(1000);
if (!enabled) {
counter = null;
return null;
}
}
counter = null;
return null;
}
}
Any suggestions?
Thanks in advance
-
4. How to show progress value on rich:modalPanel
ilya40umov Jan 28, 2011 9:59 AM (in response to topfan)Take a look at this link:
http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/a4j_poll.html
It contains an example how to disable a4j:poll
-
5. How to show progress value on rich:modalPanel
ilya40umov Jan 28, 2011 10:00 AM (in response to ilya40umov)Ooops. I see that you are already aware of this link. =)
-
6. How to show progress value on rich:modalPanel
ilya40umov Jan 28, 2011 10:56 AM (in response to ilya40umov)But if i set the enabled attribute to bean property, the poll start only at the end of request. Belowe my code:
When do want it to start pulling?
-
7. How to show progress value on rich:modalPanel
topfan Jan 30, 2011 4:18 PM (in response to ilya40umov)When i click on "Start Clock" ajax request start and start my java process ( counter ) that show modal panel.
If the enabled property of poll is set to "true" it work, the progress counter is shown on modal panel, but generates too much server request.
But if the enabled property is set to "#{pc_Prova.enabled}", it does not work because the polling is not active.
My question is:
Is it possible to start polling when start java process, show the progress counter on the modal panel, stop polling and hide modal panel at the end of process?
Thanks for your answer.
-
8. How to show progress value on rich:modalPanel
ilya40umov Jan 31, 2011 1:39 AM (in response to topfan)Why can't you just set "#{pc_Prova.enabled}" to true and reRender a4j:poll when you need it to be started and set "#{pc_Prova.enabled}" to false and reRender a4j:poll when you need it to be stopped?
P.S. Take a look at this link(It's about JS api):
-
9. How to show progress value on rich:modalPanel
topfan Jan 31, 2011 5:44 AM (in response to ilya40umov)I'm usin RF 3.1.6 so A4J.AJAX.StartPoll is not present.
Unfortunatelly A4J.AJAX.StopPoll, in my code, does not work :-(
Code:
...........
<a4j:region id="region">
<h:form id="pollForm">
<a4j:poll id="poll" interval="500" enabled="true" reRender="poll,clock"
timeout="20000" />
</h:form>
</a4j:region>
.........................................................................................................................
.........................................................................................................................
<a4j:commandButton value="Stop Clock" action="#{pc_Prova.stopClock}"
reRender="poll,clock" onclick="A4J.AJAX.StopPoll('pollForm:poll');">
<a4j:actionparam name="enabled" value="false"
assignTo="#{pc_Prova.enabled}"></a4j:actionparam>
</a4j:commandButton>
When i click on "Stop Clock" the polling do not stop.
Something wrong?
Suggestion?
Thanks.
topfan