Project

General

Profile

Download (40.6 KB) Statistics
| Branch: | Tag: | Revision:
1

    
2
// $Id$
3
/**
4
 * Copyright (C) 2011 EDIT
5
 * European Distributed Institute of Taxonomy
6
 * http://www.e-taxonomy.eu
7
 *
8
 * The contents of this file are subject to the Mozilla Public License Version 1.1
9
 * See LICENSE.TXT at the top of this package for the full license terms.
10
 */
11

    
12
package eu.etaxonomy.taxeditor.view.detail;
13

    
14
import java.util.Set;
15

    
16
import org.eclipse.jface.viewers.ISelection;
17
import org.eclipse.jface.viewers.SelectionChangedEvent;
18
import org.eclipse.swt.SWT;
19
import org.eclipse.swt.widgets.Composite;
20
import org.eclipse.ui.forms.widgets.ExpandableComposite;
21

    
22
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
23
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
24
import eu.etaxonomy.cdm.api.service.ITermService;
25
import eu.etaxonomy.cdm.model.agent.Person;
26
import eu.etaxonomy.cdm.model.agent.Team;
27
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
28
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
29
import eu.etaxonomy.cdm.model.common.Group;
30
import eu.etaxonomy.cdm.model.common.Marker;
31
import eu.etaxonomy.cdm.model.common.MarkerType;
32
import eu.etaxonomy.cdm.model.common.TermVocabulary;
33
import eu.etaxonomy.cdm.model.common.User;
34
import eu.etaxonomy.cdm.model.description.CategoricalData;
35
import eu.etaxonomy.cdm.model.description.DescriptionBase;
36
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
37
import eu.etaxonomy.cdm.model.description.PolytomousKey;
38
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
39
import eu.etaxonomy.cdm.model.description.SpecimenDescription;
40
import eu.etaxonomy.cdm.model.media.Media;
41
import eu.etaxonomy.cdm.model.molecular.Amplification;
42
import eu.etaxonomy.cdm.model.molecular.DnaSample;
43
import eu.etaxonomy.cdm.model.molecular.Sequence;
44
import eu.etaxonomy.cdm.model.molecular.SingleRead;
45
import eu.etaxonomy.cdm.model.name.NonViralName;
46
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
47
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
48
import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
49
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
50
import eu.etaxonomy.cdm.model.reference.Reference;
51
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
52
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
53
import eu.etaxonomy.taxeditor.editor.UsageTermCollection;
54
import eu.etaxonomy.taxeditor.model.AbstractUtility;
55
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
56
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
57
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
58
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
59
import eu.etaxonomy.taxeditor.store.CdmStore;
60
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
61
import eu.etaxonomy.taxeditor.ui.element.RootElement;
62
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
63
import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
64
import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
65
import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
66
import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
67
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
68
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
69
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
70
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
71
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
72
import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
73
import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
74
import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
75
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
76
import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
77
import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
78
import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
79
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
80
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
81
import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
82
import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
83
import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
84
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
85
import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
86
import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
87
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
88
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailSection;
89
import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
90
import eu.etaxonomy.taxeditor.ui.section.occurrence.EmptySection;
91
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
92
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
93
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
94
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailSection;
95
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDeterminationDetailSection;
96
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenGeneralDetailSection;
97
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationCloningDetailSection;
98
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGelPhotoCollectionDetailSection;
99
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGeneralDetailSection;
100
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationPrimerDetailSection;
101
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailSection;
102
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailSection;
103
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceContigFileCollectionDetailSection;
104
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailSection;
105
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollectionDetailSection;
106
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailSection;
107
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
108
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
109
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.LivingPlantPhotoGeneralDetailSection;
110
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
111
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.SpecimenScanGeneralDetailSection;
112
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
113
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
114
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
115
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
116
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
117
import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
118
import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
119
import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
120
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
121
import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
122
import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
123

    
124
/**
125
 *
126
 * The DetailsViewer handles the content of the details view (
127
 * {@link DetailsViewPart}).<br>
128
 * Depending on the type of the selected element the section of the details view
129
 * are created.
130
 *
131
 * @author n.hoffmann
132
 * @created Feb 12, 2010
133
 * @version 1.0
134
 */
135
public class DetailsViewer extends AbstractCdmDataViewer {
136

    
137
    private ISelection selection;
138

    
139
    /**
140
     * <p>
141
     * Constructor for DetailsViewer.
142
     * </p>
143
     *
144
     * @param parent
145
     *            a {@link org.eclipse.swt.widgets.Composite} object.
146
     * @param viewPart
147
     *            a {@link eu.etaxonomy.taxeditor.view.AbstractCdmViewPart}
148
     *            object.
149
     */
150
    public DetailsViewer(Composite parent, AbstractCdmViewPart viewPart) {
151
        super(parent, viewPart);
152
    }
153

    
154
    // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
155
    // since we are getting implementations of DerivedUnitBase from the bulk
156
    // editor
157
    // and not derived unit facade objects,
158

    
159
    /*
160
     * (non-Javadoc)
161
     *
162
     * @see
163
     * eu.etaxonomy.taxeditor.editor.view.AbstractCdmDataViewer#setInput(java
164
     * .lang.Object)
165
     */
166
    @Override
167
    public void setInput(Object input) {
168
        if (input.getClass().equals(DerivedUnit.class)) {
169
            DerivedUnit derivedUnit = (DerivedUnit)input;
170
            try {
171
                input = DerivedUnitFacade.NewInstance(derivedUnit,
172
                        PreferencesUtil.getDerivedUnitConfigurator());
173
            } catch (DerivedUnitFacadeNotSupportedException e) {
174
                AbstractUtility.error(getClass(), e);
175
            }
176
        }
177
        else if(input instanceof FieldUnit){
178
            input = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) input);
179
        }
180
        super.setInput(input);
181
    }
182

    
183
    @Override
184
    protected void markViewPartDirty() {
185
        if (getInput() instanceof DerivedUnitFacade) {
186
            DerivedUnitFacade facade = (DerivedUnitFacade) getInput();
187
            if(facade.innerDerivedUnit()!=null){
188
                getViewPart().changed(facade.innerDerivedUnit());
189
            }
190
            else if(facade.innerFieldUnit()!=null){
191
                getViewPart().changed(facade.innerFieldUnit());
192
            }
193
        }
194
        else{
195
            super.markViewPartDirty();
196
        }
197
    }
198

    
199
    // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
200

    
201
    /*
202
     * (non-Javadoc)
203
     *
204
     * @see org.eclipse.jface.viewers.Viewer#refresh()
205
     */
206
    /** {@inheritDoc} */
207
    @Override
208
    protected void showParts() {
209
        // FIXME (CM) : Need to clean out this code.
210
        // Too much type checking to decide which detail view to display.
211
        // Need to build in a mechanism where navigators / editors are 'aware'
212
        // of the corresponding detail viewer.
213
        Object input = getInput();
214

    
215
        destroySections();
216
        if (input instanceof TaxonBase) {
217
            createTaxonSections(rootElement);
218

    
219
        } else if (input instanceof NonViralName) {
220
            createNameSections(rootElement);
221

    
222
        } else if (input instanceof Reference) {
223
            createReferenceSections(rootElement);
224

    
225
        } else if (input instanceof Team) {
226
            createTeamDetailSection(rootElement);
227

    
228
        } else if (input instanceof Person) {
229
            createPersonDetailSection(rootElement);
230

    
231
        } else if (input instanceof TeamOrPersonBase) {
232
            createTeamOrPersonBaseDetailSection(rootElement);
233

    
234
        } else if (input instanceof DescriptionBase) {
235
            if(input instanceof SpecimenDescription){
236
                //TODO: add more sections to DetailsView for SpecimenDescription
237
                createSpecimenDescriptionSection(rootElement);
238
            }
239
            else{
240
                Set<Marker> descriptionMarkers = ((DescriptionBase) input).getMarkers();
241
                MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
242
                        UsageTermCollection.uuidUseMarkerType);
243
                Boolean isUseDescription = false;
244
                for (Marker marker : descriptionMarkers) {
245
                    if (marker.getMarkerType().equals(useMarkertype)) {
246
                        isUseDescription = true;
247
                    }
248
                }
249
                if (((DescriptionBase) input).isImageGallery()) {
250
                    createImageGallerySection(rootElement);
251

    
252
                } else if (isUseDescription) {
253
                    createUseDescriptionSection(rootElement);
254
                } else {
255
                    createDescriptionSection(rootElement);
256

    
257
                }
258
            }
259
        } else if (input instanceof DescriptionElementBase) {
260
            Set<Marker> descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
261
            MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
262
                    UsageTermCollection.uuidUseMarkerType);
263
            Boolean isUseDescription = false;
264
            for (Marker marker : descriptionMarkers) {
265
                if (marker.getMarkerType().equals(useMarkertype)) {
266
                    isUseDescription = true;
267
                }
268
            }
269

    
270
            if (isUseDescription == true && input instanceof CategoricalData) {
271
                createUseRecordSection(rootElement);
272
            } else {
273
                createDescriptionElementSection(rootElement);
274
            }
275

    
276
        } else if (input instanceof Media) {
277
            createMediaElementSection(rootElement);
278

    
279
        } else if (input instanceof DerivedUnitFacade) {
280
            if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.FieldUnit){
281
                createFieldUnitSection(rootElement);
282
            }
283
            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.PreservedSpecimen){
284
                createDerivedUnitBaseElementSection(rootElement);
285
            }
286
            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.TissueSample){
287
                createTissueSampleSection(rootElement);
288
            }
289
            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
290
                createSpecimenScanSection(rootElement);
291
            }
292
            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
293
                createLivingPlantPhotoSection(rootElement);
294
            }
295
            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
296
                createMediaSpecimenSection(rootElement);
297
            }
298
            else{
299
                createDerivedUnitBaseElementSection(rootElement);
300
            }
301
        } else if (input instanceof DnaSample){
302
            createDnaSampleSection(rootElement);
303
        } else if (input instanceof MediaSpecimen){
304
            createMediaSpecimenSection(rootElement);
305
        }
306
        else if(input instanceof Amplification){
307
            createAmplificationSection(rootElement);
308
        }
309
        else if(input instanceof Sequence){
310
            createSequenceSection(rootElement);
311
        }
312
        else if(input instanceof SingleRead){
313
            createSingleReadSection(rootElement);
314
        }
315
        else if (input instanceof FeatureNodeContainer) {
316
            createFeatureDistributionSection(rootElement);
317

    
318
        } else if (input instanceof PolytomousKey) {
319
            //createPolytomousKeySection(rootElement);
320

    
321
        } else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
322
            createPolytomousKeyNodeSection(rootElement);
323
        } else if (input instanceof User) {
324
            createUserSection(rootElement);
325
        } else if (input instanceof Group) {
326
            createGroupSection(rootElement);
327
        } else if (input instanceof TaxonRelationship) {
328
            createTaxonRelationshipSection(rootElement);
329
        } else if (input instanceof TermVocabulary) {
330
            createTermVocabularySection(rootElement);
331
        } else if (input instanceof DefinedTermBase) {
332
            createDefinedTermSection(rootElement);
333
        }
334
        if(managedForm.getParts().length==0) {
335
            createEmptySection(rootElement);
336
        }
337
        layout();
338
    }
339

    
340

    
341
    /**
342
     * @param rootElement
343
     */
344
    private void createEmptySection(RootElement parent) {
345
        destroySections();
346

    
347
        EmptySection emptySection = formFactory.createEmptySection(formFactory, parent, SWT.NONE);
348

    
349
        addPart(emptySection);
350
    }
351

    
352
    /**
353
     * @param rootElement
354
     */
355
    private void createGroupSection(RootElement parent) {
356
        destroySections();
357

    
358
        GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
359
        MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
360
        GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
361

    
362
        addPart(groupDetailSection);
363
        addPart(memberDetailSection);
364
        addPart(grantedAuthorityDetailSection);
365
    }
366

    
367
    /*
368
     * (non-Javadoc)
369
     *
370
     * @see org.eclipse.jface.viewers.Viewer#getSelection()
371
     */
372
    /** {@inheritDoc} */
373
    @Override
374
    public ISelection getSelection() {
375
        return selection;
376
    }
377

    
378
    /*
379
     * (non-Javadoc)
380
     *
381
     * @see
382
     * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
383
     * .ISelection, boolean)
384
     */
385
    /** {@inheritDoc} */
386
    @Override
387
    public void setSelection(ISelection selection, boolean reveal) {
388
        this.selection = selection;
389
        SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
390
        fireSelectionChanged(selectionChangedEvent);
391
    }
392

    
393
    /**
394
     * createTaxonSections(RootElement parent)
395
     *
396
     * @param parent
397
     */
398
    private void createTaxonSections(RootElement parent) {
399
        destroySections();
400

    
401
        TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
402

    
403
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
404

    
405
        NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
406
                | ExpandableComposite.EXPANDED);
407

    
408
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
409

    
410
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
411

    
412
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
413

    
414
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE);
415

    
416
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
417

    
418
        ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
419

    
420
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
421

    
422
        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
423

    
424
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
425

    
426
        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
427

    
428
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
429

    
430
        ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this, ExpandableComposite.EXPANDED);
431

    
432
        addPart(taxonBaseDetailSection);
433
        addPart(nonViralNameSection);
434
        addPart(nomenclaturalStatusSection);
435
        addPart(protologSection);
436
        addPart(referenceDetailSection);
437
        addPart(typeDesignationSection);
438
        addPart(nameRelationshipSection);
439
        addPart(parsingMessagesSection);
440
    }
441

    
442
    /**
443
     * createNameSections
444
     *
445
     * @param parent
446
     */
447
    private void createNameSections(RootElement parent) {
448
        destroySections();
449
        NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
450

    
451
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
452

    
453
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
454

    
455
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
456

    
457
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
458

    
459
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
460

    
461
        ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
462

    
463
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
464

    
465
        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
466

    
467
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
468

    
469
        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
470

    
471
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
472

    
473
        addPart(nonViralNameSection);
474
        addPart(nomenclaturalStatusSection);
475
        addPart(protologSection);
476
        addPart(referenceDetailSection);
477
        addPart(typeDesignationSection);
478
        addPart(nameRelationshipSection);
479
    }
480

    
481
    /**
482
     * createReferenceSections
483
     *
484
     * @param parent
485
     */
486
    private void createReferenceSections(RootElement parent) {
487
        destroySections();
488

    
489
        ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
490

    
491
        addPart(referenceDetailSection);
492
    }
493

    
494
    /**
495
     * createTeamOrPersonBaseDetailSection
496
     *
497
     * @param parent
498
     */
499
    private void createTeamOrPersonBaseDetailSection(RootElement parent) {
500
        destroySections();
501
        TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
502

    
503
        addPart(teamOrPersonBaseDetailSection);
504
    }
505

    
506
    /**
507
     * createTeamDetailSection
508
     *
509
     * @param parent
510
     */
511
    private void createTeamDetailSection(RootElement parent) {
512
        destroySections();
513
        TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
514

    
515
        addPart(teamDetailSection);
516
    }
517

    
518
    /**
519
     * createPersonDetailSection
520
     *
521
     * @param parent
522
     */
523
    private void createPersonDetailSection(RootElement parent) {
524
        destroySections();
525
        PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
526
        addPart(personDetailSection);
527
    }
528

    
529
    /**
530
     * createDescriptionElementSection
531
     *
532
     * @param parent
533
     */
534
    private void createDescriptionElementSection(RootElement parent) {
535
        destroySections();
536

    
537
        DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
538

    
539
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
540

    
541
        DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
542

    
543
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
544

    
545
        DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
546

    
547
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
548

    
549
        addPart(descriptionElementDetailSection);
550
        addPart(descriptionElementSourceSection);
551
        addPart(descriptionElementMediaSection);
552
    }
553

    
554
    /**
555
     * createDescriptionSection
556
     *
557
     * @param parent
558
     */
559
    private void createDescriptionSection(RootElement parent) {
560
        destroySections();
561
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
562

    
563
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
564

    
565
        NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
566

    
567
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
568

    
569
        DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
570

    
571
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
572

    
573
        //		DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
574
        //				.createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
575
        //						getConversationHolder(), parent, Section.TWISTIE);
576
        //
577
        //		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
578

    
579
        ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
580

    
581
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
582

    
583
        addPart(descriptionDetailSection);
584
        addPart(naturalLanguageSection);
585
        addPart(describedSpecimenSection);
586
        //		addPart(descriptionSourceSection);
587
        addPart(scopeSection);
588
    }
589

    
590
    /**
591
     * createDescriptionSection
592
     *
593
     * @param parent
594
     */
595
    private void createSpecimenDescriptionSection(RootElement parent) {
596
        destroySections();
597
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
598
        addPart(descriptionDetailSection);
599
    }
600

    
601
    /**
602
     * Creates the use Description section
603
     *
604
     * @param parent
605
     */
606
    private void createUseDescriptionSection(RootElement parent) {
607
        destroySections();
608
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
609

    
610
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
611

    
612
        DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
613

    
614
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
615

    
616
        addPart(descriptionDetailSection);
617
        addPart(descriptionSourceSection);
618

    
619
    }
620

    
621

    
622
    /**
623
     * @param rootElement
624
     */
625
    private void createImageGallerySection(RootElement parent) {
626
        destroySections();
627
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
628

    
629
        addPart(descriptionDetailSection);
630
    }
631

    
632
    /**
633
     * createMediaElementSection
634
     *
635
     * @param parent
636
     */
637

    
638
    private void createMediaElementSection(RootElement parent) {
639
        destroySections();
640

    
641
        MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
642

    
643
        addPart(mediaDetailSection);
644
    }
645

    
646
    /**
647
     * createDerivedUnitBaseElementSection
648
     *
649
     * @param parent
650
     */
651
    private void createDerivedUnitBaseElementSection(RootElement parent) {
652
        destroySections();
653

    
654
        DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
655

    
656
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
657

    
658
        GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
659

    
660
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
661

    
662
        FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
663

    
664
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
665

    
666
        DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
667

    
668
        addPart(derivedUnitGeneralDetailSection);
669
        addPart(gatheringEventDetailSection);
670
        addPart(fieldUnitDetailSection);
671
        addPart(derivedUnitBaseDetailSection);
672

    
673
        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
674
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
675
            DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
676
            addPart(determinationDetailSection);
677
        }
678

    
679

    
680
    }
681

    
682
    private void createFieldUnitSection(RootElement parent) {
683
        destroySections();
684

    
685
        FieldUnitGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
686

    
687
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
688

    
689
        GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
690

    
691
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
692

    
693
        FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
694

    
695
        addPart(fielUnitGeneralDetailSection);
696
        addPart(gatheringEventDetailSection);
697
        addPart(fieldUnitDetailSection);
698

    
699
        if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
700
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
701
            DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
702
            addPart(determinationDetailSection);
703
        }
704
    }
705

    
706
    private void createPreservedSpecimenSpecimenSection(RootElement parent) {
707
        destroySections();
708

    
709
        PreservedSpecimenGeneralDetailSection section = formFactory.createPreservedSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
710

    
711
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
712

    
713
        PreservedSpecimenDetailSection derivedUnitBaseDetailSection = formFactory.createPreservedSpecimenDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
714

    
715
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
716

    
717
        PreservedSpecimenDeterminationDetailSection determinationDetailSection = formFactory.createPreservedSpecimenDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
718

    
719
        addPart(section);
720
        addPart(derivedUnitBaseDetailSection);
721
        addPart(determinationDetailSection);
722
    }
723

    
724
    private void createTissueSampleSection(RootElement parent) {
725
        destroySections();
726

    
727
        TissueSampleGeneralDetailSection section = formFactory.createTissueSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
728

    
729
        addPart(section);
730
    }
731

    
732
    private void createDnaSampleSection(RootElement parent) {
733
        destroySections();
734

    
735
        DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
736

    
737
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
738

    
739
        DnaQualityDetailSection qualitySection = formFactory.createDnaQualityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
740

    
741
        addPart(section);
742
        addPart(qualitySection);
743
    }
744

    
745
    private void createAmplificationSection(RootElement parent) {
746
        destroySections();
747
        AmplificationGeneralDetailSection generalSection = formFactory.createAmplificationGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
748

    
749
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
750

    
751
        AmplificationPrimerDetailSection primerSection = formFactory.createAmplificationPrimerDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
752

    
753
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
754

    
755
        AmplificationCloningDetailSection cloningSection = formFactory.createAmplificationCloningDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
756

    
757
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
758

    
759
        AmplificationGelPhotoCollectionDetailSection gelPhotoSection = formFactory.createAmplificationGelPhotoCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
760

    
761

    
762
        addPart(generalSection);
763
        addPart(primerSection);
764
        addPart(cloningSection);
765
        addPart(gelPhotoSection);
766
    }
767

    
768
    private void createSequenceSection(RootElement parent) {
769
        destroySections();
770

    
771
        SequenceGeneralDetailSection section = formFactory.createSequenceGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
772

    
773
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
774

    
775
        SequenceReferenceCollectionDetailSection referenceSection = formFactory.createSequenceReferenceCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
776

    
777
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
778

    
779
        SequenceContigFileCollectionDetailSection contigFileSection = formFactory.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
780

    
781

    
782
        addPart(section);
783
        addPart(referenceSection);
784
        addPart(contigFileSection);
785
    }
786

    
787
    private void createSingleReadSection(RootElement parent) {
788
        destroySections();
789

    
790
        SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
791

    
792
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
793

    
794
        SingleReadPherogramCollectionDetailSection pherogramSection = formFactory.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
795

    
796
        addPart(section);
797
        addPart(pherogramSection);
798
    }
799

    
800
    private void createSpecimenScanSection(RootElement parent) {
801
        destroySections();
802
        SpecimenScanGeneralDetailSection section = formFactory.createSpecimenScanGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
803

    
804
        addPart(section);
805
    }
806

    
807
    private void createLivingPlantPhotoSection(RootElement parent) {
808
        destroySections();
809
        LivingPlantPhotoGeneralDetailSection section = formFactory.createLivingPlantPhotoGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
810

    
811
        addPart(section);
812
    }
813

    
814
    private void createMediaSpecimenSection(RootElement parent) {
815
        destroySections();
816
        MediaSpecimenGeneralDetailSection section = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
817

    
818
        addPart(section);
819
    }
820

    
821

    
822

    
823
    /**
824
     * @param rootElement
825
     */
826
    private void createFeatureDistributionSection(RootElement parent) {
827
        destroySections();
828

    
829
        FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
830

    
831
        addPart(featureDistributionSection);
832
    }
833

    
834
    /**
835
     * createPolytomousKeyNodeSection
836
     *
837
     * @param parent
838
     */
839
    private void createPolytomousKeyNodeSection(RootElement parent) {
840
        destroySections();
841

    
842
        PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
843

    
844
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
845

    
846
        PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
847

    
848
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
849

    
850
        TaxonomicScopeSection taxonomicScopeSection = formFactory.createTaxonomicScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
851

    
852
        addPart(polytomousKeyDetailSection);
853
        addPart(polytomousKeyNodeDetailSection);
854
        addPart(taxonomicScopeSection);
855

    
856
    }
857

    
858
    /**
859
     * create the UseRecordSection
860
     *
861
     * @param parent
862
     */
863
    private void createUseRecordSection(RootElement parent) {
864
        destroySections();
865

    
866
        UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
867

    
868
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
869

    
870
        addPart(descriptionUseRecordSection);
871

    
872

    
873
    }
874

    
875
    /**
876
     * createUserSection
877
     *
878
     * @param parent
879
     */
880
    private void createUserSection(RootElement parent) {
881
        destroySections();
882

    
883
        UserDetailSection userDetailSection = formFactory.createUserDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
884

    
885
        GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
886

    
887
        addPart(userDetailSection);
888
        addPart(groupByUserDetailSection);
889
    }
890

    
891
    /**
892
     * createTaxonRelationshipSection
893
     *
894
     * @param parent
895
     */
896
    private void createTaxonRelationshipSection(RootElement parent) {
897
        destroySections();
898

    
899
        TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
900

    
901
        ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
902
        addPart(taxonRelationshipDetailSection);
903
        addPart(referencedEntityBaseDetailSection);
904
    }
905

    
906
    /**
907
     * @param rootElement
908
     */
909
    private void createTermVocabularySection(RootElement parent) {
910
        destroySections();
911

    
912
        TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
913
        addPart(termVocabularyDetailSection);
914
    }
915

    
916
    /**
917
     * createDefinedTermSection
918
     *
919
     * @param parent
920
     */
921
    private void createDefinedTermSection(RootElement parent) {
922
        destroySections();
923

    
924
        AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
925
        addPart(definedTermDetailSection);
926
    }
927

    
928
}
(3-3/3)