Project

General

Profile

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

    
10
package eu.etaxonomy.taxeditor.view.e4.details;
11

    
12
import java.util.ArrayList;
13
import java.util.HashSet;
14
import java.util.List;
15
import java.util.Set;
16

    
17
import javax.inject.Inject;
18

    
19
import org.eclipse.e4.core.di.annotations.Optional;
20
import org.eclipse.e4.ui.di.UIEventTopic;
21
import org.eclipse.jface.viewers.ISelection;
22
import org.eclipse.jface.viewers.IStructuredSelection;
23
import org.eclipse.jface.viewers.SelectionChangedEvent;
24
import org.eclipse.jface.viewers.TreeNode;
25
import org.eclipse.swt.SWT;
26
import org.eclipse.ui.forms.widgets.ExpandableComposite;
27

    
28
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
29
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
30
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
31
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
32
import eu.etaxonomy.cdm.model.agent.Person;
33
import eu.etaxonomy.cdm.model.agent.Team;
34
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
35
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
36
import eu.etaxonomy.cdm.model.common.Group;
37
import eu.etaxonomy.cdm.model.common.Marker;
38
import eu.etaxonomy.cdm.model.common.TermVocabulary;
39
import eu.etaxonomy.cdm.model.common.User;
40
import eu.etaxonomy.cdm.model.description.CategoricalData;
41
import eu.etaxonomy.cdm.model.description.Character;
42
import eu.etaxonomy.cdm.model.description.DescriptionBase;
43
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
44
import eu.etaxonomy.cdm.model.description.Distribution;
45
import eu.etaxonomy.cdm.model.description.FeatureNode;
46
import eu.etaxonomy.cdm.model.description.FeatureTree;
47
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
48
import eu.etaxonomy.cdm.model.description.SpecimenDescription;
49
import eu.etaxonomy.cdm.model.media.Media;
50
import eu.etaxonomy.cdm.model.molecular.DnaSample;
51
import eu.etaxonomy.cdm.model.molecular.Sequence;
52
import eu.etaxonomy.cdm.model.molecular.SingleRead;
53
import eu.etaxonomy.cdm.model.name.TaxonName;
54
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
55
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
56
import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
57
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
58
import eu.etaxonomy.cdm.model.reference.Reference;
59
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
60
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
61
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
62
import eu.etaxonomy.taxeditor.editor.IDistributionEditor;
63
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
64
import eu.etaxonomy.taxeditor.l10n.Messages;
65
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
66
import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
67
import eu.etaxonomy.taxeditor.model.MessagingUtils;
68
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
69
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
70
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
71
import eu.etaxonomy.taxeditor.store.UsageTermCollection;
72
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
73
import eu.etaxonomy.taxeditor.ui.element.RootElement;
74
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
75
import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
76
import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
77
import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
78
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
79
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
80
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
81
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
82
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
83
import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
84
import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
85
import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
86
import eu.etaxonomy.taxeditor.ui.section.feature.CharacterDetailSection;
87
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
88
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureNodeDetailSection;
89
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureTreeDetailSection;
90
import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
91
import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
92
import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
93
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
94
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
95
import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
96
import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
97
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
98
import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
99
import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
100
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
101
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailSection;
102
import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
103
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
104
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
105
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
106
import eu.etaxonomy.taxeditor.ui.section.occurrence.association.DerivedUnitTypeDesignationSection;
107
import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
108
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailSection;
109
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailSection;
110
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSamplePreparationPreservationSection;
111
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailSection;
112
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceContigFileCollectionDetailSection;
113
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailSection;
114
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollectionDetailSection;
115
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailSection;
116
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
117
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
118
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
119
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
120
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
121
import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection;
122
import eu.etaxonomy.taxeditor.ui.section.supplemental.identifier.DerivedUnitFacadeIdentifierSection;
123
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
124
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
125
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
126
import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
127
import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
128
import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
129
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
130
import eu.etaxonomy.taxeditor.view.e4.AbstractCdmDataViewerE4;
131

    
132
/**
133
 *
134
 * The DetailsViewer handles the content of the details view (
135
 * {@link DetailsViewerE4}).<br>
136
 * Depending on the type of the selected element the section of the details view
137
 * are created.
138
 *
139
 * @author pplitzner
140
 * @date 18.07.2017
141
 *
142
 */
143
public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
144

    
145
    private ISelection selection;
146
    private boolean detailsEnabled = true;
147

    
148
    public boolean isDetailsEnabled() {
149
		return detailsEnabled;
150
	}
151

    
152
	public void setDetailsEnabled(boolean detailsEnabled) {
153
		this.detailsEnabled = detailsEnabled;
154
	}
155

    
156
	public void setInput(Object input, Object activePart) {
157
        if (activePart instanceof IDistributionEditor){
158
            detailsEnabled = false;
159
        }else{
160
            detailsEnabled = true;
161
        }
162
        setInput(input);
163

    
164
    }
165
    // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
166
    // since we are getting implementations of DerivedUnitBase from the bulk
167
    // editor
168
    // and not derived unit facade objects,
169

    
170
    @Override
171
    public void setInput(Object input) {
172

    
173
        if(input instanceof TreeNode){
174
            input = ((TreeNode) input).getValue();
175
        }
176
        if(input instanceof GbifResponse){
177
            input = ((GbifResponse) input).getDerivedUnitFacade();
178
        }
179
        if(input instanceof FeatureNode
180
                && HibernateProxyHelper.isInstanceOf(((FeatureNode) input).getFeature(), Character.class)){
181
            input = HibernateProxyHelper.deproxy(((FeatureNode) input).getFeature(), Character.class);
182
        }
183
        if (input !=null && input.getClass().equals(DerivedUnit.class)) {
184
            DerivedUnit derivedUnit = (DerivedUnit)input;
185
            try {
186
                input = DerivedUnitFacade.NewInstance(derivedUnit,
187
                        PreferencesUtil.getDerivedUnitConfigurator());
188
            } catch (DerivedUnitFacadeNotSupportedException e) {
189
                //                MessagingUtils.error(getClass(), e); //nothing should happen, later on the Details View will show an according information that it is not possible to open this data
190
            }
191
        }
192
        else if(input instanceof FieldUnit){
193
            input = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) input);
194
        }
195
        super.setInput(input);
196
    }
197

    
198
    @Override
199
    protected void markViewPartDirty() {
200
        if (getInput() instanceof DerivedUnitFacade) {
201
            if(part instanceof IDerivedUnitFacadePart){
202
                part.changed(getInput());
203
            }
204
            else{
205
                DerivedUnitFacade facade = (DerivedUnitFacade) getInput();
206
                if(facade.innerDerivedUnit()!=null){
207
                    part.changed(facade.innerDerivedUnit());
208
                }
209
                else if(facade.innerFieldUnit()!=null){
210
                    part.changed(facade.innerFieldUnit());
211
                }
212
            }
213
        }
214
        else{
215
            super.markViewPartDirty();
216
        }
217
    }
218

    
219
    private boolean isCached(String id){
220
        List<AbstractFormSection> sections = entityToSectionsMap.get(id);
221
        return sections!=null;
222
    }
223

    
224
    /** {@inheritDoc} */
225
    @Override
226
    protected void showParts() {
227
        // FIXME (CM) : Need to clean out this code.
228
        // Too much type checking to decide which detail view to display.
229
        // Need to build in a mechanism where navigators / editors are 'aware'
230
        // of the corresponding detail viewer.
231

    
232
        Object input = getInput();
233

    
234
        if (input instanceof TaxonBase) {
235
            if(((TaxonBase) input).getName()==null){
236
                createEmptySection(Messages.DetailsViewerE4_TAXON_HAS_NO_NAME, rootElement);
237
            }
238
            else{
239
                createTaxonSections(rootElement);
240
            }
241

    
242
        } else if (input instanceof TaxonName) {
243
            createNameSections(rootElement);
244

    
245
        } else if (input instanceof Reference) {
246
            createReferenceSections(rootElement);
247

    
248
        } else if (input instanceof Team) {
249
            createTeamDetailSection(rootElement);
250

    
251
        } else if (input instanceof Person) {
252
            createPersonDetailSection(rootElement);
253

    
254
        } else if (input instanceof TeamOrPersonBase) {
255
            createTeamOrPersonBaseDetailSection(rootElement);
256

    
257
        } else if (input instanceof DescriptionBase) {
258
            if(input instanceof SpecimenDescription){
259
                //TODO: add more sections to DetailsView for SpecimenDescription
260
                createSpecimenDescriptionSection(rootElement);
261
            }
262
            else{
263
                Set<Marker> descriptionMarkers = ((DescriptionBase<?>) input).getMarkers();
264

    
265
                Boolean isUseDescription = false;
266
                for (Marker marker : descriptionMarkers) {
267
                    if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
268
                        isUseDescription = true;
269
                    }
270
                }
271
                if (((DescriptionBase<?>) input).isImageGallery()) {
272
                    createImageGallerySection(rootElement);
273

    
274
                } else if (isUseDescription) {
275
                    createUseDescriptionSection(rootElement);
276
                } else {
277
                    createTaxonDescriptionSection(rootElement);
278

    
279
                }
280
            }
281
        } else if (input instanceof DescriptionElementBase){
282
            Set<Marker> descriptionMarkers = new HashSet<>();
283
            if(((DescriptionElementBase) input).getInDescription()!=null) {
284
                descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
285
            }
286

    
287
            Boolean isUseDescription = false;
288
            for (Marker marker : descriptionMarkers) {
289
                if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
290
                    isUseDescription = true;
291
                }
292
            }
293

    
294
            if (isUseDescription == true && input instanceof CategoricalData) {
295
                createUseRecordSection(rootElement);
296
            } else {
297
                createDescriptionElementSection(rootElement);
298
            }
299

    
300
        } else if (input instanceof Media) {
301
            createMediaElementSection(rootElement);
302

    
303
        }
304
        //FIXME hack to show more informative message to the user when
305
        //DerivedUnit has more than one FieldUnit #4363
306
        else if (input.getClass().equals(DerivedUnit.class)) {
307
            DerivedUnit derivedUnit = (DerivedUnit)input;
308
            try {
309
                input = DerivedUnitFacade.NewInstance(derivedUnit,
310
                        PreferencesUtil.getDerivedUnitConfigurator());
311
            } catch (DerivedUnitFacadeNotSupportedException e) {
312
                createEmptySection(e.getMessage(), rootElement);
313
            }
314
        }
315
        else if (input instanceof DerivedUnitFacade) {
316
            if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.FieldUnit){
317
                if(((DerivedUnitFacade) input).innerFieldUnit()==null){
318
                    MessagingUtils.error(DetailsViewerE4.class, "FieldUnit of facade is null", null); //$NON-NLS-1$
319
                }
320
                else{
321
                    createFieldUnitSection(rootElement);
322
                }
323
            }
324
            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.PreservedSpecimen){
325
                if(((DerivedUnitFacade) input).innerDerivedUnit()==null){
326
                    MessagingUtils.error(DetailsViewerE4.class, "DerivedUnit of facade is null", null); //$NON-NLS-1$
327
                }
328
                else{
329
                    createDerivedUnitBaseElementSection(rootElement);
330
                }
331
            }
332
            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.TissueSample){
333
                //TissueSample should only be created by using it's own class
334
                //in future using only one class with different SpecimenOrObservationTypes is desired
335
                createTissueSampleSection(rootElement);
336
            }
337
            else{
338
                createDerivedUnitBaseElementSection(rootElement);
339
            }
340
        } else if (input instanceof DnaSample){
341
            DnaSample dnaSample = (DnaSample)input;
342
            if(dnaSample.getRecordBasis()==SpecimenOrObservationType.TissueSample){
343
                createTissueSampleSection(rootElement);
344
            }
345
            else if(dnaSample.getRecordBasis()==SpecimenOrObservationType.DnaSample){
346
                createDnaSampleSection(rootElement);
347
            }
348
        } else if (input instanceof MediaSpecimen){
349
            createMediaSpecimenSection(rootElement);
350
        }
351
        else if(input instanceof Sequence){
352
            createSequenceSection(rootElement);
353
        }
354
        else if(input instanceof SingleRead){
355
            createSingleReadSection(rootElement);
356
        }
357
        else if (input instanceof FeatureNodeContainer) {
358
            createFeatureDistributionSection(rootElement);
359

    
360
        } else if (input instanceof FeatureNode) {
361
            createFeatureNodeSection(rootElement);
362

    
363
        } else if (input instanceof FeatureTree) {
364
            createFeatureTreeSection(rootElement);
365

    
366
        } else if (input instanceof Character) {
367
            createCharacterSection(rootElement);
368

    
369
        }else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
370
            createPolytomousKeyNodeSection(rootElement);
371
        } else if (input instanceof User) {
372
            createUserSection(rootElement);
373
        } else if (input instanceof Group) {
374
            createGroupSection(rootElement);
375
        } else if (input instanceof TaxonRelationship && ((TaxonRelationship)input).getType()!=null
376
                && (((TaxonRelationship)input).getType().isAnyMisappliedName() || ((TaxonRelationship)input).getType().isAnySynonym() || ((TaxonRelationship)input).getType().isMisappliedNameOrInvalidDesignation())){
377
            createMisappliedNameSection(rootElement);
378
        }else if (input instanceof TaxonRelationship ) {
379
            createTaxonRelationshipSection(rootElement);
380
        } else if (input instanceof TermVocabulary) {
381
            createTermVocabularySection(rootElement);
382
        } else if (input instanceof DefinedTermBase) {
383
            createDefinedTermSection(rootElement);
384

    
385
        } else if (input instanceof SelectionChangedEvent ) {
386
            IStructuredSelection sel =(IStructuredSelection) ((SelectionChangedEvent)input).getSelection();
387
            if (sel.getFirstElement()instanceof Distribution){
388
                createDescriptionElementSection(rootElement);
389
            }
390

    
391
            //            createDescriptionElementSection(rootElement);
392

    
393
        }else {
394
            createEmptySection(null, rootElement);
395
        }
396
        layout();
397

    
398
    }
399

    
400
    private void createGroupSection(RootElement parent) {
401
        destroySections();
402

    
403
        GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
404
        MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
405
        GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
406

    
407
        addPart(groupDetailSection);
408
        addPart(memberDetailSection);
409
        addPart(grantedAuthorityDetailSection);
410
    }
411

    
412
    /** {@inheritDoc} */
413
    @Override
414
    public ISelection getSelection() {
415
        return selection;
416
    }
417

    
418
    /** {@inheritDoc} */
419
    @Override
420
    public void setSelection(ISelection selection, boolean reveal) {
421

    
422
        this.selection = selection;
423

    
424
        if(this.selection!=null){
425
            SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
426
            fireSelectionChanged(selectionChangedEvent);
427
        }
428

    
429
    }
430

    
431
    private void createTaxonSections(RootElement parent) {
432
        ArrayList<AbstractFormSection> sections = new ArrayList<>();
433

    
434
        String id = "createTaxonSections";
435
        boolean sectionCached = isCached(id);
436

    
437
        if(!sectionCached){
438
            destroySections();
439

    
440
            ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
441
                    ExpandableComposite.EXPANDED | ExpandableComposite.EXPANDED);
442
            addPart(parsingMessagesSection);
443
            sections.add(parsingMessagesSection);
444

    
445
            if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
446
                TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
447
                        ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
448
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
449
                addPart(taxonBaseDetailSection);
450
                sections.add(taxonBaseDetailSection);
451
            }else{
452
                if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON)){
453
                    TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
454
                            ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
455
                    formFactory.createHorizontalSeparator(parent, SWT.BORDER);
456
                    addPart(taxonBaseDetailSection);
457
                    sections.add(taxonBaseDetailSection);
458
                }
459
            }
460
            NonViralNameDetailSection nonViralNameSection = formFactory
461
                    .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
462
                            ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
463
            addPart(nonViralNameSection);
464
            sections.add(nonViralNameSection);
465
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
466

    
467
            if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE))){
468
                NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
469
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
470
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
471
                addPart(referenceDetailSection);
472
                sections.add(referenceDetailSection);
473

    
474
            }
475
            if ( !PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS))){
476
                NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
477
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
478
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
479
                addPart(nomenclaturalStatusSection);
480
                sections.add(nomenclaturalStatusSection);
481
            }
482

    
483
            if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE))){
484
                ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
485
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
486
                addPart(protologSection);
487
                sections.add(protologSection);
488
            }
489

    
490
            if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) &&  PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION))){
491
                TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
492
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
493
                addPart(typeDesignationSection);
494
                sections.add(typeDesignationSection);
495
            }
496

    
497
            if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP))){
498
                NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
499
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
500
                addPart(nameRelationshipSection);
501
                sections.add(nameRelationshipSection);
502
            }
503

    
504
            entityToSectionsMap.put(id, sections);
505
        }
506
    }
507

    
508
    private void createNameSections(RootElement parent) {
509
        destroySections();
510

    
511
        NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(
512
                getConversationHolder(), parent, this, false, ExpandableComposite.TWISTIE
513
                | ExpandableComposite.EXPANDED);
514

    
515
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
516

    
517
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
518
                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
519
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
520

    
521
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
522
                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
523
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
524

    
525
        addPart(nonViralNameSection);
526
        addPart(nomenclaturalStatusSection);
527
        addPart(referenceDetailSection);
528

    
529
        ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
530
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
531

    
532
        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
533
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
534

    
535
        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
536
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
537
        addPart(protologSection);
538
        addPart(typeDesignationSection);
539
        addPart(nameRelationshipSection);
540

    
541
    }
542

    
543
    private void createReferenceSections(RootElement parent) {
544
        destroySections();
545

    
546
        ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this,
547
                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
548

    
549
        addPart(referenceDetailSection);
550
    }
551

    
552
    private void createTeamOrPersonBaseDetailSection(RootElement parent) {
553
        destroySections();
554

    
555
        TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
556

    
557
        addPart(teamOrPersonBaseDetailSection);
558
    }
559

    
560
    private void createTeamDetailSection(RootElement parent) {
561
        destroySections();
562

    
563
        TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
564

    
565
        addPart(teamDetailSection);
566
    }
567

    
568
    private void createPersonDetailSection(RootElement parent) {
569
        destroySections();
570

    
571
        PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
572
        addPart(personDetailSection);
573
    }
574

    
575
    private void createDescriptionElementSection(RootElement parent) {
576
        destroySections();
577

    
578
        DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
579
        descriptionElementDetailSection.setEnabled(this.detailsEnabled);
580

    
581
        //  IntextReferenceSection intextReferenceSection = formFactory.createIntextReferenceSection(getConversationHolder(), parent,  ExpandableComposite.TWISTIE);
582

    
583
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
584

    
585
        DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
586

    
587
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
588

    
589
        DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
590

    
591
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
592

    
593
        addPart(descriptionElementDetailSection);
594
        addPart(descriptionElementSourceSection);
595
        addPart(descriptionElementMediaSection);
596
    }
597

    
598
    private void createDescriptionSection(RootElement parent, boolean isTaxonDescription) {
599
        destroySections();
600

    
601
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
602
        addPart(descriptionDetailSection);
603

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

    
606
        if(isTaxonDescription) {
607
            NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(
608
                    getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
609
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
610
            addPart(naturalLanguageSection);
611
        }
612
        DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(
613
                getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
614
        addPart(descriptionSourceSection);
615

    
616
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
617

    
618
        if(isTaxonDescription) {
619
            ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
620
            addPart(scopeSection);
621
        }
622
    }
623

    
624
    private void createTaxonDescriptionSection(RootElement parent) {
625
        destroySections();
626

    
627
        createDescriptionSection(parent, true);
628
    }
629

    
630
    private void createSpecimenDescriptionSection(RootElement parent) {
631
        destroySections();
632

    
633
        createDescriptionSection(parent, false);
634
    }
635

    
636
    private void createUseDescriptionSection(RootElement parent) {
637
        destroySections();
638

    
639
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
640

    
641
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
642

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

    
645
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
646

    
647
        addPart(descriptionDetailSection);
648
        addPart(descriptionSourceSection);
649

    
650
    }
651

    
652
    private void createImageGallerySection(RootElement parent) {
653
        destroySections();
654

    
655
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
656

    
657
        addPart(descriptionDetailSection);
658
    }
659

    
660
    private void createMediaElementSection(RootElement parent) {
661
        destroySections();
662

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

    
665
        addPart(mediaDetailSection);
666
    }
667

    
668
    private void createDerivedUnitBaseElementSection(RootElement parent) {
669
        ArrayList<AbstractFormSection> sections = new ArrayList<>();
670

    
671
        String id = "createDerivedUnitBaseElementSection";
672
        boolean sectionCached = isCached(id);
673
        if(!sectionCached){
674

    
675
            destroySections();
676

    
677
            DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, getSectionStyle(DerivedUnitGeneralDetailSection.class));
678
            derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true);
679
            //        }
680
            addPart(derivedUnitGeneralDetailSection);
681
            sections.add(derivedUnitGeneralDetailSection);
682

    
683

    
684
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
685

    
686
            DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, getSectionStyle(DerivedUnitBaseDetailSection.class));
687
            addPart(derivedUnitBaseDetailSection);
688
            sections.add(derivedUnitBaseDetailSection);
689
            //        //for editors working with facades
690
            //        if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart){
691
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
692
            GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, getSectionStyle(GatheringEventDetailSection.class));
693
            addPart(gatheringEventDetailSection);
694
            sections.add(gatheringEventDetailSection);
695

    
696
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
697
            FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, getSectionStyle(FieldUnitDetailSection.class));
698
            addPart(fieldUnitDetailSection);
699
            sections.add(fieldUnitDetailSection);
700
            //        }
701
            //        else{
702
            //
703
            if(PreferencesUtil.isShowTaxonAssociations()){
704
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
705
                TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, getSectionStyle(TaxonAssociationDetailSection.class));
706
                addPart(taxonAssociationDetailSection);
707
                sections.add(taxonAssociationDetailSection);
708
            }
709
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
710
            DerivedUnitFacadeIdentifierSection identifierDetailSection = formFactory.createDerivedUnitFacadeIdentifierSection(getConversationHolder(), parent, getSectionStyle(DerivedUnitFacadeIdentifierSection.class));
711
            addPart(identifierDetailSection);
712
            sections.add(identifierDetailSection);
713
            //    }
714
            if(!PreferencesUtil.isDeterminationOnlyForFieldUnits()){
715
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
716
                DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, getSectionStyle(DeterminationDetailSection.class));
717
                addPart(determinationDetailSection);
718
                sections.add(determinationDetailSection);
719
            }
720

    
721
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
722
            DerivedUnitTypeDesignationSection derivedUnitTypeDesignationSection = formFactory.createDerivedUnitTypeDesignationSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
723
            addPart(derivedUnitTypeDesignationSection);
724
            sections.add(derivedUnitTypeDesignationSection);
725
        }
726
        entityToSectionsMap.put(id, sections);
727
    }
728

    
729
    private void createFieldUnitSection(RootElement parent) {
730
        destroySections();
731

    
732
        FieldUnitGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitGeneralDetailSection(getConversationHolder(), parent, this, getSectionStyle(FieldUnitGeneralDetailSection.class));
733

    
734
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
735

    
736
        GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, getSectionStyle(GatheringEventDetailSection.class));
737

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

    
740
        FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, getSectionStyle(FieldUnitDetailSection.class));
741

    
742
        addPart(fielUnitGeneralDetailSection);
743
        addPart(gatheringEventDetailSection);
744
        addPart(fieldUnitDetailSection);
745

    
746
        if(PreferencesUtil.isDeterminationOnlyForFieldUnits()){
747
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
748
            DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, getSectionStyle(DeterminationDetailSection.class));
749
            addPart(determinationDetailSection);
750
        }
751
    }
752

    
753
    private void createTissueSampleSection(RootElement parent) {
754
        destroySections();
755

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

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

    
760
        SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
761

    
762
        addPart(section);
763
        addPart(sampleDesignationDetailSection);
764
    }
765

    
766
    private void createDnaSampleSection(RootElement parent) {
767
        destroySections();
768

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

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

    
773
        DnaSamplePreparationPreservationSection preparationPreservationSection = formFactory.createDnaSamplePreparationPreservationSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
774

    
775
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
776

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

    
779
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
780

    
781
        SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
782

    
783
        addPart(section);
784
        addPart(preparationPreservationSection);
785
        addPart(qualitySection);
786
        addPart(sampleDesignationDetailSection);
787
    }
788

    
789
    private void createSequenceSection(RootElement parent) {
790
        destroySections();
791

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

    
794
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
795

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

    
798
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
799

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

    
802

    
803
        addPart(section);
804
        addPart(referenceSection);
805
        addPart(contigFileSection);
806
    }
807

    
808
    private void createSingleReadSection(RootElement parent) {
809
        destroySections();
810

    
811
        SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
812
        addPart(section);
813

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

    
816
        SingleReadPherogramCollectionDetailSection pherogramSection = formFactory.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
817
        addPart(pherogramSection);
818

    
819
    }
820

    
821
    private void createMediaSpecimenSection(RootElement parent) {
822
        destroySections();
823

    
824
        MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
825
        addPart(generalSection);
826

    
827
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
828

    
829
        RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
830
        addPart(rightsSection);
831

    
832
    }
833

    
834
    private void createFeatureTreeSection(RootElement parent) {
835
        destroySections();
836

    
837
        FeatureTreeDetailSection section = formFactory.createFeatureTreeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
838

    
839
        addPart(section);
840
    }
841

    
842
    private void createFeatureNodeSection(RootElement parent) {
843
        destroySections();
844

    
845
        FeatureNodeDetailSection featureDistributionSection = formFactory.createFeatureNodeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
846

    
847
        addPart(featureDistributionSection);
848
    }
849

    
850
    private void createFeatureDistributionSection(RootElement parent) {
851
        destroySections();
852

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

    
855
        addPart(featureDistributionSection);
856
    }
857

    
858
    private void createCharacterSection(RootElement parent) {
859
        destroySections();
860

    
861
        CharacterDetailSection featureDistributionSection = formFactory.createCharacterDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
862

    
863
        addPart(featureDistributionSection);
864
    }
865

    
866
    private void createPolytomousKeyNodeSection(RootElement parent) {
867
        destroySections();
868

    
869
        PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
870

    
871
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
872

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

    
875
        addPart(polytomousKeyDetailSection);
876
        addPart(polytomousKeyNodeDetailSection);
877

    
878
    }
879

    
880
    private void createUseRecordSection(RootElement parent) {
881
        destroySections();
882

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

    
885
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
886

    
887
        addPart(descriptionUseRecordSection);
888

    
889

    
890
    }
891

    
892
    private void createUserSection(RootElement parent) {
893
        destroySections();
894

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

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

    
899
        addPart(userDetailSection);
900
        addPart(groupByUserDetailSection);
901
    }
902

    
903
    private void createMisappliedNameSection(RootElement parent) {
904
        destroySections();
905

    
906
        TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this,
907
                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
908
        addPart(taxonRelationshipDetailSection);
909

    
910
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
911

    
912

    
913
        NonViralNameDetailSection nonViralNameSection = formFactory
914
                .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
915
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
916
        addPart(nonViralNameSection);
917

    
918
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
919

    
920
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
921
                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
922
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
923
        addPart(referenceDetailSection);
924

    
925

    
926
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
927
            		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
928
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
929
        addPart(nomenclaturalStatusSection);
930

    
931
		ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
932
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
933
		addPart(protologSection);
934

    
935
		TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
936
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
937
		addPart(typeDesignationSection);
938

    
939
		NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
940
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
941
		addPart(nameRelationshipSection);
942

    
943
    }
944

    
945
    private void createTaxonRelationshipSection(RootElement parent) {
946
        destroySections();
947

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

    
950
        ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
951
        addPart(taxonRelationshipDetailSection);
952
        addPart(referencedEntityBaseDetailSection);
953
    }
954
    private void createTermVocabularySection(RootElement parent) {
955
        destroySections();
956

    
957
        TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
958
        addPart(termVocabularyDetailSection);
959
    }
960

    
961
    private void createDefinedTermSection(RootElement parent) {
962
        destroySections();
963

    
964
        AbstractFormSection<?> definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
965
        addPart(definedTermDetailSection);
966
    }
967

    
968
    @Override
969
    public void update(CdmDataChangeMap arg0) {
970

    
971
    }
972

    
973
    @Inject
974
    @Optional
975
    private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_TAXON_DETAILS)boolean refresh){
976
        if(refresh){
977
            refresh();
978
        }
979
    }
980
}
(2-2/2)