Update of
/var/cvs/applications/editwizard/src/org/mmbase/applications/editwizard
In directory
james.mmbase.org:/tmp/cvs-serv28827/applications/editwizard/src/org/mmbase/applications/editwizard
Modified Files:
Tag: MMBase-1_8
Wizard.java Utils.java
Log Message:
MMB-1594 Data loaded by included lists (add list item) are not saved when
changed
Fix for UPDATE_ITEM through inline wizard
See also:
http://cvs.mmbase.org/viewcvs/applications/editwizard/src/org/mmbase/applications/editwizard
See also: http://www.mmbase.org/jira/browse/MMB-1594
Index: Wizard.java
===================================================================
RCS file:
/var/cvs/applications/editwizard/src/org/mmbase/applications/editwizard/Wizard.java,v
retrieving revision 1.149.2.10
retrieving revision 1.149.2.11
diff -u -b -r1.149.2.10 -r1.149.2.11
--- Wizard.java 30 Dec 2008 12:07:01 -0000 1.149.2.10
+++ Wizard.java 7 Jan 2009 20:40:06 -0000 1.149.2.11
@@ -45,7 +45,7 @@
* @author Pierre van Rooden
* @author Hillebrand Gelderblom
* @since MMBase-1.6
- * @version $Id: Wizard.java,v 1.149.2.10 2008/12/30 12:07:01 nklasens Exp $
+ * @version $Id: Wizard.java,v 1.149.2.11 2009/01/07 20:40:06 nklasens Exp $
*
*/
public class Wizard implements org.mmbase.util.SizeMeasurable {
@@ -1379,7 +1379,7 @@
NodeList descendants = null;
if (con!=null) descendants =
Utils.selectNodeList(con,"descendants/descendant");
- if (descendants == null || descendants.getLength() == 0) {
+ if (Utils.isEmptyNodeList(descendants)) {
fdatapath.append("object/@type='").append(destination).append('\'');
} else {
@@ -2134,11 +2134,11 @@
String value = cmd.getValue();
NodeList nodesToUpdate = Utils.selectNodeList(data,
".//*...@number='" + value + "']");
NodeList originalNodesToUpdate =
Utils.selectNodeList(originalData, ".//*...@number='" + value + "']");
- if (originalNodesToUpdate == null) {
+ if (Utils.isEmptyNodeList(originalNodesToUpdate) ) {
originalNodesToUpdate = Utils.selectNodeList(loadedData,
".//*...@number='" + value + "']");
}
- if ((nodesToUpdate != null) || (originalNodesToUpdate != null)) {
+ if (Utils.isNotEmptyNodeList(nodesToUpdate) ||
Utils.isNotEmptyNodeList(originalNodesToUpdate)) {
Node updatedNode = null;
try {
@@ -2369,6 +2369,7 @@
}
}
+
/**
* This method adds a listitem. It is used by the #processCommand method
to add new items to a list. (Usually when the
* add-item command is fired.)
Index: Utils.java
===================================================================
RCS file:
/var/cvs/applications/editwizard/src/org/mmbase/applications/editwizard/Utils.java,v
retrieving revision 1.41.2.4
retrieving revision 1.41.2.5
diff -u -b -r1.41.2.4 -r1.41.2.5
--- Utils.java 6 Feb 2008 13:13:18 -0000 1.41.2.4
+++ Utils.java 7 Jan 2009 20:40:06 -0000 1.41.2.5
@@ -10,6 +10,7 @@
package org.mmbase.applications.editwizard;
import org.w3c.dom.*;
+
import java.io.*;
import java.net.*;
import java.util.*;
@@ -40,7 +41,7 @@
* @author Pierre van Rooden
* @author Michiel Meeuwissen
* @since MMBase-1.6
- * @version $Id: Utils.java,v 1.41.2.4 2008/02/06 13:13:18 michiel Exp $
+ * @version $Id: Utils.java,v 1.41.2.5 2009/01/07 20:40:06 nklasens Exp $
*/
public class Utils {
@@ -712,6 +713,14 @@
}
+ public static boolean isEmptyNodeList(NodeList list) {
+ return list == null || list.getLength() == 0;
+ }
+
+ public static boolean isNotEmptyNodeList(NodeList list) {
+ return !isEmptyNodeList(list);
+ }
+
/**
* (Not used) method to post (http-post) xml to a url.
*
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs