Author: ilya_shaikovsky
Date: 2008-12-30 09:34:11 -0500 (Tue, 30 Dec 2008)
New Revision: 12074
Added:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/orderingList/
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/orderingList/SongConverter.java
trunk/samples/richfaces-demo/src/main/webapp/images/icons/ico_new_group.gif
trunk/samples/richfaces-demo/src/main/webapp/images/icons/ico_new_item.gif
trunk/samples/richfaces-demo/src/main/webapp/templates/include/navigationPanelHeader.xhtml
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Album.java
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Artist.java
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Library.java
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Song.java
trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/orderingList/example/playlist.xhtml
trunk/samples/richfaces-demo/src/main/webapp/templates/include/sourceview.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-5502
Added:
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
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/orderingList/SongConverter.java 2008-12-30
14:34:11 UTC (rev 12074)
@@ -0,0 +1,31 @@
+package org.richfaces.demo.orderingList;
+
+import java.util.StringTokenizer;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+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));
+ }
+
+ public String getAsString(FacesContext context, UIComponent component,
+ Object value) {
+ Song song = (Song)value;
+ return song.getId()+":" +
+ song.getTitle() + ":" +
+ song.getTrackNumber();
+ }
+
+}
Modified: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Album.java
===================================================================
---
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Album.java 2008-12-30
13:27:57 UTC (rev 12073)
+++
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Album.java 2008-12-30
14:34:11 UTC (rev 12074)
@@ -91,6 +91,5 @@
public String getType() {
return "album";
}
-
}
Modified: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Artist.java
===================================================================
---
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Artist.java 2008-12-30
13:27:57 UTC (rev 12073)
+++
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Artist.java 2008-12-30
14:34:11 UTC (rev 12074)
@@ -84,4 +84,5 @@
public String getType() {
return "artist";
}
+
}
Modified: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Library.java
===================================================================
---
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Library.java 2008-12-30
13:27:57 UTC (rev 12073)
+++
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Library.java 2008-12-30
14:34:11 UTC (rev 12074)
@@ -4,10 +4,13 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.StringTokenizer;
import org.richfaces.model.TreeNode;
@@ -20,7 +23,13 @@
private Map artists = null;
private Object state1;
private Object state2;
-
+ private List<Song> songsList;
+ private Set<Song> selectedSongsSet = new HashSet<Song>();
+ private List<Song> selectedSongsList = new ArrayList<Song>();
+ public Library() {
+ songsList = new ArrayList<Song>();
+ songsList.addAll(getLibraryAsList());
+ }
private Map getArtists() {
if (this.artists==null) {
initData();
@@ -162,4 +171,27 @@
walk(this, appendTo, Song.class);
return appendTo;
}
+ public List<Song> getSongsList() {
+ return songsList;
+ }
+ public void setSongsList(List<Song> songsList) {
+ this.songsList = songsList;
+ }
+ public void takeSelection() {
+ selectedSongsList.clear();
+ selectedSongsList.addAll(selectedSongsSet);
+ }
+ public Set<Song> getSelectedSongsSet() {
+ return selectedSongsSet;
+ }
+ public void setSelectedSongsSet(Set<Song> selectedSongsSet) {
+ this.selectedSongsSet = selectedSongsSet;
+ }
+ public List<Song> getSelectedSongsList() {
+ return selectedSongsList;
+ }
+ public void setSelectedSongsList(List<Song> selectedSongsList) {
+ this.selectedSongsList = selectedSongsList;
+ }
+
}
Modified: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Song.java
===================================================================
---
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Song.java 2008-12-30
13:27:57 UTC (rev 12073)
+++
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Song.java 2008-12-30
14:34:11 UTC (rev 12074)
@@ -16,6 +16,13 @@
private int trackNumber;
private Album album;
+ public Song(long id,String title,int num) {
+ this.id=id;
+ this.title=title;
+ this.genre=genre;
+ this.trackNumber=num;
+ }
+
public Song(long id) {
this.id = id;
}
@@ -94,4 +101,36 @@
public String getType() {
return "song";
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + ((title == null) ? 0 : title.hashCode());
+ result = prime * result + trackNumber;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final Song other = (Song) obj;
+ if (id != other.id)
+ return false;
+ if (title == null) {
+ if (other.title != null)
+ return false;
+ } else if (!title.equals(other.title))
+ return false;
+ if (trackNumber != other.trackNumber)
+ return false;
+ return true;
+ }
+
}
Modified: trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-12-30
13:27:57 UTC (rev 12073)
+++ trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-12-30
14:34:11 UTC (rev 12074)
@@ -6,6 +6,10 @@
<converter-id>listShuttleconverter</converter-id>
<converter-class>org.richfaces.demo.listShuttle.Converter</converter-class>
</converter>
+ <converter>
+ <converter-id>orderingListConverter</converter-id>
+
<converter-class>org.richfaces.demo.orderingList.SongConverter</converter-class>
+ </converter>
<managed-bean>
<managed-bean-name>loginbean</managed-bean-name>
<managed-bean-class>org.richfaces.demo.stateApi.Bean</managed-bean-class>
Added: trunk/samples/richfaces-demo/src/main/webapp/images/icons/ico_new_group.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/samples/richfaces-demo/src/main/webapp/images/icons/ico_new_group.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/richfaces-demo/src/main/webapp/images/icons/ico_new_item.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/samples/richfaces-demo/src/main/webapp/images/icons/ico_new_item.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
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
13:27:57 UTC (rev 12073)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/orderingList/example/playlist.xhtml 2008-12-30
14:34:11 UTC (rev 12074)
@@ -7,10 +7,14 @@
<style>
.cent{
text-align:center;
+ }
+ .top{
+ vertical-align:top;
}
</style>
<h:form>
- <rich:orderingList value="#{library.libraryAsList}" var="lib"
listHeight="300" listWidth="350">
+ <h:panelGrid columns="2" columnClasses="top, top">
+ <rich:orderingList value="#{library.songsList}" var="lib"
listHeight="300" listWidth="350"
converter="orderingListConverter"
selection="#{library.selectedSongsSet}">
<rich:column width="180">
<f:facet name="header">
<h:outputText value="Song Name" />
@@ -22,7 +26,16 @@
<h:outputText value="Artist Name" />
</f:facet>
<h:outputText value="#{lib.album.artist.name}"></h:outputText>
- </rich:column>
+ </rich:column>
+ <a4j:support event="onclick" requestDelay="500"
action="#{library.takeSelection}" reRender="output"/>
+ <a4j:support event="onkeyup" requestDelay="500"
action="#{library.takeSelection}" reRender="output"/>
</rich:orderingList>
+ <rich:panel id="output" header="Current Selection">
+ <rich:dataList value="#{library.selectedSongsList}" var="song"
rendered="#{not empty library.selectedSongsList}">
+ <h:outputText value="#{song.title}"></h:outputText>
+ </rich:dataList>
+ <h:outputText value="No Songs Selected" rendered="#{empty
library.selectedSongsList}"/>
+ </rich:panel>
+ </h:panelGrid>
</h:form>
</ui:composition>
\ No newline at end of file
Added:
trunk/samples/richfaces-demo/src/main/webapp/templates/include/navigationPanelHeader.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/templates/include/navigationPanelHeader.xhtml
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/webapp/templates/include/navigationPanelHeader.xhtml 2008-12-30
14:34:11 UTC (rev 12074)
@@ -0,0 +1,13 @@
+<ui:composition
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+ <table cellpadding="0" cellspacing="0"
width="100%">
+ <tbody>
+ <tr valign="middle">
+ <td width="100%" valign="middle">
+ <h:outputText value="#{label}"
style="font-family:Arial,Verdana,sans-serif; font-size:11px;"/>
+ </td>
+ <td align="right" valign="middle"><h:graphicImage
value="/images/icons/ico_new_group.gif"
rendered="#{isNew}"/></td>
+ </tr>
+ </tbody>
+ </table>
+</ui:composition>
Modified: trunk/samples/richfaces-demo/src/main/webapp/templates/include/sourceview.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/templates/include/sourceview.xhtml 2008-12-30
13:27:57 UTC (rev 12073)
+++
trunk/samples/richfaces-demo/src/main/webapp/templates/include/sourceview.xhtml 2008-12-30
14:34:11 UTC (rev 12074)
@@ -55,8 +55,8 @@
</a4j:outputPanel>
<a4j:outputPanel styleClass="viewsourcelooklink" id="look">
- <rich:effect for="look" event="onclick" type="Fade"
params="delay:0.0, duration:0.1" />
- <rich:effect for="look" event="onclick"
type="BlindDown" targetId="source1"
params="delay:0.1,duration:1.0,from:0.0,to:1.0" />
+ <rich:effect for="look" event="onclick" type="Fade"
params="delay:0.0, duration:0.1" disableDefault="true"/>
+ <rich:effect for="look" event="onclick"
type="BlindDown" targetId="source1"
params="delay:0.1,duration:1.0,from:0.0,to:1.0"/>
<rich:effect for="look" event="onclick"
type="Appear" targetId="source1"
params="delay:0.1,duration:0.5,from:0.0,to:1.0" />
<rich:effect for="look" event="onclick"
type="Appear" targetId="hide2"
params="delay:1.5,duration:1.0,from:0.0,to:1.0" />
<h:outputText escape="false" value="#{empty openlabel?'View
Source' : openlabel }" />