KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > form > RequirableField


1 // Copyright 2005 The Apache Software Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15 package org.apache.tapestry.form;
16
17 import org.apache.tapestry.IMarkupWriter;
18 import org.apache.tapestry.IRequestCycle;
19 import org.apache.tapestry.valid.ValidatorException;
20
21 /**
22  * Implemented by form components that can be marked as required. The form rewind will record
23  * validation errors for required fields for which a value was not submitted.
24  *
25  * @author Paul Ferraro
26  * @since 4.0
27  */

28 public interface RequirableField extends IFormComponent
29 {
30     /**
31      * Indicates whether or not this field is required.
32      *
33      * @return true, if this field is required, false otherwise.
34      */

35     public boolean isRequired();
36
37     /**
38      * Returns the custom validation message pattern that overrides the default one. This value may
39      * include {@link MessageFormat} parameters, the context of which is specific to this field.
40      *
41      * @return a custom validation message
42      */

43     public String JavaDoc getRequiredMessage();
44
45     /**
46      * Called on the field if the required field check succeeds.
47      *
48      * @throws ValidatorException
49      * if required field check fails.
50      */

51     public void bind(IMarkupWriter writer, IRequestCycle cycle) throws ValidatorException;
52
53     /**
54      * Retrieves a simplified view of the value submitted for this component. Used during required
55      * field checking.
56      */

57     public String JavaDoc getSubmittedValue(IRequestCycle cycle);
58 }
59
Popular Tags