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