- moved ICdmFormElement to ui.element
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / element / AbstractCdmFormElementWithErrors.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.taxeditor.ui.element;
12
13 import java.util.ArrayList;
14 import java.util.List;
15
16
17
18
19 /**
20 * <p>Abstract AbstractCdmFormElementWithErrors class.</p>
21 *
22 * @author n.hoffmann
23 * @created Oct 26, 2010
24 * @version 1.0
25 */
26 public abstract class AbstractCdmFormElementWithErrors extends AbstractCdmFormElement implements IErrorIntolerableElement {
27
28 private List<IExceptionHandler> exceptionHandlers = new ArrayList<IExceptionHandler>();
29
30 /**
31 * <p>Constructor for AbstractCdmFormElementWithErrors.</p>
32 *
33 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
34 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
35 */
36 public AbstractCdmFormElementWithErrors(CdmFormFactory formFactory,
37 ICdmFormElement formElement) {
38 super(formFactory, formElement);
39 }
40
41 /* (non-Javadoc)
42 * @see eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#addExceptionHandler(eu.etaxonomy.taxeditor.forms.IExceptionHandler)
43 */
44 /** {@inheritDoc} */
45 @Override
46 public void addExceptionHandler(IExceptionHandler handler) {
47 exceptionHandlers.add(handler);
48 }
49
50 /* (non-Javadoc)
51 * @see eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#removeExceptionHandler(eu.etaxonomy.taxeditor.forms.IExceptionHandler)
52 */
53 /** {@inheritDoc} */
54 @Override
55 public void removeExceptionHandler(IExceptionHandler handler) {
56 exceptionHandlers.remove(handler);
57 }
58
59 /* (non-Javadoc)
60 * @see eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#exceptionOccurred()
61 */
62 /** {@inheritDoc} */
63 @Override
64 public void exceptionOccurred(CdmPropertyChangeEvent event) {
65 for(IExceptionHandler handler : exceptionHandlers){
66 handler.handleException(event);
67 }
68 }
69
70 }