01: /*
02: * $Id: RequiredTextField.java 459552 2006-02-28 21:22:29Z jdonnerstag $
03: * $Revision: 459552 $ $Date: 2006-02-28 22:22:29 +0100 (Tue, 28 Feb 2006) $
04: *
05: * ==============================================================================
06: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
07: * use this file except in compliance with the License. You may obtain a copy of
08: * the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15: * License for the specific language governing permissions and limitations under
16: * the License.
17: */
18: package wicket.markup.html.form;
19:
20: import wicket.model.IModel;
21:
22: /**
23: * A text field which automatically adds a RequiredValidator. This is mainly for
24: * convenience, since you can always add(new RequiredValidator()) manually.
25: *
26: * @author Jonathan Locke
27: */
28: public class RequiredTextField extends TextField {
29: private static final long serialVersionUID = 1L;
30:
31: /**
32: * @see wicket.Component#Component(String)
33: */
34: public RequiredTextField(final String id) {
35: super (id);
36: setRequired(true);
37: }
38:
39: /**
40: * @see TextField#TextField(String, Class)
41: */
42: public RequiredTextField(final String id, final Class type) {
43: super (id, type);
44: setRequired(true);
45: }
46:
47: /**
48: * @see wicket.Component#Component(String, IModel)
49: */
50: public RequiredTextField(final String id, final IModel model) {
51: super (id, model);
52: setRequired(true);
53: }
54:
55: /**
56: * @param id
57: * See Component
58: * @param model
59: * See Component
60: * @param type
61: * The type to use when updating the model for this text field
62: * @see wicket.Component#Component(String, IModel)
63: */
64: public RequiredTextField(final String id, IModel model, Class type) {
65: super (id, model, type);
66: setRequired(true);
67: }
68: }
|