Project

General

Profile

Download (28.9 KB) Statistics
| Branch: | Tag: | Revision:
1

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

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

    
14
import java.util.Set;
15

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

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

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

    
112
	private ISelection selection;
113

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

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

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

    
157
	@Override
158
	protected void markViewPartDirty() {
159
		if (getInput() instanceof DerivedUnitFacade) {
160
            getViewPart().changed(((DerivedUnitFacade) getInput()).innerDerivedUnit());
161
		}
162

    
163
		super.markViewPartDirty();
164
	}
165

    
166
	// END HACK TO MAKE THE DERIVED UNIT FACADE WORK
167

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

    
184
        } else if (input instanceof NonViralName) {
185
			createNameSections(rootElement);
186

    
187
        } else if (input instanceof Reference) {
188
			createReferenceSections(rootElement);
189

    
190
        } else if (input instanceof Team) {
191
			createTeamDetailSection(rootElement);
192

    
193
        } else if (input instanceof Person) {
194
			createPersonDetailSection(rootElement);
195

    
196
        } else if (input instanceof TeamOrPersonBase) {
197
			createTeamOrPersonBaseDetailSection(rootElement);
198

    
199
        } else if (input instanceof DescriptionBase) {
200
            if(input instanceof SpecimenDescription){
201
                //TODO: add more sections to DetailsView for SpecimenDescription
202
                createSpecimenDescriptionSection(rootElement);
203
            }
204
            else{
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
            }
224
        } else if (input instanceof DescriptionElementBase) {
225
            Set<Marker> descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
226
            MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
227
                    UsageTermCollection.uuidUseMarkerType);
228
			Boolean isUseDescription = false;
229
			for (Marker marker : descriptionMarkers) {
230
				if (marker.getMarkerType().equals(useMarkertype)) {
231
					isUseDescription = true;
232
				}
233
			}
234

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

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

    
244
        } else if (input instanceof DerivedUnitFacade) {
245
            if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.FieldUnit){
246
                createFieldUnitSection(rootElement);
247
            }
248
            else{
249
                createDerivedUnitBaseElementSection(rootElement);
250
            }
251

    
252
        } else if (input instanceof FieldUnit) {
253
            createFieldUnitSection(rootElement);
254

    
255
        } else if (input instanceof FeatureNodeContainer) {
256
			createFeatureDistributionSection(rootElement);
257

    
258
        } else if (input instanceof PolytomousKey) {
259
			//createPolytomousKeySection(rootElement);
260

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

    
279

    
280
	/**
281
	 * @param rootElement
282
	 */
283
	private void createGroupSection(RootElement parent) {
284
		destroySections();
285

    
286
        GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
287
        MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
288
        GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
289

    
290
		addPart(groupDetailSection);
291
		addPart(memberDetailSection);
292
		addPart(grantedAuthorityDetailSection);
293
	}
294

    
295
	/*
296
	 * (non-Javadoc)
297
	 *
298
	 * @see org.eclipse.jface.viewers.Viewer#getSelection()
299
	 */
300
	/** {@inheritDoc} */
301
	@Override
302
	public ISelection getSelection() {
303
		return selection;
304
	}
305

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

    
321
	/**
322
	 * createTaxonSections(RootElement parent)
323
     *
324
	 * @param parent
325
	 */
326
	private void createTaxonSections(RootElement parent) {
327
		destroySections();
328

    
329
        TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
330

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

    
333
        NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
334
                        | ExpandableComposite.EXPANDED);
335

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

    
338
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
339

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

    
342
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE);
343

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

    
346
        ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
347

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

    
350
        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
351

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

    
354
        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
355

    
356
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
357

    
358
        ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this, ExpandableComposite.EXPANDED);
359

    
360
		addPart(taxonBaseDetailSection);
361
		addPart(nonViralNameSection);
362
		addPart(nomenclaturalStatusSection);
363
		addPart(protologSection);
364
		addPart(referenceDetailSection);
365
		addPart(typeDesignationSection);
366
		addPart(nameRelationshipSection);
367
		addPart(parsingMessagesSection);
368
	}
369

    
370
	/**
371
	 * createNameSections
372
     *
373
	 * @param parent
374
	 */
375
	private void createNameSections(RootElement parent) {
376
		destroySections();
377
        NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
378

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

    
381
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
382

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

    
385
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
386

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

    
389
        ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
390

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

    
393
        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
394

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

    
397
        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
398

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

    
401
		addPart(nonViralNameSection);
402
		addPart(nomenclaturalStatusSection);
403
		addPart(protologSection);
404
		addPart(referenceDetailSection);
405
		addPart(typeDesignationSection);
406
		addPart(nameRelationshipSection);
407
	}
408

    
409
	/**
410
	 * createReferenceSections
411
     *
412
	 * @param parent
413
	 */
414
	private void createReferenceSections(RootElement parent) {
415
		destroySections();
416

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

    
419
		addPart(referenceDetailSection);
420
	}
421

    
422
	/**
423
	 * createTeamOrPersonBaseDetailSection
424
     *
425
	 * @param parent
426
	 */
427
	private void createTeamOrPersonBaseDetailSection(RootElement parent) {
428
		destroySections();
429
        TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
430

    
431
		addPart(teamOrPersonBaseDetailSection);
432
	}
433

    
434
	/**
435
	 * createTeamDetailSection
436
     *
437
	 * @param parent
438
	 */
439
	private void createTeamDetailSection(RootElement parent) {
440
		destroySections();
441
        TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
442

    
443
		addPart(teamDetailSection);
444
	}
445

    
446
	/**
447
	 * createPersonDetailSection
448
     *
449
	 * @param parent
450
	 */
451
	private void createPersonDetailSection(RootElement parent) {
452
		destroySections();
453
        PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
454
		addPart(personDetailSection);
455
	}
456

    
457
	/**
458
	 * createDescriptionElementSection
459
     *
460
	 * @param parent
461
	 */
462
	private void createDescriptionElementSection(RootElement parent) {
463
		destroySections();
464

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

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

    
469
        DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
470

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

    
473
        DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
474

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

    
477
		addPart(descriptionElementDetailSection);
478
		addPart(descriptionElementSourceSection);
479
		addPart(descriptionElementMediaSection);
480
	}
481

    
482
	/**
483
	 * createDescriptionSection
484
     *
485
	 * @param parent
486
	 */
487
	private void createDescriptionSection(RootElement parent) {
488
		destroySections();
489
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
490

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

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

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

    
497
        DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
498

    
499
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
500

    
501
//		DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
502
//				.createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
503
//						getConversationHolder(), parent, Section.TWISTIE);
504
//
505
//		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
506

    
507
        ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
508

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

    
511
		addPart(descriptionDetailSection);
512
		addPart(naturalLanguageSection);
513
		addPart(describedSpecimenSection);
514
//		addPart(descriptionSourceSection);
515
		addPart(scopeSection);
516
	}
517

    
518
	/**
519
	 * createDescriptionSection
520
	 *
521
	 * @param parent
522
	 */
523
	private void createSpecimenDescriptionSection(RootElement parent) {
524
	    destroySections();
525
	    DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
526
	    addPart(descriptionDetailSection);
527
	}
528

    
529
	/**
530
	 * Creates the use Description section
531
     *
532
	 * @param parent
533
	 */
534
	private void createUseDescriptionSection(RootElement parent) {
535
		destroySections();
536
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
537

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

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

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

    
544
		addPart(descriptionDetailSection);
545
		addPart(descriptionSourceSection);
546

    
547
	}
548

    
549

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

    
557
		addPart(descriptionDetailSection);
558
	}
559

    
560
	/**
561
	 * createMediaElementSection
562
     *
563
	 * @param parent
564
	 */
565

    
566
	private void createMediaElementSection(RootElement parent) {
567
		destroySections();
568
        MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
569

    
570
		addPart(mediaDetailSection);
571
	}
572

    
573
	/**
574
	 * createDerivedUnitBaseElementSection
575
     *
576
	 * @param parent
577
	 */
578
	private void createDerivedUnitBaseElementSection(RootElement parent) {
579
		destroySections();
580

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

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

    
585
        GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
586

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

    
589
        FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
590

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

    
593
        DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
594

    
595
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
596

    
597
        DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
598

    
599
		addPart(derivedUnitGeneralDetailSection);
600
		addPart(gatheringEventDetailSection);
601
		addPart(fieldUnitDetailSection);
602
		addPart(derivedUnitBaseDetailSection);
603
		addPart(determinationDetailSection);
604

    
605
	}
606

    
607
	/**
608
	 * createDerivedUnitBaseElementSection
609
	 *
610
	 * @param parent
611
	 */
612
	private void createFieldUnitSection(RootElement parent) {
613
	    destroySections();
614

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

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

    
619
	    GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
620

    
621
	    formFactory.createHorizontalSeparator(parent, SWT.BORDER);
622

    
623
	    FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
624

    
625
	    addPart(fielUnitGeneralDetailSection);
626
	    addPart(gatheringEventDetailSection);
627
	    addPart(fieldUnitDetailSection);
628
	}
629

    
630
	/**
631
	 * @param rootElement
632
	 */
633
	private void createFeatureDistributionSection(RootElement parent) {
634
		destroySections();
635

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

    
638
		addPart(featureDistributionSection);
639
	}
640

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

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

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

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

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

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

    
659
	    addPart(polytomousKeyDetailSection);
660
	    addPart(polytomousKeyNodeDetailSection);
661
	    addPart(taxonomicScopeSection);
662

    
663
	}
664

    
665
	/**
666
	 * create the UseRecordSection
667
     *
668
	 * @param parent
669
	 */
670
	private void createUseRecordSection(RootElement parent) {
671
		destroySections();
672

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

    
675
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
676

    
677
		addPart(descriptionUseRecordSection);
678

    
679

    
680
	}
681

    
682
	/**
683
	 * createUserSection
684
     *
685
	 * @param parent
686
	 */
687
	private void createUserSection(RootElement parent) {
688
		destroySections();
689

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

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

    
694
		addPart(userDetailSection);
695
		addPart(groupByUserDetailSection);
696
	}
697

    
698
	/**
699
	 * createTaxonRelationshipSection
700
     *
701
	 * @param parent
702
	 */
703
	private void createTaxonRelationshipSection(RootElement parent) {
704
		destroySections();
705

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

    
708
        ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
709
		addPart(taxonRelationshipDetailSection);
710
		addPart(referencedEntityBaseDetailSection);
711
	}
712

    
713
	/**
714
	 * @param rootElement
715
	 */
716
	private void createTermVocabularySection(RootElement parent) {
717
		destroySections();
718

    
719
        TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
720
		addPart(termVocabularyDetailSection);
721
	}
722

    
723
	/**
724
	 * createDefinedTermSection
725
     *
726
	 * @param parent
727
	 */
728
	private void createDefinedTermSection(RootElement parent) {
729
		destroySections();
730

    
731
        AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
732
		addPart(definedTermDetailSection);
733
	}
734

    
735
}
(3-3/3)