|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
IFieldTracking.java | - | - | - | - |
|
1 |
// Copyright 2004, 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.valid;
|
|
16 |
|
|
17 |
import org.apache.tapestry.IRender;
|
|
18 |
import org.apache.tapestry.form.IFormComponent;
|
|
19 |
|
|
20 |
/**
|
|
21 |
* Defines the interface for an object that tracks input fields. This
|
|
22 |
* interface is now poorly named, in that it tracks errors that may <em>not</em>
|
|
23 |
* be associated with a specific field.
|
|
24 |
*
|
|
25 |
* <p>For each field, a flag is stored indicating if the field is, in fact, in error.
|
|
26 |
* The input supplied by the client is stored so that if the form is re-rendered
|
|
27 |
* (as is typically done when there are input errors), the value entered by the user
|
|
28 |
* is displayed back to the user. An error message renderer is stored; this is
|
|
29 |
* an object that can render the error message (it is usually
|
|
30 |
* a {@link org.apache.tapestry.valid.RenderString} wrapper around a simple string).
|
|
31 |
*
|
|
32 |
* @author Howard Lewis Ship
|
|
33 |
* @since 1.0.8
|
|
34 |
*
|
|
35 |
**/
|
|
36 |
|
|
37 |
public interface IFieldTracking |
|
38 |
{ |
|
39 |
/**
|
|
40 |
* Returns true if the field is in error (that is,
|
|
41 |
* if it has an error message {@link #getErrorRenderer() renderer}.
|
|
42 |
*
|
|
43 |
**/
|
|
44 |
|
|
45 |
public boolean isInError(); |
|
46 |
|
|
47 |
|
|
48 |
/**
|
|
49 |
* Returns the field component. This may return null if the error
|
|
50 |
* is not associated with any particular field.
|
|
51 |
*
|
|
52 |
**/
|
|
53 |
|
|
54 |
public IFormComponent getComponent();
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Returns an object that will render the error message.
|
|
58 |
*
|
|
59 |
* @since 1.0.9
|
|
60 |
*
|
|
61 |
**/
|
|
62 |
|
|
63 |
public IRender getErrorRenderer();
|
|
64 |
|
|
65 |
|
|
66 |
/**
|
|
67 |
* Returns the invalid input recorded for the field. This is stored
|
|
68 |
* so that, on a subsequent render, the smae invalid input can be presented
|
|
69 |
* to the client to be corrected.
|
|
70 |
*
|
|
71 |
**/
|
|
72 |
|
|
73 |
public String getInput();
|
|
74 |
|
|
75 |
/**
|
|
76 |
* Returns the name of the field, that is, the name assigned by the form
|
|
77 |
* (this will differ from the component's id when any kind of looping operation
|
|
78 |
* is in effect).
|
|
79 |
*
|
|
80 |
**/
|
|
81 |
|
|
82 |
public String getFieldName();
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Returns the validation constraint that was violated by the input. This
|
|
86 |
* may be null if the constraint isn't known.
|
|
87 |
*
|
|
88 |
**/
|
|
89 |
|
|
90 |
public ValidationConstraint getConstraint();
|
|
91 |
} |
|