summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Kennke <roman@kennke.org>2006-09-27 18:53:20 +0000
committerRoman Kennke <roman@kennke.org>2006-09-27 18:53:20 +0000
commit4cf8476ecca577f7e086603d6c3e4f9c42fdb889 (patch)
tree8b2e2cf5ea3fd6b852ac0e94ce70a772279833d3
parente210a70e75f478e8f681f52f496db5c91a5db42b (diff)
downloadclasspath-4cf8476ecca577f7e086603d6c3e4f9c42fdb889.tar.gz
22006-09-27 Roman Kennke <kennke@aicas.com>
PR 29218 * javax/swing/tree/DefaultTreeModel.java (isLeaf): Check if the node allows children when asksAllowsChildren is true, otherwise fall back to return the node's leaf property.
-rw-r--r--ChangeLog14
-rw-r--r--javax/swing/tree/DefaultTreeModel.java27
2 files changed, 32 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index b1e008029..a17cbe494 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,12 @@
-2006-09-27 Mario Torre <neugens@limasoftware.net>
+22006-09-27 Roman Kennke <kennke@aicas.com>
+
+ PR 29218
+ * javax/swing/tree/DefaultTreeModel.java
+ (isLeaf): Check if the node allows children when
+ asksAllowsChildren is true, otherwise fall back
+ to return the node's leaf property.
+
+006-09-27 Mario Torre <neugens@limasoftware.net>
* scripts/check_jni_methods.sh: removed methods from the
ignore list:
@@ -11,14 +19,14 @@
to better follow the GNU style.
* include/gnu_java_util_prefs_gconf_GConfNativePeer.h.
regenerated header file for GConfNativePeer.
-
+
2006-09-27 Robert Schuster <robertschuster@fsfe.org>
* INSTALL: Added information about grmic being built when ASM
is available, added information about gconf dependency, indented
Qt4 dependency section.
* configure.ac: Added information about grmic being built when ASM
- is available.
+ is available.
2006-09-27 Ian Rogers <ian.rogers@manchester.ac.uk>
diff --git a/javax/swing/tree/DefaultTreeModel.java b/javax/swing/tree/DefaultTreeModel.java
index 5819d15b6..639d861fb 100644
--- a/javax/swing/tree/DefaultTreeModel.java
+++ b/javax/swing/tree/DefaultTreeModel.java
@@ -210,17 +210,32 @@ public class DefaultTreeModel
}
/**
- * isLeaf
+ * Returns if the specified node is a leaf or not. When
+ * {@link #asksAllowsChildren} is true, then this checks if the TreeNode
+ * allows children, otherwise it returns the TreeNode's <code>leaf</code>
+ * property.
*
- * @param node TODO
- * @return boolean
+ * @param node the node to check
+ *
+ * @return boolean <code>true</code> if the node is a leaf node,
+ * <code>false</code> otherwise
+ *
+ * @throws ClassCastException if the specified node is not a
+ * <code>TreeNode</code> instance
+ *
+ * @see TreeNode#getAllowsChildren()
+ * @see TreeNode#isLeaf()
*/
public boolean isLeaf(Object node)
{
- if (node instanceof TreeNode)
- return ((TreeNode) node).isLeaf();
+ // The RI throws a ClassCastException when node isn't a TreeNode, so do we.
+ TreeNode treeNode = (TreeNode) node;
+ boolean leaf;
+ if (asksAllowsChildren)
+ leaf = ! treeNode.getAllowsChildren();
else
- return true;
+ leaf = treeNode.isLeaf();
+ return leaf;
}
/**