Project

General

Profile

Download (27.5 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.DescriptionBase;
35
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
36
import eu.etaxonomy.cdm.model.description.PolytomousKey;
37
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
38
import eu.etaxonomy.cdm.model.media.Media;
39
import eu.etaxonomy.cdm.model.name.NonViralName;
40
import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
41
import eu.etaxonomy.cdm.model.reference.Reference;
42
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
43
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
44
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
45
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
46
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
47
import eu.etaxonomy.taxeditor.store.CdmStore;
48
import eu.etaxonomy.taxeditor.store.StoreUtil;
49
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
50
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType;
51
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType;
52
import eu.etaxonomy.taxeditor.ui.element.RootElement;
53
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
54
import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
55
import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
56
import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
57
import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
58
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
59
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
60
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
61
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
62
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
63
import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
64
import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
65
import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
66
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
67
import eu.etaxonomy.taxeditor.ui.section.group.GrantedAuthorityDetailSection;
68
import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
69
import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
70
import eu.etaxonomy.taxeditor.ui.section.key.GeographicalScopeDetailSection;
71
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
72
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
73
import eu.etaxonomy.taxeditor.ui.section.key.ScopeRestrictionSection;
74
import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
75
import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
76
import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
77
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
78
import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
79
import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
80
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
81
import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
82
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationDetailSection;
83
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
84
import eu.etaxonomy.taxeditor.ui.section.occurrence.GeneralDetailSection;
85
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
86
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
87
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
88
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
89
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
90
import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
91
import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
92
import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
93
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
94
import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
95
import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
96

    
97
/**
98
 * <p>
99
 * DetailsViewer class.
100
 * </p>
101
 * 
102
 * @author n.hoffmann
103
 * @created Feb 12, 2010
104
 * @version 1.0
105
 */
106
public class DetailsViewer extends AbstractCdmDataViewer {
107

    
108
	private ISelection selection;
109

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

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

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

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

    
157
		super.markViewPartDirty();
158
	}
159

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

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

    
173
		} else if (getInput() instanceof NonViralName) {
174
			createNameSections(rootElement);
175

    
176
		} else if (getInput() instanceof Reference) {
177
			createReferenceSections(rootElement);
178

    
179
		} else if (getInput() instanceof Team) {
180
			createTeamDetailSection(rootElement);
181

    
182
		} else if (getInput() instanceof Person) {
183
			createPersonDetailSection(rootElement);
184

    
185
		} else if (getInput() instanceof TeamOrPersonBase) {
186
			createTeamOrPersonBaseDetailSection(rootElement);
187

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

    
200
			} else if (isUseDescription) { 
201
				createUseDescriptionSection(rootElement);
202
			} else {
203
				createDescriptionSection(rootElement);
204

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

    
223
		} else if (getInput() instanceof Media) {
224
			createMediaElementSection(rootElement);
225

    
226
		} else if (getInput() instanceof DerivedUnitFacade) {
227
			createDerivedUnitBaseElementSection(rootElement);
228

    
229
		} else if (getInput() instanceof FeatureNodeContainer) {
230
			createFeatureDistributionSection(rootElement);
231

    
232
		} else if (getInput() instanceof PolytomousKey) {
233
			createPolytomousKeySection(rootElement);
234

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

    
239
		} else if (getInput() instanceof User) {
240
			createUserSection(rootElement);
241

    
242
		} else if (getInput() instanceof Group) {
243
			createGroupSection(rootElement);
244

    
245
		} else if (getInput() instanceof TaxonRelationship) {
246
			createTaxonRelationshipSection(rootElement);
247

    
248
		} else if (getInput() instanceof TermVocabulary) {
249
			createTermVocabularySection(rootElement);
250

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

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

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

    
279
		addPart(groupDetailSection);
280
		addPart(memberDetailSection);
281
		addPart(grantedAuthorityDetailSection);
282
	}
283

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

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

    
311
	private void createTaxonSections(RootElement parent) {
312
		destroySections();
313

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
404
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
405

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

    
410
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
411

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

    
420
	private void createReferenceSections(RootElement parent) {
421
		destroySections();
422

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

    
428
		addPart(referenceDetailSection);
429
	}
430

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

    
438
		addPart(teamOrPersonBaseDetailSection);
439
	}
440

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

    
448
		addPart(teamDetailSection);
449
	}
450

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

    
460
	private void createDescriptionElementSection(RootElement parent) {
461
		destroySections();
462

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

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

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

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

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

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

    
484
		addPart(descriptionElementDetailSection);
485
		addPart(descriptionElementSourceSection);
486
		addPart(descriptionElementMediaSection);
487
	}
488

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

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

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

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

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

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

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

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

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

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

    
523
		addPart(descriptionDetailSection);
524
		addPart(naturalLanguageSection);
525
		addPart(describedSpecimenSection);
526
		addPart(descriptionSourceSection);
527
		addPart(scopeSection);
528
	}
529
	
530
	private void createUseDescriptionSection(RootElement parent) {
531
		destroySections();
532
		DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
533
				.createCdmDetailSection(DetailType.DESCRIPTION,
534
						getConversationHolder(), parent, this, Section.TWISTIE
535
								| Section.EXPANDED);
536

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

    
539
		DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
540
				.createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
541
						getConversationHolder(), parent, Section.TWISTIE
542
								| Section.EXPANDED);
543

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

    
546
		addPart(descriptionDetailSection);
547
		addPart(descriptionSourceSection);
548
		
549
	}
550

    
551

    
552
	/**
553
	 * @param rootElement
554
	 */
555
	private void createImageGallerySection(RootElement parent) {
556
		destroySections();
557
		DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
558
				.createCdmDetailSection(DetailType.DESCRIPTION,
559
						getConversationHolder(), parent, this, Section.TWISTIE
560
								| Section.EXPANDED);
561

    
562
		addPart(descriptionDetailSection);
563
	}
564

    
565
	private void createMediaElementSection(RootElement parent) {
566
		destroySections();
567
		MediaDetailsSection mediaDetailSection = (MediaDetailsSection) formFactory
568
				.createCdmDetailSection(DetailType.MEDIA,
569
						getConversationHolder(), parent, this, Section.TWISTIE
570
								| Section.EXPANDED);
571

    
572
		addPart(mediaDetailSection);
573
	}
574

    
575
	private void createDerivedUnitBaseElementSection(RootElement parent) {
576
		destroySections();
577

    
578
		GeneralDetailSection generalDetailSection = (GeneralDetailSection) formFactory
579
				.createCdmDetailSection(DetailType.DERIVED_UNIT_GENERAL,
580
						getConversationHolder(), parent, this, Section.TWISTIE
581
								| Section.EXPANDED);
582

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

    
585
		GatheringEventDetailSection gatheringEventDetailSection = (GatheringEventDetailSection) formFactory
586
				.createCdmDetailSection(DetailType.GATHERING_EVENT,
587
						getConversationHolder(), parent, this, Section.TWISTIE);
588

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

    
591
		FieldObservationDetailSection fieldObservationDetailSection = (FieldObservationDetailSection) formFactory
592
				.createCdmDetailSection(DetailType.FIELD_OBSERVATION,
593
						getConversationHolder(), parent, this, Section.TWISTIE);
594

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

    
597
		DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = (DerivedUnitBaseDetailSection) formFactory
598
				.createCdmDetailSection(DetailType.DERIVED_UNIT,
599
						getConversationHolder(), parent, this, Section.TWISTIE);
600

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

    
603
		DeterminationDetailSection determinationDetailSection = (DeterminationDetailSection) formFactory
604
				.createCdmDetailSection(DetailType.DETERMINATION,
605
						getConversationHolder(), parent, this, Section.TWISTIE);
606

    
607
		addPart(generalDetailSection);
608
		addPart(gatheringEventDetailSection);
609
		addPart(fieldObservationDetailSection);
610
		addPart(derivedUnitBaseDetailSection);
611
		addPart(determinationDetailSection);
612

    
613
	}
614

    
615
	/**
616
	 * @param rootElement
617
	 */
618
	private void createFeatureDistributionSection(RootElement parent) {
619
		destroySections();
620

    
621
		FeatureDistributionDetailSection featureDistributionSection = (FeatureDistributionDetailSection) formFactory
622
				.createCdmDetailSection(DetailType.FEATURE_DISTRIBUTION,
623
						getConversationHolder(), parent, this, Section.TWISTIE
624
								| Section.EXPANDED);
625

    
626
		addPart(featureDistributionSection);
627
	}
628

    
629
	private void createPolytomousKeySection(RootElement parent) {
630
		destroySections();
631

    
632
		PolytomousKeyDetailSection polytomousKeyDetailSection = (PolytomousKeyDetailSection) formFactory
633
				.createCdmDetailSection(DetailType.POLYTOMOUS_KEY,
634
						getConversationHolder(), parent, this, Section.TWISTIE
635
								| Section.EXPANDED);
636

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

    
639
		GeographicalScopeDetailSection geographicalScopeDetailSection = (GeographicalScopeDetailSection) formFactory
640
				.createEntityDetailSection(EntityDetailType.GEOGRAPHICAL_SCOPE,
641
						getConversationHolder(), parent, Section.TWISTIE);
642

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

    
645
		ScopeRestrictionSection scopeRestrictionSection = (ScopeRestrictionSection) formFactory
646
				.createEntityDetailSection(EntityDetailType.SCOPE_RESTRICTION,
647
						getConversationHolder(), parent, Section.TWISTIE);
648

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

    
651
		TaxonomicScopeSection taxonomicScopeSection = (TaxonomicScopeSection) formFactory
652
				.createEntityDetailSection(EntityDetailType.TAXONOMIC_SCOPE,
653
						getConversationHolder(), parent, Section.TWISTIE);
654

    
655
		addPart(polytomousKeyDetailSection);
656
		addPart(geographicalScopeDetailSection);
657
		addPart(scopeRestrictionSection);
658
		addPart(taxonomicScopeSection);
659
	}
660

    
661
	private void createPolytomousKeyNodeSection(RootElement parent) {
662
		destroySections();
663

    
664
		PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = (PolytomousKeyNodeDetailSection) formFactory
665
				.createCdmDetailSection(DetailType.POLYTOMOUS_KEY_NODE,
666
						getConversationHolder(), parent, this, Section.TWISTIE
667
								| Section.EXPANDED);
668

    
669
		addPart(polytomousKeyNodeDetailSection);
670
	}
671
	
672
	private void createUseRecordSection(RootElement parent) {
673
		destroySections();
674

    
675
		UseRecordDetailSection descriptionUseRecordSection = (UseRecordDetailSection) formFactory
676
				.createCdmDetailSection(DetailType.USE_RECORD,
677
						getConversationHolder(), parent, this, Section.TWISTIE
678
								| Section.EXPANDED);
679

    
680
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
681
		
682
		addPart(descriptionUseRecordSection);
683
		
684
		
685
	}
686

    
687
	private void createUserSection(RootElement parent) {
688
		destroySections();
689

    
690
		UserDetailSection userDetailSection = (UserDetailSection) formFactory
691
				.createCdmDetailSection(DetailType.USER,
692
						getConversationHolder(), parent, this, Section.TWISTIE
693
								| Section.EXPANDED);
694

    
695
		GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) formFactory
696
				.createEntityDetailSection(EntityDetailType.GROUPS_BY_USER,
697
						getConversationHolder(), parent, Section.TWISTIE
698
								| Section.EXPANDED);
699

    
700
		addPart(userDetailSection);
701
		addPart(groupByUserDetailSection);
702
	}
703

    
704
	private void createTaxonRelationshipSection(RootElement parent) {
705
		destroySections();
706

    
707
		TaxonRelationshipDetailSection taxonRelationshipDetailSection = (TaxonRelationshipDetailSection) formFactory
708
				.createCdmDetailSection(DetailType.TAXON_RELATIONSHIP,
709
						getConversationHolder(), parent, this, Section.TWISTIE
710
								| Section.EXPANDED);
711

    
712
		ReferencedEntityDetailSection referencedEntityBaseDetailSection = (ReferencedEntityDetailSection) formFactory
713
				.createCdmDetailSection(DetailType.REFERENCED_ENTITY,
714
						getConversationHolder(), parent, this, Section.TWISTIE
715
								| Section.EXPANDED);
716
		addPart(taxonRelationshipDetailSection);
717
		addPart(referencedEntityBaseDetailSection);
718
	}
719

    
720
	/**
721
	 * @param rootElement
722
	 */
723
	private void createTermVocabularySection(RootElement parent) {
724
		destroySections();
725

    
726
		TermVocabularyDetailSection termVocabularyDetailSection = (TermVocabularyDetailSection) formFactory
727
				.createCdmDetailSection(DetailType.TERM_VOCABULARY,
728
						getConversationHolder(), parent, this, Section.TWISTIE
729
								| Section.EXPANDED);
730
		addPart(termVocabularyDetailSection);
731
	}
732

    
733
	private void createDefinedTermSection(RootElement parent) {
734
		destroySections();
735

    
736
		AbstractFormSection definedTermDetailSection = formFactory
737
				.createDefinedTermDetailSection(getInput().getClass(),
738
						getConversationHolder(), parent, this, Section.TWISTIE
739
								| Section.EXPANDED);
740
		addPart(definedTermDetailSection);
741
	}
742
}
(3-3/3)