1. /*
  2. * Copyright (c) 2000 World Wide Web Consortium,
  3. * (Massachusetts Institute of Technology, Institut National de
  4. * Recherche en Informatique et en Automatique, Keio University). All
  5. * Rights Reserved. This program is distributed under the W3C's Software
  6. * Intellectual Property License. This program is distributed in the
  7. * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
  8. * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  9. * PURPOSE.
  10. * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
  11. */
  12. package org.w3c.dom.events;
  13. import org.w3c.dom.Node;
  14. /**
  15. * The <code>MutationEvent</code> interface provides specific contextual
  16. * information associated with Mutation events.
  17. * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113'>Document Object Model (DOM) Level 2 Events Specification</a>.
  18. * @since DOM Level 2
  19. */
  20. public interface MutationEvent extends Event {
  21. // attrChangeType
  22. /**
  23. * The <code>Attr</code> was modified in place.
  24. */
  25. public static final short MODIFICATION = 1;
  26. /**
  27. * The <code>Attr</code> was just added.
  28. */
  29. public static final short ADDITION = 2;
  30. /**
  31. * The <code>Attr</code> was just removed.
  32. */
  33. public static final short REMOVAL = 3;
  34. /**
  35. * <code>relatedNode</code> is used to identify a secondary node related
  36. * to a mutation event. For example, if a mutation event is dispatched
  37. * to a node indicating that its parent has changed, the
  38. * <code>relatedNode</code> is the changed parent. If an event is
  39. * instead dispatched to a subtree indicating a node was changed within
  40. * it, the <code>relatedNode</code> is the changed node. In the case of
  41. * the DOMAttrModified event it indicates the <code>Attr</code> node
  42. * which was modified, added, or removed.
  43. */
  44. public Node getRelatedNode();
  45. /**
  46. * <code>prevValue</code> indicates the previous value of the
  47. * <code>Attr</code> node in DOMAttrModified events, and of the
  48. * <code>CharacterData</code> node in DOMCharDataModified events.
  49. */
  50. public String getPrevValue();
  51. /**
  52. * <code>newValue</code> indicates the new value of the <code>Attr</code>
  53. * node in DOMAttrModified events, and of the <code>CharacterData</code>
  54. * node in DOMCharDataModified events.
  55. */
  56. public String getNewValue();
  57. /**
  58. * <code>attrName</code> indicates the name of the changed
  59. * <code>Attr</code> node in a DOMAttrModified event.
  60. */
  61. public String getAttrName();
  62. /**
  63. * <code>attrChange</code> indicates the type of change which triggered
  64. * the DOMAttrModified event. The values can be <code>MODIFICATION</code>
  65. * , <code>ADDITION</code>, or <code>REMOVAL</code>.
  66. */
  67. public short getAttrChange();
  68. /**
  69. * The <code>initMutationEvent</code> method is used to initialize the
  70. * value of a <code>MutationEvent</code> created through the
  71. * <code>DocumentEvent</code> interface. This method may only be called
  72. * before the <code>MutationEvent</code> has been dispatched via the
  73. * <code>dispatchEvent</code> method, though it may be called multiple
  74. * times during that phase if necessary. If called multiple times, the
  75. * final invocation takes precedence.
  76. * @param typeArgSpecifies the event type.
  77. * @param canBubbleArgSpecifies whether or not the event can bubble.
  78. * @param cancelableArgSpecifies whether or not the event's default
  79. * action can be prevented.
  80. * @param relatedNodeArgSpecifies the <code>Event</code>'s related Node.
  81. * @param prevValueArgSpecifies the <code>Event</code>'s
  82. * <code>prevValue</code> attribute. This value may be null.
  83. * @param newValueArgSpecifies the <code>Event</code>'s
  84. * <code>newValue</code> attribute. This value may be null.
  85. * @param attrNameArgSpecifies the <code>Event</code>'s
  86. * <code>attrName</code> attribute. This value may be null.
  87. * @param attrChangeArgSpecifies the <code>Event</code>'s
  88. * <code>attrChange</code> attribute
  89. */
  90. public void initMutationEvent(String typeArg,
  91. boolean canBubbleArg,
  92. boolean cancelableArg,
  93. Node relatedNodeArg,
  94. String prevValueArg,
  95. String newValueArg,
  96. String attrNameArg,
  97. short attrChangeArg);
  98. }