1. /*
  2. * @(#)HTMLFrameHyperlinkEvent.java 1.3 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.text.html;
  8. import javax.swing.text.*;
  9. import javax.swing.event.HyperlinkEvent;
  10. import java.net.URL;
  11. /**
  12. * HTMLFrameHyperlinkEvent is used to notify interested
  13. * parties that link was activated in a frame.
  14. *
  15. * @author Sunita Mani
  16. * @version 1.3, 11/29/01
  17. */
  18. public class HTMLFrameHyperlinkEvent extends HyperlinkEvent {
  19. /**
  20. * Creates a new object representing a html frame
  21. * hypertext link event.
  22. *
  23. * @param source the object responsible for the event
  24. * @param type the event type
  25. * @param targetURL the affected URL
  26. * @param targetFrame the Frame to display the document in
  27. */
  28. public HTMLFrameHyperlinkEvent(Object source, EventType type, URL targetURL,
  29. String targetFrame) {
  30. super(source, type, targetURL);
  31. this.targetFrame = targetFrame;
  32. this.sourceElement = null;
  33. }
  34. /**
  35. * Creates a new object representing a hypertext link event.
  36. *
  37. * @param source the object responsible for the event
  38. * @param type the event type
  39. * @param targetURL the affected URL
  40. * @param desc a description
  41. * @param targetFrame the Frame to display the document in
  42. */
  43. public HTMLFrameHyperlinkEvent(Object source, EventType type, URL targetURL, String desc,
  44. String targetFrame) {
  45. super(source, type, targetURL, desc);
  46. this.targetFrame = targetFrame;
  47. this.sourceElement = null;
  48. }
  49. /**
  50. * Creates a new object representing a hypertext link event.
  51. *
  52. * @param source the object responsible for the event
  53. * @param type the event type
  54. * @param targetURL the affected URL
  55. * @param sourceElement the element that corresponds to the source
  56. * of the event
  57. * @param targetFrame the Frame to display the document in
  58. */
  59. public HTMLFrameHyperlinkEvent(Object source, EventType type, URL targetURL,
  60. Element sourceElement, String targetFrame) {
  61. super(source, type, targetURL);
  62. this.targetFrame = targetFrame;
  63. this.sourceElement = sourceElement;
  64. }
  65. /**
  66. * Creates a new object representing a hypertext link event.
  67. *
  68. * @param source the object responsible for the event
  69. * @param type the event type
  70. * @param targetURL the affected URL
  71. * @param desc a desription
  72. * @param sourceElement the element that corresponds to the source
  73. * of the event
  74. * @param targetFrame the Frame to display the document in
  75. */
  76. public HTMLFrameHyperlinkEvent(Object source, EventType type, URL targetURL, String desc,
  77. Element sourceElement, String targetFrame) {
  78. super(source, type, targetURL, desc);
  79. this.targetFrame = targetFrame;
  80. this.sourceElement = sourceElement;
  81. }
  82. /**
  83. * returns the element that corresponds to the source of the
  84. * event. This would always be the leaf element whose
  85. * tag is HTML.Tag.FRAME.
  86. */
  87. public Element getSourceElement() {
  88. return sourceElement;
  89. }
  90. /**
  91. * returns the target for the link.
  92. */
  93. public String getTarget() {
  94. return targetFrame;
  95. }
  96. private String targetFrame;
  97. private Element sourceElement;
  98. }