Source code: com/voytechs/html/component/Form.java
1 /*
2 * File: Form.java
3 * Auth: Mark Bednarczyk
4 * Date: DATE
5 * Id: $Id: Form.java,v 1.1.1.1 2002/01/23 23:52:49 voytechs Exp $
6 ********************************************
7 * $Log: Form.java,v $
8 * Revision 1.1.1.1 2002/01/23 23:52:49 voytechs
9 * Initial public release, BETA 1.0 - voytechs
10 *
11 */
12 package com.voytechs.html.component;
13
14 import com.voytechs.html.event.EventException;
15 import com.voytechs.html.io.HtmlWriter;
16 import com.voytechs.html.util.LogFacility;
17
18 import java.lang.*;
19 import java.util.*;
20 import java.io.IOException;
21
22 /**
23 * A Form object is has a collection of form input/button elements.
24 */
25 public class Form
26 extends Container {
27
28 /* Internal attributes */
29
30 private String actionUrl = null;
31
32 /**
33 *
34 * @param
35 * @exception
36 */
37 public Form(String actionUrl) {
38 super();
39
40 this.actionUrl = actionUrl;
41
42 tagProperties.put("METHOD", "POST");
43 }
44
45 /**
46 *
47 * @param
48 * @exception
49 */
50 public Form() {
51 super();
52
53 tagProperties.put("METHOD", "POST");
54 }
55
56
57 /**
58 * Setup the initial HTML Document with the required headers.
59 */
60 public void paint(HtmlWriter htmlOut) throws IOException {
61
62 if(actionUrl == null)
63 htmlOut.form(getUriPath(), tagProperties.toString());
64 else
65 htmlOut.form(actionUrl, tagProperties.toString());
66
67 super.paint(htmlOut);
68
69 htmlOut.formEnd();
70 }
71
72 /**
73 * Add all form related components.
74 * @param element A component to be added to the list of children to be managed.
75 */
76 public Form addElement(FormComponent formElement) throws EventException {
77
78 LogFacility.log.println(this + "::Form::addElement() - formElement=" + formElement);
79
80 super.addChild(formElement);
81
82 return(this);
83 }
84
85 /**
86 * Add all form related components.
87 * @param element A component to be added to the list of children to be managed.
88 */
89 public Form addElement(SimpleComponent simpleElement) throws EventException {
90 LogFacility.log.println(this + "::Form::addElement() - simpleElement=" + simpleElement);
91 super.addChild(simpleElement);
92
93 return(this);
94 }
95
96 /**
97 * Add HTML TAG parameter
98
99 /**
100 * Test function for Form
101 * @param args command line arguments
102 */
103 public static void main(String [] args) {
104 }
105
106 } /* END OF: Form */