[richfaces-svn-commits] JBoss Rich Faces SVN: r4596 - in branches/3.1.x/samples/richfaces-demo/src/main: java/org/richfaces/demo/tree and 5 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri Dec 7 12:31:31 EST 2007


Author: ilya_shaikovsky
Date: 2007-12-07 12:31:30 -0500 (Fri, 07 Dec 2007)
New Revision: 4596

Added:
   branches/3.1.x/samples/richfaces-demo/src/main/webapp/richfaces/orderingList.xhtml
   branches/3.1.x/samples/richfaces-demo/src/main/webapp/richfaces/orderingList/
   branches/3.1.x/samples/richfaces-demo/src/main/webapp/richfaces/orderingList/example/
   branches/3.1.x/samples/richfaces-demo/src/main/webapp/richfaces/orderingList/example/playlist.xhtml
   branches/3.1.x/samples/richfaces-demo/src/main/webapp/richfaces/orderingList/orderingList.xhtml
Modified:
   branches/3.1.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/common/ComponentNavigator.java
   branches/3.1.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Library.java
   branches/3.1.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Song.java
   branches/3.1.x/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties
   branches/3.1.x/samples/richfaces-demo/src/main/webapp/templates/include/components-navigation.xhtml
Log:
http://jira.jboss.com/jira/browse/RF-1191

Modified: branches/3.1.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/common/ComponentNavigator.java
===================================================================
--- branches/3.1.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/common/ComponentNavigator.java	2007-12-07 17:19:25 UTC (rev 4595)
+++ branches/3.1.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/common/ComponentNavigator.java	2007-12-07 17:31:30 UTC (rev 4596)
@@ -118,6 +118,10 @@
 		return ret;
 	}
 	
+	public List getSelectComponents() {
+		return getFilteredComponents("richSelect");
+	}
+	
 	public List getRichDragDropComponents() {
 		return getFilteredComponents("richDragDrop");
 	}

Modified: branches/3.1.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Library.java
===================================================================
--- branches/3.1.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Library.java	2007-12-07 17:19:25 UTC (rev 4595)
+++ branches/3.1.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Library.java	2007-12-07 17:31:30 UTC (rev 4596)
@@ -3,8 +3,10 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
 
@@ -111,7 +113,9 @@
 			} while (read>0);
 			String buf = os.toString();
 			StringTokenizer toc1 = new StringTokenizer(buf,"\n");
+			int index = 0;
 			while (toc1.hasMoreTokens()) {
+				index++;
 				String str = toc1.nextToken();
 				StringTokenizer toc2 = new StringTokenizer(str, "\t");
 				String songTitle = toc2.nextToken();
@@ -125,6 +129,7 @@
 				album.setYear(new Integer(albumYear));
 				Song song = new Song(getNextId());
 				song.setTitle(songTitle);
+				song.setTrackNumber(index);
 				album.addSong(song);
 			}
 		} catch (IOException e) {
@@ -144,4 +149,21 @@
 		this.state2 = state2;
 	}
 	
+	public void walk(TreeNode node, List<TreeNode> appendTo, Class<? extends TreeNode> type) {
+		if (type.isInstance(node)){
+			appendTo.add(node);
+		}
+		Iterator<Map.Entry<Object, TreeNode>> iterator = node.getChildren();
+		while(iterator.hasNext()) {
+			walk(iterator.next().getValue(), appendTo, type);
+		}
+		
+	}
+	
+	public ArrayList getLibraryAsList(){
+		ArrayList appendTo = new ArrayList();
+		walk(this, appendTo, Song.class);
+		return appendTo;
+	}
+	
 }

Modified: branches/3.1.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Song.java
===================================================================
--- branches/3.1.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Song.java	2007-12-07 17:19:25 UTC (rev 4595)
+++ branches/3.1.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Song.java	2007-12-07 17:31:30 UTC (rev 4596)
@@ -19,6 +19,13 @@
 	public Song(long id) {
 		this.id = id;
 	}
+
+	public Song(long id, int index) {
+		this.trackNumber=index;
+		this.id = id;
+		System.out.println(index);
+	}
+
 	
 	public void addChild(Object identifier, TreeNode child) {
 		throw new UnsupportedOperationException("Songs do not have children");

Modified: branches/3.1.x/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties
===================================================================
--- branches/3.1.x/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties	2007-12-07 17:19:25 UTC (rev 4595)
+++ branches/3.1.x/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties	2007-12-07 17:31:30 UTC (rev 4596)
@@ -69,4 +69,5 @@
 portlet=            ajaxMisc,             Ajax Portlet,         /images/ico_common.gif,                 /images/cn_AjaxPortlet.gif,              RichFacesComponentsLibrary.html#portlet,                                            jbossajax4jsf/freezone/docs/tlddoc/a4j/portlet.html,              jbossajax4jsf/freezone/docs/apidoc/org/ajax4jsf/ajax/UIPortlet.html,                           /richfaces/portlet.jsf
 effect=             richMisc,             Effect,               /images/ico_common.gif,                 /images/cn_Effect.gif,                   RichFacesComponentsLibrary.html#effect,                                             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_dropDownMenu.gif,           /images/cn_contextMenu.gif,             RichFacesComponentsLibrary.html\#contextMenu,                                        jbossrichfaces/freezone/docs/tlddoc/rich/contextMenu.html,        jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIContextMenu.html,                /richfaces/contextMenu.jsf
-componentControl=richMisc,        Component Control,    		/images/ico_common.gif,           		/images/cn_componentControl.gif,         RichFacesComponentsLibrary.html\#componentControl,                                 jbossrichfaces/freezone/docs/tlddoc/rich/componentControl.html,        jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIcomponentControl.html,                /richfaces/componentControl.jsf
\ No newline at end of file
+componentControl=	richMisc,            Component Control,    /images/ico_common.gif,           /images/cn_componentControl.gif,         RichFacesComponentsLibrary.html\#componentControl,                                 jbossrichfaces/freezone/docs/tlddoc/rich/componentControl.html,        jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIcomponentControl.html,                /richfaces/componentControl.jsf
+orderingList=		richSelect,          Ordering List,    /images/ico_DataTable.gif,           /images/cn_orderingList.gif,         RichFacesComponentsLibrary.html\#orderingList,                                 jbossrichfaces/freezone/docs/tlddoc/rich/orderingList.html,        jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIorderingList.html,                /richfaces/orderingList.jsf
\ No newline at end of file

Added: branches/3.1.x/samples/richfaces-demo/src/main/webapp/richfaces/orderingList/example/playlist.xhtml
===================================================================
--- branches/3.1.x/samples/richfaces-demo/src/main/webapp/richfaces/orderingList/example/playlist.xhtml	                        (rev 0)
+++ branches/3.1.x/samples/richfaces-demo/src/main/webapp/richfaces/orderingList/example/playlist.xhtml	2007-12-07 17:31:30 UTC (rev 4596)
@@ -0,0 +1,26 @@
+<ui:composition 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">
+	<style>
+	.cent{
+		text-align:center;
+	}
+</style>
+	<rich:orderingList value="#{library.libraryAsList}" var="lib" listHeight="300px">
+		<rich:column>
+		<f:facet name="header">
+			Song Name
+		</f:facet>
+			<h:outputText value="#{lib.title}"></h:outputText>
+		</rich:column>
+		<rich:column>
+			<f:facet name="header">
+				Album Title
+			</f:facet>
+			<h:outputText value="#{lib.album.title}"></h:outputText>
+		</rich:column>
+	</rich:orderingList>
+</ui:composition>
\ No newline at end of file

Added: branches/3.1.x/samples/richfaces-demo/src/main/webapp/richfaces/orderingList/orderingList.xhtml
===================================================================
--- branches/3.1.x/samples/richfaces-demo/src/main/webapp/richfaces/orderingList/orderingList.xhtml	                        (rev 0)
+++ branches/3.1.x/samples/richfaces-demo/src/main/webapp/richfaces/orderingList/orderingList.xhtml	2007-12-07 17:31:30 UTC (rev 4596)
@@ -0,0 +1,42 @@
+<!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 template="/templates/component-sample.xhtml">
+		<ui:define name="sample">
+			<p>
+				<b>orderingList</b> component allows to reorder items in a list. 
+			</p>
+			<p>
+				Ordering List could contain several columns in list representation. And it
+				also has strong keyboard support out of the box.
+			</p>
+			<p><b>Example.</b>Manage simple playlist represented via Ordering List:</p>
+			<div class="sample-container">
+				<ui:include src="/richfaces/orderingList/example/playlist.xhtml"/>
+				<ui:include src="/templates/include/sourceview.xhtml">
+					<ui:param name="sourcepath" value="/richfaces/orderingList/example/playlist.xhtml"/>
+				</ui:include>		 
+
+			</div>			
+			<p>
+				In this example you may select some songs (using mouse and Ctrl/Shift keys) and move them 
+				within the list using controls.
+			</p>
+			
+			<p>
+				Content definition for this component - analogous to any Iteration component.
+				So, all you need is define collection in Ordering List <b>value</b> attribute 
+				and iterate the collection in nested columns through <b>var</b> attribute.
+			</p>
+			<p>
+				In order to set initially selected rows or to process submitted selection - 
+				use <b>selection</b> attribute.
+			</p>
+		</ui:define>
+
+	</ui:composition>
+</html>

Added: branches/3.1.x/samples/richfaces-demo/src/main/webapp/richfaces/orderingList.xhtml
===================================================================
--- branches/3.1.x/samples/richfaces-demo/src/main/webapp/richfaces/orderingList.xhtml	                        (rev 0)
+++ branches/3.1.x/samples/richfaces-demo/src/main/webapp/richfaces/orderingList.xhtml	2007-12-07 17:31:30 UTC (rev 4596)
@@ -0,0 +1,20 @@
+<!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:rich="http://richfaces.org/rich">
+<ui:composition template="/templates/main.xhtml">
+	<ui:define name="title">RichFaces - Open Source Rich JSF Components - Ordering List Component</ui:define>
+	<ui:define name="body">
+		<rich:tabPanel switchType="server" styleClass="top_tab" contentClass="content_tab" headerClass="header_tabs_class"  inactiveTabClass="inactive_tab" activeTabClass="active_tab">
+			<rich:tab label="Usage">
+				<ui:include src="/richfaces/orderingList/orderingList.xhtml"/>
+			</rich:tab>			
+			<ui:include src="/templates/include/tagInfo.xhtml">
+				<ui:param name="path" value="rich/orderingList"/>
+			</ui:include>		
+		</rich:tabPanel>
+	</ui:define>
+</ui:composition>
+</html>

Modified: branches/3.1.x/samples/richfaces-demo/src/main/webapp/templates/include/components-navigation.xhtml
===================================================================
--- branches/3.1.x/samples/richfaces-demo/src/main/webapp/templates/include/components-navigation.xhtml	2007-12-07 17:19:25 UTC (rev 4595)
+++ branches/3.1.x/samples/richfaces-demo/src/main/webapp/templates/include/components-navigation.xhtml	2007-12-07 17:31:30 UTC (rev 4596)
@@ -7,7 +7,7 @@
 <ui:composition>            
 
 <rich:panel styleClass="panel_menu">
-<rich:panelBar selectedPanel="#{componentNavigator.currentComponent.group}" height="550" width="100%">
+<rich:panelBar selectedPanel="#{componentNavigator.currentComponent.group}" height="600" width="100%">
 	<rich:panelBarItem   id="ajaxSupport" label="Ajax Support">
 		<ui:include src="/templates/include/components-group.xhtml" >
  			<ui:param name="components" value="#{componentNavigator.ajaxSupport}" />
@@ -58,6 +58,11 @@
  			<ui:param name="components" value="#{componentNavigator.richInputs}" />
  		</ui:include>
 	</rich:panelBarItem>
+	<rich:panelBarItem id="richSelect" label="Rich Selects"> 
+		<ui:include src="/templates/include/components-group.xhtml" >
+ 			<ui:param name="components" value="#{componentNavigator.selectComponents}" />
+ 		</ui:include>
+	</rich:panelBarItem> 
 	<rich:panelBarItem id="richMisc" label="Rich Miscellaneous"> 
 		<ui:include src="/templates/include/components-group.xhtml" >
  			<ui:param name="components" value="#{componentNavigator.richMisc}" />




More information about the richfaces-svn-commits mailing list