Project

General

Profile

« Previous | Next » 

Revision b85b96a3

Added by Patrick Plitzner almost 9 years ago

  • extended DnaQuality details view
    • refactored DateElement creation

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
37 37
import org.eclipse.ui.forms.widgets.FormToolkit;
38 38
import org.eclipse.ui.forms.widgets.Section;
39 39
import org.eclipse.ui.internal.forms.widgets.FormFonts;
40
import org.joda.time.DateTime;
40 41
import org.joda.time.Partial;
41 42
import org.springframework.security.core.GrantedAuthority;
42 43

  
......
102 103
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
103 104
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
104 105
import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection.UnitType;
106
import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement;
105 107
import eu.etaxonomy.taxeditor.ui.openurl.IOpenUrlEnabled;
106 108
import eu.etaxonomy.taxeditor.ui.openurl.OpenUrlSelectorElement;
107 109
import eu.etaxonomy.taxeditor.ui.password.EditPasswordElement;
......
2676 2678
        return labelElement;
2677 2679
    }
2678 2680

  
2681
    public DateElement createDateElement(ICdmFormElement formElement, String labelText, DateTime dateTime, int style){
2682
        Label label = new Label(formElement.getLayoutComposite(), style);
2683
        label.setText(labelText+" (yyyy-MM-dd)");
2684
        DateElement dateElement = new DateElement(formElement.getLayoutComposite(), dateTime, style);
2685
        dateElement.initController(this, formElement);
2686
        return dateElement;
2687
    }
2688

  
2679 2689
    /**
2680 2690
     * <p>
2681 2691
     * Getter for the field <code>selectionProvider</code>.
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/element/DateElement.java
62 62
            setLayout(tableWrapLayout);
63 63
        }
64 64

  
65
        textDate = new Text(this, SWT.BORDER);
65
        textDate = new Text(this, SWT.BORDER | SWT.WRAP);
66 66
        textDate.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
67 67
        toolkit.adapt(textDate, true, true);
68 68
    }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaQualityDetailElement.java
9 9
*/
10 10
package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
11 11

  
12
import org.joda.time.DateTime;
13

  
12 14
import eu.etaxonomy.cdm.model.common.DefinedTerm;
13 15
import eu.etaxonomy.cdm.model.molecular.DnaQuality;
14 16
import eu.etaxonomy.cdm.model.molecular.DnaSample;
......
16 18
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
17 19
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
18 20
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
21
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
19 22
import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement;
20 23
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
21 24

  
......
28 31

  
29 32
//    private final TermType qualityTermVocabulary = CdmStore.getService(IVocabularyService.class).find(VocabularyEnum.DnaQualityTerm.getUuid());
30 33

  
34
    private TextWithLabelElement textPurificationMethod;
31 35
    private NumberWithLabelElement numberRatioOfAbsorbance260_280;
32
    private NumberWithLabelElement numberRatioOfAbsorbance230_260;
36
    private NumberWithLabelElement numberRatioOfAbsorbance260_230;
33 37
    private NumberWithLabelElement numberConcentration;
34 38
    private TermComboElement<DefinedTerm> comboQualityTerm;
35 39
    private DateElement dateQualityCheck;
36
    private DateElement dateNanoDrop;
37 40

  
38 41
    /**
39 42
     * @param formFactory
......
56 59
        if(dnaQuality==null){
57 60
            dnaQuality = DnaQuality.NewInstance();
58 61
        }
59
        Double ratioOfAbsorbance230_260 = dnaQuality.getRatioOfAbsorbance230_260();
62
        Double ratioOfAbsorbance260_230 = dnaQuality.getRatioOfAbsorbance260_230();
60 63
        Double ratioOfAbsorbance260_280 = dnaQuality.getRatioOfAbsorbance260_280();
61 64
        Double concentration = dnaQuality.getConcentration();
62 65
        DefinedTerm qualityTerm = dnaQuality.getQualityTerm();
63 66

  
64
        numberRatioOfAbsorbance230_260 = formFactory.createNumberTextWithLabelElement(formElement, "Ratio of absorbance 230-260", ratioOfAbsorbance230_260, style);
67
//        textPurificationMethod = formFactory.createTextWithLabelElement(formElement, "Purification Method", dnaQuality.getPurificationMethod(), style);
65 68
        numberRatioOfAbsorbance260_280 = formFactory.createNumberTextWithLabelElement(formElement, "Ratio of absorbance 260-280", ratioOfAbsorbance260_280, style);
69
        numberRatioOfAbsorbance260_230 = formFactory.createNumberTextWithLabelElement(formElement, "Ratio of absorbance 260-230", ratioOfAbsorbance260_230, style);
66 70
        numberConcentration = formFactory.createNumberTextWithLabelElement(formElement, "Concentration", concentration, style);
67 71
//        comboQualityTerm = formFactory.createDefinedTermComboElement(qualityTermVocabulary, formElement, "Quality Term", qualityTerm, style);
68

  
69
        //TODO DNA purification details
70
        //TODO concentration unit
71
        //TODO DNA quality
72
        //TODO Quality check date
73
        //TODO Description
72
        dateQualityCheck = formFactory.createDateElement(formElement, "Quality Check", dnaQuality.getQualityCheckDate(), style);
74 73
    }
75 74

  
76 75
    /*
......
82 81
     */
83 82
    @Override
84 83
    public void handleEvent(Object eventSource) {
85
        if(eventSource==numberRatioOfAbsorbance230_260){
86
            getEntity().getDnaQuality().setRatioOfAbsorbance230_260(numberRatioOfAbsorbance230_260.getDouble());
84
        DnaQuality dnaQuality = getEntity().getDnaQuality();
85
        if(eventSource==textPurificationMethod){
86
            //TODO
87
//            dnaQuality.setPurificationMethod(textPurificationMethod.getText());
88
        }
89
        else if(eventSource==numberRatioOfAbsorbance260_230){
90
            dnaQuality.setRatioOfAbsorbance260_230(numberRatioOfAbsorbance260_230.getDouble());
87 91
        }
88 92
        else if(eventSource==numberRatioOfAbsorbance260_280){
89
            getEntity().getDnaQuality().setRatioOfAbsorbance260_280(numberRatioOfAbsorbance260_280.getDouble());
93
            dnaQuality.setRatioOfAbsorbance260_280(numberRatioOfAbsorbance260_280.getDouble());
90 94
        }
91 95
        else if(eventSource==numberConcentration){
92
            getEntity().getDnaQuality().setConcentration(numberConcentration.getDouble());
96
            dnaQuality.setConcentration(numberConcentration.getDouble());
97
        }
98
        else if(eventSource==comboQualityTerm){
99
            dnaQuality.setQualityTerm(comboQualityTerm.getSelection());
100
        }
101
        else if(eventSource==dateQualityCheck.getController()){
102
            DateTime dateTime = dateQualityCheck.getController().getDateTime();
103
            dnaQuality.setQualityCheckDate(dateTime);
93 104
        }
94 105
    }
95 106
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/MediaSpecimenGeneralDetailElement.java
9 9
 */
10 10
package eu.etaxonomy.taxeditor.ui.section.occurrence.media;
11 11

  
12
import org.eclipse.swt.widgets.Label;
13 12
import org.joda.time.DateTime;
14 13

  
15 14
import eu.etaxonomy.cdm.api.service.IVocabularyService;
......
79 78
            comboKindOfUnit = formFactory.createDefinedTermComboElement(mediaSpecimenVocabulary, formElement, "Kind of Media", entity.getKindOfUnit(), style);
80 79
            textTitleLanguageString = formFactory.createLanguageStringWithLabelElement(formElement, "Motif", media.getTitle(), style);
81 80
            selectionArtist = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Prepared by", media.getArtist(), EntitySelectionElement.ALL, style);
82

  
83
            Label label = new Label(getLayoutComposite(), style);
84
            label.setText("Preparation Date (yyyy-mm-dd)");
85
            date = new DateElement(formElement.getLayoutComposite(), entity.getMediaSpecimen().getMediaCreated(), style);
86
            date.initController(formFactory, formElement);
87

  
88

  
81
            date = formFactory.createDateElement(formElement, "Preparation Date", entity.getMediaSpecimen().getMediaCreated(), style);
89 82
            textMethodLanguageString = formFactory.createLanguageStringWithLabelElement(formElement, "Method", media.getDescription(Language.getDefaultLanguage()), style);
90 83
            selection_collection = formFactory.createSelectionElement(Collection.class, getConversationHolder(), formElement, "Collection", entity.getCollection(), EntitySelectionElement.ALL, style);
91 84
            text_accessionNumber = formFactory.createTextWithLabelElement(formElement, "Accession Number", entity.getAccessionNumber(), style);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateLabelProvider.java
193 193
            DnaSample dnaSample = (DnaSample)derivate;
194 194
            if(((DnaSample) derivate).getRecordBasis()==SpecimenOrObservationType.DnaSample){
195 195
                Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(dnaSample);
196
                if(currentSampleDesignation!=null){
196
                if(currentSampleDesignation!=null && currentSampleDesignation.getIdentifier()!=null){
197 197
                    label += currentSampleDesignation.getIdentifier()+separator;
198 198
                }
199 199
                else{
......
203 203
            else if(((DnaSample) derivate).getRecordBasis()==SpecimenOrObservationType.TissueSample){
204 204
                label += dnaSample.getKindOfUnit()+separator;
205 205
                Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(dnaSample);
206
                if(currentSampleDesignation!=null){
206
                if(currentSampleDesignation!=null && currentSampleDesignation.getIdentifier()!=null){
207 207
                    label += currentSampleDesignation.getIdentifier()+separator;
208 208
                }
209 209
                else{
......
242 242
        else if(derivate instanceof Sequence){
243 243
            Sequence sequence = (Sequence)derivate;
244 244
            Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(sequence);
245
            if(currentSampleDesignation!=null){
245
            if(currentSampleDesignation!=null && currentSampleDesignation.getIdentifier()!=null){
246 246
                label += currentSampleDesignation.getIdentifier()+separator;
247 247
            }
248 248
            else{
......
256 256
            if(parentNode!=null && parentNode.getValue() instanceof Sequence){
257 257
                Sequence sequence = (Sequence) parentNode.getValue();
258 258
                Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(sequence);
259
                if(currentSampleDesignation!=null){
259
                if(currentSampleDesignation!=null && currentSampleDesignation.getIdentifier()!=null){
260 260
                    label = currentSampleDesignation.getIdentifier()+separator;
261 261
                }
262 262
                else{
......
353 353
        }
354 354
        else if(entity instanceof Sequence){
355 355
            Sequence sequence = (Sequence)entity;
356
            //check if sequence has its own sample designation
357
//            if(sequence.getSampleDesignation()){
358
//
359
//            }
360
//            else
361
            //if not take a look at the DnaSample
362
                if(sequence.getDnaSample()!=null){
356
            if(sequence.getDnaSample()!=null){
363 357
                return getCurrentSampleDesignation(sequence.getDnaSample());
364 358
            }
365 359
        }

Also available in: Unified diff