Project

General

Profile

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

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

    
13
import java.util.Set;
14

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

    
21
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
22
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
23
import eu.etaxonomy.cdm.api.service.ITermService;
24
import eu.etaxonomy.cdm.model.agent.Person;
25
import eu.etaxonomy.cdm.model.agent.Team;
26
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
27
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
28
import eu.etaxonomy.cdm.model.common.Group;
29
import eu.etaxonomy.cdm.model.common.Marker;
30
import eu.etaxonomy.cdm.model.common.MarkerType;
31
import eu.etaxonomy.cdm.model.common.TermVocabulary;
32
import eu.etaxonomy.cdm.model.common.User;
33
import eu.etaxonomy.cdm.model.description.CategoricalData;
34
import eu.etaxonomy.cdm.model.description.DescriptionBase;
35
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
36
import eu.etaxonomy.cdm.model.description.PolytomousKey;
37
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
38
import eu.etaxonomy.cdm.model.media.Media;
39
import eu.etaxonomy.cdm.model.name.NonViralName;
40
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
41
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
42
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
43
import eu.etaxonomy.cdm.model.reference.Reference;
44
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
45
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
46
import eu.etaxonomy.taxeditor.editor.UsageTermCollection;
47
import eu.etaxonomy.taxeditor.model.AbstractUtility;
48
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
49
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
50
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
51
import eu.etaxonomy.taxeditor.store.CdmStore;
52
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationDetailsSection;
53
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationGeneralSection;
54
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.GatheringEventSection;
55
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenSection;
56
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
57
import eu.etaxonomy.taxeditor.ui.element.RootElement;
58
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
59
import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
60
import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
61
import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
62
import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
63
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
64
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
65
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
66
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
67
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
68
import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
69
import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
70
import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
71
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
72
import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
73
import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
74
import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
75
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
76
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
77
import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
78
import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
79
import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
80
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
81
import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
82
import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
83
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
84
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
85
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
86
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
87
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
88
import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
89
import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
90
import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
91
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
92
import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
93
import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
94

    
95
/**
96
 *
97
 * The DetailsViewer handles the content of the details view (
98
 * {@link DetailsViewPart}).<br>
99
 * Depending on the type of the selected element the section of the details view
100
 * are created.
101
 *
102
 * @author n.hoffmann
103
 * @created Feb 12, 2010
104
 * @version 1.0
105
 */
106
public class DetailsViewer extends AbstractCdmDataViewer {
107

    
108
    private ISelection selection;
109

    
110
    /**
111
     * <p>
112
     * Constructor for DetailsViewer.
113
     * </p>
114
     *
115
     * @param parent
116
     *            a {@link org.eclipse.swt.widgets.Composite} object.
117
     * @param viewPart
118
     *            a {@link eu.etaxonomy.taxeditor.view.AbstractCdmViewPart}
119
     *            object.
120
     */
121
    public DetailsViewer(Composite parent, AbstractCdmViewPart viewPart) {
122
        super(parent, viewPart);
123
    }
124

    
125
    // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
126
    // since we are getting implementations of DerivedUnitBase from the bulk
127
    // editor
128
    // and not derived unit facade objects,
129

    
130
    /*
131
     * (non-Javadoc)
132
     *
133
     * @see
134
     * eu.etaxonomy.taxeditor.editor.view.AbstractCdmDataViewer#setInput(java
135
     * .lang.Object)
136
     */
137
    @Override
138
    public void setInput(Object input) {
139
		if (input instanceof DerivedUnit) {
140
            try {
141
				input = DerivedUnitFacade.NewInstance((DerivedUnit) input,PreferencesUtil.getDerivedUnitConfigurator());
142
            } catch (DerivedUnitFacadeNotSupportedException e) {
143
                AbstractUtility.error(getClass(), e);
144
            }
145
        }
146
		else if(input instanceof FieldUnit){
147
		    input = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) input,PreferencesUtil.getDerivedUnitConfigurator());
148
		}
149
        super.setInput(input);
150
    }
151

    
152
    @Override
153
    protected void markViewPartDirty() {
154
        if (getInput() instanceof DerivedUnitFacade) {
155
            getViewPart().changed(((DerivedUnitFacade) getInput()).innerDerivedUnit());
156
        }
157

    
158
        super.markViewPartDirty();
159
    }
160

    
161
    // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
162

    
163
    /*
164
     * (non-Javadoc)
165
     *
166
     * @see org.eclipse.jface.viewers.Viewer#refresh()
167
     */
168
    /** {@inheritDoc} */
169
    @Override
170
    protected void showParts() {
171
        // FIXME (CM) : Need to clean out this code.
172
        // Too much type checking to decide which detail view to display.
173
        // Need to build in a mechanism where navigators / editors are 'aware'
174
        // of the corresponding detail viewer.
175
        Object input = getInput();
176
        if (input instanceof TaxonBase) {
177
            createTaxonSections(rootElement);
178

    
179
        } else if (input instanceof NonViralName) {
180
            createNameSections(rootElement);
181

    
182
        } else if (input instanceof Reference) {
183
            createReferenceSections(rootElement);
184

    
185
        } else if (input instanceof Team) {
186
            createTeamDetailSection(rootElement);
187

    
188
        } else if (input instanceof Person) {
189
            createPersonDetailSection(rootElement);
190

    
191
        } else if (input instanceof TeamOrPersonBase) {
192
            createTeamOrPersonBaseDetailSection(rootElement);
193

    
194
        } else if (input instanceof DescriptionBase) {
195
            Set<Marker> descriptionMarkers = ((DescriptionBase) input).getMarkers();
196
            MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
197
                    UsageTermCollection.uuidUseMarkerType);
198
            Boolean isUseDescription = false;
199
            for (Marker marker : descriptionMarkers) {
200
                if (marker.getMarkerType().equals(useMarkertype)) {
201
                    isUseDescription = true;
202
                }
203
            }
204
            if (((DescriptionBase) input).isImageGallery()) {
205
                createImageGallerySection(rootElement);
206

    
207
            } else if (isUseDescription) {
208
                createUseDescriptionSection(rootElement);
209
            } else {
210
                createDescriptionSection(rootElement);
211

    
212
            }
213
        } else if (input instanceof DescriptionElementBase) {
214
            Set<Marker> descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
215
            MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
216
                    UsageTermCollection.uuidUseMarkerType);
217
            Boolean isUseDescription = false;
218
            for (Marker marker : descriptionMarkers) {
219
                if (marker.getMarkerType().equals(useMarkertype)) {
220
                    isUseDescription = true;
221
                }
222
            }
223

    
224
            if (isUseDescription == true && input instanceof CategoricalData) {
225
                createUseRecordSection(rootElement);
226
            } else {
227
                createDescriptionElementSection(rootElement);
228
            }
229

    
230
        } else if (input instanceof Media) {
231
            createMediaElementSection(rootElement);
232

    
233
        } else if (input instanceof DerivedUnitFacade) {
234
            DerivedUnitFacade derivedUnitFacade = (DerivedUnitFacade)input;
235

    
236
            if(derivedUnitFacade.getType()==SpecimenOrObservationType.FieldUnit){
237
                createDerivedUnitBaseElementSection(rootElement);
238
            } else if(derivedUnitFacade.getType()==SpecimenOrObservationType.DerivedUnit){
239
                createSpecimenDetailsView(rootElement);
240
            }
241
        } else if (input instanceof FeatureNodeContainer) {
242
            createFeatureDistributionSection(rootElement);
243

    
244
        } else if (input instanceof PolytomousKey) {
245
            // createPolytomousKeySection(rootElement);
246

    
247
        } else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
248
            createPolytomousKeyNodeSection(rootElement);
249
        } else if (input instanceof User) {
250
            createUserSection(rootElement);
251
        } else if (input instanceof Group) {
252
            createGroupSection(rootElement);
253
        } else if (input instanceof TaxonRelationship) {
254
            createTaxonRelationshipSection(rootElement);
255
        } else if (input instanceof TermVocabulary) {
256
            createTermVocabularySection(rootElement);
257
        } else if (input instanceof DefinedTermBase) {
258
            createDefinedTermSection(rootElement);
259
        } else {
260
            destroySections();
261
        }
262
        layout();
263
    }
264

    
265
    /**
266
     * @param rootElement
267
     */
268
    private void createGroupSection(RootElement parent) {
269
        destroySections();
270

    
271
        GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
272
        MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
273
        GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
274

    
275
        addPart(groupDetailSection);
276
        addPart(memberDetailSection);
277
        addPart(grantedAuthorityDetailSection);
278
    }
279

    
280
    /*
281
     * (non-Javadoc)
282
     *
283
     * @see org.eclipse.jface.viewers.Viewer#getSelection()
284
     */
285
    /** {@inheritDoc} */
286
    @Override
287
    public ISelection getSelection() {
288
        return selection;
289
    }
290

    
291
    /*
292
     * (non-Javadoc)
293
     *
294
     * @see
295
     * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
296
     * .ISelection, boolean)
297
     */
298
    /** {@inheritDoc} */
299
    @Override
300
    public void setSelection(ISelection selection, boolean reveal) {
301
        this.selection = selection;
302
        SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
303
        fireSelectionChanged(selectionChangedEvent);
304
    }
305

    
306
    /**
307
     * createTaxonSections(RootElement parent)
308
     *
309
     * @param parent
310
     */
311
    private void createTaxonSections(RootElement parent) {
312
        destroySections();
313

    
314
        TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
315

    
316
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
317

    
318
        NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
319
                        | ExpandableComposite.EXPANDED);
320

    
321
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
322

    
323
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
324

    
325
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
326

    
327
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE);
328

    
329
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
330

    
331
        ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
332

    
333
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
334

    
335
        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
336

    
337
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
338

    
339
        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
340

    
341
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
342

    
343
        ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this, ExpandableComposite.EXPANDED);
344

    
345
        addPart(taxonBaseDetailSection);
346
        addPart(nonViralNameSection);
347
        addPart(nomenclaturalStatusSection);
348
        addPart(protologSection);
349
        addPart(referenceDetailSection);
350
        addPart(typeDesignationSection);
351
        addPart(nameRelationshipSection);
352
        addPart(parsingMessagesSection);
353
    }
354

    
355
    /**
356
     * createNameSections
357
     *
358
     * @param parent
359
     */
360
    private void createNameSections(RootElement parent) {
361
        destroySections();
362
        NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
363

    
364
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
365

    
366
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
367

    
368
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
369

    
370
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
371

    
372
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
373

    
374
        ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
375

    
376
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
377

    
378
        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
379

    
380
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
381

    
382
        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
383

    
384
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
385

    
386
        addPart(nonViralNameSection);
387
        addPart(nomenclaturalStatusSection);
388
        addPart(protologSection);
389
        addPart(referenceDetailSection);
390
        addPart(typeDesignationSection);
391
        addPart(nameRelationshipSection);
392
    }
393

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

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

    
404
        addPart(referenceDetailSection);
405
    }
406

    
407
    /**
408
     * createTeamOrPersonBaseDetailSection
409
     *
410
     * @param parent
411
     */
412
    private void createTeamOrPersonBaseDetailSection(RootElement parent) {
413
        destroySections();
414
        TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
415

    
416
        addPart(teamOrPersonBaseDetailSection);
417
    }
418

    
419
    /**
420
     * createTeamDetailSection
421
     *
422
     * @param parent
423
     */
424
    private void createTeamDetailSection(RootElement parent) {
425
        destroySections();
426
        TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
427

    
428
        addPart(teamDetailSection);
429
    }
430

    
431
    /**
432
     * createPersonDetailSection
433
     *
434
     * @param parent
435
     */
436
    private void createPersonDetailSection(RootElement parent) {
437
        destroySections();
438
        PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
439
        addPart(personDetailSection);
440
    }
441

    
442
    /**
443
     * createDescriptionElementSection
444
     *
445
     * @param parent
446
     */
447
    private void createDescriptionElementSection(RootElement parent) {
448
        destroySections();
449

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

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

    
454
        DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
455

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

    
458
        DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
459

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

    
462
        addPart(descriptionElementDetailSection);
463
        addPart(descriptionElementSourceSection);
464
        addPart(descriptionElementMediaSection);
465
    }
466

    
467
    /**
468
     * createDescriptionSection
469
     *
470
     * @param parent
471
     */
472
    private void createDescriptionSection(RootElement parent) {
473
        destroySections();
474
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
475

    
476
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
477

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

    
480
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
481

    
482
        DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
483

    
484
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
485

    
486
//        DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
487
//
488
//        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
489

    
490
        ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
491

    
492
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
493

    
494
        addPart(descriptionDetailSection);
495
        addPart(naturalLanguageSection);
496
        addPart(describedSpecimenSection);
497
//        addPart(descriptionSourceSection);
498
        addPart(scopeSection);
499
    }
500

    
501
    /**
502
     * Creates the use Description section
503
     *
504
     * @param parent
505
     */
506
    private void createUseDescriptionSection(RootElement parent) {
507
        destroySections();
508
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
509

    
510
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
511

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

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

    
516
        addPart(descriptionDetailSection);
517
        addPart(descriptionSourceSection);
518

    
519
    }
520

    
521
    /**
522
     * @param rootElement
523
     */
524
    private void createImageGallerySection(RootElement parent) {
525
        destroySections();
526
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
527

    
528
        addPart(descriptionDetailSection);
529
    }
530

    
531
    /**
532
     * createMediaElementSection
533
     *
534
     * @param parent
535
     */
536

    
537
    private void createMediaElementSection(RootElement parent) {
538
        destroySections();
539
        MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
540

    
541
        addPart(mediaDetailSection);
542
    }
543

    
544
    /**
545
     * createDerivedUnitBaseElementSection
546
     *
547
     * @param parent
548
     */
549
    private void createDerivedUnitBaseElementSection(RootElement parent) {
550
        destroySections();
551

    
552
        FieldObservationGeneralSection fieldObservationSection = formFactory.createFieldObservationGeneralSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
553

    
554
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
555

    
556
        GatheringEventSection gatheringEventDetailSection = formFactory.createGatheringEventSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
557

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

    
560
        FieldObservationDetailsSection fieldObservationDetailSection = formFactory.createFieldObservationDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
561

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

    
564
//        DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
565
//
566
//        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
567
//
568
//        DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
569

    
570
        addPart(fieldObservationSection);
571
        addPart(gatheringEventDetailSection);
572
        addPart(fieldObservationDetailSection);
573
//        addPart(derivedUnitBaseDetailSection);
574
//        addPart(determinationDetailSection);
575
    }
576

    
577
    /**
578
     * createDerivedUnitBaseElementSection
579
     *
580
     * @param parent
581
     */
582
    private void createSpecimenDetailsView(RootElement parent) {
583
        destroySections();
584

    
585
        SpecimenSection specimenSection = formFactory.createSpecimenSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
586

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

    
589
        addPart(specimenSection);
590
    }
591

    
592
    /**
593
     * @param rootElement
594
     */
595
    private void createFeatureDistributionSection(RootElement parent) {
596
        destroySections();
597

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

    
600
        addPart(featureDistributionSection);
601
    }
602

    
603
    /**
604
     * createPolytomousKeyNodeSection
605
     *
606
     * @param parent
607
     */
608
    private void createPolytomousKeyNodeSection(RootElement parent) {
609
        destroySections();
610

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

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

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

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

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

    
621
        addPart(polytomousKeyDetailSection);
622
        addPart(polytomousKeyNodeDetailSection);
623
        addPart(taxonomicScopeSection);
624

    
625
    }
626

    
627
    /**
628
     * create the UseRecordSection
629
     *
630
     * @param parent
631
     */
632
    private void createUseRecordSection(RootElement parent) {
633
        destroySections();
634

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

    
637
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
638

    
639
        addPart(descriptionUseRecordSection);
640

    
641
    }
642

    
643
    /**
644
     * createUserSection
645
     *
646
     * @param parent
647
     */
648
    private void createUserSection(RootElement parent) {
649
        destroySections();
650

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

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

    
655
        addPart(userDetailSection);
656
        addPart(groupByUserDetailSection);
657
    }
658

    
659
    /**
660
     * createTaxonRelationshipSection
661
     *
662
     * @param parent
663
     */
664
    private void createTaxonRelationshipSection(RootElement parent) {
665
        destroySections();
666

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

    
669
        ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
670
        addPart(taxonRelationshipDetailSection);
671
        addPart(referencedEntityBaseDetailSection);
672
    }
673

    
674
    /**
675
     * @param rootElement
676
     */
677
    private void createTermVocabularySection(RootElement parent) {
678
        destroySections();
679

    
680
        TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
681
        addPart(termVocabularyDetailSection);
682
    }
683

    
684
    /**
685
     * createDefinedTermSection
686
     *
687
     * @param parent
688
     */
689
    private void createDefinedTermSection(RootElement parent) {
690
        destroySections();
691

    
692
        AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
693
        addPart(definedTermDetailSection);
694
    }
695
}
(3-3/3)