1. /*
  2. * @(#)FormSubmitEvent.java 1.3 03/12/19
  3. *
  4. * Copyright 2004 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 java.net.URL;
  10. /**
  11. * FormSubmitEvent is used to notify interested
  12. * parties that a form was submited.
  13. *
  14. * @version 1.3 12/19/03
  15. * @since 1.5
  16. * @author Denis Sharypov
  17. */
  18. public class FormSubmitEvent extends HTMLFrameHyperlinkEvent {
  19. /**
  20. * Represents an HTML form method type.
  21. * <UL>
  22. * <LI><code>GET</code> corresponds to the GET form method</LI>
  23. * <LI><code>POST</code> corresponds to the POST from method</LI>
  24. * </UL>
  25. */
  26. public enum MethodType { GET, POST };
  27. /**
  28. * Creates a new object representing an html form submit event.
  29. *
  30. * @param source the object responsible for the event
  31. * @param type the event type
  32. * @param actionURL the form action URL
  33. * @param sourceElement the element that corresponds to the source
  34. * of the event
  35. * @param targetFrame the Frame to display the document in
  36. * @param method the form method type
  37. * @param data the form submission data
  38. */
  39. FormSubmitEvent(Object source, EventType type, URL targetURL,
  40. Element sourceElement, String targetFrame,
  41. MethodType method, String data) {
  42. super(source, type, targetURL, sourceElement, targetFrame);
  43. this.method = method;
  44. this.data = data;
  45. }
  46. /**
  47. * Gets the form method type.
  48. *
  49. * @return the form method type, either
  50. * <code>Method.GET</code> or <code>Method.POST</code>.
  51. */
  52. public MethodType getMethod() {
  53. return method;
  54. }
  55. /**
  56. * Gets the form submission data.
  57. *
  58. * @return the string representing the form submission data.
  59. */
  60. public String getData() {
  61. return data;
  62. }
  63. private MethodType method;
  64. private String data;
  65. }