Project

General

Profile

Download (40.2 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.DnaSampleGeneralDetailSection;
102
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceContigFileCollectionDetailSection;
103
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailSection;
104
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollectionDetailSection;
105
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailSection;
106
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
107
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
108
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.LivingPlantPhotoGeneralDetailSection;
109
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
110
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.SpecimenScanGeneralDetailSection;
111
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
112
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
113
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
114
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
115
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
116
import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
117
import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
118
import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
119
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
120
import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
121
import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
122

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

    
136
    private ISelection selection;
137

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
339

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

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

    
348
        addPart(emptySection);
349
    }
350

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
490
        addPart(referenceDetailSection);
491
    }
492

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

    
502
        addPart(teamOrPersonBaseDetailSection);
503
    }
504

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

    
514
        addPart(teamDetailSection);
515
    }
516

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
618
    }
619

    
620

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

    
628
        addPart(descriptionDetailSection);
629
    }
630

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

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

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

    
642
        addPart(mediaDetailSection);
643
    }
644

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

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

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

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

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

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

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

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

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

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

    
678

    
679
    }
680

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
728
        addPart(section);
729
    }
730

    
731
    private void createDnaSampleSection(RootElement parent) {
732
        destroySections();
733
        DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
734

    
735
        addPart(section);
736
    }
737

    
738
    private void createAmplificationSection(RootElement parent) {
739
        destroySections();
740
        AmplificationGeneralDetailSection generalSection = formFactory.createAmplificationGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
741

    
742
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
743

    
744
        AmplificationPrimerDetailSection primerSection = formFactory.createAmplificationPrimerDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
745

    
746
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
747

    
748
        AmplificationCloningDetailSection cloningSection = formFactory.createAmplificationCloningDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
749

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

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

    
754

    
755
        addPart(generalSection);
756
        addPart(primerSection);
757
        addPart(cloningSection);
758
        addPart(gelPhotoSection);
759
    }
760

    
761
    private void createSequenceSection(RootElement parent) {
762
        destroySections();
763

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

    
766
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
767

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

    
770
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
771

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

    
774

    
775
        addPart(section);
776
        addPart(referenceSection);
777
        addPart(contigFileSection);
778
    }
779

    
780
    private void createSingleReadSection(RootElement parent) {
781
        destroySections();
782

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

    
785
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
786

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

    
789
        addPart(section);
790
        addPart(pherogramSection);
791
    }
792

    
793
    private void createSpecimenScanSection(RootElement parent) {
794
        destroySections();
795
        SpecimenScanGeneralDetailSection section = formFactory.createSpecimenScanGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
796

    
797
        addPart(section);
798
    }
799

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

    
804
        addPart(section);
805
    }
806

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

    
811
        addPart(section);
812
    }
813

    
814

    
815

    
816
    /**
817
     * @param rootElement
818
     */
819
    private void createFeatureDistributionSection(RootElement parent) {
820
        destroySections();
821

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

    
824
        addPart(featureDistributionSection);
825
    }
826

    
827
    /**
828
     * createPolytomousKeyNodeSection
829
     *
830
     * @param parent
831
     */
832
    private void createPolytomousKeyNodeSection(RootElement parent) {
833
        destroySections();
834

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

    
837
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
838

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

    
841
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
842

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

    
845
        addPart(polytomousKeyDetailSection);
846
        addPart(polytomousKeyNodeDetailSection);
847
        addPart(taxonomicScopeSection);
848

    
849
    }
850

    
851
    /**
852
     * create the UseRecordSection
853
     *
854
     * @param parent
855
     */
856
    private void createUseRecordSection(RootElement parent) {
857
        destroySections();
858

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

    
861
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
862

    
863
        addPart(descriptionUseRecordSection);
864

    
865

    
866
    }
867

    
868
    /**
869
     * createUserSection
870
     *
871
     * @param parent
872
     */
873
    private void createUserSection(RootElement parent) {
874
        destroySections();
875

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

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

    
880
        addPart(userDetailSection);
881
        addPart(groupByUserDetailSection);
882
    }
883

    
884
    /**
885
     * createTaxonRelationshipSection
886
     *
887
     * @param parent
888
     */
889
    private void createTaxonRelationshipSection(RootElement parent) {
890
        destroySections();
891

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

    
894
        ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
895
        addPart(taxonRelationshipDetailSection);
896
        addPart(referencedEntityBaseDetailSection);
897
    }
898

    
899
    /**
900
     * @param rootElement
901
     */
902
    private void createTermVocabularySection(RootElement parent) {
903
        destroySections();
904

    
905
        TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
906
        addPart(termVocabularyDetailSection);
907
    }
908

    
909
    /**
910
     * createDefinedTermSection
911
     *
912
     * @param parent
913
     */
914
    private void createDefinedTermSection(RootElement parent) {
915
        destroySections();
916

    
917
        AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
918
        addPart(definedTermDetailSection);
919
    }
920

    
921
}
(3-3/3)