Update of
/var/cvs/applications/editwizard/src/org/mmbase/applications/editwizard
In directory
james.mmbase.org:/tmp/cvs-serv28801/applications/editwizard/src/org/mmbase/applications/editwizard
Modified Files:
Utils.java Wizard.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: Utils.java
===================================================================
RCS file:
/var/cvs/applications/editwizard/src/org/mmbase/applications/editwizard/Utils.java,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- Utils.java 4 Sep 2008 05:58:11 -0000 1.52
+++ Utils.java 7 Jan 2009 20:39:58 -0000 1.53
@@ -10,6 +10,7 @@
package org.mmbase.applications.editwizard;
import org.w3c.dom.*;
+
import java.io.*;
import java.net.*;
import java.util.*;
@@ -38,7 +39,7 @@
* @author Pierre van Rooden
* @author Michiel Meeuwissen
* @since MMBase-1.6
- * @version $Id: Utils.java,v 1.52 2008/09/04 05:58:11 michiel Exp $
+ * @version $Id: Utils.java,v 1.53 2009/01/07 20:39:58 nklasens Exp $
*/
public class Utils {
@@ -719,4 +720,20 @@
return text;
}
+ /** Is nodelist empty
+ * @param list NodeList
+ * @return <code>true</code> when empty
+ */
+ public static boolean isEmptyNodeList(NodeList list) {
+ return list == null || list.getLength() == 0;
+ }
+
+ /** Is nodelist not empty
+ * @param list NodeList
+ * @return <code>true</code> when not empty
+ */
+ public static boolean isNotEmptyNodeList(NodeList list) {
+ return !isEmptyNodeList(list);
+ }
+
}
Index: Wizard.java
===================================================================
RCS file:
/var/cvs/applications/editwizard/src/org/mmbase/applications/editwizard/Wizard.java,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -b -r1.176 -r1.177
--- Wizard.java 30 Dec 2008 12:48:03 -0000 1.176
+++ Wizard.java 7 Jan 2009 20:39:58 -0000 1.177
@@ -46,7 +46,7 @@
* @author Pierre van Rooden
* @author Hillebrand Gelderblom
* @since MMBase-1.6
- * @version $Id: Wizard.java,v 1.176 2008/12/30 12:48:03 nklasens Exp $
+ * @version $Id: Wizard.java,v 1.177 2009/01/07 20:39:58 nklasens Exp $
*
*/
public class Wizard implements org.mmbase.util.SizeMeasurable,
java.io.Serializable {
@@ -1450,7 +1450,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 {
@@ -2214,11 +2214,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 {
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs