KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > tags > IErrorReporter


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

18 package org.apache.beehive.netui.tags;
19
20 import java.util.ArrayList JavaDoc;
21
22 /**
23  * An <code>ErrorReporter</code> acts as a container allowing a tag to gather up all errors reported by it's children
24  * and report them as a single group. Typically, there should be a single active <code>ErrorReporter</code>
25  * so all the errors on the page are reported in a single place. All error reporters must look at any parent
26  * tags and also the CONTAINER_ERRORS request variable for an instance of <code>ErrorReporter</code> before
27  * becoming the primary <code>ErrorReporter</code>. If another <code>ErrorReporter</code> is defined,
28  * the tag should return <code>false</code> from the <code>isReporting()</code> method. Otherwise, the tag
29  * may become the primary <code>ErrorReporter</code>. If a tag sets the CONTAINER_ERRORS request attribute,
30  * it must clear this when processing it's <code>doEndTag()</code> method because it will not be
31  * able to report errors after this point.
32  */

33 public interface IErrorReporter
34 {
35     /**
36      * This is a request scoped attribute name which may contain an ErrorReporter instance. If this
37      * is defined, then this is the top most error reporter and should be used to report errors.
38      */

39     final String JavaDoc CONTAINER_ERRORS = "_netui.ErrorReporter";
40
41     /**
42      * Add an error to this <code>ErrorReporter</code>.
43      * @param ape the page error to add to the container.
44      */

45     public void addError(AbstractPageError ape);
46
47     /**
48      * This boolean indicates if an ErrorReporter is reporting errors
49      * or not. The caller should check this before calling addError
50      * because the ErrorReporter may be off.
51      * @return a boolean indicating if the tag is reporting errors or not.
52      */

53     public boolean isReporting();
54
55     /**
56      * Return an ArrayList of the errors
57      * @return an <code>ArrayList</code> of all errors.
58      */

59     public ArrayList JavaDoc returnErrors();
60 }
61
Popular Tags