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.classification;
|
12
|
|
13
|
import org.apache.log4j.Logger;
|
14
|
import org.eclipse.swt.SWT;
|
15
|
|
16
|
import eu.etaxonomy.cdm.model.common.LanguageString;
|
17
|
import eu.etaxonomy.cdm.model.taxon.Classification;
|
18
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
19
|
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
|
20
|
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
|
21
|
import eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement;
|
22
|
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType;
|
23
|
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
|
24
|
import eu.etaxonomy.taxeditor.ui.selection.ReferenceSelectionElement;
|
25
|
|
26
|
/**
|
27
|
* <p>ClassificationDetailElement class.</p>
|
28
|
*
|
29
|
* @author n.hoffmann
|
30
|
* @created Sep 27, 2010
|
31
|
* @version 1.0
|
32
|
*/
|
33
|
public class ClassificationDetailElement extends AbstractCdmDetailElement<Classification> {
|
34
|
|
35
|
|
36
|
private static final Logger logger = Logger
|
37
|
.getLogger(ClassificationDetailElement.class);
|
38
|
|
39
|
private TextWithLabelElement text_treeLabel;
|
40
|
|
41
|
private ReferenceSelectionElement selection_reference;
|
42
|
|
43
|
private TextWithLabelElement text_microReference;
|
44
|
|
45
|
/**
|
46
|
* <p>Constructor for ClassificationDetailElement.</p>
|
47
|
*
|
48
|
* @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
|
49
|
* @param formElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
|
50
|
*/
|
51
|
public ClassificationDetailElement(CdmFormFactory formFactory,
|
52
|
ICdmFormElement formElement) {
|
53
|
super(formFactory, formElement);
|
54
|
}
|
55
|
|
56
|
/* (non-Javadoc)
|
57
|
* @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.forms.ICdmFormElement, eu.etaxonomy.cdm.model.common.IAnnotatableEntity, int)
|
58
|
*/
|
59
|
/** {@inheritDoc} */
|
60
|
@Override
|
61
|
protected void createControls(ICdmFormElement formElement,
|
62
|
Classification entity, int style) {
|
63
|
text_treeLabel = formFactory.createTextWithLabelElement(formElement, "Label", entity != null ? entity.getTitleCache() : null, SWT.NULL);
|
64
|
selection_reference = (ReferenceSelectionElement) formFactory.createSelectionElement(SelectionType.REFERENCE, getConversationHolder(), formElement, "Reference", entity != null ? entity.getReference() : null, SWT.NULL);
|
65
|
text_microReference = formFactory.createTextWithLabelElement(formElement, "Reference Detail", entity != null ? entity.getMicroReference() : null, SWT.NULL);
|
66
|
}
|
67
|
|
68
|
/* (non-Javadoc)
|
69
|
* @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
|
70
|
*/
|
71
|
/** {@inheritDoc} */
|
72
|
@Override
|
73
|
public void handleEvent(Object eventSource) {
|
74
|
if(eventSource == text_treeLabel){
|
75
|
LanguageString languageString = LanguageString.NewInstance(text_treeLabel.getText(), CdmStore.getDefaultLanguage());
|
76
|
getEntity().setName(languageString);
|
77
|
}
|
78
|
else if(eventSource == selection_reference){
|
79
|
getEntity().setReference(selection_reference.getEntity());
|
80
|
}
|
81
|
else if(eventSource == text_microReference){
|
82
|
getEntity().setMicroReference(text_microReference.getText());
|
83
|
}
|
84
|
}
|
85
|
}
|