Probleme avec ProgressBar de Richfaces
Bonjour,
J'ai essayé d'implémenter une ProgressBar de la librairie richfaces en reprenant exactement leurs code disponible sur le net, mais cela ne marche pas et ça ne me génère pas le bon code HTML/AJAX !!! ça me sort qu'un page blanche avec un simplz trait !!!!! Voila le code que j'ai:
La page XHTML:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| <!DOCTYPE composition
PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<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:outputText id="uploadProgressLabel" value="#{progressBarBean.currentValue}" />
<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">
<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;" />
<br />
<h:outputText value="Process Done" />
<a4j:commandButton action="#{progressBarBean.startProcess}"
value="Restart Process" reRender="progressPanel"
rendered="#{progressBarBean.buttonRendered}"
style="margin: 9px 0px 5px;" />
</rich:progressBar>
</a4j:outputPanel>
</h:form>
</ui:composition> |
et Voila mon Bean:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
| import java.util.Date;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
@Name("progressBar")
@Scope(ScopeType.SESSION)
public class ProgressBarBean
{
private boolean buttonRendered = true;
private Long currentValue;
private boolean enabled = false;
private Long startTime;
public Long getCurrentValue()
{
if (isEnabled())
{
Long current = (new Date().getTime() - startTime) / 1000;
if (current > 100)
{
setButtonRendered(true);
}
else if (current.equals(0))
{
System.out.println("called");
currentValue = new Long(1);
}
currentValue = (new Date().getTime() - startTime) / 1000;
}
if (startTime == null)
{
currentValue = Long.valueOf(-1);
}
else
{
currentValue = Long.valueOf(101);
}
return currentValue;
}
public Long getStartTime()
{
return startTime;
}
public boolean isButtonRendered()
{
return buttonRendered;
}
public boolean isEnabled()
{
return enabled;
}
public void setButtonRendered(boolean buttonRendered)
{
this.buttonRendered = buttonRendered;
}
public void setcurrentValue(Long currentValue)
{
this.currentValue = currentValue;
}
public void setEnabled(boolean enabled)
{
this.enabled = enabled;
}
public void setStartTime(Long startTime)
{
this.startTime = startTime;
}
public String startProcess()
{
setEnabled(true);
setButtonRendered(false);
setStartTime(new Date().getTime());
return null;
}
} |
Merci pour l'aide