Author: nbelaevski
Date: 2008-03-17 23:27:25 -0400 (Mon, 17 Mar 2008)
New Revision: 6884
Modified:
trunk/samples/suggestionbox-sample/src/main/java/org/richfaces/SuggestionBox.java
trunk/samples/suggestionbox-sample/src/main/webapp/pages/index.jsp
Log:
http://jira.jboss.com/jira/browse/RF-2344
Modified:
trunk/samples/suggestionbox-sample/src/main/java/org/richfaces/SuggestionBox.java
===================================================================
---
trunk/samples/suggestionbox-sample/src/main/java/org/richfaces/SuggestionBox.java 2008-03-17
20:11:25 UTC (rev 6883)
+++
trunk/samples/suggestionbox-sample/src/main/java/org/richfaces/SuggestionBox.java 2008-03-18
03:27:25 UTC (rev 6884)
@@ -21,13 +21,16 @@
package org.richfaces;
-import org.richfaces.renderkit.html.SuggestionBoxRenderer;
-
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.io.Serializable;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.renderkit.html.SuggestionBoxRenderer;
+
public class SuggestionBox implements Serializable {
private String property;
@@ -67,7 +70,11 @@
}
public List autocomplete(Object suggest) {
- String pref = (String)suggest;
+ FacesContext context = FacesContext.getCurrentInstance();
+ FacesMessage message = new FacesMessage("SuggestionBox.autocomplete(" +
suggest + ")");
+ context.addMessage(null, message);
+
+ String pref = (String)suggest;
ArrayList result = new ArrayList();
Iterator iterator = getAllData().iterator();
Modified: trunk/samples/suggestionbox-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/suggestionbox-sample/src/main/webapp/pages/index.jsp 2008-03-17 20:11:25
UTC (rev 6883)
+++ trunk/samples/suggestionbox-sample/src/main/webapp/pages/index.jsp 2008-03-18 03:27:25
UTC (rev 6884)
@@ -11,6 +11,11 @@
<body>
<f:view>
+
+<a4j:outputPanel ajaxRendered="true">
+ <h:messages />
+</a4j:outputPanel>
+
<h:form id="suggestionbox_form">
<h:selectOneRadio binding="#{skinBean.component}" />
<h:commandLink action="#{skinBean.change}" value="set skin" />
@@ -24,7 +29,7 @@
<br/>
<br/>
-<h:panelGrid columns="3" border="0" style="border: 1px solid
black;">
+<h:panelGrid columns="4" border="0" style="border: 1px solid
black;">
<f:verbatim>Suggestion Box will suggest you Town's names if it's
started with the "a" or
"A" letter</f:verbatim>
@@ -35,30 +40,58 @@
<f:verbatim> </f:verbatim>
- <h:inputText value="#{suggestionBox.property}" id="text"/>
- <rich:suggestionbox id="suggestionBoxId" for="text"
tokens=",["
- rules="#{suggestionBox.rules}"
- suggestionAction="#{suggestionBox.autocomplete}"
var="result"
- fetchValue="#{result.text}"
- first="#{suggestionBox.intFirst}"
- minChars="#{suggestionBox.minchars}"
- shadowOpacity="#{suggestionBox.shadowOpacity}"
- border="#{suggestionBox.border}"
- width="#{suggestionBox.width}"
- height="#{suggestionBox.height}"
- shadowDepth="#{suggestionBox.shadowDepth}"
- cellpadding="#{suggestionBox.cellpadding}">
+ <h:panelGroup>
+ <h:inputText value="#{suggestionBox.property}"
id="text"/>
+ <rich:suggestionbox id="suggestionBoxId" for="text"
tokens=",["
+ rules="#{suggestionBox.rules}"
+ suggestionAction="#{suggestionBox.autocomplete}"
var="result"
+ fetchValue="#{result.text}"
+ first="#{suggestionBox.intFirst}"
+ minChars="#{suggestionBox.minchars}"
+ shadowOpacity="#{suggestionBox.shadowOpacity}"
+ border="#{suggestionBox.border}"
+ width="#{suggestionBox.width}"
+ height="#{suggestionBox.height}"
+ shadowDepth="#{suggestionBox.shadowDepth}"
+ cellpadding="#{suggestionBox.cellpadding}">
+
+ <a4j:ajaxListener type="org.richfaces.AjaxListener"/>
+ <h:column>
+ <h:outputText value="#{result.text}"/>
+ </h:column>
+ <h:column>
+ <h:outputText value="#{result.price}">
+ <f:convertNumber pattern="#,##.00"
type="currency"/>
+ </h:outputText>
+ </h:column>
+ </rich:suggestionbox>
+ </h:panelGroup>
- <a4j:ajaxListener type="org.richfaces.AjaxListener"/>
- <h:column>
- <h:outputText value="#{result.text}"/>
- </h:column>
- <h:column>
- <h:outputText value="#{result.price}">
- <f:convertNumber pattern="#,##.00"
type="currency"/>
- </h:outputText>
- </h:column>
- </rich:suggestionbox>
+ <h:inputText value="#{suggestionBox.property}" id="text1">
+ <rich:suggestionbox id="suggestionBoxId1" tokens=",["
+ rules="#{suggestionBox.rules}"
+ suggestionAction="#{suggestionBox.autocomplete}"
var="result"
+ fetchValue="#{result.text}"
+ first="#{suggestionBox.intFirst}"
+ minChars="#{suggestionBox.minchars}"
+ shadowOpacity="#{suggestionBox.shadowOpacity}"
+ border="#{suggestionBox.border}"
+ width="#{suggestionBox.width}"
+ height="#{suggestionBox.height}"
+ shadowDepth="#{suggestionBox.shadowDepth}"
+ cellpadding="#{suggestionBox.cellpadding}">
+
+ <a4j:ajaxListener type="org.richfaces.AjaxListener"/>
+ <h:column>
+ <h:outputText value="#{result.text}"/>
+ </h:column>
+ <h:column>
+ <h:outputText value="#{result.price}">
+ <f:convertNumber pattern="#,##.00"
type="currency"/>
+ </h:outputText>
+ </h:column>
+ </rich:suggestionbox>
+ </h:inputText>
</h:panelGrid>
<br/>