01 /*
02 * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
03 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04 *
05 * This code is free software; you can redistribute it and/or modify it
06 * under the terms of the GNU General Public License version 2 only, as
07 * published by the Free Software Foundation. Sun designates this
08 * particular file as subject to the "Classpath" exception as provided
09 * 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 */
25 package javax.swing.text.html;
26
27 import javax.swing.text.*;
28 import java.net.URL;
29
30 /**
31 * FormSubmitEvent is used to notify interested
32 * parties that a form was submited.
33 *
34 * @version 1.11 05/05/07
35 * @since 1.5
36 * @author Denis Sharypov
37 */
38
39 public class FormSubmitEvent extends HTMLFrameHyperlinkEvent {
40
41 /**
42 * Represents an HTML form method type.
43 * <UL>
44 * <LI><code>GET</code> corresponds to the GET form method</LI>
45 * <LI><code>POST</code> corresponds to the POST from method</LI>
46 * </UL>
47 * @since 1.5
48 */
49 public enum MethodType {
50 GET, POST
51 };
52
53 /**
54 * Creates a new object representing an html form submit event.
55 *
56 * @param source the object responsible for the event
57 * @param type the event type
58 * @param actionURL the form action URL
59 * @param sourceElement the element that corresponds to the source
60 * of the event
61 * @param targetFrame the Frame to display the document in
62 * @param method the form method type
63 * @param data the form submission data
64 */
65 FormSubmitEvent(Object source, EventType type, URL targetURL,
66 Element sourceElement, String targetFrame,
67 MethodType method, String data) {
68 super (source, type, targetURL, sourceElement, targetFrame);
69 this .method = method;
70 this .data = data;
71 }
72
73 /**
74 * Gets the form method type.
75 *
76 * @return the form method type, either
77 * <code>Method.GET</code> or <code>Method.POST</code>.
78 */
79 public MethodType getMethod() {
80 return method;
81 }
82
83 /**
84 * Gets the form submission data.
85 *
86 * @return the string representing the form submission data.
87 */
88 public String getData() {
89 return data;
90 }
91
92 private MethodType method;
93 private String data;
94 }
|