< prev index next >

src/java.desktop/share/classes/javax/swing/tree/DefaultTreeModel.java

Print this page

        

*** 40,50 **** * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @author Rob Davis * @author Ray Ryan * @author Scott Violet --- 40,50 ---- * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. * * @author Rob Davis * @author Ray Ryan * @author Scott Violet
*** 54,64 **** /** Root of the tree. */ protected TreeNode root; /** Listeners. */ protected EventListenerList listenerList = new EventListenerList(); /** ! * Determines how the <code>isLeaf</code> method figures * out if a node is a leaf node. If true, a node is a leaf * node if it does not allow children. (If it allows * children, it is not a leaf node, even if no children * are present.) That lets you distinguish between <i>folder</i> * nodes and <i>file</i> nodes in a file system, for example. --- 54,64 ---- /** Root of the tree. */ protected TreeNode root; /** Listeners. */ protected EventListenerList listenerList = new EventListenerList(); /** ! * Determines how the {@code isLeaf} method figures * out if a node is a leaf node. If true, a node is a leaf * node if it does not allow children. (If it allows * children, it is not a leaf node, even if no children * are present.) That lets you distinguish between <i>folder</i> * nodes and <i>file</i> nodes in a file system, for example.
*** 124,134 **** public boolean asksAllowsChildren() { return asksAllowsChildren; } /** ! * Sets the root to <code>root</code>. A null <code>root</code> implies * the tree is to display nothing, and is legal. * * @param root new value of tree root */ public void setRoot(TreeNode root) { --- 124,134 ---- public boolean asksAllowsChildren() { return asksAllowsChildren; } /** ! * Sets the root to {@code root}. A null {@code root} implies * the tree is to display nothing, and is legal. * * @param root new value of tree root */ public void setRoot(TreeNode root) {
*** 152,166 **** return root; } /** * Returns the index of child in parent. ! * If either the parent or child is <code>null</code>, returns -1. * @param parent a note in the tree, obtained from this data source * @param child the node we are interested in * @return the index of the child in the parent, or -1 ! * if either the parent or the child is <code>null</code> */ public int getIndexOfChild(Object parent, Object child) { if(parent == null || child == null) return -1; return ((TreeNode)parent).getIndex((TreeNode)child); --- 152,166 ---- return root; } /** * Returns the index of child in parent. ! * If either the parent or child is {@code null}, returns -1. * @param parent a note in the tree, obtained from this data source * @param child the node we are interested in * @return the index of the child in the parent, or -1 ! * if either the parent or the child is {@code null} */ public int getIndexOfChild(Object parent, Object child) { if(parent == null || child == null) return -1; return ((TreeNode)parent).getIndex((TreeNode)child);
*** 193,203 **** } /** * Returns whether the specified node is a leaf node. * The way the test is performed depends on the ! * <code>askAllowsChildren</code> setting. * * @param node the node to check * @return true if the node is a leaf node * * @see #asksAllowsChildren --- 193,203 ---- } /** * Returns whether the specified node is a leaf node. * The way the test is performed depends on the ! * {@code askAllowsChildren} setting. * * @param node the node to check * @return true if the node is a leaf node * * @see #asksAllowsChildren
*** 468,478 **** /** * Returns an array of all the tree model listeners * registered on this model. * ! * @return all of this model's <code>TreeModelListener</code>s * or an empty * array if no tree model listeners are currently registered * * @see #addTreeModelListener * @see #removeTreeModelListener --- 468,478 ---- /** * Returns an array of all the tree model listeners * registered on this model. * ! * @return all of this model's {@code TreeModelListener}s * or an empty * array if no tree model listeners are currently registered * * @see #addTreeModelListener * @see #removeTreeModelListener
*** 643,658 **** * <code><em>Foo</em>Listener</code>s are registered using the * <code>add<em>Foo</em>Listener</code> method. * * <p> * ! * You can specify the <code>listenerType</code> argument * with a class literal, * such as * <code><em>Foo</em>Listener.class</code>. * For example, you can query a ! * <code>DefaultTreeModel</code> <code>m</code> * for its tree model listeners with the following code: * * <pre>TreeModelListener[] tmls = (TreeModelListener[])(m.getListeners(TreeModelListener.class));</pre> * * If no such listeners exist, this method returns an empty array. --- 643,658 ---- * <code><em>Foo</em>Listener</code>s are registered using the * <code>add<em>Foo</em>Listener</code> method. * * <p> * ! * You can specify the {@code listenerType} argument * with a class literal, * such as * <code><em>Foo</em>Listener.class</code>. * For example, you can query a ! * {@code DefaultTreeModel m} * for its tree model listeners with the following code: * * <pre>TreeModelListener[] tmls = (TreeModelListener[])(m.getListeners(TreeModelListener.class));</pre> * * If no such listeners exist, this method returns an empty array.
*** 661,673 **** * @param listenerType the type of listeners requested * @return an array of all objects registered as * <code><em>Foo</em>Listener</code>s on this component, * or an empty array if no such * listeners have been added ! * @exception ClassCastException if <code>listenerType</code> * doesn't specify a class or interface that implements ! * <code>java.util.EventListener</code> * * @see #getTreeModelListeners * * @since 1.3 */ --- 661,673 ---- * @param listenerType the type of listeners requested * @return an array of all objects registered as * <code><em>Foo</em>Listener</code>s on this component, * or an empty array if no such * listeners have been added ! * @exception ClassCastException if {@code listenerType} * doesn't specify a class or interface that implements ! * {@code java.util.EventListener} * * @see #getTreeModelListeners * * @since 1.3 */
< prev index next >