blob: b1c97b9e2f6145f56cdf547c3f1ffb4e731307dc [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25package javax.swing.text.html;
26
27import java.awt.event.InputEvent;
28import javax.swing.text.*;
29import javax.swing.event.HyperlinkEvent;
30import java.net.URL;
31
32/**
33 * HTMLFrameHyperlinkEvent is used to notify interested
34 * parties that link was activated in a frame.
35 *
36 * @author Sunita Mani
37 */
38
39public class HTMLFrameHyperlinkEvent extends HyperlinkEvent {
40
41 /**
42 * Creates a new object representing a html frame
43 * hypertext link event.
44 *
45 * @param source the object responsible for the event
46 * @param type the event type
47 * @param targetURL the affected URL
48 * @param targetFrame the Frame to display the document in
49 */
50 public HTMLFrameHyperlinkEvent(Object source, EventType type, URL targetURL,
51 String targetFrame) {
52 super(source, type, targetURL);
53 this.targetFrame = targetFrame;
54 }
55
56
57 /**
58 * Creates a new object representing a hypertext link event.
59 *
60 * @param source the object responsible for the event
61 * @param type the event type
62 * @param targetURL the affected URL
63 * @param desc a description
64 * @param targetFrame the Frame to display the document in
65 */
66 public HTMLFrameHyperlinkEvent(Object source, EventType type, URL targetURL, String desc,
67 String targetFrame) {
68 super(source, type, targetURL, desc);
69 this.targetFrame = targetFrame;
70 }
71
72 /**
73 * Creates a new object representing a hypertext link event.
74 *
75 * @param source the object responsible for the event
76 * @param type the event type
77 * @param targetURL the affected URL
78 * @param sourceElement the element that corresponds to the source
79 * of the event
80 * @param targetFrame the Frame to display the document in
81 */
82 public HTMLFrameHyperlinkEvent(Object source, EventType type, URL targetURL,
83 Element sourceElement, String targetFrame) {
84 super(source, type, targetURL, null, sourceElement);
85 this.targetFrame = targetFrame;
86 }
87
88
89 /**
90 * Creates a new object representing a hypertext link event.
91 *
92 * @param source the object responsible for the event
93 * @param type the event type
94 * @param targetURL the affected URL
95 * @param desc a desription
96 * @param sourceElement the element that corresponds to the source
97 * of the event
98 * @param targetFrame the Frame to display the document in
99 */
100 public HTMLFrameHyperlinkEvent(Object source, EventType type, URL targetURL, String desc,
101 Element sourceElement, String targetFrame) {
102 super(source, type, targetURL, desc, sourceElement);
103 this.targetFrame = targetFrame;
104 }
105
106 /**
107 * Creates a new object representing a hypertext link event.
108 *
109 * @param source the object responsible for the event
110 * @param type the event type
111 * @param targetURL the affected URL
112 * @param desc a desription
113 * @param sourceElement the element that corresponds to the source
114 * of the event
115 * @param inputEvent InputEvent that triggered the hyperlink event
116 * @param targetFrame the Frame to display the document in
117 * @since 1.7
118 */
119 public HTMLFrameHyperlinkEvent(Object source, EventType type, URL targetURL,
120 String desc, Element sourceElement,
121 InputEvent inputEvent, String targetFrame) {
122 super(source, type, targetURL, desc, sourceElement, inputEvent);
123 this.targetFrame = targetFrame;
124 }
125
126 /**
127 * returns the target for the link.
128 */
129 public String getTarget() {
130 return targetFrame;
131 }
132
133 private String targetFrame;
134}