Project

General

Profile

Download (25 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
 * Copyright (C) 2007 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 org.eclipse.jface.viewers.ISelection;
14
import org.eclipse.jface.viewers.SelectionChangedEvent;
15
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.widgets.Composite;
17
import org.eclipse.ui.forms.widgets.Section;
18

    
19
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
20
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
21
import eu.etaxonomy.cdm.model.agent.Person;
22
import eu.etaxonomy.cdm.model.agent.Team;
23
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
24
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
25
import eu.etaxonomy.cdm.model.common.Group;
26
import eu.etaxonomy.cdm.model.common.TermVocabulary;
27
import eu.etaxonomy.cdm.model.common.User;
28
import eu.etaxonomy.cdm.model.description.DescriptionBase;
29
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
30
import eu.etaxonomy.cdm.model.description.PolytomousKey;
31
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
32
import eu.etaxonomy.cdm.model.media.Media;
33
import eu.etaxonomy.cdm.model.name.NonViralName;
34
import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
35
import eu.etaxonomy.cdm.model.reference.Reference;
36
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
37
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
38
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
39
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
40
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
41
import eu.etaxonomy.taxeditor.store.StoreUtil;
42
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
43
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType;
44
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType;
45
import eu.etaxonomy.taxeditor.ui.element.RootElement;
46
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
47
import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
48
import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
49
import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
50
import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
51
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
52
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
53
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
54
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
55
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
56
import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
57
import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
58
import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
59
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
60
import eu.etaxonomy.taxeditor.ui.section.group.GrantedAuthorityDetailSection;
61
import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
62
import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
63
import eu.etaxonomy.taxeditor.ui.section.key.GeographicalScopeDetailSection;
64
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
65
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
66
import eu.etaxonomy.taxeditor.ui.section.key.ScopeRestrictionSection;
67
import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
68
import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
69
import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
70
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
71
import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
72
import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
73
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
74
import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
75
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationDetailSection;
76
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
77
import eu.etaxonomy.taxeditor.ui.section.occurrence.GeneralDetailSection;
78
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
79
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
80
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
81
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
82
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
83
import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
84
import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
85
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
86
import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
87
import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
88

    
89
/**
90
 * <p>
91
 * DetailsViewer class.
92
 * </p>
93
 * 
94
 * @author n.hoffmann
95
 * @created Feb 12, 2010
96
 * @version 1.0
97
 */
98
public class DetailsViewer extends AbstractCdmDataViewer {
99

    
100
	private ISelection selection;
101

    
102
	/**
103
	 * <p>
104
	 * Constructor for DetailsViewer.
105
	 * </p>
106
	 * 
107
	 * @param parent
108
	 *            a {@link org.eclipse.swt.widgets.Composite} object.
109
	 * @param viewPart
110
	 *            a {@link eu.etaxonomy.taxeditor.view.AbstractCdmViewPart}
111
	 *            object.
112
	 */
113
	public DetailsViewer(Composite parent, AbstractCdmViewPart viewPart) {
114
		super(parent, viewPart);
115
	}
116

    
117
	// START HACK TO MAKE THE DERIVED UNIT FACADE WORK
118
	// since we are getting implementations of DerivedUnitBase from the bulk
119
	// editor
120
	// and not derived unit facade objects,
121

    
122
	/*
123
	 * (non-Javadoc)
124
	 * 
125
	 * @see
126
	 * eu.etaxonomy.taxeditor.editor.view.AbstractCdmDataViewer#setInput(java
127
	 * .lang.Object)
128
	 */
129
	@Override
130
	public void setInput(Object input) {
131
		if (input instanceof DerivedUnitBase) {
132
			try {
133
				input = DerivedUnitFacade.NewInstance((DerivedUnitBase) input,
134
						PreferencesUtil.getDerivedUnitConfigurator());
135
			} catch (DerivedUnitFacadeNotSupportedException e) {
136
				StoreUtil.error(getClass(), e);
137
			}
138
		}
139
		super.setInput(input);
140
	}
141

    
142
	@Override
143
	protected void markViewPartDirty() {
144
		if (getInput() instanceof DerivedUnitFacade) {
145
			getViewPart().changed(
146
					((DerivedUnitFacade) getInput()).innerDerivedUnit());
147
		}
148

    
149
		super.markViewPartDirty();
150
	}
151

    
152
	// END HACK TO MAKE THE DERIVED UNIT FACADE WORK
153

    
154
	/*
155
	 * (non-Javadoc)
156
	 * 
157
	 * @see org.eclipse.jface.viewers.Viewer#refresh()
158
	 */
159
	/** {@inheritDoc} */
160
	@Override
161
	protected void showParts() {
162
		if (getInput() instanceof TaxonBase) {
163
			createTaxonSections(rootElement);
164

    
165
		} else if (getInput() instanceof NonViralName) {
166
			createNameSections(rootElement);
167

    
168
		} else if (getInput() instanceof Reference) {
169
			createReferenceSections(rootElement);
170

    
171
		} else if (getInput() instanceof Team) {
172
			createTeamDetailSection(rootElement);
173

    
174
		} else if (getInput() instanceof Person) {
175
			createPersonDetailSection(rootElement);
176

    
177
		} else if (getInput() instanceof TeamOrPersonBase) {
178
			createTeamOrPersonBaseDetailSection(rootElement);
179

    
180
		} else if (getInput() instanceof DescriptionBase) {
181
			if (((DescriptionBase) getInput()).isImageGallery()) {
182
				createImageGallerySection(rootElement);
183

    
184
			} else {
185
				createDescriptionSection(rootElement);
186

    
187
			}
188
		} else if (getInput() instanceof DescriptionElementBase) {
189
			createDescriptionElementSection(rootElement);
190

    
191
		} else if (getInput() instanceof Media) {
192
			createMediaElementSection(rootElement);
193

    
194
		} else if (getInput() instanceof DerivedUnitFacade) {
195
			createDerivedUnitBaseElementSection(rootElement);
196

    
197
		} else if (getInput() instanceof FeatureNodeContainer) {
198
			createFeatureDistributionSection(rootElement);
199

    
200
		} else if (getInput() instanceof PolytomousKey) {
201
			createPolytomousKeySection(rootElement);
202

    
203
		} else if ((getInput() instanceof PolytomousKeyNode)
204
				|| (getInput() instanceof PolytomousKeyRelationship)) {
205
			createPolytomousKeyNodeSection(rootElement);
206

    
207
		} else if (getInput() instanceof User) {
208
			createUserSection(rootElement);
209

    
210
		} else if (getInput() instanceof Group) {
211
			createGroupSection(rootElement);
212

    
213
		} else if (getInput() instanceof TaxonRelationship) {
214
			createTaxonRelationshipSection(rootElement);
215

    
216
		} else if (getInput() instanceof TermVocabulary) {
217
			createTermVocabularySection(rootElement);
218

    
219
		} else if (getInput() instanceof DefinedTermBase) {
220
			createDefinedTermSection(rootElement);
221
		} else {
222
			destroySections();
223
		}
224
		layout();
225
	}
226

    
227
	/**
228
	 * @param rootElement
229
	 */
230
	private void createGroupSection(RootElement parent) {
231
		destroySections();
232

    
233
		GroupDetailSection groupDetailSection = (GroupDetailSection) formFactory
234
				.createCdmDetailSection(DetailType.GROUP,
235
						getConversationHolder(), parent, this, Section.TWISTIE
236
								| Section.EXPANDED);
237
		MemberDetailSection memberDetailSection = (MemberDetailSection) formFactory
238
				.createEntityDetailSection(EntityDetailType.MEMBER,
239
						getConversationHolder(), parent, Section.TWISTIE
240
								| Section.EXPANDED);
241
		GrantedAuthorityDetailSection grantedAuthorityDetailSection = (GrantedAuthorityDetailSection) formFactory
242
				.createEntityDetailSection(EntityDetailType.GRANTED_AUTHORITY,
243
						getConversationHolder(), parent, Section.TWISTIE
244
								| Section.EXPANDED);
245

    
246
		addPart(groupDetailSection);
247
		addPart(memberDetailSection);
248
		addPart(grantedAuthorityDetailSection);
249
	}
250

    
251
	/*
252
	 * (non-Javadoc)
253
	 * 
254
	 * @see org.eclipse.jface.viewers.Viewer#getSelection()
255
	 */
256
	/** {@inheritDoc} */
257
	@Override
258
	public ISelection getSelection() {
259
		return selection;
260
	}
261

    
262
	/*
263
	 * (non-Javadoc)
264
	 * 
265
	 * @see
266
	 * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
267
	 * .ISelection, boolean)
268
	 */
269
	/** {@inheritDoc} */
270
	@Override
271
	public void setSelection(ISelection selection, boolean reveal) {
272
		this.selection = selection;
273
		SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(
274
				this, selection);
275
		fireSelectionChanged(selectionChangedEvent);
276
	}
277

    
278
	private void createTaxonSections(RootElement parent) {
279
		destroySections();
280

    
281
		TaxonBaseDetailSection taxonBaseDetailSection = (TaxonBaseDetailSection) formFactory
282
				.createCdmDetailSection(DetailType.TAXONBASE,
283
						getConversationHolder(), parent, this, Section.TWISTIE);
284

    
285
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
286

    
287
		NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
288
				.createCdmDetailSection(DetailType.NONVIRALNAME,
289
						getConversationHolder(), parent, this, Section.TWISTIE
290
								| Section.EXPANDED);
291

    
292
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
293

    
294
		NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
295
				.createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
296
						getConversationHolder(), parent, this, Section.TWISTIE);
297

    
298
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
299

    
300
		NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
301
				.createEntityDetailSection(
302
						EntityDetailType.NOMENCLATURALSTATUS,
303
						getConversationHolder(), parent, Section.TWISTIE);
304

    
305
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
306

    
307
		ProtologueSection protologSection = (ProtologueSection) formFactory
308
				.createEntityDetailSection(EntityDetailType.PROTOLOG,
309
						getConversationHolder(), parent, Section.TWISTIE);
310

    
311
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
312

    
313
		TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
314
				.createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
315
						getConversationHolder(), parent, Section.TWISTIE);
316

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

    
319
		NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
320
				.createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
321
						getConversationHolder(), parent, Section.TWISTIE);
322

    
323
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
324

    
325
		ParsingMessagesSection parsingMessagesSection = (ParsingMessagesSection) formFactory
326
				.createCdmDetailSection(DetailType.PARSINGMESSAGE,
327
						getConversationHolder(), parent, this, Section.EXPANDED);
328

    
329
		addPart(taxonBaseDetailSection);
330
		addPart(nonViralNameSection);
331
		addPart(nomenclaturalStatusSection);
332
		addPart(protologSection);
333
		addPart(referenceDetailSection);
334
		addPart(typeDesignationSection);
335
		addPart(nameRelationshipSection);
336
		addPart(parsingMessagesSection);
337
	}
338

    
339
	private void createNameSections(RootElement parent) {
340
		destroySections();
341
		NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
342
				.createCdmDetailSection(DetailType.NONVIRALNAME,
343
						getConversationHolder(), parent, this, Section.TWISTIE
344
								| Section.EXPANDED);
345

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

    
348
		NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
349
				.createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
350
						getConversationHolder(), parent, this, Section.TWISTIE);
351

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

    
354
		NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
355
				.createEntityDetailSection(
356
						EntityDetailType.NOMENCLATURALSTATUS,
357
						getConversationHolder(), parent, Section.TWISTIE);
358

    
359
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
360

    
361
		ProtologueSection protologSection = (ProtologueSection) formFactory
362
				.createEntityDetailSection(EntityDetailType.PROTOLOG,
363
						getConversationHolder(), parent, Section.TWISTIE);
364

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

    
367
		TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
368
				.createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
369
						getConversationHolder(), parent, Section.TWISTIE);
370

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

    
373
		NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
374
				.createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
375
						getConversationHolder(), parent, Section.TWISTIE);
376

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

    
379
		addPart(nonViralNameSection);
380
		addPart(nomenclaturalStatusSection);
381
		addPart(protologSection);
382
		addPart(referenceDetailSection);
383
		addPart(typeDesignationSection);
384
		addPart(nameRelationshipSection);
385
	}
386

    
387
	private void createReferenceSections(RootElement parent) {
388
		destroySections();
389

    
390
		ReferenceDetailSection referenceDetailSection = (ReferenceDetailSection) formFactory
391
				.createCdmDetailSection(DetailType.REFERENCEBASE,
392
						getConversationHolder(), parent, this, Section.TWISTIE
393
								| Section.EXPANDED);
394

    
395
		addPart(referenceDetailSection);
396
	}
397

    
398
	private void createTeamOrPersonBaseDetailSection(RootElement parent) {
399
		destroySections();
400
		TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = (TeamOrPersonBaseDetailSection) formFactory
401
				.createCdmDetailSection(DetailType.TEAMORPERSONBASE,
402
						getConversationHolder(), parent, this, Section.TWISTIE
403
								| Section.EXPANDED);
404

    
405
		addPart(teamOrPersonBaseDetailSection);
406
	}
407

    
408
	private void createTeamDetailSection(RootElement parent) {
409
		destroySections();
410
		TeamDetailSection teamDetailSection = (TeamDetailSection) formFactory
411
				.createCdmDetailSection(DetailType.TEAM,
412
						getConversationHolder(), parent, this, Section.TWISTIE
413
								| Section.EXPANDED);
414

    
415
		addPart(teamDetailSection);
416
	}
417

    
418
	private void createPersonDetailSection(RootElement parent) {
419
		destroySections();
420
		PersonDetailSection personDetailSection = (PersonDetailSection) formFactory
421
				.createCdmDetailSection(DetailType.PERSON,
422
						getConversationHolder(), parent, this, Section.TWISTIE
423
								| Section.EXPANDED);
424
		addPart(personDetailSection);
425
	}
426

    
427
	private void createDescriptionElementSection(RootElement parent) {
428
		destroySections();
429

    
430
		DescriptionElementDetailSection descriptionElementDetailSection = (DescriptionElementDetailSection) formFactory
431
				.createCdmDetailSection(DetailType.DESCRIPTIONELEMENT,
432
						getConversationHolder(), parent, this, Section.TWISTIE
433
								| Section.EXPANDED);
434

    
435
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
436

    
437
		DescriptionElementSourceSection descriptionElementSourceSection = (DescriptionElementSourceSection) formFactory
438
				.createEntityDetailSection(
439
						EntityDetailType.DESCRIPTIONELEMENTSOURCE,
440
						getConversationHolder(), parent, Section.TWISTIE);
441

    
442
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
443

    
444
		DescriptionElementMediaSection descriptionElementMediaSection = (DescriptionElementMediaSection) formFactory
445
				.createEntityDetailSection(
446
						EntityDetailType.DESCRIPTIONELEMENTMEDIA,
447
						getConversationHolder(), parent, Section.TWISTIE);
448

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

    
451
		addPart(descriptionElementDetailSection);
452
		addPart(descriptionElementSourceSection);
453
		addPart(descriptionElementMediaSection);
454
	}
455

    
456
	private void createDescriptionSection(RootElement parent) {
457
		destroySections();
458
		DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
459
				.createCdmDetailSection(DetailType.DESCRIPTION,
460
						getConversationHolder(), parent, this, Section.TWISTIE
461
								| Section.EXPANDED);
462

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

    
465
		NaturalLanguageSection naturalLanguageSection = (NaturalLanguageSection) formFactory
466
				.createCdmDetailSection(DetailType.NATURAL_LANGUAGE,
467
						getConversationHolder(), parent, this, Section.TWISTIE
468
								| Section.EXPANDED);
469

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

    
472
		DescribedSpecimenSection describedSpecimenSection = (DescribedSpecimenSection) formFactory
473
				.createEntityDetailSection(EntityDetailType.DESCRIBED_SPECIMEN,
474
						getConversationHolder(), parent, Section.TWISTIE);
475

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

    
478
		DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
479
				.createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
480
						getConversationHolder(), parent, Section.TWISTIE);
481

    
482
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
483

    
484
		ScopeSection scopeSection = (ScopeSection) formFactory
485
				.createEntityDetailSection(EntityDetailType.SCOPE,
486
						getConversationHolder(), parent, Section.TWISTIE);
487

    
488
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
489

    
490
		addPart(descriptionDetailSection);
491
		addPart(naturalLanguageSection);
492
		addPart(describedSpecimenSection);
493
		addPart(descriptionSourceSection);
494
		addPart(scopeSection);
495
	}
496

    
497
	/**
498
	 * @param rootElement
499
	 */
500
	private void createImageGallerySection(RootElement parent) {
501
		destroySections();
502
		DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
503
				.createCdmDetailSection(DetailType.DESCRIPTION,
504
						getConversationHolder(), parent, this, Section.TWISTIE
505
								| Section.EXPANDED);
506

    
507
		addPart(descriptionDetailSection);
508
	}
509

    
510
	private void createMediaElementSection(RootElement parent) {
511
		destroySections();
512
		MediaDetailsSection mediaDetailSection = (MediaDetailsSection) formFactory
513
				.createCdmDetailSection(DetailType.MEDIA,
514
						getConversationHolder(), parent, this, Section.TWISTIE
515
								| Section.EXPANDED);
516

    
517
		addPart(mediaDetailSection);
518
	}
519

    
520
	private void createDerivedUnitBaseElementSection(RootElement parent) {
521
		destroySections();
522

    
523
		GeneralDetailSection generalDetailSection = (GeneralDetailSection) formFactory
524
				.createCdmDetailSection(DetailType.DERIVED_UNIT_GENERAL,
525
						getConversationHolder(), parent, this, Section.TWISTIE
526
								| Section.EXPANDED);
527

    
528
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
529

    
530
		GatheringEventDetailSection gatheringEventDetailSection = (GatheringEventDetailSection) formFactory
531
				.createCdmDetailSection(DetailType.GATHERING_EVENT,
532
						getConversationHolder(), parent, this, Section.TWISTIE);
533

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

    
536
		FieldObservationDetailSection fieldObservationDetailSection = (FieldObservationDetailSection) formFactory
537
				.createCdmDetailSection(DetailType.FIELD_OBSERVATION,
538
						getConversationHolder(), parent, this, Section.TWISTIE);
539

    
540
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
541

    
542
		DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = (DerivedUnitBaseDetailSection) formFactory
543
				.createCdmDetailSection(DetailType.DERIVED_UNIT,
544
						getConversationHolder(), parent, this, Section.TWISTIE);
545

    
546
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
547

    
548
		DeterminationDetailSection determinationDetailSection = (DeterminationDetailSection) formFactory
549
				.createCdmDetailSection(DetailType.DETERMINATION,
550
						getConversationHolder(), parent, this, Section.TWISTIE);
551

    
552
		addPart(generalDetailSection);
553
		addPart(gatheringEventDetailSection);
554
		addPart(fieldObservationDetailSection);
555
		addPart(derivedUnitBaseDetailSection);
556
		addPart(determinationDetailSection);
557

    
558
	}
559

    
560
	/**
561
	 * @param rootElement
562
	 */
563
	private void createFeatureDistributionSection(RootElement parent) {
564
		destroySections();
565

    
566
		FeatureDistributionDetailSection featureDistributionSection = (FeatureDistributionDetailSection) formFactory
567
				.createCdmDetailSection(DetailType.FEATURE_DISTRIBUTION,
568
						getConversationHolder(), parent, this, Section.TWISTIE
569
								| Section.EXPANDED);
570

    
571
		addPart(featureDistributionSection);
572
	}
573

    
574
	private void createPolytomousKeySection(RootElement parent) {
575
		destroySections();
576

    
577
		PolytomousKeyDetailSection polytomousKeyDetailSection = (PolytomousKeyDetailSection) formFactory
578
				.createCdmDetailSection(DetailType.POLYTOMOUS_KEY,
579
						getConversationHolder(), parent, this, Section.TWISTIE
580
								| Section.EXPANDED);
581

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

    
584
		GeographicalScopeDetailSection geographicalScopeDetailSection = (GeographicalScopeDetailSection) formFactory
585
				.createEntityDetailSection(EntityDetailType.GEOGRAPHICAL_SCOPE,
586
						getConversationHolder(), parent, Section.TWISTIE);
587

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

    
590
		ScopeRestrictionSection scopeRestrictionSection = (ScopeRestrictionSection) formFactory
591
				.createEntityDetailSection(EntityDetailType.SCOPE_RESTRICTION,
592
						getConversationHolder(), parent, Section.TWISTIE);
593

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

    
596
		TaxonomicScopeSection taxonomicScopeSection = (TaxonomicScopeSection) formFactory
597
				.createEntityDetailSection(EntityDetailType.TAXONOMIC_SCOPE,
598
						getConversationHolder(), parent, Section.TWISTIE);
599

    
600
		addPart(polytomousKeyDetailSection);
601
		addPart(geographicalScopeDetailSection);
602
		addPart(scopeRestrictionSection);
603
		addPart(taxonomicScopeSection);
604
	}
605

    
606
	private void createPolytomousKeyNodeSection(RootElement parent) {
607
		destroySections();
608

    
609
		PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = (PolytomousKeyNodeDetailSection) formFactory
610
				.createCdmDetailSection(DetailType.POLYTOMOUS_KEY_NODE,
611
						getConversationHolder(), parent, this, Section.TWISTIE
612
								| Section.EXPANDED);
613

    
614
		addPart(polytomousKeyNodeDetailSection);
615
	}
616

    
617
	private void createUserSection(RootElement parent) {
618
		destroySections();
619

    
620
		UserDetailSection userDetailSection = (UserDetailSection) formFactory
621
				.createCdmDetailSection(DetailType.USER,
622
						getConversationHolder(), parent, this, Section.TWISTIE
623
								| Section.EXPANDED);
624

    
625
		GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) formFactory
626
				.createEntityDetailSection(EntityDetailType.GROUPS_BY_USER,
627
						getConversationHolder(), parent, Section.TWISTIE
628
								| Section.EXPANDED);
629

    
630
		addPart(userDetailSection);
631
		addPart(groupByUserDetailSection);
632
	}
633

    
634
	private void createTaxonRelationshipSection(RootElement parent) {
635
		destroySections();
636

    
637
		TaxonRelationshipDetailSection taxonRelationshipDetailSection = (TaxonRelationshipDetailSection) formFactory
638
				.createCdmDetailSection(DetailType.TAXON_RELATIONSHIP,
639
						getConversationHolder(), parent, this, Section.TWISTIE
640
								| Section.EXPANDED);
641

    
642
		ReferencedEntityDetailSection referencedEntityBaseDetailSection = (ReferencedEntityDetailSection) formFactory
643
				.createCdmDetailSection(DetailType.REFERENCED_ENTITY,
644
						getConversationHolder(), parent, this, Section.TWISTIE
645
								| Section.EXPANDED);
646
		addPart(taxonRelationshipDetailSection);
647
		addPart(referencedEntityBaseDetailSection);
648
	}
649

    
650
	/**
651
	 * @param rootElement
652
	 */
653
	private void createTermVocabularySection(RootElement parent) {
654
		destroySections();
655

    
656
		TermVocabularyDetailSection termVocabularyDetailSection = (TermVocabularyDetailSection) formFactory
657
				.createCdmDetailSection(DetailType.TERM_VOCABULARY,
658
						getConversationHolder(), parent, this, Section.TWISTIE
659
								| Section.EXPANDED);
660
		addPart(termVocabularyDetailSection);
661
	}
662

    
663
	private void createDefinedTermSection(RootElement parent) {
664
		destroySections();
665

    
666
		AbstractFormSection definedTermDetailSection = formFactory
667
				.createDefinedTermDetailSection(getInput().getClass(),
668
						getConversationHolder(), parent, this, Section.TWISTIE
669
								| Section.EXPANDED);
670
		addPart(definedTermDetailSection);
671
	}
672
}
(3-3/3)