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