[richfaces-svn-commits] JBoss Rich Faces SVN: r14096 - in trunk/samples/richfaces-demo: src/main/java/org/richfaces/demo/modifiableModel and 3 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri May 8 14:27:57 EDT 2009


Author: nbelaevski
Date: 2009-05-08 14:27:57 -0400 (Fri, 08 May 2009)
New Revision: 14096

Added:
   trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/DatatableStateHolder.java
Modified:
   trunk/samples/richfaces-demo/
   trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/HibernateDataModel.java
   trunk/samples/richfaces-demo/src/main/resources/hibernate.cfg.xml
   trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
   trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/examples/modifiableModel.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-7049


Property changes on: trunk/samples/richfaces-demo
___________________________________________________________________
Name: svn:ignore
   - target
.settings
.classpath
.exadelproject
.project

richfaces-demo.iws

richfaces-demo.ipr

richfaces-demo.iml

   + bin
.settings
target
.classpath
.project


Added: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/DatatableStateHolder.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/DatatableStateHolder.java	                        (rev 0)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/DatatableStateHolder.java	2009-05-08 18:27:57 UTC (rev 14096)
@@ -0,0 +1,55 @@
+/**
+ * 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.modifiableModel;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.richfaces.model.SortOrder;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.1
+ */
+public class DatatableStateHolder {
+
+	private Map<String, SortOrder> sortOrders = new HashMap<String, SortOrder>();
+
+	private Map<String, Object> columnFilterValues = new HashMap<String, Object>();
+
+	public Map<String, Object> getColumnFilterValues() {
+		return columnFilterValues;
+	}
+
+	public void setColumnFilterValues(Map<String, Object> columnFilterValues) {
+		this.columnFilterValues = columnFilterValues;
+	}
+
+	public Map<String, SortOrder> getSortOrders() {
+		return sortOrders;
+	}
+
+	public void setSortOrders(Map<String, SortOrder> sortOrders) {
+		this.sortOrders = sortOrders;
+	}
+	
+}

Modified: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/HibernateDataModel.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/HibernateDataModel.java	2009-05-08 18:25:52 UTC (rev 14095)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/HibernateDataModel.java	2009-05-08 18:27:57 UTC (rev 14096)
@@ -1,9 +1,28 @@
+/**
+ * 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.modifiableModel;
 
 import java.io.IOException;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import javax.annotation.PreDestroy;
 import javax.el.ELException;
@@ -27,8 +46,11 @@
 import org.richfaces.model.Modifiable;
 import org.richfaces.model.Ordering;
 import org.richfaces.model.SortField2;
-import org.richfaces.model.SortOrder;
 
+/**
+ * @author Nick Belaevski
+ * @since 3.3.1
+ */
 public class HibernateDataModel extends ExtendedDataModel implements Modifiable {
 
 	private SessionFactory sessionFactory;
@@ -56,8 +78,6 @@
 	
 	private Long rowKey;
 	
-	private SortOrder sortOrder = new SortOrder();
-	
 	private DataItem dataItem;
 	
 	private SequenceRange cachedRange;
@@ -68,27 +88,6 @@
 
 	private List<SortField2> sortFields;
 
-	private Map<String, SortOrder> sortOrders = new HashMap<String, SortOrder>();
-
-	private Map<String, Object> columnFilterValues = new HashMap<String, Object>();
-
-
-	public Map<String, Object> getColumnFilterValues() {
-		return columnFilterValues;
-	}
-
-	public void setColumnFilterValues(Map<String, Object> columnFilterValues) {
-		this.columnFilterValues = columnFilterValues;
-	}
-
-	public Map<String, SortOrder> getSortOrders() {
-		return sortOrders;
-	}
-
-	public void setSortOrders(Map<String, SortOrder> sortOrders) {
-		this.sortOrders = sortOrders;
-	}
-	
 	private static boolean areEqualRanges(SequenceRange range1, SequenceRange range2) {
 		if (range1 == null || range2 == null) {
 			return range1 == null && range2 == null;
@@ -232,11 +231,4 @@
 		this.cachedRange = null;
 	}
 
-	public SortOrder getSortOrder() {
-		return sortOrder;
-	}
-
-	public void setSortOrder(SortOrder sortOrder) {
-		this.sortOrder = sortOrder;
-	}
 }

Modified: trunk/samples/richfaces-demo/src/main/resources/hibernate.cfg.xml
===================================================================
--- trunk/samples/richfaces-demo/src/main/resources/hibernate.cfg.xml	2009-05-08 18:25:52 UTC (rev 14095)
+++ trunk/samples/richfaces-demo/src/main/resources/hibernate.cfg.xml	2009-05-08 18:27:57 UTC (rev 14096)
@@ -6,11 +6,11 @@
 <hibernate-configuration>
 	<session-factory>
 		<property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
-		<property name="hibernate.connection.url">jdbc:hsqldb:mem:abc</property>
+		<property name="hibernate.connection.url">jdbc:hsqldb:mem:richfaces_demo</property>
 		<property name="hibernate.connection.username">sa</property>
 		<property name="hibernate.connection.password"></property>
 		<property name="hibernate.connection.pool_size">10</property>
-		<property name="show_sql">true</property>
+		<property name="show_sql">false</property>
 		<property name="dialect">org.hibernate.dialect.HSQLDialect</property>
 		<property name="hibernate.hbm2ddl.auto">create</property>
 	</session-factory>

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	2009-05-08 18:25:52 UTC (rev 14095)
+++ trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml	2009-05-08 18:27:57 UTC (rev 14096)
@@ -3,10 +3,6 @@
  xmlns:xi="http://www.w3.org/2001/XInclude"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
  <converter>
- 	<converter-id>longConverter</converter-id>
- 	<converter-class>javax.faces.convert.LongConverter</converter-class>
- </converter>
- <converter>
   <converter-id>listShuttleconverter</converter-id>
   <converter-class>org.richfaces.demo.listShuttle.Converter</converter-class>
  </converter>
@@ -20,9 +16,14 @@
 		<managed-bean-scope>application</managed-bean-scope>
 	</managed-bean>
 	<managed-bean>
+		<managed-bean-name>dataTableStateHolder</managed-bean-name>
+		<managed-bean-class>org.richfaces.demo.modifiableModel.DatatableStateHolder</managed-bean-class>
+		<managed-bean-scope>session</managed-bean-scope>
+	</managed-bean>
+	<managed-bean>
 		<managed-bean-name>hibernateDataModel</managed-bean-name>
 		<managed-bean-class>org.richfaces.demo.modifiableModel.HibernateDataModel</managed-bean-class>
-		<managed-bean-scope>session</managed-bean-scope>
+		<managed-bean-scope>request</managed-bean-scope>
 		<managed-property>
 			<property-name>sessionFactory</property-name>
 			<value>#{hibernateBean.sessionFactory}</value>

Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/examples/modifiableModel.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/examples/modifiableModel.xhtml	2009-05-08 18:25:52 UTC (rev 14095)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/examples/modifiableModel.xhtml	2009-05-08 18:27:57 UTC (rev 14096)
@@ -8,12 +8,12 @@
 		<a4j:queue requestDelay="100" />
 		<rich:messages />
 		<rich:dataTable value="#{hibernateDataModel}" var="row" rows="10"
-			rowKeyConverter="#{longConverter}" reRender="datascroller" rendered="#{componentNavigator.currentComponent.activeTab == 'modifiableDataModel'}">
+			rowKeyConverter="javax.faces.Long" reRender="datascroller" rendered="#{componentNavigator.currentComponent.activeTab == 'modifiableDataModel'}">
 			<rich:columns value="#{hibernateBean.csvFields}" var="field"
 				sortBy="#{field}" filterBy="#{field}" filterEvent="onkeyup"
 				index="index" id="column#{index}"
-				sortOrder="#{hibernateDataModel.sortOrders[field]}"
-				filterValue="#{hibernateDataModel.columnFilterValues[field]}">
+				sortOrder="#{dataTableStateHolder.sortOrders[field]}"
+				filterValue="#{dataTableStateHolder.columnFilterValues[field]}">
 				<f:facet name="header">
 					<h:outputText value="#{field}" />
 				</f:facet>




More information about the richfaces-svn-commits mailing list