[richfaces-issues] [JBoss JIRA] Commented: (RF-3013) a4j:push ALWAYS (not only if event occurs) rerendering specified components...
Alexander Smirnov (JIRA)
jira-events at lists.jboss.org
Wed Apr 9 18:50:54 EDT 2008
[ http://jira.jboss.com/jira/browse/RF-3013?page=comments#action_12408006 ]
Alexander Smirnov commented on RF-3013:
---------------------------------------
I can't reproduce this problem. In the my sample, requests performed after event only.
There is part of the my worked sample :
package org.ajax4jsf;
import java.util.ArrayList;
import java.util.Date;
import java.util.EventListener;
import java.util.EventObject;
import java.util.List;
import org.ajax4jsf.event.PushEventListener;
public class MessageBean implements Runnable {
private String result;
private boolean running = true;
private PushEventListener listener;
private List messages = new ArrayList(10);
private int counter = 0;
public MessageBean() {
// TODO Auto-generated constructor stub
}
/**
* @return the result
*/
public String getResult() {
return result;
}
/**
* @param result
* the result to set
*/
public void setResult(String result) {
this.result = result;
}
public void addListener(EventListener listener) {
synchronized (listener) {
if (this.listener != listener) {
this.listener = (PushEventListener) listener;
Thread th = new Thread(this);
th.start();
}
}
}
public void run() {
try {
while (isRunning()) {
Thread.sleep(10000);
Date current = new Date(System.currentTimeMillis());
if(messages.size()>=10){
messages.remove(0);
}
messages.add(messages.size(),String.valueOf(counter++)+" at "+current.toString());
System.out.println("event occurs");
synchronized (listener) {
listener.onEvent(new EventObject(this));
}
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
/**
* @return the running
*/
public synchronized boolean isRunning() {
return running;
}
/**
* @param running
* the running to set
*/
public synchronized void setRunning(boolean running) {
this.running = running;
}
/**
* @return the messages
*/
public List getMessages() {
return messages;
}
/**
* @param messages the messages to set
*/
public void setMessages(List messages) {
this.messages = messages;
}
}
XHTML Page content :
<!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:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:c="http://java.sun.com/jsp/jstl/core"
>
<head>
<title>AJAX Push demo</title>
</head>
<body>
<f:view>
<a4j:push reRender="msg" eventProducer="#{messageBean.addListener}" interval="3000"/>
<h:dataTable id="msg" value="#{messageBean.messages}" var="msg">
<f:facet name="header"><h2>Messags : </h2></f:facet>
<h:column>
Message :
</h:column>
<h:column>
<h:outputText value="#{msg}"></h:outputText>
</h:column>
</h:dataTable>
<h:form>
<a4j:status startText="Request started" stopText="stop."></a4j:status>
</h:form>
<a4j:log hotkey="M"></a4j:log>
</f:view>
</body>
</html>
> a4j:push ALWAYS (not only if event occurs) rerendering specified components...
> ------------------------------------------------------------------------------
>
> Key: RF-3013
> URL: http://jira.jboss.com/jira/browse/RF-3013
> Project: RichFaces
> Issue Type: Bug
> Affects Versions: 3.2.0.SR1, 3.2.1
> Environment: JDK 1.6
> JBOSS 4.0.3 SP1
> Facelets
> JSF-RI
> Reporter: Jens Behrens
> Assigned To: Tsikhon Kuprevich
> Priority: Critical
> Fix For: 3.2.1
>
>
> I tried the new classes from asmirnov, fixing the issue http://jira.jboss.com/jira/browse/RF-2960
> The eventProducer method is getting called now, but actually rerendering of specified components is happening always and not only if an event occurs via onEvent method of the listener...
> The component has interval 3000, so every 3 seconds the msg component is rerendered instead of checking if there actually is an event in queue.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the richfaces-issues
mailing list