Project

General

Profile

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

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

    
132
    private ISelection selection;
133

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

    
149
    // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
150
    // since we are getting implementations of DerivedUnitBase from the bulk
151
    // editor
152
    // and not derived unit facade objects,
153

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

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

    
194
    // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
195

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

    
210
        destroySections();
211
        if (input instanceof TaxonBase) {
212
            createTaxonSections(rootElement);
213

    
214
        } else if (input instanceof NonViralName) {
215
            createNameSections(rootElement);
216

    
217
        } else if (input instanceof Reference) {
218
            createReferenceSections(rootElement);
219

    
220
        } else if (input instanceof Team) {
221
            createTeamDetailSection(rootElement);
222

    
223
        } else if (input instanceof Person) {
224
            createPersonDetailSection(rootElement);
225

    
226
        } else if (input instanceof TeamOrPersonBase) {
227
            createTeamOrPersonBaseDetailSection(rootElement);
228

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

    
247
                } else if (isUseDescription) {
248
                    createUseDescriptionSection(rootElement);
249
                } else {
250
                    createDescriptionSection(rootElement);
251

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

    
265
            if (isUseDescription == true && input instanceof CategoricalData) {
266
                createUseRecordSection(rootElement);
267
            } else {
268
                createDescriptionElementSection(rootElement);
269
            }
270

    
271
        } else if (input instanceof Media) {
272
            createMediaElementSection(rootElement);
273

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

    
313
        } else if (input instanceof PolytomousKey) {
314
            //createPolytomousKeySection(rootElement);
315

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

    
335

    
336
    /**
337
     * @param rootElement
338
     */
339
    private void createEmptySection(RootElement parent) {
340
        destroySections();
341

    
342
        EmptySection emptySection = formFactory.createEmptySection(formFactory, parent, SWT.NONE);
343

    
344
        addPart(emptySection);
345
    }
346

    
347
    /**
348
     * @param rootElement
349
     */
350
    private void createGroupSection(RootElement parent) {
351
        destroySections();
352

    
353
        GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
354
        MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
355
        GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
356

    
357
        addPart(groupDetailSection);
358
        addPart(memberDetailSection);
359
        addPart(grantedAuthorityDetailSection);
360
    }
361

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

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

    
388
    /**
389
     * createTaxonSections(RootElement parent)
390
     *
391
     * @param parent
392
     */
393
    private void createTaxonSections(RootElement parent) {
394
        destroySections();
395

    
396
        TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
397

    
398
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
399

    
400
        NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
401
                | ExpandableComposite.EXPANDED);
402

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

    
405
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
406

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

    
409
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE);
410

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

    
413
        ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
414

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

    
417
        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
418

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

    
421
        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
422

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

    
425
        ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this, ExpandableComposite.EXPANDED);
426

    
427
        addPart(taxonBaseDetailSection);
428
        addPart(nonViralNameSection);
429
        addPart(nomenclaturalStatusSection);
430
        addPart(protologSection);
431
        addPart(referenceDetailSection);
432
        addPart(typeDesignationSection);
433
        addPart(nameRelationshipSection);
434
        addPart(parsingMessagesSection);
435
    }
436

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

    
446
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
447

    
448
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
449

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

    
452
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
453

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

    
456
        ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
457

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

    
460
        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
461

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

    
464
        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
465

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

    
468
        addPart(nonViralNameSection);
469
        addPart(nomenclaturalStatusSection);
470
        addPart(protologSection);
471
        addPart(referenceDetailSection);
472
        addPart(typeDesignationSection);
473
        addPart(nameRelationshipSection);
474
    }
475

    
476
    /**
477
     * createReferenceSections
478
     *
479
     * @param parent
480
     */
481
    private void createReferenceSections(RootElement parent) {
482
        destroySections();
483

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

    
486
        addPart(referenceDetailSection);
487
    }
488

    
489
    /**
490
     * createTeamOrPersonBaseDetailSection
491
     *
492
     * @param parent
493
     */
494
    private void createTeamOrPersonBaseDetailSection(RootElement parent) {
495
        destroySections();
496
        TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
497

    
498
        addPart(teamOrPersonBaseDetailSection);
499
    }
500

    
501
    /**
502
     * createTeamDetailSection
503
     *
504
     * @param parent
505
     */
506
    private void createTeamDetailSection(RootElement parent) {
507
        destroySections();
508
        TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
509

    
510
        addPart(teamDetailSection);
511
    }
512

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

    
524
    /**
525
     * createDescriptionElementSection
526
     *
527
     * @param parent
528
     */
529
    private void createDescriptionElementSection(RootElement parent) {
530
        destroySections();
531

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

    
534
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
535

    
536
        DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
537

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

    
540
        DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
541

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

    
544
        addPart(descriptionElementDetailSection);
545
        addPart(descriptionElementSourceSection);
546
        addPart(descriptionElementMediaSection);
547
    }
548

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

    
558
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
559

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

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

    
564
        DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
565

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

    
568
        //		DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
569
        //				.createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
570
        //						getConversationHolder(), parent, Section.TWISTIE);
571
        //
572
        //		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
573

    
574
        ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
575

    
576
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
577

    
578
        addPart(descriptionDetailSection);
579
        addPart(naturalLanguageSection);
580
        addPart(describedSpecimenSection);
581
        //		addPart(descriptionSourceSection);
582
        addPart(scopeSection);
583
    }
584

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

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

    
605
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
606

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

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

    
611
        addPart(descriptionDetailSection);
612
        addPart(descriptionSourceSection);
613

    
614
    }
615

    
616

    
617
    /**
618
     * @param rootElement
619
     */
620
    private void createImageGallerySection(RootElement parent) {
621
        destroySections();
622
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
623

    
624
        addPart(descriptionDetailSection);
625
    }
626

    
627
    /**
628
     * createMediaElementSection
629
     *
630
     * @param parent
631
     */
632

    
633
    private void createMediaElementSection(RootElement parent) {
634
        destroySections();
635

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

    
638
        addPart(mediaDetailSection);
639
    }
640

    
641
    /**
642
     * createDerivedUnitBaseElementSection
643
     *
644
     * @param parent
645
     */
646
    private void createDerivedUnitBaseElementSection(RootElement parent) {
647
        destroySections();
648

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

    
651
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
652

    
653
        GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
654

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

    
657
        FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
658

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

    
661
        DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
662

    
663
        addPart(derivedUnitGeneralDetailSection);
664
        addPart(gatheringEventDetailSection);
665
        addPart(fieldUnitDetailSection);
666
        addPart(derivedUnitBaseDetailSection);
667

    
668
        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
669
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
670
            DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
671
            addPart(determinationDetailSection);
672
        }
673

    
674

    
675
    }
676

    
677
    private void createFieldUnitSection(RootElement parent) {
678
        destroySections();
679

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

    
682
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
683

    
684
        GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
685

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

    
688
        FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
689

    
690
        addPart(fielUnitGeneralDetailSection);
691
        addPart(gatheringEventDetailSection);
692
        addPart(fieldUnitDetailSection);
693

    
694
        if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
695
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
696
            DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
697
            addPart(determinationDetailSection);
698
        }
699
    }
700

    
701
    private void createPreservedSpecimenSpecimenSection(RootElement parent) {
702
        destroySections();
703

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

    
706
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
707

    
708
        PreservedSpecimenDetailSection derivedUnitBaseDetailSection = formFactory.createPreservedSpecimenDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
709

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

    
712
        PreservedSpecimenDeterminationDetailSection determinationDetailSection = formFactory.createPreservedSpecimenDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
713

    
714
        addPart(section);
715
        addPart(derivedUnitBaseDetailSection);
716
        addPart(determinationDetailSection);
717
    }
718

    
719
    private void createTissueSampleSection(RootElement parent) {
720
        destroySections();
721

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

    
724
        addPart(section);
725
    }
726

    
727
    private void createDnaSampleSection(RootElement parent) {
728
        destroySections();
729
        DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
730

    
731
        addPart(section);
732
    }
733

    
734
    private void createAmplificationSection(RootElement parent) {
735
        destroySections();
736
        AmplificationGeneralDetailSection generalSection = formFactory.createAmplificationGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
737

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

    
740
        AmplificationPrimerDetailSection primerSection = formFactory.createAmplificationPrimerDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
741

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

    
744
        AmplificationCloningDetailSection cloningSection = formFactory.createAmplificationCloningDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
745

    
746

    
747
        addPart(generalSection);
748
        addPart(primerSection);
749
        addPart(cloningSection);
750
    }
751

    
752
    private void createSequenceSection(RootElement parent) {
753
        destroySections();
754
        SequenceGeneralDetailSection section = formFactory.createSequenceGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
755

    
756
        addPart(section);
757
    }
758

    
759
    private void createSingleReadSection(RootElement parent) {
760
        destroySections();
761
        SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
762

    
763
        addPart(section);
764
    }
765

    
766
    private void createSpecimenScanSection(RootElement parent) {
767
        destroySections();
768
        SpecimenScanGeneralDetailSection section = formFactory.createSpecimenScanGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
769

    
770
        addPart(section);
771
    }
772

    
773
    private void createLivingPlantPhotoSection(RootElement parent) {
774
        destroySections();
775
        LivingPlantPhotoGeneralDetailSection section = formFactory.createLivingPlantPhotoGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
776

    
777
        addPart(section);
778
    }
779

    
780
    private void createMediaSpecimenSection(RootElement parent) {
781
        destroySections();
782
        MediaSpecimenGeneralDetailSection section = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
783

    
784
        addPart(section);
785
    }
786

    
787

    
788

    
789
    /**
790
     * @param rootElement
791
     */
792
    private void createFeatureDistributionSection(RootElement parent) {
793
        destroySections();
794

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

    
797
        addPart(featureDistributionSection);
798
    }
799

    
800
    /**
801
     * createPolytomousKeyNodeSection
802
     *
803
     * @param parent
804
     */
805
    private void createPolytomousKeyNodeSection(RootElement parent) {
806
        destroySections();
807

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

    
810
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
811

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

    
814
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
815

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

    
818
        addPart(polytomousKeyDetailSection);
819
        addPart(polytomousKeyNodeDetailSection);
820
        addPart(taxonomicScopeSection);
821

    
822
    }
823

    
824
    /**
825
     * create the UseRecordSection
826
     *
827
     * @param parent
828
     */
829
    private void createUseRecordSection(RootElement parent) {
830
        destroySections();
831

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

    
834
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
835

    
836
        addPart(descriptionUseRecordSection);
837

    
838

    
839
    }
840

    
841
    /**
842
     * createUserSection
843
     *
844
     * @param parent
845
     */
846
    private void createUserSection(RootElement parent) {
847
        destroySections();
848

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

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

    
853
        addPart(userDetailSection);
854
        addPart(groupByUserDetailSection);
855
    }
856

    
857
    /**
858
     * createTaxonRelationshipSection
859
     *
860
     * @param parent
861
     */
862
    private void createTaxonRelationshipSection(RootElement parent) {
863
        destroySections();
864

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

    
867
        ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
868
        addPart(taxonRelationshipDetailSection);
869
        addPart(referencedEntityBaseDetailSection);
870
    }
871

    
872
    /**
873
     * @param rootElement
874
     */
875
    private void createTermVocabularySection(RootElement parent) {
876
        destroySections();
877

    
878
        TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
879
        addPart(termVocabularyDetailSection);
880
    }
881

    
882
    /**
883
     * createDefinedTermSection
884
     *
885
     * @param parent
886
     */
887
    private void createDefinedTermSection(RootElement parent) {
888
        destroySections();
889

    
890
        AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
891
        addPart(definedTermDetailSection);
892
    }
893

    
894
}
(3-3/3)