1. /*
  2. * @(#)TreeNode.java 1.15 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.tree;
  8. import java.util.Enumeration;
  9. /**
  10. * Defines the requirements for an object that can be used as a
  11. * tree node in a JTree.
  12. *
  13. * @version 1.15 11/29/01
  14. * @author Rob Davis
  15. * @author Scott Violet
  16. */
  17. public interface TreeNode
  18. {
  19. /**
  20. * Returns the child <code>TreeNode</code> at index
  21. * <code>childIndex</code>.
  22. */
  23. TreeNode getChildAt(int childIndex);
  24. /**
  25. * Returns the number of children <code>TreeNode</code>s the receiver
  26. * contains.
  27. */
  28. int getChildCount();
  29. /**
  30. * Returns the parent <code>TreeNode</code> of the receiver.
  31. */
  32. TreeNode getParent();
  33. /**
  34. * Returns the index of <code>node</code> in the receivers children.
  35. * If the receiver does not contain <code>node</code>, -1 will be
  36. * returned.
  37. */
  38. int getIndex(TreeNode node);
  39. /**
  40. * Returns true if the receiver allows children.
  41. */
  42. boolean getAllowsChildren();
  43. /**
  44. * Returns true if the receiver is a leaf.
  45. */
  46. boolean isLeaf();
  47. /**
  48. * Returns the children of the reciever as an Enumeration.
  49. */
  50. Enumeration children();
  51. }