Project

General

Profile

Download (1.95 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
4
* http://www.e-taxonomy.eu
5
* 
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

    
10
package eu.etaxonomy.taxeditor.ui.element;
11

    
12
import java.util.ArrayList;
13
import java.util.List;
14

    
15

    
16

    
17

    
18
/**
19
 * <p>Abstract AbstractCdmFormElementWithErrors class.</p>
20
 *
21
 * @author n.hoffmann
22
 * @created Oct 26, 2010
23
 * @version 1.0
24
 */
25
public abstract class AbstractCdmFormElementWithErrors extends AbstractCdmFormElement implements IErrorIntolerableElement {
26

    
27
	private List<IExceptionHandler> exceptionHandlers = new ArrayList<IExceptionHandler>();
28

    
29
	/**
30
	 * <p>Constructor for AbstractCdmFormElementWithErrors.</p>
31
	 *
32
	 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
33
	 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
34
	 */
35
	public AbstractCdmFormElementWithErrors(CdmFormFactory formFactory,
36
			ICdmFormElement formElement) {
37
		super(formFactory, formElement);
38
	}
39

    
40
	/* (non-Javadoc)
41
	 * @see eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#addExceptionHandler(eu.etaxonomy.taxeditor.forms.IExceptionHandler)
42
	 */
43
	/** {@inheritDoc} */
44
	@Override
45
	public void addExceptionHandler(IExceptionHandler handler) {
46
		exceptionHandlers.add(handler);
47
	}
48
	
49
	/* (non-Javadoc)
50
	 * @see eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#removeExceptionHandler(eu.etaxonomy.taxeditor.forms.IExceptionHandler)
51
	 */
52
	/** {@inheritDoc} */
53
	@Override
54
	public void removeExceptionHandler(IExceptionHandler handler) {
55
		exceptionHandlers.remove(handler);
56
	}
57
	
58
	/* (non-Javadoc)
59
	 * @see eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#exceptionOccurred()
60
	 */
61
	/** {@inheritDoc} */
62
	@Override
63
	public void exceptionOccurred(CdmPropertyChangeEvent event) {
64
		for(IExceptionHandler handler : exceptionHandlers){
65
			handler.handleException(event);
66
		}
67
	}
68

    
69
}
(3-3/45)