Project

General

Profile

« Previous | Next » 

Revision 468ead78

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/section/reference/NomenclaturalSourceElement.java
8 8
*/
9 9
package eu.etaxonomy.taxeditor.ui.section.reference;
10 10

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

  
13 13
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
14 14
import eu.etaxonomy.cdm.model.common.CdmBase;
15
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
15
import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
16
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
17
import eu.etaxonomy.cdm.model.name.TaxonName;
16 18
import eu.etaxonomy.cdm.model.reference.OriginalSourceBase;
17 19
import eu.etaxonomy.cdm.model.reference.Reference;
20
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
18 21
import eu.etaxonomy.taxeditor.store.StoreUtil;
19 22
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
20 23
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
21 24
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
25
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
26
import eu.etaxonomy.taxeditor.ui.section.common.ExternalLinksSection;
22 27
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
23 28
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElementWithAbbreviatedTitle;
24 29

  
......
30 35

  
31 36
    private EntitySelectionElementWithAbbreviatedTitle<Reference> selection_NomRef;
32 37

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

  
44
    protected TextWithLabelElement text_idInSource;
45
    protected TextWithLabelElement text_idNamespace;
46
    protected TextWithLabelElement text_originaleNameString;
47
    protected TextWithLabelElement text_cdmsource;
48
    protected EntitySelectionElement<TaxonName> select_nameUsedInSource;
49

  
50
    protected ExternalLinksSection externalLinks;
51

  
33 52
    /**
34 53
     * @param formFactory
35 54
     * @param formElement
......
46 65
    protected void createControls(ICdmFormElement formElement, OriginalSourceBase entity,  int style) {
47 66

  
48 67
        entity = HibernateProxyHelper.deproxy(entity);
49
//        selection_Ref = formFactory.createSelectionElement(Reference.class,
50
//                      formElement, label, null,
51
//                      EntitySelectionElement.ALL, style, 100);
68

  
52 69
        selection_NomRef = formFactory.createSelectionElementWithAbbreviatedTitle(Reference.class,
53 70
                getConversationHolder(), formElement, "Reference",
54 71
                null,
......
63 80
        for (ICdmFormElement element: selection_NomRef.getElements()){
64 81
            element.setBackground(getPersistentBackground());
65 82
        }
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

  
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
        }
66 93

  
67
        advancedSection = formFactory.createOriginalSourceAdvancedSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(OriginalSourceAdvancedSection.class, INomenclaturalReference.class.getCanonicalName()));
68
        TableWrapData layoutData = LayoutConstants.FILL_HORIZONTALLY(2, 1);
69
        layoutData.indent = 10;
94
        text_originaleNameString = formFactory.createTextWithLabelElement(
95
                formElement, "Original Information", entity != null?entity.getOriginalNameString():null, SWT.NULL);
70 96

  
71
        advancedSection.setLayoutData(layoutData);
97
        externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName()));
98
        externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 3));
99
        externalLinks.setEntity(entity);
100
        externalLinks.setText("Link to protologue");
72 101

  
73
        addControl(advancedSection);
74
        addElement(advancedSection);
75
        advancedSection.setBackground(this.getPersistentBackground());
76
        advancedSection.setEntity(entity);
77
        advancedSection.setExpanded(true);
78
        advancedSection.getExternalLinksElement().setText("Link to protologue");
102
        addControl(externalLinks);
103
        addElement(externalLinks);
79 104
        this.getLayoutComposite().layout();
80 105

  
81 106
    }

Also available in: Unified diff