Project

General

Profile

Download (30.1 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.DerivedUnitDetailsSection;
56
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenDetailsSection;
57
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenGeneralSection;
58
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
59
import eu.etaxonomy.taxeditor.ui.element.RootElement;
60
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
61
import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
62
import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
63
import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
64
import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
65
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
66
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
67
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
68
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
69
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
70
import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
71
import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
72
import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
73
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
74
import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
75
import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
76
import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
77
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
78
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
79
import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
80
import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
81
import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
82
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
83
import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
84
import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
85
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
86
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
87
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
88
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
89
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
90
import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
91
import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
92
import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
93
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
94
import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
95
import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
96

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

    
110
    private ISelection selection;
111

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

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

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

    
154
    @Override
155
    protected void markViewPartDirty() {
156
        if (getInput() instanceof DerivedUnitFacade) {
157
            DerivedUnitFacade derivedUnitFacade = (DerivedUnitFacade) getInput();
158
            DerivedUnit innerDerivedUnit = derivedUnitFacade.innerDerivedUnit();
159
            FieldUnit innerFieldUnit = derivedUnitFacade.innerFieldUnit();
160
            if(innerDerivedUnit!=null){
161
                getViewPart().changed(innerDerivedUnit);
162
            }
163
            else if(innerFieldUnit!=null){
164
                getViewPart().changed(innerFieldUnit);
165
            }
166
        }
167

    
168
        super.markViewPartDirty();
169
    }
170

    
171
    // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
172

    
173
    /*
174
     * (non-Javadoc)
175
     *
176
     * @see org.eclipse.jface.viewers.Viewer#refresh()
177
     */
178
    /** {@inheritDoc} */
179
    @Override
180
    protected void showParts() {
181
        // FIXME (CM) : Need to clean out this code.
182
        // Too much type checking to decide which detail view to display.
183
        // Need to build in a mechanism where navigators / editors are 'aware'
184
        // of the corresponding detail viewer.
185
        Object input = getInput();
186
        if (input instanceof TaxonBase) {
187
            createTaxonSections(rootElement);
188

    
189
        } else if (input instanceof NonViralName) {
190
            createNameSections(rootElement);
191

    
192
        } else if (input instanceof Reference) {
193
            createReferenceSections(rootElement);
194

    
195
        } else if (input instanceof Team) {
196
            createTeamDetailSection(rootElement);
197

    
198
        } else if (input instanceof Person) {
199
            createPersonDetailSection(rootElement);
200

    
201
        } else if (input instanceof TeamOrPersonBase) {
202
            createTeamOrPersonBaseDetailSection(rootElement);
203

    
204
        } else if (input instanceof DescriptionBase) {
205
            Set<Marker> descriptionMarkers = ((DescriptionBase) input).getMarkers();
206
            MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
207
                    UsageTermCollection.uuidUseMarkerType);
208
            Boolean isUseDescription = false;
209
            for (Marker marker : descriptionMarkers) {
210
                if (marker.getMarkerType().equals(useMarkertype)) {
211
                    isUseDescription = true;
212
                }
213
            }
214
            if (((DescriptionBase) input).isImageGallery()) {
215
                createImageGallerySection(rootElement);
216

    
217
            } else if (isUseDescription) {
218
                createUseDescriptionSection(rootElement);
219
            } else {
220
                createDescriptionSection(rootElement);
221

    
222
            }
223
        } else if (input instanceof DescriptionElementBase) {
224
            Set<Marker> descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
225
            MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
226
                    UsageTermCollection.uuidUseMarkerType);
227
            Boolean isUseDescription = false;
228
            for (Marker marker : descriptionMarkers) {
229
                if (marker.getMarkerType().equals(useMarkertype)) {
230
                    isUseDescription = true;
231
                }
232
            }
233

    
234
            if (isUseDescription == true && input instanceof CategoricalData) {
235
                createUseRecordSection(rootElement);
236
            } else {
237
                createDescriptionElementSection(rootElement);
238
            }
239

    
240
        } else if (input instanceof Media) {
241
            createMediaElementSection(rootElement);
242

    
243
        } else if (input instanceof DerivedUnitFacade) {
244
            DerivedUnitFacade derivedUnitFacade = (DerivedUnitFacade)input;
245

    
246
            if(derivedUnitFacade.getType()==SpecimenOrObservationType.FieldUnit){
247
                createFieldObservationDetailsView(rootElement);
248
            } else if(derivedUnitFacade.getType()==SpecimenOrObservationType.DerivedUnit){
249
                createSpecimenDetailsView(rootElement);
250
            }
251
        } else if (input instanceof FeatureNodeContainer) {
252
            createFeatureDistributionSection(rootElement);
253

    
254
        } else if (input instanceof PolytomousKey) {
255
            // createPolytomousKeySection(rootElement);
256

    
257
        } else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
258
            createPolytomousKeyNodeSection(rootElement);
259
        } else if (input instanceof User) {
260
            createUserSection(rootElement);
261
        } else if (input instanceof Group) {
262
            createGroupSection(rootElement);
263
        } else if (input instanceof TaxonRelationship) {
264
            createTaxonRelationshipSection(rootElement);
265
        } else if (input instanceof TermVocabulary) {
266
            createTermVocabularySection(rootElement);
267
        } else if (input instanceof DefinedTermBase) {
268
            createDefinedTermSection(rootElement);
269
        } else {
270
            destroySections();
271
        }
272
        layout();
273
    }
274

    
275
    /**
276
     * @param rootElement
277
     */
278
    private void createGroupSection(RootElement parent) {
279
        destroySections();
280

    
281
        GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
282
        MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
283
        GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
284

    
285
        addPart(groupDetailSection);
286
        addPart(memberDetailSection);
287
        addPart(grantedAuthorityDetailSection);
288
    }
289

    
290
    /*
291
     * (non-Javadoc)
292
     *
293
     * @see org.eclipse.jface.viewers.Viewer#getSelection()
294
     */
295
    /** {@inheritDoc} */
296
    @Override
297
    public ISelection getSelection() {
298
        return selection;
299
    }
300

    
301
    /*
302
     * (non-Javadoc)
303
     *
304
     * @see
305
     * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
306
     * .ISelection, boolean)
307
     */
308
    /** {@inheritDoc} */
309
    @Override
310
    public void setSelection(ISelection selection, boolean reveal) {
311
        this.selection = selection;
312
        SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
313
        fireSelectionChanged(selectionChangedEvent);
314
    }
315

    
316
    /**
317
     * createTaxonSections(RootElement parent)
318
     *
319
     * @param parent
320
     */
321
    private void createTaxonSections(RootElement parent) {
322
        destroySections();
323

    
324
        TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
325

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

    
328
        NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
329
                        | ExpandableComposite.EXPANDED);
330

    
331
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
332

    
333
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
334

    
335
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
336

    
337
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE);
338

    
339
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
340

    
341
        ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
342

    
343
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
344

    
345
        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
346

    
347
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
348

    
349
        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
350

    
351
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
352

    
353
        ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this, ExpandableComposite.EXPANDED);
354

    
355
        addPart(taxonBaseDetailSection);
356
        addPart(nonViralNameSection);
357
        addPart(nomenclaturalStatusSection);
358
        addPart(protologSection);
359
        addPart(referenceDetailSection);
360
        addPart(typeDesignationSection);
361
        addPart(nameRelationshipSection);
362
        addPart(parsingMessagesSection);
363
    }
364

    
365
    /**
366
     * createNameSections
367
     *
368
     * @param parent
369
     */
370
    private void createNameSections(RootElement parent) {
371
        destroySections();
372
        NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
373

    
374
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
375

    
376
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
377

    
378
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
379

    
380
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
381

    
382
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
383

    
384
        ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
385

    
386
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
387

    
388
        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
389

    
390
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
391

    
392
        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
393

    
394
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
395

    
396
        addPart(nonViralNameSection);
397
        addPart(nomenclaturalStatusSection);
398
        addPart(protologSection);
399
        addPart(referenceDetailSection);
400
        addPart(typeDesignationSection);
401
        addPart(nameRelationshipSection);
402
    }
403

    
404
    /**
405
     * createReferenceSections
406
     *
407
     * @param parent
408
     */
409
    private void createReferenceSections(RootElement parent) {
410
        destroySections();
411

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

    
414
        addPart(referenceDetailSection);
415
    }
416

    
417
    /**
418
     * createTeamOrPersonBaseDetailSection
419
     *
420
     * @param parent
421
     */
422
    private void createTeamOrPersonBaseDetailSection(RootElement parent) {
423
        destroySections();
424
        TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
425

    
426
        addPart(teamOrPersonBaseDetailSection);
427
    }
428

    
429
    /**
430
     * createTeamDetailSection
431
     *
432
     * @param parent
433
     */
434
    private void createTeamDetailSection(RootElement parent) {
435
        destroySections();
436
        TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
437

    
438
        addPart(teamDetailSection);
439
    }
440

    
441
    /**
442
     * createPersonDetailSection
443
     *
444
     * @param parent
445
     */
446
    private void createPersonDetailSection(RootElement parent) {
447
        destroySections();
448
        PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
449
        addPart(personDetailSection);
450
    }
451

    
452
    /**
453
     * createDescriptionElementSection
454
     *
455
     * @param parent
456
     */
457
    private void createDescriptionElementSection(RootElement parent) {
458
        destroySections();
459

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

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

    
464
        DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
465

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

    
468
        DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
469

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

    
472
        addPart(descriptionElementDetailSection);
473
        addPart(descriptionElementSourceSection);
474
        addPart(descriptionElementMediaSection);
475
    }
476

    
477
    /**
478
     * createDescriptionSection
479
     *
480
     * @param parent
481
     */
482
    private void createDescriptionSection(RootElement parent) {
483
        destroySections();
484
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
485

    
486
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
487

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

    
490
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
491

    
492
        DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
493

    
494
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
495

    
496
//        DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
497
//
498
//        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
499

    
500
        ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
501

    
502
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
503

    
504
        addPart(descriptionDetailSection);
505
        addPart(naturalLanguageSection);
506
        addPart(describedSpecimenSection);
507
//        addPart(descriptionSourceSection);
508
        addPart(scopeSection);
509
    }
510

    
511
    /**
512
     * Creates the use Description section
513
     *
514
     * @param parent
515
     */
516
    private void createUseDescriptionSection(RootElement parent) {
517
        destroySections();
518
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
519

    
520
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
521

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

    
524
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
525

    
526
        addPart(descriptionDetailSection);
527
        addPart(descriptionSourceSection);
528

    
529
    }
530

    
531
    /**
532
     * @param rootElement
533
     */
534
    private void createImageGallerySection(RootElement parent) {
535
        destroySections();
536
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
537

    
538
        addPart(descriptionDetailSection);
539
    }
540

    
541
    /**
542
     * createMediaElementSection
543
     *
544
     * @param parent
545
     */
546

    
547
    private void createMediaElementSection(RootElement parent) {
548
        destroySections();
549
        MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
550

    
551
        addPart(mediaDetailSection);
552
    }
553

    
554
    /**
555
     * createDerivedUnitBaseElementSection
556
     *
557
     * @param parent
558
     */
559
    private void createFieldObservationDetailsView(RootElement parent) {
560
        destroySections();
561

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

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

    
566
        GatheringEventSection gatheringEventDetailSection = formFactory.createGatheringEventSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
567

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

    
570
        FieldObservationDetailsSection fieldObservationDetailSection = formFactory.createFieldObservationDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
571

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

    
574
//        DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
575
//
576
//        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
577
//
578
//        DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
579

    
580
        addPart(fieldObservationSection);
581
        addPart(gatheringEventDetailSection);
582
        addPart(fieldObservationDetailSection);
583
//        addPart(derivedUnitBaseDetailSection);
584
//        addPart(determinationDetailSection);
585
    }
586

    
587
    /**
588
     * createDerivedUnitBaseElementSection
589
     *
590
     * @param parent
591
     */
592
    private void createSpecimenDetailsView(RootElement parent) {
593
        destroySections();
594

    
595
        SpecimenGeneralSection specimenSection = formFactory.createSpecimenSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
596

    
597
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
598

    
599
        SpecimenDetailsSection specimenDetailsSection = formFactory.createSpecimenDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
600

    
601
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
602

    
603
        DerivedUnitDetailsSection derivedUnitDetailsSection = formFactory.createDerivedUnitDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
604

    
605
        addPart(specimenSection);
606
        addPart(specimenDetailsSection);
607
        addPart(derivedUnitDetailsSection);
608
    }
609

    
610
    /**
611
     * @param rootElement
612
     */
613
    private void createFeatureDistributionSection(RootElement parent) {
614
        destroySections();
615

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

    
618
        addPart(featureDistributionSection);
619
    }
620

    
621
    /**
622
     * createPolytomousKeyNodeSection
623
     *
624
     * @param parent
625
     */
626
    private void createPolytomousKeyNodeSection(RootElement parent) {
627
        destroySections();
628

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

    
631
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
632

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

    
635
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
636

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

    
639
        addPart(polytomousKeyDetailSection);
640
        addPart(polytomousKeyNodeDetailSection);
641
        addPart(taxonomicScopeSection);
642

    
643
    }
644

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

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

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

    
657
        addPart(descriptionUseRecordSection);
658

    
659
    }
660

    
661
    /**
662
     * createUserSection
663
     *
664
     * @param parent
665
     */
666
    private void createUserSection(RootElement parent) {
667
        destroySections();
668

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

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

    
673
        addPart(userDetailSection);
674
        addPart(groupByUserDetailSection);
675
    }
676

    
677
    /**
678
     * createTaxonRelationshipSection
679
     *
680
     * @param parent
681
     */
682
    private void createTaxonRelationshipSection(RootElement parent) {
683
        destroySections();
684

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

    
687
        ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
688
        addPart(taxonRelationshipDetailSection);
689
        addPart(referencedEntityBaseDetailSection);
690
    }
691

    
692
    /**
693
     * @param rootElement
694
     */
695
    private void createTermVocabularySection(RootElement parent) {
696
        destroySections();
697

    
698
        TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
699
        addPart(termVocabularyDetailSection);
700
    }
701

    
702
    /**
703
     * createDefinedTermSection
704
     *
705
     * @param parent
706
     */
707
    private void createDefinedTermSection(RootElement parent) {
708
        destroySections();
709

    
710
        AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
711
        addPart(definedTermDetailSection);
712
    }
713
}
(3-3/3)