01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: * $Header:$
18: */
19: package org.apache.beehive.netui.tags;
20:
21: import java.util.ArrayList;
22:
23: /**
24: * An <code>ErrorReporter</code> acts as a container allowing a tag to gather up all errors reported by it's children
25: * and report them as a single group. Typically, there should be a single active <code>ErrorReporter</code>
26: * so all the errors on the page are reported in a single place. All error reporters must look at any parent
27: * tags and also the CONTAINER_ERRORS request variable for an instance of <code>ErrorReporter</code> before
28: * becoming the primary <code>ErrorReporter</code>. If another <code>ErrorReporter</code> is defined,
29: * the tag should return <code>false</code> from the <code>isReporting()</code> method. Otherwise, the tag
30: * may become the primary <code>ErrorReporter</code>. If a tag sets the CONTAINER_ERRORS request attribute,
31: * it must clear this when processing it's <code>doEndTag()</code> method because it will not be
32: * able to report errors after this point.
33: */
34: public interface IErrorReporter {
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 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 returnErrors();
60: }
|