Project

General

Profile

Download (25.4 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.taxeditor.model.FeatureNodeContainer;
36
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
37
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
38
import eu.etaxonomy.taxeditor.store.StoreUtil;
39
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
40
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EntityDetailType;
41
import eu.etaxonomy.taxeditor.ui.forms.RootElement;
42
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
43
import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
44
import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
45
import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
46
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
47
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
48
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
49
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
50
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
51
import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
52
import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
53
import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
54
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
55
import eu.etaxonomy.taxeditor.ui.section.group.GrantedAuthorityDetailSection;
56
import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
57
import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
58
import eu.etaxonomy.taxeditor.ui.section.key.GeographicalScopeDetailSection;
59
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
60
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
61
import eu.etaxonomy.taxeditor.ui.section.key.ScopeRestrictionSection;
62
import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
63
import eu.etaxonomy.taxeditor.ui.section.name.HybridDetailSection;
64
import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
65
import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
66
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
67
import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
68
import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
69
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
70
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationDetailSection;
71
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
72
import eu.etaxonomy.taxeditor.ui.section.occurrence.GeneralDetailSection;
73
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
74
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
75
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
76
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
77
import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
78
import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
79
import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
80
import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
81

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

    
93
	private enum VIEW_PART {
94
		TAXON, NAME, REFEERENCE, TEAM, PERSON, DESCRIPTION, DESCRIPTION_ELEMENT, EMPTY, IMAGE_GALLERY, MEDIA, TEAM_OR_PERSON_BASE, DERIVED_UNIT, FEATURE_DISTRIBUTION, POLYTOMOUS_KEY, POLYTOMOUS_KEY_NODE, USER, GROUP
95
	}
96

    
97
	private VIEW_PART currentViewPart;
98

    
99
	private ISelection selection;
100

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

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

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

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

    
148
		super.markViewPartDirty();
149
	}
150

    
151
	// END HACK TO MAKE THE DERIVED UNIT FACADE WORKING
152

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

    
166
				// preserve a pointer to the AbstractNameComposite
167
				// MultiPageTaxonEditor editor =
168
				// EditorUtil.getActiveMultiPageTaxonEditor();
169
				// if(editor != null){
170
				// TaxonNameEditor page = (TaxonNameEditor)
171
				// editor.getPage(Page.NAME);
172
				// for(AbstractGroupedContainer container :
173
				// page.getGroupedContainers()){
174
				// if(container.getData() == getInput()){
175
				// sourceContainer = container;
176
				// }
177
				// }
178
				// }
179
			}
180
		} else if (getInput() instanceof NonViralName) {
181
			if (currentViewPart != VIEW_PART.NAME) {
182
				createNameSections(rootElement);
183
				currentViewPart = VIEW_PART.NAME;
184
			}
185
		} else if (getInput() instanceof Reference) {
186
			if (currentViewPart != VIEW_PART.REFEERENCE) {
187
				createReferenceSections(rootElement);
188
				currentViewPart = VIEW_PART.REFEERENCE;
189
			}
190
		} else if (getInput() instanceof Team) {
191
			if (currentViewPart != VIEW_PART.TEAM) {
192
				createTeamDetailSection(rootElement);
193
				currentViewPart = VIEW_PART.TEAM;
194
			}
195
		} else if (getInput() instanceof Person) {
196
			if (currentViewPart != VIEW_PART.PERSON) {
197
				createPersonDetailSection(rootElement);
198
				currentViewPart = VIEW_PART.PERSON;
199
			}
200
		} else if (getInput() instanceof TeamOrPersonBase) {
201
			// fallback
202
			if (currentViewPart != VIEW_PART.TEAM_OR_PERSON_BASE) {
203
				createTeamOrPersonBaseDetailSection(rootElement);
204
				currentViewPart = VIEW_PART.TEAM_OR_PERSON_BASE;
205
			}
206
		} else if (getInput() instanceof DescriptionBase) {
207
			if (((DescriptionBase) getInput()).isImageGallery()) {
208
				if (currentViewPart != VIEW_PART.IMAGE_GALLERY) {
209
					createImageGallerySection(rootElement);
210
					currentViewPart = VIEW_PART.IMAGE_GALLERY;
211
				}
212
			} else {
213
				if (currentViewPart != VIEW_PART.DESCRIPTION) {
214
					createDescriptionSection(rootElement);
215
					currentViewPart = VIEW_PART.DESCRIPTION;
216
				}
217
			}
218
		} else if (getInput() instanceof DescriptionElementBase) {
219
			if (currentViewPart != VIEW_PART.DESCRIPTION_ELEMENT) {
220
				createDescriptionElementSection(rootElement);
221
				currentViewPart = VIEW_PART.DESCRIPTION_ELEMENT;
222
			}
223
		} else if (getInput() instanceof Media) {
224
			if (currentViewPart != VIEW_PART.MEDIA) {
225
				createMediaElementSection(rootElement);
226
				currentViewPart = VIEW_PART.MEDIA;
227
			}
228
		} else if (getInput() instanceof DerivedUnitFacade) {
229
			if (currentViewPart != VIEW_PART.DERIVED_UNIT) {
230
				createDerivedUnitBaseElementSection(rootElement);
231
				currentViewPart = VIEW_PART.DERIVED_UNIT;
232
			}
233
		} else if (getInput() instanceof FeatureNodeContainer) {
234
			if (currentViewPart != VIEW_PART.FEATURE_DISTRIBUTION) {
235
				createFeatureDistributionSection(rootElement);
236
				currentViewPart = VIEW_PART.FEATURE_DISTRIBUTION;
237
			}
238
		} else if (getInput() instanceof PolytomousKey) {
239
			if (currentViewPart != VIEW_PART.POLYTOMOUS_KEY) {
240
				createPolytomousKeySection(rootElement);
241
				currentViewPart = VIEW_PART.POLYTOMOUS_KEY;
242
			}
243
		} else if ((getInput() instanceof PolytomousKeyNode)
244
				|| (getInput() instanceof PolytomousKeyRelationship)) {
245
			if (currentViewPart != VIEW_PART.POLYTOMOUS_KEY_NODE) {
246
				createPolytomousKeyNodeSection(rootElement);
247
				currentViewPart = VIEW_PART.POLYTOMOUS_KEY_NODE;
248
			}
249
		} else if (getInput() instanceof User) {
250
			if (currentViewPart != VIEW_PART.USER) {
251
				createUserSection(rootElement);
252
				currentViewPart = VIEW_PART.USER;
253
			}
254
		} else if (getInput() instanceof Group) {
255
			if (currentViewPart != VIEW_PART.GROUP) {
256
				createGroupSection(rootElement);
257
				currentViewPart = VIEW_PART.GROUP;
258
			}
259
		} else {
260
			destroySections();
261
			currentViewPart = VIEW_PART.EMPTY;
262
		}
263

    
264
		layout();
265
	}
266

    
267
	/**
268
	 * @param rootElement
269
	 */
270
	private void createGroupSection(RootElement parent) {
271
		destroySections();
272

    
273
		GroupDetailSection groupDetailSection = (GroupDetailSection) formFactory
274
				.createCdmDetailSection(DetailType.GROUP,
275
						getConversationHolder(), parent, this, Section.TWISTIE
276
								| Section.EXPANDED);
277
		MemberDetailSection memberDetailSection = (MemberDetailSection) formFactory
278
				.createEntityDetailSection(EntityDetailType.MEMBER,
279
						getConversationHolder(), parent, Section.TWISTIE
280
								| Section.EXPANDED);
281
		GrantedAuthorityDetailSection grantedAuthorityDetailSection = (GrantedAuthorityDetailSection) formFactory
282
				.createEntityDetailSection(EntityDetailType.GRANTED_AUTHORITY,
283
						getConversationHolder(), parent, Section.TWISTIE
284
								| Section.EXPANDED);
285

    
286
		addPart(groupDetailSection);
287
		addPart(memberDetailSection);
288
		addPart(grantedAuthorityDetailSection);
289
	}
290

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

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

    
318
	private void createTaxonSections(RootElement parent) {
319
		destroySections();
320

    
321
		TaxonBaseDetailSection taxonBaseDetailSection = (TaxonBaseDetailSection) formFactory
322
				.createCdmDetailSection(DetailType.TAXONBASE,
323
						getConversationHolder(), parent, this, Section.TWISTIE);
324

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

    
327
		NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
328
				.createCdmDetailSection(DetailType.NONVIRALNAME,
329
						getConversationHolder(), parent, this, Section.TWISTIE
330
								| Section.EXPANDED);
331

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

    
334
		NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
335
				.createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
336
						getConversationHolder(), parent, this, Section.TWISTIE);
337

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

    
340
		NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
341
				.createEntityDetailSection(
342
						EntityDetailType.NOMENCLATURALSTATUS,
343
						getConversationHolder(), parent, Section.TWISTIE);
344

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

    
347
		ProtologueSection protologSection = (ProtologueSection) formFactory
348
				.createEntityDetailSection(EntityDetailType.PROTOLOG,
349
						getConversationHolder(), parent, Section.TWISTIE);
350

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

    
353
		TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
354
				.createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
355
						getConversationHolder(), parent, Section.TWISTIE);
356

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

    
359
		NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
360
				.createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
361
						getConversationHolder(), parent, Section.TWISTIE);
362

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

    
365
		HybridDetailSection hybridDetailSection = (HybridDetailSection) formFactory
366
				.createCdmDetailSection(DetailType.HYBRID,
367
						getConversationHolder(), parent, this, Section.TWISTIE);
368

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

    
371
		ParsingMessagesSection parsingMessagesSection = (ParsingMessagesSection) formFactory
372
				.createCdmDetailSection(DetailType.PARSINGMESSAGE,
373
						getConversationHolder(), parent, this, Section.EXPANDED);
374

    
375
		addPart(taxonBaseDetailSection);
376
		addPart(nonViralNameSection);
377
		addPart(nomenclaturalStatusSection);
378
		addPart(protologSection);
379
		addPart(referenceDetailSection);
380
		addPart(typeDesignationSection);
381
		addPart(nameRelationshipSection);
382
		addPart(hybridDetailSection);
383
		addPart(parsingMessagesSection);
384
	}
385

    
386
	private void createNameSections(RootElement parent) {
387
		destroySections();
388
		NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
389
				.createCdmDetailSection(DetailType.NONVIRALNAME,
390
						getConversationHolder(), parent, this, Section.TWISTIE
391
								| Section.EXPANDED);
392

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

    
395
		NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
396
				.createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
397
						getConversationHolder(), parent, this, Section.TWISTIE);
398

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

    
401
		NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
402
				.createEntityDetailSection(
403
						EntityDetailType.NOMENCLATURALSTATUS,
404
						getConversationHolder(), parent, Section.TWISTIE);
405

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

    
408
		ProtologueSection protologSection = (ProtologueSection) formFactory
409
				.createEntityDetailSection(EntityDetailType.PROTOLOG,
410
						getConversationHolder(), parent, Section.TWISTIE);
411

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

    
414
		TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
415
				.createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
416
						getConversationHolder(), parent, Section.TWISTIE);
417

    
418
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
419

    
420
		NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
421
				.createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
422
						getConversationHolder(), parent, Section.TWISTIE);
423

    
424
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
425

    
426
		HybridDetailSection hybridDetailSection = (HybridDetailSection) formFactory
427
				.createCdmDetailSection(DetailType.HYBRID,
428
						getConversationHolder(), parent, this, Section.TWISTIE);
429

    
430
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
431

    
432
		addPart(nonViralNameSection);
433
		addPart(nomenclaturalStatusSection);
434
		addPart(protologSection);
435
		addPart(referenceDetailSection);
436
		addPart(typeDesignationSection);
437
		addPart(nameRelationshipSection);
438
		addPart(hybridDetailSection);
439
	}
440

    
441
	private void createReferenceSections(RootElement parent) {
442
		destroySections();
443

    
444
		ReferenceDetailSection referenceDetailSection = (ReferenceDetailSection) formFactory
445
				.createCdmDetailSection(DetailType.REFERENCEBASE,
446
						getConversationHolder(), parent, this, Section.TWISTIE
447
								| Section.EXPANDED);
448

    
449
		addPart(referenceDetailSection);
450
	}
451

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

    
459
		addPart(teamOrPersonBaseDetailSection);
460
	}
461

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

    
469
		addPart(teamDetailSection);
470
	}
471

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

    
481
	private void createDescriptionElementSection(RootElement parent) {
482
		destroySections();
483

    
484
		DescriptionElementDetailSection descriptionElementDetailSection = (DescriptionElementDetailSection) formFactory
485
				.createCdmDetailSection(DetailType.DESCRIPTIONELEMENT,
486
						getConversationHolder(), parent, this, Section.TWISTIE
487
								| Section.EXPANDED);
488

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

    
491
		DescriptionElementSourceSection descriptionElementSourceSection = (DescriptionElementSourceSection) formFactory
492
				.createEntityDetailSection(
493
						EntityDetailType.DESCRIPTIONELEMENTSOURCE,
494
						getConversationHolder(), parent, Section.TWISTIE);
495

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

    
498
		DescriptionElementMediaSection descriptionElementMediaSection = (DescriptionElementMediaSection) formFactory
499
				.createEntityDetailSection(
500
						EntityDetailType.DESCRIPTIONELEMENTMEDIA,
501
						getConversationHolder(), parent, Section.TWISTIE);
502

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

    
505
		addPart(descriptionElementDetailSection);
506
		addPart(descriptionElementSourceSection);
507
		addPart(descriptionElementMediaSection);
508
	}
509

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

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

    
519
		NaturalLanguageSection naturalLanguageSection = (NaturalLanguageSection) formFactory
520
				.createCdmDetailSection(DetailType.NATURAL_LANGUAGE,
521
						getConversationHolder(), parent, this, Section.TWISTIE
522
								| Section.EXPANDED);
523

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

    
526
		DescribedSpecimenSection describedSpecimenSection = (DescribedSpecimenSection) formFactory
527
				.createEntityDetailSection(EntityDetailType.DESCRIBED_SPECIMEN,
528
						getConversationHolder(), parent, Section.TWISTIE);
529

    
530
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
531

    
532
		DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
533
				.createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
534
						getConversationHolder(), parent, Section.TWISTIE);
535

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

    
538
		ScopeSection scopeSection = (ScopeSection) formFactory
539
				.createEntityDetailSection(EntityDetailType.SCOPE,
540
						getConversationHolder(), parent, Section.TWISTIE);
541

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

    
544
		addPart(descriptionDetailSection);
545
		addPart(naturalLanguageSection);
546
		addPart(describedSpecimenSection);
547
		addPart(descriptionSourceSection);
548
		addPart(scopeSection);
549
	}
550

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

    
561
		addPart(descriptionDetailSection);
562
	}
563

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

    
571
		addPart(mediaDetailSection);
572
	}
573

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

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

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

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

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

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

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

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

    
600
		addPart(generalDetailSection);
601
		addPart(gatheringEventDetailSection);
602
		addPart(fieldObservationDetailSection);
603
		addPart(derivedUnitBaseDetailSection);
604
	}
605

    
606
	/**
607
	 * @param rootElement
608
	 */
609
	private void createFeatureDistributionSection(RootElement parent) {
610
		destroySections();
611

    
612
		FeatureDistributionDetailSection featureDistributionSection = (FeatureDistributionDetailSection) formFactory
613
				.createCdmDetailSection(DetailType.FEATURE_DISTRIBUTION,
614
						getConversationHolder(), parent, this, Section.TWISTIE
615
								| Section.EXPANDED);
616

    
617
		addPart(featureDistributionSection);
618
	}
619

    
620
	private void createPolytomousKeySection(RootElement parent) {
621
		destroySections();
622

    
623
		PolytomousKeyDetailSection polytomousKeyDetailSection = (PolytomousKeyDetailSection) formFactory
624
				.createCdmDetailSection(DetailType.POLYTOMOUS_KEY,
625
						getConversationHolder(), parent, this, Section.TWISTIE
626
								| Section.EXPANDED);
627

    
628
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
629

    
630
		GeographicalScopeDetailSection geographicalScopeDetailSection = (GeographicalScopeDetailSection) formFactory
631
				.createEntityDetailSection(EntityDetailType.GEOGRAPHICAL_SCOPE,
632
						getConversationHolder(), parent, Section.TWISTIE);
633

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

    
636
		ScopeRestrictionSection scopeRestrictionSection = (ScopeRestrictionSection) formFactory
637
				.createEntityDetailSection(EntityDetailType.SCOPE_RESTRICTION,
638
						getConversationHolder(), parent, Section.TWISTIE);
639

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

    
642
		TaxonomicScopeSection taxonomicScopeSection = (TaxonomicScopeSection) formFactory
643
				.createEntityDetailSection(EntityDetailType.TAXONOMIC_SCOPE,
644
						getConversationHolder(), parent, Section.TWISTIE);
645

    
646
		addPart(polytomousKeyDetailSection);
647
		addPart(geographicalScopeDetailSection);
648
		addPart(scopeRestrictionSection);
649
		addPart(taxonomicScopeSection);
650
	}
651

    
652
	private void createPolytomousKeyNodeSection(RootElement parent) {
653
		destroySections();
654

    
655
		PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = (PolytomousKeyNodeDetailSection) formFactory
656
				.createCdmDetailSection(DetailType.POLYTOMOUS_KEY_NODE,
657
						getConversationHolder(), parent, this, Section.TWISTIE
658
								| Section.EXPANDED);
659

    
660
		addPart(polytomousKeyNodeDetailSection);
661
	}
662

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

    
666
		UserDetailSection userDetailSection = (UserDetailSection) formFactory
667
				.createCdmDetailSection(DetailType.USER,
668
						getConversationHolder(), parent, this, Section.TWISTIE
669
								| Section.EXPANDED);
670

    
671
		GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) formFactory
672
				.createEntityDetailSection(EntityDetailType.GROUPS_BY_USER,
673
						getConversationHolder(), parent, Section.TWISTIE
674
								| Section.EXPANDED);
675

    
676
		addPart(userDetailSection);
677
		addPart(groupByUserDetailSection);
678
	}
679
}
(3-3/3)