Project

General

Profile

« Previous | Next » 

Revision eccc9d31

Added by Katja Luther over 3 years ago

ref #9116: layout issues and improve handling if no source exist

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/OriginalSourceElement.java
16 16
import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
17 17
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
18 18
import eu.etaxonomy.cdm.model.reference.Reference;
19
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
20 19
import eu.etaxonomy.taxeditor.l10n.Messages;
21 20
import eu.etaxonomy.taxeditor.store.StoreUtil;
22 21
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
......
57 56
        }
58 57
        selection_Ref.setBackground(this.getPersistentBackground());
59 58
        microReference = formFactory.createTextWithLabelElement(formElement, "Details", entity != null? entity.getCitationMicroReference(): "", style);
59

  
60

  
60 61
        for (ICdmFormElement element: selection_Ref.getElements()){
61 62
            element.setBackground(getPersistentBackground());
62 63
        }
63 64

  
64 65
        advancedSection = formFactory.createOriginalSourceAdvancedSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(OriginalSourceAdvancedSection.class, INomenclaturalReference.class.getCanonicalName()));
65 66
        TableWrapData layoutData = LayoutConstants.FILL_HORIZONTALLY(2, 1);
66

  
67
        layoutData.indent = 10;
67 68

  
68 69
        advancedSection.setLayoutData(layoutData);
69 70

  
......
71 72
        addElement(advancedSection);
72 73
        advancedSection.setBackground(this.getPersistentBackground());
73 74
        advancedSection.setEntity(entity);
75
        if (!((DescriptionElementSource)entity).checkEmpty()){
76
            advancedSection.setExpanded(true);
77
        }else{
78
            advancedSection.setExpanded(false);
79
        }
74 80

  
75 81
    }
76 82

  
77 83
    @Override
78 84
    public void handleEvent(Object eventSource) {
79 85
        if (eventSource.equals(selection_Ref)){
80

  
81
            if (getEntity() == null){
82
                Reference ref = selection_Ref.getEntity();
83
                DescriptionElementSource source = DescriptionElementSource.NewPrimarySourceInstance(null, null);
84
                setEntity(source);
85
                selection_Ref.setEntity(ref);
86
                if (cdmEntity != null && cdmEntity instanceof TaxonNode){
87
                    ((TaxonNode)cdmEntity).setSource(source);
88
                }
89
            }
90
            //TODO: why is this null????ß
91 86
            getEntity().setCitation(selection_Ref.getEntity());
92

  
93 87
        }else if (eventSource.equals(microReference)){
94

  
95
            if (getEntity() == null){
96
                DescriptionElementSource source = DescriptionElementSource.NewPrimarySourceInstance(null, null);
97
                setEntity(source);
98
                if (cdmEntity != null && cdmEntity instanceof TaxonNode){
99
                    ((TaxonNode)cdmEntity).setSource(source);
100
                }
101
            }
102
            //TODO: why is this null????ß
103 88
            getEntity().setCitationMicroReference(microReference.getText());
104 89

  
105 90
        }

Also available in: Unified diff