29 import java.awt.*;
30 import java.awt.event.*;
31 import java.util.*;
32 import javax.swing.*;
33 import javax.swing.event.*;
34 import javax.swing.text.*;
35
36 /**
37 * Component decorator that implements the view interface
38 * for form elements, <input>, <textarea>,
39 * and <select>. The model for the component is stored
40 * as an attribute of the element (using StyleConstants.ModelAttribute),
41 * and is used to build the component of the view. The type
42 * of the model is assumed to of the type that would be set by
43 * <code>HTMLDocument.HTMLReader.FormAction</code>. If there are
44 * multiple views mapped over the document, they will share the
45 * embedded component models.
46 * <p>
47 * The following table shows what components get built
48 * by this view.
49 * <table summary="shows what components get built by this view">
50 * <tr>
51 * <th>Element Type</th>
52 * <th>Component built</th>
53 * </tr>
54 * <tr>
55 * <td>input, type button</td>
56 * <td>JButton</td>
57 * </tr>
58 * <tr>
59 * <td>input, type checkbox</td>
60 * <td>JCheckBox</td>
61 * </tr>
62 * <tr>
63 * <td>input, type image</td>
64 * <td>JButton</td>
65 * </tr>
66 * <tr>
67 * <td>input, type password</td>
68 * <td>JPasswordField</td>
69 * </tr>
70 * <tr>
71 * <td>input, type radio</td>
72 * <td>JRadioButton</td>
73 * </tr>
82 * <tr>
83 * <td>input, type text</td>
84 * <td>JTextField</td>
85 * </tr>
86 * <tr>
87 * <td>select, size > 1 or multiple attribute defined</td>
88 * <td>JList in a JScrollPane</td>
89 * </tr>
90 * <tr>
91 * <td>select, size unspecified or 1</td>
92 * <td>JComboBox</td>
93 * </tr>
94 * <tr>
95 * <td>textarea</td>
96 * <td>JTextArea in a JScrollPane</td>
97 * </tr>
98 * <tr>
99 * <td>input, type file</td>
100 * <td>JTextField</td>
101 * </tr>
102 * </table>
103 *
104 * @author Timothy Prinzing
105 * @author Sunita Mani
106 */
107 public class FormView extends ComponentView implements ActionListener {
108
109 /**
110 * If a value attribute is not specified for a FORM input element
111 * of type "submit", then this default string is used.
112 *
113 * @deprecated As of 1.3, value now comes from UIManager property
114 * FormView.submitButtonText
115 */
116 @Deprecated
117 public static final String SUBMIT = new String("Submit Query");
118 /**
119 * If a value attribute is not specified for a FORM input element
120 * of type "reset", then this default string is used.
121 *
|
29 import java.awt.*;
30 import java.awt.event.*;
31 import java.util.*;
32 import javax.swing.*;
33 import javax.swing.event.*;
34 import javax.swing.text.*;
35
36 /**
37 * Component decorator that implements the view interface
38 * for form elements, <input>, <textarea>,
39 * and <select>. The model for the component is stored
40 * as an attribute of the element (using StyleConstants.ModelAttribute),
41 * and is used to build the component of the view. The type
42 * of the model is assumed to of the type that would be set by
43 * <code>HTMLDocument.HTMLReader.FormAction</code>. If there are
44 * multiple views mapped over the document, they will share the
45 * embedded component models.
46 * <p>
47 * The following table shows what components get built
48 * by this view.
49 *
50 * <table class="striped">
51 * <caption>Shows what components get built by this view</caption>
52 * <thead>
53 * <tr>
54 * <th>Element Type</th>
55 * <th>Component built</th>
56 * </tr>
57 * </thead>
58 * <tbody>
59 * <tr>
60 * <td>input, type button</td>
61 * <td>JButton</td>
62 * </tr>
63 * <tr>
64 * <td>input, type checkbox</td>
65 * <td>JCheckBox</td>
66 * </tr>
67 * <tr>
68 * <td>input, type image</td>
69 * <td>JButton</td>
70 * </tr>
71 * <tr>
72 * <td>input, type password</td>
73 * <td>JPasswordField</td>
74 * </tr>
75 * <tr>
76 * <td>input, type radio</td>
77 * <td>JRadioButton</td>
78 * </tr>
87 * <tr>
88 * <td>input, type text</td>
89 * <td>JTextField</td>
90 * </tr>
91 * <tr>
92 * <td>select, size > 1 or multiple attribute defined</td>
93 * <td>JList in a JScrollPane</td>
94 * </tr>
95 * <tr>
96 * <td>select, size unspecified or 1</td>
97 * <td>JComboBox</td>
98 * </tr>
99 * <tr>
100 * <td>textarea</td>
101 * <td>JTextArea in a JScrollPane</td>
102 * </tr>
103 * <tr>
104 * <td>input, type file</td>
105 * <td>JTextField</td>
106 * </tr>
107 * </tbody>
108 * </table>
109 *
110 * @author Timothy Prinzing
111 * @author Sunita Mani
112 */
113 public class FormView extends ComponentView implements ActionListener {
114
115 /**
116 * If a value attribute is not specified for a FORM input element
117 * of type "submit", then this default string is used.
118 *
119 * @deprecated As of 1.3, value now comes from UIManager property
120 * FormView.submitButtonText
121 */
122 @Deprecated
123 public static final String SUBMIT = new String("Submit Query");
124 /**
125 * If a value attribute is not specified for a FORM input element
126 * of type "reset", then this default string is used.
127 *
|