Project

General

Profile

Download (27.8 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 java.util.Set;
14
import java.util.UUID;
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.Section;
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.TextData;
40
import eu.etaxonomy.cdm.model.media.Media;
41
import eu.etaxonomy.cdm.model.name.NonViralName;
42
import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
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.model.FeatureNodeContainer;
47
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
48
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
49
import eu.etaxonomy.taxeditor.store.CdmStore;
50
import eu.etaxonomy.taxeditor.store.StoreUtil;
51
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
52
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType;
53
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType;
54
import eu.etaxonomy.taxeditor.ui.element.RootElement;
55
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
56
import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
57
import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
58
import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
59
import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
60
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
61
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
62
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
63
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
64
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
65
import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
66
import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
67
import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
68
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
69
import eu.etaxonomy.taxeditor.ui.section.group.GrantedAuthorityDetailSection;
70
import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
71
import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
72
import eu.etaxonomy.taxeditor.ui.section.key.GeographicalScopeDetailSection;
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.ScopeRestrictionSection;
76
import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
77
import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
78
import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
79
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
80
import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
81
import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
82
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
83
import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
84
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationDetailSection;
85
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
86
import eu.etaxonomy.taxeditor.ui.section.occurrence.GeneralDetailSection;
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
 * <p>
101
 * DetailsViewer class.
102
 * </p>
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 DerivedUnitBase) {
142
			try {
143
				input = DerivedUnitFacade.NewInstance((DerivedUnitBase) input,
144
						PreferencesUtil.getDerivedUnitConfigurator());
145
			} catch (DerivedUnitFacadeNotSupportedException e) {
146
				StoreUtil.error(getClass(), e);
147
			}
148
		}
149
		super.setInput(input);
150
	}
151

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

    
159
		super.markViewPartDirty();
160
	}
161

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

    
164
	/*
165
	 * (non-Javadoc)
166
	 * 
167
	 * @see org.eclipse.jface.viewers.Viewer#refresh()
168
	 */
169
	/** {@inheritDoc} */
170
	@Override
171
	protected void showParts() {
172
		if (getInput() instanceof TaxonBase) {
173
			createTaxonSections(rootElement);
174

    
175
		} else if (getInput() instanceof NonViralName) {
176
			createNameSections(rootElement);
177

    
178
		} else if (getInput() instanceof Reference) {
179
			createReferenceSections(rootElement);
180

    
181
		} else if (getInput() instanceof Team) {
182
			createTeamDetailSection(rootElement);
183

    
184
		} else if (getInput() instanceof Person) {
185
			createPersonDetailSection(rootElement);
186

    
187
		} else if (getInput() instanceof TeamOrPersonBase) {
188
			createTeamOrPersonBaseDetailSection(rootElement);
189

    
190
		} else if (getInput() instanceof DescriptionBase) {
191
			Set<Marker> descriptionMarkers = ((DescriptionBase) getInput()).getMarkers();
192
			MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UUID.fromString("2e6e42d9-e92a-41f4-899b-03c0ac64f039"));
193
			Boolean isUseDescription = false;
194
			for (Marker marker : descriptionMarkers) {
195
				if (marker.getMarkerType().equals(useMarkertype)) {
196
					isUseDescription = true;
197
				}
198
			}
199
			if (((DescriptionBase) getInput()).isImageGallery()) {
200
				createImageGallerySection(rootElement);
201

    
202
			} else if (isUseDescription) { 
203
				createUseDescriptionSection(rootElement);
204
			} else {
205
				createDescriptionSection(rootElement);
206

    
207
			}
208
		} else if (getInput() instanceof DescriptionElementBase) {
209
			Set<Marker> descriptionMarkers = ((DescriptionElementBase) getInput()).getInDescription().getMarkers();
210
			MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UUID.fromString("2e6e42d9-e92a-41f4-899b-03c0ac64f039"));
211
			Boolean isUseDescription = false;
212
			for (Marker marker : descriptionMarkers) {
213
				if (marker.getMarkerType().equals(useMarkertype)) {
214
					isUseDescription = true;
215
				}
216
			}
217
			
218
			if (isUseDescription == true && getInput() instanceof CategoricalData ) {
219
				createUseRecordSection(rootElement);
220
			}
221
			else {
222
				createDescriptionElementSection(rootElement);
223
			}
224

    
225
		} else if (getInput() instanceof Media) {
226
			createMediaElementSection(rootElement);
227

    
228
		} else if (getInput() instanceof DerivedUnitFacade) {
229
			createDerivedUnitBaseElementSection(rootElement);
230

    
231
		} else if (getInput() instanceof FeatureNodeContainer) {
232
			createFeatureDistributionSection(rootElement);
233

    
234
		} else if (getInput() instanceof PolytomousKey) {
235
			createPolytomousKeySection(rootElement);
236

    
237
		} else if ((getInput() instanceof PolytomousKeyNode)
238
				|| (getInput() instanceof PolytomousKeyRelationship)) {
239
			createPolytomousKeyNodeSection(rootElement);
240

    
241
		} else if (getInput() instanceof User) {
242
			createUserSection(rootElement);
243

    
244
		} else if (getInput() instanceof Group) {
245
			createGroupSection(rootElement);
246

    
247
		} else if (getInput() instanceof TaxonRelationship) {
248
			createTaxonRelationshipSection(rootElement);
249

    
250
		} else if (getInput() instanceof TermVocabulary) {
251
			createTermVocabularySection(rootElement);
252

    
253
		} else if (getInput() instanceof DefinedTermBase) {
254
			createDefinedTermSection(rootElement);
255
		} else {
256
			destroySections();
257
		}
258
		layout();
259
	}
260

    
261
	
262
	/**
263
	 * @param rootElement
264
	 */
265
	private void createGroupSection(RootElement parent) {
266
		destroySections();
267

    
268
		GroupDetailSection groupDetailSection = (GroupDetailSection) formFactory
269
				.createCdmDetailSection(DetailType.GROUP,
270
						getConversationHolder(), parent, this, Section.TWISTIE
271
								| Section.EXPANDED);
272
		MemberDetailSection memberDetailSection = (MemberDetailSection) formFactory
273
				.createEntityDetailSection(EntityDetailType.MEMBER,
274
						getConversationHolder(), parent, Section.TWISTIE
275
								| Section.EXPANDED);
276
		GrantedAuthorityDetailSection grantedAuthorityDetailSection = (GrantedAuthorityDetailSection) formFactory
277
				.createEntityDetailSection(EntityDetailType.GRANTED_AUTHORITY,
278
						getConversationHolder(), parent, Section.TWISTIE
279
								| Section.EXPANDED);
280

    
281
		addPart(groupDetailSection);
282
		addPart(memberDetailSection);
283
		addPart(grantedAuthorityDetailSection);
284
	}
285

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

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

    
313
	private void createTaxonSections(RootElement parent) {
314
		destroySections();
315

    
316
		TaxonBaseDetailSection taxonBaseDetailSection = (TaxonBaseDetailSection) formFactory
317
				.createCdmDetailSection(DetailType.TAXONBASE,
318
						getConversationHolder(), parent, this, Section.TWISTIE);
319

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

    
322
		NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
323
				.createCdmDetailSection(DetailType.NONVIRALNAME,
324
						getConversationHolder(), parent, this, Section.TWISTIE
325
								| Section.EXPANDED);
326

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

    
329
		NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
330
				.createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
331
						getConversationHolder(), parent, this, Section.TWISTIE);
332

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

    
335
		NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
336
				.createEntityDetailSection(
337
						EntityDetailType.NOMENCLATURALSTATUS,
338
						getConversationHolder(), parent, Section.TWISTIE);
339

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

    
342
		ProtologueSection protologSection = (ProtologueSection) formFactory
343
				.createEntityDetailSection(EntityDetailType.PROTOLOG,
344
						getConversationHolder(), parent, Section.TWISTIE);
345

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

    
348
		TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
349
				.createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
350
						getConversationHolder(), parent, Section.TWISTIE);
351

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

    
354
		NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
355
				.createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
356
						getConversationHolder(), parent, Section.TWISTIE);
357

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

    
360
		ParsingMessagesSection parsingMessagesSection = (ParsingMessagesSection) formFactory
361
				.createCdmDetailSection(DetailType.PARSINGMESSAGE,
362
						getConversationHolder(), parent, this, Section.EXPANDED);
363

    
364
		addPart(taxonBaseDetailSection);
365
		addPart(nonViralNameSection);
366
		addPart(nomenclaturalStatusSection);
367
		addPart(protologSection);
368
		addPart(referenceDetailSection);
369
		addPart(typeDesignationSection);
370
		addPart(nameRelationshipSection);
371
		addPart(parsingMessagesSection);
372
	}
373

    
374
	private void createNameSections(RootElement parent) {
375
		destroySections();
376
		NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
377
				.createCdmDetailSection(DetailType.NONVIRALNAME,
378
						getConversationHolder(), parent, this, Section.TWISTIE
379
								| Section.EXPANDED);
380

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

    
383
		NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
384
				.createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
385
						getConversationHolder(), parent, this, Section.TWISTIE);
386

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

    
389
		NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
390
				.createEntityDetailSection(
391
						EntityDetailType.NOMENCLATURALSTATUS,
392
						getConversationHolder(), parent, Section.TWISTIE);
393

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

    
396
		ProtologueSection protologSection = (ProtologueSection) formFactory
397
				.createEntityDetailSection(EntityDetailType.PROTOLOG,
398
						getConversationHolder(), parent, Section.TWISTIE);
399

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

    
402
		TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
403
				.createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
404
						getConversationHolder(), parent, Section.TWISTIE);
405

    
406
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
407

    
408
		NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
409
				.createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
410
						getConversationHolder(), parent, Section.TWISTIE);
411

    
412
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
413

    
414
		addPart(nonViralNameSection);
415
		addPart(nomenclaturalStatusSection);
416
		addPart(protologSection);
417
		addPart(referenceDetailSection);
418
		addPart(typeDesignationSection);
419
		addPart(nameRelationshipSection);
420
	}
421

    
422
	private void createReferenceSections(RootElement parent) {
423
		destroySections();
424

    
425
		ReferenceDetailSection referenceDetailSection = (ReferenceDetailSection) formFactory
426
				.createCdmDetailSection(DetailType.REFERENCEBASE,
427
						getConversationHolder(), parent, this, Section.TWISTIE
428
								| Section.EXPANDED);
429

    
430
		addPart(referenceDetailSection);
431
	}
432

    
433
	private void createTeamOrPersonBaseDetailSection(RootElement parent) {
434
		destroySections();
435
		TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = (TeamOrPersonBaseDetailSection) formFactory
436
				.createCdmDetailSection(DetailType.TEAMORPERSONBASE,
437
						getConversationHolder(), parent, this, Section.TWISTIE
438
								| Section.EXPANDED);
439

    
440
		addPart(teamOrPersonBaseDetailSection);
441
	}
442

    
443
	private void createTeamDetailSection(RootElement parent) {
444
		destroySections();
445
		TeamDetailSection teamDetailSection = (TeamDetailSection) formFactory
446
				.createCdmDetailSection(DetailType.TEAM,
447
						getConversationHolder(), parent, this, Section.TWISTIE
448
								| Section.EXPANDED);
449

    
450
		addPart(teamDetailSection);
451
	}
452

    
453
	private void createPersonDetailSection(RootElement parent) {
454
		destroySections();
455
		PersonDetailSection personDetailSection = (PersonDetailSection) formFactory
456
				.createCdmDetailSection(DetailType.PERSON,
457
						getConversationHolder(), parent, this, Section.TWISTIE
458
								| Section.EXPANDED);
459
		addPart(personDetailSection);
460
	}
461

    
462
	private void createDescriptionElementSection(RootElement parent) {
463
		destroySections();
464

    
465
		DescriptionElementDetailSection descriptionElementDetailSection = (DescriptionElementDetailSection) formFactory
466
				.createCdmDetailSection(DetailType.DESCRIPTIONELEMENT,
467
						getConversationHolder(), parent, this, Section.TWISTIE
468
								| Section.EXPANDED);
469

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

    
472
		DescriptionElementSourceSection descriptionElementSourceSection = (DescriptionElementSourceSection) formFactory
473
				.createEntityDetailSection(
474
						EntityDetailType.DESCRIPTIONELEMENTSOURCE,
475
						getConversationHolder(), parent, Section.TWISTIE);
476

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

    
479
		DescriptionElementMediaSection descriptionElementMediaSection = (DescriptionElementMediaSection) formFactory
480
				.createEntityDetailSection(
481
						EntityDetailType.DESCRIPTIONELEMENTMEDIA,
482
						getConversationHolder(), parent, Section.TWISTIE);
483

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

    
486
		addPart(descriptionElementDetailSection);
487
		addPart(descriptionElementSourceSection);
488
		addPart(descriptionElementMediaSection);
489
	}
490

    
491
	private void createDescriptionSection(RootElement parent) {
492
		destroySections();
493
		DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
494
				.createCdmDetailSection(DetailType.DESCRIPTION,
495
						getConversationHolder(), parent, this, Section.TWISTIE
496
								| Section.EXPANDED);
497

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

    
500
		NaturalLanguageSection naturalLanguageSection = (NaturalLanguageSection) formFactory
501
				.createCdmDetailSection(DetailType.NATURAL_LANGUAGE,
502
						getConversationHolder(), parent, this, Section.TWISTIE
503
								| Section.EXPANDED);
504

    
505
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
506

    
507
		DescribedSpecimenSection describedSpecimenSection = (DescribedSpecimenSection) formFactory
508
				.createEntityDetailSection(EntityDetailType.DESCRIBED_SPECIMEN,
509
						getConversationHolder(), parent, Section.TWISTIE);
510

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

    
513
		DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
514
				.createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
515
						getConversationHolder(), parent, Section.TWISTIE);
516

    
517
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
518

    
519
		ScopeSection scopeSection = (ScopeSection) formFactory
520
				.createEntityDetailSection(EntityDetailType.SCOPE,
521
						getConversationHolder(), parent, Section.TWISTIE);
522

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

    
525
		addPart(descriptionDetailSection);
526
		addPart(naturalLanguageSection);
527
		addPart(describedSpecimenSection);
528
		addPart(descriptionSourceSection);
529
		addPart(scopeSection);
530
	}
531
	
532
	/**
533
	 * Creates the use Description section
534
	 * @param parent
535
	 */
536
	private void createUseDescriptionSection(RootElement parent) {
537
		destroySections();
538
		DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
539
				.createCdmDetailSection(DetailType.DESCRIPTION,
540
						getConversationHolder(), parent, this, Section.TWISTIE
541
								| Section.EXPANDED);
542

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

    
545
		DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
546
				.createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
547
						getConversationHolder(), parent, Section.TWISTIE
548
								| Section.EXPANDED);
549

    
550
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
551

    
552
		addPart(descriptionDetailSection);
553
		addPart(descriptionSourceSection);
554
		
555
	}
556

    
557

    
558
	/**
559
	 * @param rootElement
560
	 */
561
	private void createImageGallerySection(RootElement parent) {
562
		destroySections();
563
		DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
564
				.createCdmDetailSection(DetailType.DESCRIPTION,
565
						getConversationHolder(), parent, this, Section.TWISTIE
566
								| Section.EXPANDED);
567

    
568
		addPart(descriptionDetailSection);
569
	}
570

    
571
	private void createMediaElementSection(RootElement parent) {
572
		destroySections();
573
		MediaDetailsSection mediaDetailSection = (MediaDetailsSection) formFactory
574
				.createCdmDetailSection(DetailType.MEDIA,
575
						getConversationHolder(), parent, this, Section.TWISTIE
576
								| Section.EXPANDED);
577

    
578
		addPart(mediaDetailSection);
579
	}
580

    
581
	private void createDerivedUnitBaseElementSection(RootElement parent) {
582
		destroySections();
583

    
584
		GeneralDetailSection generalDetailSection = (GeneralDetailSection) formFactory
585
				.createCdmDetailSection(DetailType.DERIVED_UNIT_GENERAL,
586
						getConversationHolder(), parent, this, Section.TWISTIE
587
								| Section.EXPANDED);
588

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

    
591
		GatheringEventDetailSection gatheringEventDetailSection = (GatheringEventDetailSection) formFactory
592
				.createCdmDetailSection(DetailType.GATHERING_EVENT,
593
						getConversationHolder(), parent, this, Section.TWISTIE);
594

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

    
597
		FieldObservationDetailSection fieldObservationDetailSection = (FieldObservationDetailSection) formFactory
598
				.createCdmDetailSection(DetailType.FIELD_OBSERVATION,
599
						getConversationHolder(), parent, this, Section.TWISTIE);
600

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

    
603
		DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = (DerivedUnitBaseDetailSection) formFactory
604
				.createCdmDetailSection(DetailType.DERIVED_UNIT,
605
						getConversationHolder(), parent, this, Section.TWISTIE);
606

    
607
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
608

    
609
		DeterminationDetailSection determinationDetailSection = (DeterminationDetailSection) formFactory
610
				.createCdmDetailSection(DetailType.DETERMINATION,
611
						getConversationHolder(), parent, this, Section.TWISTIE);
612

    
613
		addPart(generalDetailSection);
614
		addPart(gatheringEventDetailSection);
615
		addPart(fieldObservationDetailSection);
616
		addPart(derivedUnitBaseDetailSection);
617
		addPart(determinationDetailSection);
618

    
619
	}
620

    
621
	/**
622
	 * @param rootElement
623
	 */
624
	private void createFeatureDistributionSection(RootElement parent) {
625
		destroySections();
626

    
627
		FeatureDistributionDetailSection featureDistributionSection = (FeatureDistributionDetailSection) formFactory
628
				.createCdmDetailSection(DetailType.FEATURE_DISTRIBUTION,
629
						getConversationHolder(), parent, this, Section.TWISTIE
630
								| Section.EXPANDED);
631

    
632
		addPart(featureDistributionSection);
633
	}
634

    
635
	private void createPolytomousKeySection(RootElement parent) {
636
		destroySections();
637

    
638
		PolytomousKeyDetailSection polytomousKeyDetailSection = (PolytomousKeyDetailSection) formFactory
639
				.createCdmDetailSection(DetailType.POLYTOMOUS_KEY,
640
						getConversationHolder(), parent, this, Section.TWISTIE
641
								| Section.EXPANDED);
642

    
643
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
644

    
645
		GeographicalScopeDetailSection geographicalScopeDetailSection = (GeographicalScopeDetailSection) formFactory
646
				.createEntityDetailSection(EntityDetailType.GEOGRAPHICAL_SCOPE,
647
						getConversationHolder(), parent, Section.TWISTIE);
648

    
649
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
650

    
651
		ScopeRestrictionSection scopeRestrictionSection = (ScopeRestrictionSection) formFactory
652
				.createEntityDetailSection(EntityDetailType.SCOPE_RESTRICTION,
653
						getConversationHolder(), parent, Section.TWISTIE);
654

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

    
657
		TaxonomicScopeSection taxonomicScopeSection = (TaxonomicScopeSection) formFactory
658
				.createEntityDetailSection(EntityDetailType.TAXONOMIC_SCOPE,
659
						getConversationHolder(), parent, Section.TWISTIE);
660

    
661
		addPart(polytomousKeyDetailSection);
662
		addPart(geographicalScopeDetailSection);
663
		addPart(scopeRestrictionSection);
664
		addPart(taxonomicScopeSection);
665
	}
666

    
667
	private void createPolytomousKeyNodeSection(RootElement parent) {
668
		destroySections();
669

    
670
		PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = (PolytomousKeyNodeDetailSection) formFactory
671
				.createCdmDetailSection(DetailType.POLYTOMOUS_KEY_NODE,
672
						getConversationHolder(), parent, this, Section.TWISTIE
673
								| Section.EXPANDED);
674

    
675
		addPart(polytomousKeyNodeDetailSection);
676
	}
677
	
678
	/**
679
	 * create the UseRecordSection
680
	 * @param parent
681
	 */
682
	private void createUseRecordSection(RootElement parent) {
683
		destroySections();
684

    
685
		UseRecordDetailSection descriptionUseRecordSection = (UseRecordDetailSection) formFactory
686
				.createCdmDetailSection(DetailType.USE_RECORD,
687
						getConversationHolder(), parent, this, Section.TWISTIE
688
								| Section.EXPANDED);
689

    
690
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
691
		
692
		addPart(descriptionUseRecordSection);
693
		
694
		
695
	}
696

    
697
	private void createUserSection(RootElement parent) {
698
		destroySections();
699

    
700
		UserDetailSection userDetailSection = (UserDetailSection) formFactory
701
				.createCdmDetailSection(DetailType.USER,
702
						getConversationHolder(), parent, this, Section.TWISTIE
703
								| Section.EXPANDED);
704

    
705
		GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) formFactory
706
				.createEntityDetailSection(EntityDetailType.GROUPS_BY_USER,
707
						getConversationHolder(), parent, Section.TWISTIE
708
								| Section.EXPANDED);
709

    
710
		addPart(userDetailSection);
711
		addPart(groupByUserDetailSection);
712
	}
713

    
714
	private void createTaxonRelationshipSection(RootElement parent) {
715
		destroySections();
716

    
717
		TaxonRelationshipDetailSection taxonRelationshipDetailSection = (TaxonRelationshipDetailSection) formFactory
718
				.createCdmDetailSection(DetailType.TAXON_RELATIONSHIP,
719
						getConversationHolder(), parent, this, Section.TWISTIE
720
								| Section.EXPANDED);
721

    
722
		ReferencedEntityDetailSection referencedEntityBaseDetailSection = (ReferencedEntityDetailSection) formFactory
723
				.createCdmDetailSection(DetailType.REFERENCED_ENTITY,
724
						getConversationHolder(), parent, this, Section.TWISTIE
725
								| Section.EXPANDED);
726
		addPart(taxonRelationshipDetailSection);
727
		addPart(referencedEntityBaseDetailSection);
728
	}
729

    
730
	/**
731
	 * @param rootElement
732
	 */
733
	private void createTermVocabularySection(RootElement parent) {
734
		destroySections();
735

    
736
		TermVocabularyDetailSection termVocabularyDetailSection = (TermVocabularyDetailSection) formFactory
737
				.createCdmDetailSection(DetailType.TERM_VOCABULARY,
738
						getConversationHolder(), parent, this, Section.TWISTIE
739
								| Section.EXPANDED);
740
		addPart(termVocabularyDetailSection);
741
	}
742

    
743
	private void createDefinedTermSection(RootElement parent) {
744
		destroySections();
745

    
746
		AbstractFormSection definedTermDetailSection = formFactory
747
				.createDefinedTermDetailSection(getInput().getClass(),
748
						getConversationHolder(), parent, this, Section.TWISTIE
749
								| Section.EXPANDED);
750
		addPart(definedTermDetailSection);
751
	}
752
}
(3-3/3)