a8bdfe4d0d4f5bdca50a1dc84334d12dbd361c83
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / reference / ReferenceWizardPage.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.section.reference;
12
13 import org.eclipse.swt.SWT;
14
15 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16 import eu.etaxonomy.cdm.model.reference.Reference;
17 import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
18 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
19 import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
20 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
21 import eu.etaxonomy.taxeditor.ui.element.IExceptionHandler;
22 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
23
24 /**
25 * <p>ReferenceBaseWizardPage class.</p>
26 *
27 * @author n.hoffmann
28 * @created Jun 1, 2010
29 * @version 1.0
30 */
31 public class ReferenceWizardPage extends AbstractCdmEntityWizardPage<Reference> implements IExceptionHandler{
32
33 /**
34 * <p>Constructor for ReferenceBaseWizardPage.</p>
35 *
36 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
37 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
38 * @param entity a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
39 */
40 public ReferenceWizardPage(CdmFormFactory formFactory, ConversationHolder conversation, Reference entity) {
41 super(formFactory, conversation, entity);
42 setTitle("Reference");
43 }
44
45 /*
46 * (non-Javadoc)
47 * @see eu.etaxonomy.taxeditor.forms.CdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
48 */
49 /** {@inheritDoc} */
50 @Override
51 public AbstractCdmDetailElement<Reference> createElement(ICdmFormElement rootElement){
52 ReferenceDetailElement referenceElement = formFactory.createReferenceDetailElement(rootElement, SWT.NULL);
53 referenceElement.addExceptionHandler(this);
54 referenceElement.setEntity(entity);
55 return referenceElement;
56 }
57
58 /* (non-Javadoc)
59 * @see eu.etaxonomy.taxeditor.forms.IExceptionHandler#handleException(eu.etaxonomy.taxeditor.forms.CdmPropertyChangeEvent)
60 */
61 /** {@inheritDoc} */
62 @Override
63 public void handleException(CdmPropertyChangeEvent event) {
64 setMessage(event.getException().getMessage(), WARNING);
65 }
66
67 /* (non-Javadoc)
68 * @see eu.etaxonomy.taxeditor.forms.IExceptionHandler#clearException()
69 */
70 /** {@inheritDoc} */
71 @Override
72 public void clearException() {
73 setMessage(null);
74 }
75 }