Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 3.3
-
Fix Version/s: 4.0
-
Component/s: ACE-Components
-
Labels:None
-
Environment:Glassfish 3.1.2.2
-
Assignee Priority:P2
Description
In the sample code below the textChangeListener is executed whenever the user types in oder deletes a char. If the deleted char was the last char, the field will be blanc, but in this case the textChangeListener is not executed.
If the user types in "E", "i","n" and then presses delete key 3 times, the output is:
INFO: textChanged(TextChangeEvent):E
INFO: textChanged(TextChangeEvent):Ei
INFO: textChanged(TextChangeEvent):Ein
INFO: textChanged(TextChangeEvent):Ei
INFO: textChanged(TextChangeEvent):E
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ace="http://www.icefaces.org/icefaces/components"
xmlns:h="http://java.sun.com/jsf/html">
<h:head></h:head>
<h:body>
<h:form>
<ace:autoCompleteEntry value="#{bean.value}"
textChangeListener="#{bean.textChanged}"
minChars="1">
<f:selectItems value="#{bean.items}"/>
</ace:autoCompleteEntry>
<h:inputText />
</h:form>
</h:body>
</html>
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.model.SelectItem;
import org.icefaces.ace.event.TextChangeEvent;
@ManagedBean
@SessionScoped
public class Bean {
private String value;
private List<SelectItem> items = java.util.Arrays.asList(new SelectItem("Eins"), new SelectItem("Zwei"));
public void textChanged(TextChangeEvent e) {
System.out.println("textChanged(TextChangeEvent):" + e.getNewValue());
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public List<SelectItem> getItems() {
return items;
}
public void setItems(List<SelectItem> items) {
this.items = items;
}
}
This bug does not occur, if, for example, "minChars="1"" is omitted or is replaced by minChars="0".
In Addition: A Listener should not be called when no action occured. I think, this interferes with the implicit autocomplete ajax-request. What if the developer does not want this textChangeListener be called on every key event?
If the user types in "E", "i","n" and then presses delete key 3 times, the output is:
INFO: textChanged(TextChangeEvent):E
INFO: textChanged(TextChangeEvent):Ei
INFO: textChanged(TextChangeEvent):Ein
INFO: textChanged(TextChangeEvent):Ei
INFO: textChanged(TextChangeEvent):E
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ace="http://www.icefaces.org/icefaces/components"
xmlns:h="http://java.sun.com/jsf/html">
<h:head></h:head>
<h:body>
<h:form>
<ace:autoCompleteEntry value="#{bean.value}"
textChangeListener="#{bean.textChanged}"
minChars="1">
<f:selectItems value="#{bean.items}"/>
</ace:autoCompleteEntry>
<h:inputText />
</h:form>
</h:body>
</html>
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.model.SelectItem;
import org.icefaces.ace.event.TextChangeEvent;
@ManagedBean
@SessionScoped
public class Bean {
private String value;
private List<SelectItem> items = java.util.Arrays.asList(new SelectItem("Eins"), new SelectItem("Zwei"));
public void textChanged(TextChangeEvent e) {
System.out.println("textChanged(TextChangeEvent):" + e.getNewValue());
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public List<SelectItem> getItems() {
return items;
}
public void setItems(List<SelectItem> items) {
this.items = items;
}
}
This bug does not occur, if, for example, "minChars="1"" is omitted or is replaced by minChars="0".
In Addition: A Listener should not be called when no action occured. I think, this interferes with the implicit autocomplete ajax-request. What if the developer does not want this textChangeListener be called on every key event?
Confirmed to remain an issue using ICEfaces4 trunk r41836.