Project

General

Profile

« Previous | Next » 

Revision 80a540f2

Added by Patrick Plitzner about 5 years ago

ref #6413 Implement type duplication in type detail section

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/type/CloneTypeWizardPage.java
25 25

  
26 26
import eu.etaxonomy.cdm.common.CdmUtils;
27 27
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
28
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
28 29
import eu.etaxonomy.taxeditor.ui.dialog.selection.CollectionSelectionDialog;
29 30

  
30 31
/**
......
37 38
    private CloneTypeWizardComposite composite;
38 39

  
39 40
    private eu.etaxonomy.cdm.model.occurrence.Collection selectedCollection = null;
41
    private SpecimenTypeDesignation baseDesignation = null;
40 42

  
41 43
    private final Collection<SpecimenTypeDesignation> typeDesignations;
42 44

  
......
65 67
        });
66 68
        composite.getComboViewerBaseType().setInput(typeDesignations);
67 69
        if(typeDesignations.size()==1){
68
            composite.getComboViewerBaseType().setSelection(new StructuredSelection(typeDesignations.iterator().next()));
70
            SpecimenTypeDesignation next = typeDesignations.iterator().next();
71
            baseDesignation = next;
72
            composite.getComboViewerBaseType().setSelection(new StructuredSelection(next));
69 73
        }
74
        composite.getComboViewerBaseType().addSelectionChangedListener(e->{
75
            baseDesignation = (SpecimenTypeDesignation) ((StructuredSelection) e.getSelection()).getFirstElement();
76
            getWizard().getContainer().updateButtons();
77
        });
70 78

  
71 79
        composite.getBtnBrowseCollection().addSelectionListener(new SelectionAdapter() {
72 80
            @Override
......
78 86
        });
79 87

  
80 88
        // add listeners for update buttons
81
        composite.getComboViewerBaseType().addSelectionChangedListener(this);
82 89
        composite.getTxtAccNumber().addModifyListener(this);
83 90
        composite.getComboTypeStatus().addSelectionChangedListener(this);
84 91

  
......
104 111

  
105 112
    }
106 113

  
114
    public SpecimenTypeDesignation getBaseTypeDesignation() {
115
        return baseDesignation;
116
    }
117

  
118
    public String getAccessionNumber() {
119
        return composite.getTxtAccNumber().getText();
120
    }
121

  
122
    public eu.etaxonomy.cdm.model.occurrence.Collection getCollection() {
123
        return selectedCollection;
124
    }
125

  
126
    public SpecimenTypeDesignationStatus getTypeStatus() {
127
        return (SpecimenTypeDesignationStatus) composite.getComboTypeStatus().getSelection();
128
    }
129

  
107 130
}

Also available in: Unified diff