[richfaces-svn-commits] JBoss Rich Faces SVN: r2845 - in trunk/samples/richfaces-demo/src/main: webapp/WEB-INF and 2 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Mon Sep 10 13:32:50 EDT 2007


Author: nbelaevski
Date: 2007-09-10 13:32:50 -0400 (Mon, 10 Sep 2007)
New Revision: 2845

Removed:
   trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/IdentifierTreeNode.java
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/tree/examples/ajaxTree.xhtml
   trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/clientTree.xhtml
   trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/serverTree.xhtml
   trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/usage.xhtml
Log:
DnD Tree sample reverted

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	2007-09-10 16:58:18 UTC (rev 2844)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Album.java	2007-09-10 17:32:50 UTC (rev 2845)
@@ -6,7 +6,7 @@
 
 import org.richfaces.model.TreeNode;
 
-public class Album implements IdentifierTreeNode {
+public class Album implements TreeNode {
 	/**
 	 * 
 	 */
@@ -23,9 +23,9 @@
 	
 	public void addSong(Song song) {
 		addChild(Long.toString(song.getId()), song);
+		song.setParent(this);
 	}
 	public void addChild(Object identifier, TreeNode child) {
-		child.setParent(this);
 		songs.put(identifier, child);
 	}
 

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	2007-09-10 16:58:18 UTC (rev 2844)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Artist.java	2007-09-10 17:32:50 UTC (rev 2845)
@@ -6,7 +6,7 @@
 
 import org.richfaces.model.TreeNode;
 
-public class Artist implements IdentifierTreeNode {
+public class Artist implements TreeNode {
 	private long id;
 	private Map albums = new HashMap();
 	private String name;
@@ -24,10 +24,10 @@
 
 	public void addAlbum(Album album) {
 		addChild(Long.toString(album.getId()), album);
+		album.setParent(this);
 	}
 	
 	public void addChild(Object identifier, TreeNode child) {
-		child.setParent(this);
 		albums.put(identifier, child);
 	}
 

Deleted: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/IdentifierTreeNode.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/IdentifierTreeNode.java	2007-09-10 16:58:18 UTC (rev 2844)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/IdentifierTreeNode.java	2007-09-10 17:32:50 UTC (rev 2845)
@@ -1,28 +0,0 @@
-/**
- * License Agreement.
- *
- *  JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007  Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
- */
-
-package org.richfaces.demo.tree;
-
-import org.richfaces.model.TreeNode;
-
-public interface IdentifierTreeNode extends TreeNode {
-	public long getId();
-}

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	2007-09-10 16:58:18 UTC (rev 2844)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Library.java	2007-09-10 17:32:50 UTC (rev 2845)
@@ -3,19 +3,11 @@
 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;
 
-import javax.faces.FacesException;
-
-import org.richfaces.component.UITree;
-import org.richfaces.component.UITreeNode;
-import org.richfaces.event.DropEvent;
-import org.richfaces.model.ListRowKey;
 import org.richfaces.model.TreeNode;
 
 public class Library implements TreeNode {
@@ -38,8 +30,8 @@
 	}
 	
 	public void addChild(Object identifier, TreeNode child) {
-		child.setParent(this);
 		getArtists().put(identifier, child);
+		child.setParent(this);
 	}
 
 	public TreeNode getChild(Object id) {
@@ -152,36 +144,4 @@
 		this.state2 = state2;
 	}
 	
-	public void processDrop(DropEvent event) {
-		ListRowKey srcKey = (ListRowKey) event.getDragValue();
-		ListRowKey destKey = (ListRowKey) event.getDropValue();
-	
-		UITree tree = ((UITreeNode) event.getComponent()).getUITree();
-
-		TreeNode destNode = tree.getTreeNode(destKey);
-		TreeNode srcNode = tree.getTreeNode(srcKey);
-	
-		try {
-			tree.queueNodeCollapse(srcKey);
-			tree.queueNodeExpand(destKey);
-		} catch (IOException e) {
-			throw new FacesException(e.getMessage(), e);
-		}
-		
-		String srcNodeKey = String.valueOf(((IdentifierTreeNode) srcNode).getId());
-		srcNode.getParent().removeChild(srcNodeKey);
-		destNode.addChild(srcNodeKey, srcNode);
-	
-		List list = new ArrayList();
-		//this is to get row key segments for the parent node of source node 
-		//candidate for inclusion to UITree API
-		for (Iterator iterator = srcKey.iterator(); iterator.hasNext();) {
-			Object object = (Object) iterator.next();
-			if (iterator.hasNext()) {
-				list.add(object);
-			}
-		}
-		tree.addRequestKey(new ListRowKey(list));
-		tree.addRequestKey(destKey);
-	}
 }

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	2007-09-10 16:58:18 UTC (rev 2844)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/Song.java	2007-09-10 17:32:50 UTC (rev 2845)
@@ -5,7 +5,7 @@
 
 import org.richfaces.model.TreeNode;
 
-public class Song implements IdentifierTreeNode {
+public class Song implements TreeNode {
 	/**
 	 * 
 	 */

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	2007-09-10 16:58:18 UTC (rev 2844)
+++ trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml	2007-09-10 17:32:50 UTC (rev 2845)
@@ -165,20 +165,10 @@
 	<managed-bean-scope>session</managed-bean-scope>
  </managed-bean>
  <managed-bean>
-  <managed-bean-name>libraryAjaxTree</managed-bean-name>
+  <managed-bean-name>library</managed-bean-name>
   <managed-bean-class>org.richfaces.demo.tree.Library</managed-bean-class>
   <managed-bean-scope>session</managed-bean-scope>
  </managed-bean>
- <managed-bean>
-  <managed-bean-name>libraryClientTree</managed-bean-name>
-  <managed-bean-class>org.richfaces.demo.tree.Library</managed-bean-class>
-  <managed-bean-scope>session</managed-bean-scope>
- </managed-bean>
- <managed-bean>
-  <managed-bean-name>libraryServerTree</managed-bean-name>
-  <managed-bean-class>org.richfaces.demo.tree.Library</managed-bean-class>
-  <managed-bean-scope>session</managed-bean-scope>
- </managed-bean>
  <managed-bean>
   <managed-bean-name>dndBean</managed-bean-name>
   <managed-bean-class>org.richfaces.demo.dnd.DndBean</managed-bean-class>

Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/ajaxTree.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/ajaxTree.xhtml	2007-09-10 16:58:18 UTC (rev 2844)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/ajaxTree.xhtml	2007-09-10 17:32:50 UTC (rev 2845)
@@ -7,19 +7,15 @@
 
 	<p>This tree uses "ajax" switch type, note that for collapse/expand operations it will be Ajax request to the server. You may see short delay in this case.</p>
 	<h:form>	
-		<rich:tree dragIndicator=":treeDragIndicator" dropListener="#{libraryAjaxTree.processDrop}" style="width:300px" value="#{libraryAjaxTree.data}" var="item" nodeFace="#{item.type}">
-			<rich:treeNode type="artist" acceptedTypes="album" iconLeaf="/images/tree/group.gif" icon="/images/tree/group.gif">
+		<rich:tree style="width:300px" value="#{library.data}" var="item" nodeFace="#{item.type}">
+			<rich:treeNode type="artist" iconLeaf="/images/tree/group.gif" icon="/images/tree/group.gif">
 				<h:outputText value="#{item.name}" />
 			</rich:treeNode>
-			<rich:treeNode type="album" dragType="album" acceptedTypes="song" iconLeaf="/images/tree/cd.gif" icon="/images/tree/cd.gif">
+			<rich:treeNode type="album" iconLeaf="/images/tree/cd.gif" icon="/images/tree/cd.gif">
 				<h:outputText value="#{item.title}" />
-
-				<rich:dndParam name="label" type="drag" value="Album: #{item.title}" />
 			</rich:treeNode>
-			<rich:treeNode type="song" dragType="song" iconLeaf="/images/tree/music.gif" icon="/images/tree/music.gif">
+			<rich:treeNode type="song" iconLeaf="/images/tree/music.gif" icon="/images/tree/music.gif">
 				<h:outputText value="#{item.title}" />
-
-				<rich:dndParam name="label" type="drag" value="Song: #{item.title}" />
 			</rich:treeNode>
 		</rich:tree>
 	</h:form>

Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/clientTree.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/clientTree.xhtml	2007-09-10 16:58:18 UTC (rev 2844)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/clientTree.xhtml	2007-09-10 17:32:50 UTC (rev 2845)
@@ -7,19 +7,15 @@
 
 	<p>This is exactly the same tree, but now it uses "client" switch type. Note, that all nodes actually rendered up-front and expand/collapse now do not requre server call</p>
 	<h:form>
-		<rich:tree switchType="client" style="width:300px" dragIndicator=":treeDragIndicator" dropListener="#{libraryClientTree.processDrop}" value="#{libraryClientTree.data}" var="item" nodeFace="#{item.type}">
-			<rich:treeNode type="artist" acceptedTypes="album" iconLeaf="/images/tree/group.gif" icon="/images/tree/group.gif">
+		<rich:tree switchType="client" style="width:300px" value="#{library.data}" var="item" nodeFace="#{item.type}">
+			<rich:treeNode type="artist" iconLeaf="/images/tree/group.gif" icon="/images/tree/group.gif">
 				<h:outputText value="#{item.name}" />
 			</rich:treeNode>
-			<rich:treeNode type="album" dragType="album" acceptedTypes="song" iconLeaf="/images/tree/cd.gif" icon="/images/tree/cd.gif">
+			<rich:treeNode type="album" iconLeaf="/images/tree/cd.gif" icon="/images/tree/cd.gif">
 				<h:outputText value="#{item.title}" />
-
-				<rich:dndParam name="label" type="drag" value="Album: #{item.title}" />
 			</rich:treeNode>
-			<rich:treeNode type="song" dragType="song" iconLeaf="/images/tree/music.gif" icon="/images/tree/music.gif">
+			<rich:treeNode type="song" iconLeaf="/images/tree/music.gif" icon="/images/tree/music.gif">
 				<h:outputText value="#{item.title}" />
-
-				<rich:dndParam name="label" type="drag" value="Song: #{item.title}" />
 			</rich:treeNode>
 		</rich:tree>
 	</h:form>

Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/serverTree.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/serverTree.xhtml	2007-09-10 16:58:18 UTC (rev 2844)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/serverTree.xhtml	2007-09-10 17:32:50 UTC (rev 2845)
@@ -7,19 +7,15 @@
 
 	<p>This is again same tree, but now it uses "server" switch type. Full page content will be reloaded at every click.</p>
 	<h:form>
-		<rich:tree switchType="server" style="width:300px" dragIndicator=":treeDragIndicator" dropListener="#{libraryServerTree.processDrop}" value="#{libraryServerTree.data}" var="item" nodeFace="#{item.type}">
-			<rich:treeNode type="artist" acceptedTypes="album" iconLeaf="/images/tree/group.gif" icon="/images/tree/group.gif">
+		<rich:tree switchType="server" style="width:300px" value="#{library.data}" var="item" nodeFace="#{item.type}">
+			<rich:treeNode type="artist" iconLeaf="/images/tree/group.gif" icon="/images/tree/group.gif">
 				<h:outputText value="#{item.name}" />
 			</rich:treeNode>
-			<rich:treeNode type="album" dragType="album" acceptedTypes="song" iconLeaf="/images/tree/cd.gif" icon="/images/tree/cd.gif">
+			<rich:treeNode type="album" iconLeaf="/images/tree/cd.gif" icon="/images/tree/cd.gif">
 				<h:outputText value="#{item.title}" />
-
-				<rich:dndParam name="label" type="drag" value="Album: #{item.title}" />
 			</rich:treeNode>
-			<rich:treeNode type="song" dragType="song" iconLeaf="/images/tree/music.gif" icon="/images/tree/music.gif">
+			<rich:treeNode type="song" iconLeaf="/images/tree/music.gif" icon="/images/tree/music.gif">
 				<h:outputText value="#{item.title}" />
-
-				<rich:dndParam name="label" type="drag" value="Song: #{item.title}" />
 			</rich:treeNode>
 		</rich:tree>
 	</h:form>

Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/usage.xhtml	2007-09-10 16:58:18 UTC (rev 2844)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/usage.xhtml	2007-09-10 17:32:50 UTC (rev 2845)
@@ -7,8 +7,6 @@
 	xmlns:rich="http://richfaces.org/rich">
 	<ui:composition template="/templates/component-sample.xhtml">
 		<ui:define name="sample">
-				<rich:dragIndicator id="treeDragIndicator" />
-				
 				<p>
 					Tree is a component that renders a tree control on the page.<br/>
 					The most important tree features are:




More information about the richfaces-svn-commits mailing list