Merge branch 'release/5.18.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / reference / AdvancedNomenclaturalSourceElement.java
1 /**
2 * Copyright (C) 2020 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.reference;
10
11 import org.eclipse.swt.SWT;
12 import org.eclipse.swt.graphics.Color;
13 import org.eclipse.swt.widgets.Display;
14 import org.eclipse.swt.widgets.Label;
15
16 import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
17 import eu.etaxonomy.cdm.model.reference.OriginalSourceBase;
18 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
19 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
20 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
21
22 /**
23 * @author k.luther
24 * @since Nov 12, 2020
25 */
26 public class AdvancedNomenclaturalSourceElement extends AdvancedSourceElement {
27
28 /**
29 * @param formFactory
30 * @param formElement
31 */
32 public AdvancedNomenclaturalSourceElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
33 super(formFactory, formElement);
34 // TODO Auto-generated constructor stub
35 }
36
37 @Override
38 protected void createControls(ICdmFormElement formElement, OriginalSourceBase entity, int style) {
39 Display display = Display.getCurrent();
40 Color background = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
41 text_originaleNameString = formFactory.createTextWithLabelElement(
42 formElement, "Original Information", entity != null?entity.getOriginalNameString():null, SWT.NULL);
43
44 text_originaleNameString.setBackground(background);
45
46 if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowNamespaceInSource.getKey())){
47 text_idNamespace = formFactory.createTextWithLabelElement(formElement, "ID Namespace", entity != null?entity.getIdNamespace():null, style);
48 text_idNamespace.setBackground(background);
49 }
50 if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSource.getKey())){
51 text_idInSource = formFactory.createTextWithLabelElement(formElement, "ID in Source", entity != null?entity.getIdInSource():null, style);
52 text_idInSource.setBackground(background);
53
54 }
55 Label label = formFactory.createEmptyCell(getLayoutComposite());
56 }
57
58 }