Author: ilya_shaikovsky
Date: 2008-08-29 09:50:37 -0400 (Fri, 29 Aug 2008)
New Revision: 10236
Added:
trunk/samples/richfaces-demo/src/main/webapp/images/icons/arrow.png
trunk/samples/richfaces-demo/src/main/webapp/richfaces/suggestionBox/examples/objects.xhtml
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/suggestionBox/examples/custom.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/suggestionBox/usage.xhtml
Log:
Added: trunk/samples/richfaces-demo/src/main/webapp/images/icons/arrow.png
===================================================================
(Binary files differ)
Property changes on: trunk/samples/richfaces-demo/src/main/webapp/images/icons/arrow.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/suggestionBox/examples/custom.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/richfaces/suggestionBox/examples/custom.xhtml 2008-08-29
13:01:44 UTC (rev 10235)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/suggestionBox/examples/custom.xhtml 2008-08-29
13:50:37 UTC (rev 10236)
@@ -44,10 +44,10 @@
<h:form id="suggestionbox_form">
<p>
- Suggestion Box will suggest you states capitals names. Comma and space could be used
as suggestions separators."
+ Suggestion Box will suggest you states capitals names. Comma and square brackets
could be used as suggestions separators."
</p>
<h:inputText value="#{capitalsBean.capital}" id="text" />
- <rich:suggestionbox id="suggestionBoxId" for="text"
tokens=",["
+ <rich:suggestionbox id="suggestionBoxId" for="text"
tokens=",[]"
rules="#{suggestionBox.rules}"
suggestionAction="#{capitalsBean.autocomplete}" var="result"
fetchValue="#{result.name}" rows="#{suggestionBox.intRows}"
Added:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/suggestionBox/examples/objects.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/richfaces/suggestionBox/examples/objects.xhtml
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/suggestionBox/examples/objects.xhtml 2008-08-29
13:50:37 UTC (rev 10236)
@@ -0,0 +1,38 @@
+<!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:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+
+ <ui:composition>
+ <script type="text/javascript">
+ function printObjectsSelected(output, sgcomponent){
+ output.innerHTML=sgcomponent.getSelectedItems().pluck('state');
+ }
+ </script>
+
+ <h:form id="form">
+ <h:panelGrid columns="2">
+ <h:outputText value="Input with states names suggestions"/>
+ <h:panelGrid columns="2" border="0" cellpadding="0"
cellspacing="0">
+ <h:inputText id="statesinput"/>
+ <h:graphicImage value="/images/icons/arrow.png"
onclick="#{rich:component('suggestion')}.callSuggestion(true)"/>
+ </h:panelGrid>
+ <h:outputText value="States capitals for suggested capitals"/>
+ <h:outputText id="objects" style="font-weight:bold"/>
+ </h:panelGrid>
+ <rich:suggestionbox height="200" width="150"
usingSuggestObjects="true"
onobjectchange="printObjectsSelected(#{rich:element('objects')},
#{rich:component('suggestion')});"
+ suggestionAction="#{capitalsBean.autocomplete}" var="cap"
for="statesinput" fetchValue="#{cap.name}" id="suggestion"
tokens=",">
+ <h:column>
+ <h:graphicImage value="#{cap.stateFlag}" />
+ </h:column>
+ <h:column>
+ <h:outputText value="#{cap.name}"/>
+ </h:column>
+ </rich:suggestionbox>
+ </h:form>
+ </ui:composition>
+
+</html>
\ No newline at end of file
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/suggestionBox/usage.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/richfaces/suggestionBox/usage.xhtml 2008-08-29
13:01:44 UTC (rev 10235)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/suggestionBox/usage.xhtml 2008-08-29
13:50:37 UTC (rev 10236)
@@ -30,6 +30,26 @@
</ui:include>
</div>
</fieldset>
+
+ <p>
+ And below there is second example of new JS API and Objects selection feature usage.
+ </p>
+ <p>
+ Just choose some state from suggestion and capital name property will be fetched
+ using client side API (Some of the capitals could be fetched separated with coma).
+ No requests need anymore. You could just store needed
+ properties in the same manner in hidden fields for example.
+ </p>
+ <fieldset class="demo_fieldset">
+ <legend class="demo_legend">Objects usage example</legend>
+ <div class="sample-container">
+ <ui:include src="/richfaces/suggestionBox/examples/objects.xhtml"/>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath"
value="/richfaces/suggestionBox/examples/objects.xhtml"/>
+ </ui:include>
+ </div>
+ </fieldset>
+
</ui:define>
</ui:composition>