Project

General

Profile

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

    
85
/**
86
 * <p>
87
 * DetailsViewer class.
88
 * </p>
89
 * 
90
 * @author n.hoffmann
91
 * @created Feb 12, 2010
92
 * @version 1.0
93
 */
94
public class DetailsViewer extends AbstractCdmDataViewer {
95

    
96
	private enum VIEW_PART {
97
		TAXON, 
98
		NAME, 
99
		REFEERENCE, 
100
		TEAM, 
101
		PERSON, 
102
		DESCRIPTION, 
103
		DESCRIPTION_ELEMENT, 
104
		EMPTY, 
105
		IMAGE_GALLERY, 
106
		MEDIA, 
107
		TEAM_OR_PERSON_BASE, 
108
		DERIVED_UNIT, 
109
		FEATURE_DISTRIBUTION, 
110
		POLYTOMOUS_KEY, 
111
		POLYTOMOUS_KEY_NODE, 
112
		USER, 
113
		GROUP,
114
		TAXON_RELATIONSHIP
115
	}
116

    
117
	private VIEW_PART currentViewPart;
118

    
119
	private ISelection selection;
120

    
121
	/**
122
	 * <p>
123
	 * Constructor for DetailsViewer.
124
	 * </p>
125
	 * 
126
	 * @param parent
127
	 *            a {@link org.eclipse.swt.widgets.Composite} object.
128
	 * @param viewPart
129
	 *            a {@link eu.etaxonomy.taxeditor.view.AbstractCdmViewPart}
130
	 *            object.
131
	 */
132
	public DetailsViewer(Composite parent, AbstractCdmViewPart viewPart) {
133
		super(parent, viewPart);
134
	}
135

    
136
	// START HACK TO MAKE THE DERIVED UNIT FACADE WORK
137
	// since we are getting implementations of DerivedUnitBase from the bulk
138
	// editor
139
	// and not derived unit facade objects,
140

    
141
	/*
142
	 * (non-Javadoc)
143
	 * 
144
	 * @see
145
	 * eu.etaxonomy.taxeditor.editor.view.AbstractCdmDataViewer#setInput(java
146
	 * .lang.Object)
147
	 */
148
	@Override
149
	public void setInput(Object input) {
150
		if (input instanceof DerivedUnitBase) {
151
			try {
152
				input = DerivedUnitFacade.NewInstance((DerivedUnitBase) input,
153
						PreferencesUtil.getDerivedUnitConfigurator());
154
			} catch (DerivedUnitFacadeNotSupportedException e) {
155
				StoreUtil.error(getClass(), e);
156
			}
157
		}
158
		super.setInput(input);
159
	}
160

    
161
	@Override
162
	protected void markViewPartDirty() {
163
		if (getInput() instanceof DerivedUnitFacade) {
164
			getViewPart().changed(
165
					((DerivedUnitFacade) getInput()).innerDerivedUnit());
166
		}
167

    
168
		super.markViewPartDirty();
169
	}
170

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

    
173
	/*
174
	 * (non-Javadoc)
175
	 * 
176
	 * @see org.eclipse.jface.viewers.Viewer#refresh()
177
	 */
178
	/** {@inheritDoc} */
179
	@Override
180
	protected void showParts() {
181
		if (getInput() instanceof TaxonBase) {
182
			if (currentViewPart != VIEW_PART.TAXON) {
183
				createTaxonSections(rootElement);
184
				currentViewPart = VIEW_PART.TAXON;
185
			}
186
		} else if (getInput() instanceof NonViralName) {
187
			if (currentViewPart != VIEW_PART.NAME) {
188
				createNameSections(rootElement);
189
				currentViewPart = VIEW_PART.NAME;
190
			}
191
		} else if (getInput() instanceof Reference) {
192
			if (currentViewPart != VIEW_PART.REFEERENCE) {
193
				createReferenceSections(rootElement);
194
				currentViewPart = VIEW_PART.REFEERENCE;
195
			}
196
		} else if (getInput() instanceof Team) {
197
			if (currentViewPart != VIEW_PART.TEAM) {
198
				createTeamDetailSection(rootElement);
199
				currentViewPart = VIEW_PART.TEAM;
200
			}
201
		} else if (getInput() instanceof Person) {
202
			if (currentViewPart != VIEW_PART.PERSON) {
203
				createPersonDetailSection(rootElement);
204
				currentViewPart = VIEW_PART.PERSON;
205
			}
206
		} else if (getInput() instanceof TeamOrPersonBase) {
207
			// fallback
208
			if (currentViewPart != VIEW_PART.TEAM_OR_PERSON_BASE) {
209
				createTeamOrPersonBaseDetailSection(rootElement);
210
				currentViewPart = VIEW_PART.TEAM_OR_PERSON_BASE;
211
			}
212
		} else if (getInput() instanceof DescriptionBase) {
213
			if (((DescriptionBase) getInput()).isImageGallery()) {
214
				if (currentViewPart != VIEW_PART.IMAGE_GALLERY) {
215
					createImageGallerySection(rootElement);
216
					currentViewPart = VIEW_PART.IMAGE_GALLERY;
217
				}
218
			} else {
219
				if (currentViewPart != VIEW_PART.DESCRIPTION) {
220
					createDescriptionSection(rootElement);
221
					currentViewPart = VIEW_PART.DESCRIPTION;
222
				}
223
			}
224
		} else if (getInput() instanceof DescriptionElementBase) {
225
			if (currentViewPart != VIEW_PART.DESCRIPTION_ELEMENT) {
226
				createDescriptionElementSection(rootElement);
227
				currentViewPart = VIEW_PART.DESCRIPTION_ELEMENT;
228
			}
229
		} else if (getInput() instanceof Media) {
230
			if (currentViewPart != VIEW_PART.MEDIA) {
231
				createMediaElementSection(rootElement);
232
				currentViewPart = VIEW_PART.MEDIA;
233
			}
234
		} else if (getInput() instanceof DerivedUnitFacade) {
235
			if (currentViewPart != VIEW_PART.DERIVED_UNIT) {
236
				createDerivedUnitBaseElementSection(rootElement);
237
				currentViewPart = VIEW_PART.DERIVED_UNIT;
238
			}
239
		} else if (getInput() instanceof FeatureNodeContainer) {
240
			if (currentViewPart != VIEW_PART.FEATURE_DISTRIBUTION) {
241
				createFeatureDistributionSection(rootElement);
242
				currentViewPart = VIEW_PART.FEATURE_DISTRIBUTION;
243
			}
244
		} else if (getInput() instanceof PolytomousKey) {
245
			if (currentViewPart != VIEW_PART.POLYTOMOUS_KEY) {
246
				createPolytomousKeySection(rootElement);
247
				currentViewPart = VIEW_PART.POLYTOMOUS_KEY;
248
			}
249
		} else if ((getInput() instanceof PolytomousKeyNode)
250
				|| (getInput() instanceof PolytomousKeyRelationship)) {
251
			if (currentViewPart != VIEW_PART.POLYTOMOUS_KEY_NODE) {
252
				createPolytomousKeyNodeSection(rootElement);
253
				currentViewPart = VIEW_PART.POLYTOMOUS_KEY_NODE;
254
			}
255
		} else if (getInput() instanceof User) {
256
			if (currentViewPart != VIEW_PART.USER) {
257
				createUserSection(rootElement);
258
				currentViewPart = VIEW_PART.USER;
259
			}
260
		} else if (getInput() instanceof Group) {
261
			if (currentViewPart != VIEW_PART.GROUP) {
262
				createGroupSection(rootElement);
263
				currentViewPart = VIEW_PART.GROUP;
264
			}
265
		} else if (getInput() instanceof TaxonRelationship) {
266
			if (currentViewPart != VIEW_PART.TAXON_RELATIONSHIP) {
267
				createTaxonRelationshipSection(rootElement);
268
				currentViewPart = VIEW_PART.TAXON_RELATIONSHIP;
269
			}
270
		} else {
271
			destroySections();
272
			currentViewPart = VIEW_PART.EMPTY;
273
		}
274

    
275
		layout();
276
	}
277

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

    
284
		GroupDetailSection groupDetailSection = (GroupDetailSection) formFactory
285
				.createCdmDetailSection(DetailType.GROUP,
286
						getConversationHolder(), parent, this, Section.TWISTIE
287
								| Section.EXPANDED);
288
		MemberDetailSection memberDetailSection = (MemberDetailSection) formFactory
289
				.createEntityDetailSection(EntityDetailType.MEMBER,
290
						getConversationHolder(), parent, Section.TWISTIE
291
								| Section.EXPANDED);
292
		GrantedAuthorityDetailSection grantedAuthorityDetailSection = (GrantedAuthorityDetailSection) formFactory
293
				.createEntityDetailSection(EntityDetailType.GRANTED_AUTHORITY,
294
						getConversationHolder(), parent, Section.TWISTIE
295
								| Section.EXPANDED);
296

    
297
		addPart(groupDetailSection);
298
		addPart(memberDetailSection);
299
		addPart(grantedAuthorityDetailSection);
300
	}
301

    
302
	/*
303
	 * (non-Javadoc)
304
	 * 
305
	 * @see org.eclipse.jface.viewers.Viewer#getSelection()
306
	 */
307
	/** {@inheritDoc} */
308
	@Override
309
	public ISelection getSelection() {
310
		return selection;
311
	}
312

    
313
	/*
314
	 * (non-Javadoc)
315
	 * 
316
	 * @see
317
	 * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
318
	 * .ISelection, boolean)
319
	 */
320
	/** {@inheritDoc} */
321
	@Override
322
	public void setSelection(ISelection selection, boolean reveal) {
323
		this.selection = selection;
324
		SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(
325
				this, selection);
326
		fireSelectionChanged(selectionChangedEvent);
327
	}
328

    
329
	private void createTaxonSections(RootElement parent) {
330
		destroySections();
331

    
332
		TaxonBaseDetailSection taxonBaseDetailSection = (TaxonBaseDetailSection) formFactory
333
				.createCdmDetailSection(DetailType.TAXONBASE,
334
						getConversationHolder(), parent, this, Section.TWISTIE);
335

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

    
338
		NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
339
				.createCdmDetailSection(DetailType.NONVIRALNAME,
340
						getConversationHolder(), parent, this, Section.TWISTIE
341
								| Section.EXPANDED);
342

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

    
345
		NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
346
				.createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
347
						getConversationHolder(), parent, this, Section.TWISTIE);
348

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

    
351
		NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
352
				.createEntityDetailSection(
353
						EntityDetailType.NOMENCLATURALSTATUS,
354
						getConversationHolder(), parent, Section.TWISTIE);
355

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

    
358
		ProtologueSection protologSection = (ProtologueSection) formFactory
359
				.createEntityDetailSection(EntityDetailType.PROTOLOG,
360
						getConversationHolder(), parent, Section.TWISTIE);
361

    
362
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
363

    
364
		TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
365
				.createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
366
						getConversationHolder(), parent, Section.TWISTIE);
367

    
368
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
369

    
370
		NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
371
				.createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
372
						getConversationHolder(), parent, Section.TWISTIE);
373

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

    
376
		ParsingMessagesSection parsingMessagesSection = (ParsingMessagesSection) formFactory
377
				.createCdmDetailSection(DetailType.PARSINGMESSAGE,
378
						getConversationHolder(), parent, this, Section.EXPANDED);
379

    
380
		addPart(taxonBaseDetailSection);
381
		addPart(nonViralNameSection);
382
		addPart(nomenclaturalStatusSection);
383
		addPart(protologSection);
384
		addPart(referenceDetailSection);
385
		addPart(typeDesignationSection);
386
		addPart(nameRelationshipSection);
387
		addPart(parsingMessagesSection);
388
	}
389

    
390
	private void createNameSections(RootElement parent) {
391
		destroySections();
392
		NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
393
				.createCdmDetailSection(DetailType.NONVIRALNAME,
394
						getConversationHolder(), parent, this, Section.TWISTIE
395
								| Section.EXPANDED);
396

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

    
399
		NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
400
				.createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
401
						getConversationHolder(), parent, this, Section.TWISTIE);
402

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

    
405
		NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
406
				.createEntityDetailSection(
407
						EntityDetailType.NOMENCLATURALSTATUS,
408
						getConversationHolder(), parent, Section.TWISTIE);
409

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

    
412
		ProtologueSection protologSection = (ProtologueSection) formFactory
413
				.createEntityDetailSection(EntityDetailType.PROTOLOG,
414
						getConversationHolder(), parent, Section.TWISTIE);
415

    
416
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
417

    
418
		TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
419
				.createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
420
						getConversationHolder(), parent, Section.TWISTIE);
421

    
422
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
423

    
424
		NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
425
				.createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
426
						getConversationHolder(), parent, Section.TWISTIE);
427

    
428
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
429

    
430
		addPart(nonViralNameSection);
431
		addPart(nomenclaturalStatusSection);
432
		addPart(protologSection);
433
		addPart(referenceDetailSection);
434
		addPart(typeDesignationSection);
435
		addPart(nameRelationshipSection);
436
	}
437

    
438
	private void createReferenceSections(RootElement parent) {
439
		destroySections();
440

    
441
		ReferenceDetailSection referenceDetailSection = (ReferenceDetailSection) formFactory
442
				.createCdmDetailSection(DetailType.REFERENCEBASE,
443
						getConversationHolder(), parent, this, Section.TWISTIE
444
								| Section.EXPANDED);
445

    
446
		addPart(referenceDetailSection);
447
	}
448

    
449
	private void createTeamOrPersonBaseDetailSection(RootElement parent) {
450
		destroySections();
451
		TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = (TeamOrPersonBaseDetailSection) formFactory
452
				.createCdmDetailSection(DetailType.TEAMORPERSONBASE,
453
						getConversationHolder(), parent, this, Section.TWISTIE
454
								| Section.EXPANDED);
455

    
456
		addPart(teamOrPersonBaseDetailSection);
457
	}
458

    
459
	private void createTeamDetailSection(RootElement parent) {
460
		destroySections();
461
		TeamDetailSection teamDetailSection = (TeamDetailSection) formFactory
462
				.createCdmDetailSection(DetailType.TEAM,
463
						getConversationHolder(), parent, this, Section.TWISTIE
464
								| Section.EXPANDED);
465

    
466
		addPart(teamDetailSection);
467
	}
468

    
469
	private void createPersonDetailSection(RootElement parent) {
470
		destroySections();
471
		PersonDetailSection personDetailSection = (PersonDetailSection) formFactory
472
				.createCdmDetailSection(DetailType.PERSON,
473
						getConversationHolder(), parent, this, Section.TWISTIE
474
								| Section.EXPANDED);
475
		addPart(personDetailSection);
476
	}
477

    
478
	private void createDescriptionElementSection(RootElement parent) {
479
		destroySections();
480

    
481
		DescriptionElementDetailSection descriptionElementDetailSection = (DescriptionElementDetailSection) formFactory
482
				.createCdmDetailSection(DetailType.DESCRIPTIONELEMENT,
483
						getConversationHolder(), parent, this, Section.TWISTIE
484
								| Section.EXPANDED);
485

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

    
488
		DescriptionElementSourceSection descriptionElementSourceSection = (DescriptionElementSourceSection) formFactory
489
				.createEntityDetailSection(
490
						EntityDetailType.DESCRIPTIONELEMENTSOURCE,
491
						getConversationHolder(), parent, Section.TWISTIE);
492

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

    
495
		DescriptionElementMediaSection descriptionElementMediaSection = (DescriptionElementMediaSection) formFactory
496
				.createEntityDetailSection(
497
						EntityDetailType.DESCRIPTIONELEMENTMEDIA,
498
						getConversationHolder(), parent, Section.TWISTIE);
499

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

    
502
		addPart(descriptionElementDetailSection);
503
		addPart(descriptionElementSourceSection);
504
		addPart(descriptionElementMediaSection);
505
	}
506

    
507
	private void createDescriptionSection(RootElement parent) {
508
		destroySections();
509
		DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
510
				.createCdmDetailSection(DetailType.DESCRIPTION,
511
						getConversationHolder(), parent, this, Section.TWISTIE
512
								| Section.EXPANDED);
513

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

    
516
		NaturalLanguageSection naturalLanguageSection = (NaturalLanguageSection) formFactory
517
				.createCdmDetailSection(DetailType.NATURAL_LANGUAGE,
518
						getConversationHolder(), parent, this, Section.TWISTIE
519
								| Section.EXPANDED);
520

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

    
523
		DescribedSpecimenSection describedSpecimenSection = (DescribedSpecimenSection) formFactory
524
				.createEntityDetailSection(EntityDetailType.DESCRIBED_SPECIMEN,
525
						getConversationHolder(), parent, Section.TWISTIE);
526

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

    
529
		DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
530
				.createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
531
						getConversationHolder(), parent, Section.TWISTIE);
532

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

    
535
		ScopeSection scopeSection = (ScopeSection) formFactory
536
				.createEntityDetailSection(EntityDetailType.SCOPE,
537
						getConversationHolder(), parent, Section.TWISTIE);
538

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

    
541
		addPart(descriptionDetailSection);
542
		addPart(naturalLanguageSection);
543
		addPart(describedSpecimenSection);
544
		addPart(descriptionSourceSection);
545
		addPart(scopeSection);
546
	}
547

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

    
558
		addPart(descriptionDetailSection);
559
	}
560

    
561
	private void createMediaElementSection(RootElement parent) {
562
		destroySections();
563
		MediaDetailsSection mediaDetailSection = (MediaDetailsSection) formFactory
564
				.createCdmDetailSection(DetailType.MEDIA,
565
						getConversationHolder(), parent, this, Section.TWISTIE
566
								| Section.EXPANDED);
567

    
568
		addPart(mediaDetailSection);
569
	}
570

    
571
	private void createDerivedUnitBaseElementSection(RootElement parent) {
572
		destroySections();
573

    
574
		GeneralDetailSection generalDetailSection = (GeneralDetailSection) formFactory
575
				.createCdmDetailSection(DetailType.DERIVED_UNIT_GENERAL,
576
						getConversationHolder(), parent, this, Section.TWISTIE
577
								| Section.EXPANDED);
578

    
579
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
580

    
581
		GatheringEventDetailSection gatheringEventDetailSection = (GatheringEventDetailSection) formFactory
582
				.createCdmDetailSection(DetailType.GATHERING_EVENT,
583
						getConversationHolder(), parent, this, Section.TWISTIE);
584

    
585
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
586

    
587
		FieldObservationDetailSection fieldObservationDetailSection = (FieldObservationDetailSection) formFactory
588
				.createCdmDetailSection(DetailType.FIELD_OBSERVATION,
589
						getConversationHolder(), parent, this, Section.TWISTIE);
590

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

    
593
		DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = (DerivedUnitBaseDetailSection) formFactory
594
				.createCdmDetailSection(DetailType.DERIVED_UNIT,
595
						getConversationHolder(), parent, this, Section.TWISTIE);
596

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

    
600
		DeterminationDetailSection determinationDetailSection = (DeterminationDetailSection) formFactory
601
				.createCdmDetailSection(DetailType.DETERMINATION,
602
						getConversationHolder(), parent, this, Section.TWISTIE);
603

    
604
		addPart(generalDetailSection);
605
		addPart(gatheringEventDetailSection);
606
		addPart(fieldObservationDetailSection);
607
		addPart(derivedUnitBaseDetailSection);
608
		addPart(determinationDetailSection);
609

    
610
	}
611

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

    
618
		FeatureDistributionDetailSection featureDistributionSection = (FeatureDistributionDetailSection) formFactory
619
				.createCdmDetailSection(DetailType.FEATURE_DISTRIBUTION,
620
						getConversationHolder(), parent, this, Section.TWISTIE
621
								| Section.EXPANDED);
622

    
623
		addPart(featureDistributionSection);
624
	}
625

    
626
	private void createPolytomousKeySection(RootElement parent) {
627
		destroySections();
628

    
629
		PolytomousKeyDetailSection polytomousKeyDetailSection = (PolytomousKeyDetailSection) formFactory
630
				.createCdmDetailSection(DetailType.POLYTOMOUS_KEY,
631
						getConversationHolder(), parent, this, Section.TWISTIE
632
								| Section.EXPANDED);
633

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

    
636
		GeographicalScopeDetailSection geographicalScopeDetailSection = (GeographicalScopeDetailSection) formFactory
637
				.createEntityDetailSection(EntityDetailType.GEOGRAPHICAL_SCOPE,
638
						getConversationHolder(), parent, Section.TWISTIE);
639

    
640
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
641

    
642
		ScopeRestrictionSection scopeRestrictionSection = (ScopeRestrictionSection) formFactory
643
				.createEntityDetailSection(EntityDetailType.SCOPE_RESTRICTION,
644
						getConversationHolder(), parent, Section.TWISTIE);
645

    
646
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
647

    
648
		TaxonomicScopeSection taxonomicScopeSection = (TaxonomicScopeSection) formFactory
649
				.createEntityDetailSection(EntityDetailType.TAXONOMIC_SCOPE,
650
						getConversationHolder(), parent, Section.TWISTIE);
651

    
652
		addPart(polytomousKeyDetailSection);
653
		addPart(geographicalScopeDetailSection);
654
		addPart(scopeRestrictionSection);
655
		addPart(taxonomicScopeSection);
656
	}
657

    
658
	private void createPolytomousKeyNodeSection(RootElement parent) {
659
		destroySections();
660

    
661
		PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = (PolytomousKeyNodeDetailSection) formFactory
662
				.createCdmDetailSection(DetailType.POLYTOMOUS_KEY_NODE,
663
						getConversationHolder(), parent, this, Section.TWISTIE
664
								| Section.EXPANDED);
665

    
666
		addPart(polytomousKeyNodeDetailSection);
667
	}
668

    
669
	private void createUserSection(RootElement parent) {
670
		destroySections();
671

    
672
		UserDetailSection userDetailSection = (UserDetailSection) formFactory
673
				.createCdmDetailSection(DetailType.USER,
674
						getConversationHolder(), parent, this, Section.TWISTIE
675
								| Section.EXPANDED);
676

    
677
		GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) formFactory
678
				.createEntityDetailSection(EntityDetailType.GROUPS_BY_USER,
679
						getConversationHolder(), parent, Section.TWISTIE
680
								| Section.EXPANDED);
681

    
682
		addPart(userDetailSection);
683
		addPart(groupByUserDetailSection);
684
	}
685
	
686
	private void createTaxonRelationshipSection(RootElement parent){
687
		destroySections();
688
		
689
		TaxonRelationshipDetailSection taxonRelationshipDetailSection = (TaxonRelationshipDetailSection) formFactory
690
				.createCdmDetailSection(DetailType.TAXON_RELATIONSHIP, getConversationHolder(), parent, this, Section.TWISTIE
691
								| Section.EXPANDED);
692
		
693
		ReferencedEntityDetailSection referencedEntityBaseDetailSection = (ReferencedEntityDetailSection) formFactory
694
				.createCdmDetailSection(DetailType.REFERENCED_ENTITY, getConversationHolder(), parent, this, Section.TWISTIE
695
								| Section.EXPANDED);
696
		addPart(taxonRelationshipDetailSection);
697
		addPart(referencedEntityBaseDetailSection);
698
	}
699
}
(3-3/3)