Author: ilya_shaikovsky
Date: 2008-12-30 10:52:15 -0500 (Tue, 30 Dec 2008)
New Revision: 12077
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/orderingList/SongConverter.java
trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties
trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/web.xml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/orderingList/example/playlist.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-5502
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/orderingList/SongConverter.java
===================================================================
---
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/orderingList/SongConverter.java 2008-12-30
15:49:07 UTC (rev 12076)
+++
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/orderingList/SongConverter.java 2008-12-30
15:52:15 UTC (rev 12077)
@@ -2,30 +2,44 @@
import java.util.StringTokenizer;
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
+import org.richfaces.demo.stateApi.Bean;
+import org.richfaces.demo.tree.Library;
import org.richfaces.demo.tree.Song;
public class SongConverter implements Converter{
public Object getAsObject(FacesContext context, UIComponent component,
String value) {
- StringTokenizer tokenizer = new StringTokenizer(value,":");
- String id,title,genre,num;
- id = tokenizer.nextToken();
- title = tokenizer.nextToken();
- num = tokenizer.nextToken();
- return new Song(Long.parseLong(id),title,Integer.parseInt(num));
+ long id = Long.parseLong(value);
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ExpressionFactory expressionFactory = facesContext.getApplication()
+ .getExpressionFactory();
+
+ ValueExpression beanExpression = expressionFactory
+ .createValueExpression(facesContext.getELContext(),
+ "#{library}", Library.class);
+
+ Library library = (Library)beanExpression.getValue(facesContext.getELContext());
+ for (Song song : library.getSongsList()) {
+ if (song.getId() == id){
+ return song;
+ }
+
+ }
+
+ return null;
}
public String getAsString(FacesContext context, UIComponent component,
Object value) {
Song song = (Song)value;
- return song.getId()+":" +
- song.getTitle() + ":" +
- song.getTrackNumber();
+ return new Long(song.getId()).toString();
}
}
Modified:
trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties
===================================================================
---
trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties 2008-12-30
15:49:07 UTC (rev 12076)
+++
trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties 2008-12-30
15:52:15 UTC (rev 12077)
@@ -70,7 +70,7 @@
effect= richMisc, Effect, /images/ico_common.gif,
/images/cn_Effect.gif, effect.html,
jbossrichfaces/freezone/docs/tlddoc/rich/effect.html,
jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIEffect.html,
/richfaces/effect.jsf
contextMenu= richMenu, Context Menu, /images/ico_ContextMenu.gif,
/images/cn_contextMenu.gif, contextMenu.html,
jbossrichfaces/freezone/docs/tlddoc/rich/contextMenu.html,
jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIContextMenu.html,
/richfaces/contextMenu.jsf
componentControl=richMisc, Component Control, \t/images/ico_common.gif,
\t\t/images/cn_componentControl.gif, componentControl.html,
jbossrichfaces/freezone/docs/tlddoc/rich/componentControl.html,
jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIComponentControl.html,
/richfaces/componentControl.jsf
-orderingList=richSelect, Ordering List, \t\t/images/ico_OrderingList.gif,
\t/images/cn_orderingList.gif, orderingList.html,
jbossrichfaces/freezone/docs/tlddoc/rich/orderingList.html,
jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIOrderingList.html,
\t\t/richfaces/orderingList.jsf
+orderingList=richSelect, Ordering List, \t\t/images/ico_OrderingList.gif,
\t/images/cn_orderingList.gif, orderingList.html,
jbossrichfaces/freezone/docs/tlddoc/rich/orderingList.html,
jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIOrderingList.html,
\t\t/richfaces/orderingList.jsf, new
listShuttle=richSelect, List Shuttle, \t\t/images/ico_ListShuttle.gif,
/images/cn_listShuttle.gif, listShuttle.html,
jbossrichfaces/freezone/docs/tlddoc/rich/listShuttle.html,
jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIListShuttle.html,
\t\t/richfaces/listShuttle.jsf
pickList=richSelect, Pick List, \t\t\t/images/ico_pickList.gif,
/images/cn_PickList.gif, pickList.html,
jbossrichfaces/freezone/docs/tlddoc/rich/pickList.html,
\t\tjbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIPickList.html,
\t\t\t\t/richfaces/pickList.jsf
progressBar=richOutputs, Progress Bar, \t\t/images/ico_progressBar.gif,
/images/cn_ProgressBar.gif, progressBar.html,
jbossrichfaces/freezone/docs/tlddoc/rich/progressBar.html,
\t\tjbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIProgressBar.html,
\t/richfaces/progressBar.jsf
Modified: trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/web.xml 2008-12-30 15:49:07 UTC
(rev 12076)
+++ trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/web.xml 2008-12-30 15:52:15 UTC
(rev 12077)
@@ -58,7 +58,7 @@
</context-param>
<context-param>
<param-name>org.richfaces.LoadScriptStrategy</param-name>
- <param-value>DEFAULT</param-value>
+ <param-value>ALL</param-value>
</context-param>
<filter>
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/orderingList/example/playlist.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/richfaces/orderingList/example/playlist.xhtml 2008-12-30
15:49:07 UTC (rev 12076)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/orderingList/example/playlist.xhtml 2008-12-30
15:52:15 UTC (rev 12077)
@@ -10,10 +10,16 @@
}
.top{
vertical-align:top;
- }
+ }
+ .70per{
+ width:70%;
+ }
+ .30per{
+ width:200px;
+ }
</style>
<h:form>
- <h:panelGrid columns="2" columnClasses="top, top">
+ <h:panelGrid columns="2" columnClasses="top 70per, top 30per"
width="100%">
<rich:orderingList value="#{library.songsList}" var="lib"
listHeight="300" listWidth="350"
converter="orderingListConverter"
selection="#{library.selectedSongsSet}">
<rich:column width="180">
<f:facet name="header">
@@ -21,16 +27,16 @@
</f:facet>
<h:outputText value="#{lib.title}"></h:outputText>
</rich:column>
- <rich:column>
+ <rich:column>
<f:facet name="header">
<h:outputText value="Artist Name" />
</f:facet>
- <h:outputText value="#{lib.album.artist.name}"></h:outputText>
+ <h:outputText
value="#{lib.album.artist.name}"></h:outputText><br/>
</rich:column>
- <a4j:support event="onclick" requestDelay="500"
action="#{library.takeSelection}" reRender="output"/>
- <a4j:support event="onkeyup" requestDelay="500"
action="#{library.takeSelection}" reRender="output"/>
+ <a4j:support event="onclick" ignoreDupResponses="true"
requestDelay="500" action="#{library.takeSelection}"
reRender="output"/>
+ <a4j:support event="onkeyup" ignoreDupResponses="true"
requestDelay="500" action="#{library.takeSelection}"
reRender="output"/>
</rich:orderingList>
- <rich:panel id="output" header="Current Selection">
+ <rich:panel id="output" header="Current Selection"
style="width:200px">
<rich:dataList value="#{library.selectedSongsList}" var="song"
rendered="#{not empty library.selectedSongsList}">
<h:outputText value="#{song.title}"></h:outputText>
</rich:dataList>