- moved ICdmFormElement to campanula.compatibility
[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 import eu.etaxonomy.taxeditor.ui.section.campanula.compatibility.ICdmFormElement;
17
18
19
20 /**
21 * <p>Abstract AbstractCdmFormElementWithErrors class.</p>
22 *
23 * @author n.hoffmann
24 * @created Oct 26, 2010
25 * @version 1.0
26 */
27 public abstract class AbstractCdmFormElementWithErrors extends AbstractCdmFormElement implements IErrorIntolerableElement {
28
29 private List<IExceptionHandler> exceptionHandlers = new ArrayList<IExceptionHandler>();
30
31 /**
32 * <p>Constructor for AbstractCdmFormElementWithErrors.</p>
33 *
34 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
35 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
36 */
37 public AbstractCdmFormElementWithErrors(CdmFormFactory formFactory,
38 ICdmFormElement formElement) {
39 super(formFactory, formElement);
40 }
41
42 /* (non-Javadoc)
43 * @see eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#addExceptionHandler(eu.etaxonomy.taxeditor.forms.IExceptionHandler)
44 */
45 /** {@inheritDoc} */
46 @Override
47 public void addExceptionHandler(IExceptionHandler handler) {
48 exceptionHandlers.add(handler);
49 }
50
51 /* (non-Javadoc)
52 * @see eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#removeExceptionHandler(eu.etaxonomy.taxeditor.forms.IExceptionHandler)
53 */
54 /** {@inheritDoc} */
55 @Override
56 public void removeExceptionHandler(IExceptionHandler handler) {
57 exceptionHandlers.remove(handler);
58 }
59
60 /* (non-Javadoc)
61 * @see eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#exceptionOccurred()
62 */
63 /** {@inheritDoc} */
64 @Override
65 public void exceptionOccurred(CdmPropertyChangeEvent event) {
66 for(IExceptionHandler handler : exceptionHandlers){
67 handler.handleException(event);
68 }
69 }
70
71 }