Project

General

Profile

« Previous | Next » 

Revision 68e7703e

Added by Katja Luther over 3 years ago

ref #9266: restructure nomenclatural source detail element

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
326 326
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
327 327
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailElement;
328 328
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
329
import eu.etaxonomy.taxeditor.ui.section.reference.AdvancedNomenclaturalSourceElement;
329 330
import eu.etaxonomy.taxeditor.ui.section.reference.AdvancedSourceElement;
330 331
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailElement;
331 332
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
......
1967 1968
        return element;
1968 1969
    }
1969 1970

  
1971
    public AdvancedSourceElement createAdvancedNomenclaturalSourceDetailElement(ICdmFormElement parentElement, int style){
1972
        AdvancedNomenclaturalSourceElement element = new AdvancedNomenclaturalSourceElement(this, parentElement);
1973
        addAndAdaptElement(parentElement, element);
1974
        return element;
1975
    }
1976

  
1970 1977
    public SingleSourceSection createSingleSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, CdmBase cdmEntity, ISelectionProvider selectionProvider, String label, int style){
1971 1978
        SingleSourceSection section = new SingleSourceSection(this, conversation, parentElement, cdmEntity, selectionProvider, style, label);
1972 1979
        addAndAdaptSection(parentElement, section);
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

  
42

  
43
        if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowNamespaceInSource.getKey())){
44
            text_idNamespace = formFactory.createTextWithLabelElement(formElement, "ID Namespace", entity != null?entity.getIdNamespace():null, style);
45
            text_idNamespace.setBackground(background);
46
        }
47
        if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSource.getKey())){
48
            text_idInSource = formFactory.createTextWithLabelElement(formElement, "ID in Source", entity != null?entity.getIdInSource():null, style);
49
            text_idInSource.setBackground(background);
50

  
51
        }
52

  
53
        text_originaleNameString = formFactory.createTextWithLabelElement(
54
                formElement, "Original Information", entity != null?entity.getOriginalNameString():null, SWT.NULL);
55

  
56
        text_originaleNameString.setBackground(background);
57
        Label label = formFactory.createEmptyCell(getLayoutComposite());
58
    }
59

  
60
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/AdvancedSourceElement.java
82 82
    @Override
83 83
    public void setEntity(OriginalSourceBase entity) {
84 84
        super.setEntity(entity);
85
        externalLinks.setEntity(entity);
85
        if (externalLinks != null){
86
            externalLinks.setEntity(entity);
87
        }
86 88
    }
87 89

  
88 90
    public ExternalLinksSection getExternalLinks() {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalSourceElement.java
8 8
*/
9 9
package eu.etaxonomy.taxeditor.ui.section.reference;
10 10

  
11
import org.eclipse.swt.SWT;
11
import org.eclipse.ui.forms.widgets.TableWrapData;
12 12

  
13 13
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
14 14
import eu.etaxonomy.cdm.model.common.CdmBase;
15 15
import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
16
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
17 16
import eu.etaxonomy.cdm.model.name.TaxonName;
17
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
18 18
import eu.etaxonomy.cdm.model.reference.OriginalSourceBase;
19 19
import eu.etaxonomy.cdm.model.reference.Reference;
20
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
21 20
import eu.etaxonomy.taxeditor.store.StoreUtil;
22 21
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
23 22
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
......
37 36

  
38 37
    protected EntitySelectionElement<Reference> selection_Ref;
39 38
    protected TextWithLabelElement microReference;
40
//    protected OriginalSourceAdvancedSection advancedSection;
39
    protected OriginalSourceAdvancedSection advancedSection;
41 40
    protected String label = "Source";
42 41
    protected CdmBase cdmEntity;
43 42

  
......
80 79
        for (ICdmFormElement element: selection_NomRef.getElements()){
81 80
            element.setBackground(getPersistentBackground());
82 81
        }
83
        if (entity instanceof DescriptionElementSource){
84
            select_nameUsedInSource = formFactory.createSelectionElement(TaxonName.class, formElement, "Original spelling", entity != null? ((DescriptionElementSource)entity).getNameUsedInSource(): null, EntitySelectionElement.ALL, style);
85
        }
86 82

  
87
        if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowNamespaceInSource.getKey())){
88
            text_idNamespace = formFactory.createTextWithLabelElement(formElement, "ID Namespace", entity != null?entity.getIdNamespace():null, style);
89
        }
90
        if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSource.getKey())){
91
            text_idInSource = formFactory.createTextWithLabelElement(formElement, "ID in Source", entity != null?entity.getIdInSource():null, style);
92
        }
83
        select_nameUsedInSource = formFactory.createSelectionElement(TaxonName.class, formElement, "Original spelling", entity != null? ((DescriptionElementSource)entity).getNameUsedInSource(): null, EntitySelectionElement.ALL, style);
84

  
93 85

  
94
        text_originaleNameString = formFactory.createTextWithLabelElement(
95
                formElement, "Original Information", entity != null?entity.getOriginalNameString():null, SWT.NULL);
86
//        if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowNamespaceInSource.getKey())){
87
//            text_idNamespace = formFactory.createTextWithLabelElement(formElement, "ID Namespace", entity != null?entity.getIdNamespace():null, style);
88
//        }
89
//        if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSource.getKey())){
90
//            text_idInSource = formFactory.createTextWithLabelElement(formElement, "ID in Source", entity != null?entity.getIdInSource():null, style);
91
//        }
92
//
93
//        text_originaleNameString = formFactory.createTextWithLabelElement(
94
//                formElement, "Original Information", entity != null?entity.getOriginalNameString():null, SWT.NULL);
96 95

  
97 96
        externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName()));
98 97
        externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 3));
......
101 100

  
102 101
        addControl(externalLinks);
103 102
        addElement(externalLinks);
103

  
104
        advancedSection = formFactory.createOriginalSourceAdvancedSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(OriginalSourceAdvancedSection.class, INomenclaturalReference.class.getCanonicalName()));
105
        TableWrapData layoutData = LayoutConstants.FILL_HORIZONTALLY(2, 1);
106
        layoutData.indent = 10;
107

  
108

  
109
        advancedSection.setLayoutData(layoutData);
110
        advancedSection.setBackground(this.getPersistentBackground());
111
        advancedSection.setEntity(entity);
112
        addControl(advancedSection);
113
        addElement(advancedSection);
114

  
104 115
        this.getLayoutComposite().layout();
105 116

  
106 117
    }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/OriginalSourceAdvancedSection.java
35 35
    protected AbstractCdmDetailElement<OriginalSourceBase> createCdmDetailElement(
36 36
            AbstractCdmDetailSection<OriginalSourceBase> parentElement, int style) {
37 37

  
38
        if (parentElement.getParentElement() instanceof NomenclaturalSourceElement){
39
            return getFormFactory().createAdvancedNomenclaturalSourceDetailElement(parentElement, style);
40
        }
38 41
        return getFormFactory().createAdvancedSourceDetailElement(parentElement, style);
39 42
    }
40 43

  

Also available in: Unified diff