1. /*
  2. * @(#)TreeModelListener.java 1.12 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.event;
  8. import java.util.EventListener;
  9. /**
  10. * TreeChangeListener defines the interface for an object that listens
  11. * to changes in a TreeModel.
  12. *
  13. * @version 1.12 11/29/01
  14. * @author Rob Davis
  15. * @author Ray Ryan
  16. */
  17. public interface TreeModelListener extends EventListener {
  18. /**
  19. * <p>Invoked after a node (or a set of siblings) has changed in some
  20. * way. The node(s) have not changed locations in the tree or
  21. * altered their children arrays, but other attributes have
  22. * changed and may affect presentation. Example: the name of a
  23. * file has changed, but it is in the same location in the file
  24. * system.</p>
  25. * <p>To indicate the root has changed, childIndices and children
  26. * will be null. </p>
  27. *
  28. * <p>e.path() returns the path the parent of the changed node(s).</p>
  29. *
  30. * <p>e.childIndices() returns the index(es) of the changed node(s).</p>
  31. */
  32. void treeNodesChanged(TreeModelEvent e);
  33. /**
  34. * <p>Invoked after nodes have been inserted into the tree.</p>
  35. *
  36. * <p>e.path() returns the parent of the new nodes
  37. * <p>e.childIndices() returns the indices of the new nodes in
  38. * ascending order.
  39. */
  40. void treeNodesInserted(TreeModelEvent e);
  41. /**
  42. * <p>Invoked after nodes have been removed from the tree. Note that
  43. * if a subtree is removed from the tree, this method may only be
  44. * invoked once for the root of the removed subtree, not once for
  45. * each individual set of siblings removed.</p>
  46. *
  47. * <p>e.path() returns the former parent of the deleted nodes.</p>
  48. *
  49. * <p>e.childIndices() returns the indices the nodes had before they were deleted in ascending order.</p>
  50. */
  51. void treeNodesRemoved(TreeModelEvent e);
  52. /**
  53. * <p>Invoked after the tree has drastically changed structure from a
  54. * given node down. If the path returned by e.getPath() is of length
  55. * one and the first element does not identify the current root node
  56. * the first element should become the new root of the tree.<p>
  57. *
  58. * <p>e.path() holds the path to the node.</p>
  59. * <p>e.childIndices() returns null.</p>
  60. */
  61. void treeStructureChanged(TreeModelEvent e);
  62. }