1
|
/**
|
2
|
* Copyright (C) 2009 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
|
package eu.etaxonomy.taxeditor.ui.section.feature;
|
10
|
|
11
|
import eu.etaxonomy.cdm.api.service.ITermService;
|
12
|
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
|
13
|
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
|
14
|
import eu.etaxonomy.taxeditor.event.EventUtility;
|
15
|
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
|
16
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
17
|
import eu.etaxonomy.taxeditor.store.StoreUtil;
|
18
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
19
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
20
|
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
|
21
|
import eu.etaxonomy.taxeditor.ui.element.RepresentationElement;
|
22
|
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
|
23
|
import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement;
|
24
|
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
|
25
|
|
26
|
/**
|
27
|
*
|
28
|
* @author pplitzner
|
29
|
* @since Dec 21, 2017
|
30
|
*
|
31
|
*/
|
32
|
public class TermNodeDetailElement extends AbstractCdmDetailElement<TermNodeDto> {
|
33
|
|
34
|
private InapplicableIfEntityCollectionSection sectionInapplicableIf;
|
35
|
private OnlyApplicableIfEntityCollectionSection sectionOnlyApplicableIf;
|
36
|
//Term details
|
37
|
private TextWithLabelElement textIdInVocabulary;
|
38
|
private TextWithLabelElement textSymbol;
|
39
|
private TextWithLabelElement textSymbol2;
|
40
|
private UriWithLabelElement uri_uri;
|
41
|
private RepresentationElement element_Representation;
|
42
|
|
43
|
|
44
|
public TermNodeDetailElement(CdmFormFactory formFactory,
|
45
|
ICdmFormElement formElement) {
|
46
|
super(formFactory, formElement);
|
47
|
}
|
48
|
|
49
|
@Override
|
50
|
protected void createControls(ICdmFormElement formElement, TermNodeDto entity, int style) {
|
51
|
sectionInapplicableIf = formFactory.createInapplicableIfEntityCollectionSection(getConversationHolder(),
|
52
|
formElement, StoreUtil.getSectionStyle(InapplicableIfEntityCollectionSection.class, getEntity().getClass().getCanonicalName()));
|
53
|
sectionInapplicableIf.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
|
54
|
sectionInapplicableIf.setEntity(getEntity());
|
55
|
sectionOnlyApplicableIf = formFactory.createOnlyApplicableIfEntityCollectionSection(getConversationHolder(),
|
56
|
formElement, StoreUtil.getSectionStyle(OnlyApplicableIfEntityCollectionSection.class, getEntity().getClass().getCanonicalName()));
|
57
|
sectionOnlyApplicableIf.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
|
58
|
sectionOnlyApplicableIf.setEntity(getEntity());
|
59
|
|
60
|
DefinedTermBase term = CdmStore.getService(ITermService.class).load(entity.getTerm().getUuid());
|
61
|
|
62
|
AbstractCdmDetailElement termDetailElement = formFactory.createDefinedTermDetailElement(term.getClass(), formElement, style);
|
63
|
|
64
|
termDetailElement.setEntity(term);
|
65
|
termDetailElement.setEnabled(false);
|
66
|
// element_Representation = formFactory.createTranslatableRepresentationElement(formElement, term.getPreferredRepresentation(CdmStore.getDefaultLanguage()),term, 100, style, true);
|
67
|
// uri_uri = formFactory.createUriWithLabelElement(formElement, "URI", term.getUri(), style);
|
68
|
// element_Representation.getLayoutComposite().setEnabled(false);
|
69
|
// uri_uri.getLayoutComposite().setEnabled(false);
|
70
|
}
|
71
|
|
72
|
@Override
|
73
|
public void handleEvent(Object eventSource) {
|
74
|
EventUtility.postEvent(WorkbenchEventConstants.ADD_SAVE_CANDIDATE, getEntity().getUuid());
|
75
|
}
|
76
|
|
77
|
}
|