Project

General

Profile

« Previous | Next » 

Revision ac12d86b

Added by Patrick Plitzner almost 11 years ago

  • added java doc
    • formatted code

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
1

  
2 1
// $Id$
3 2
/**
4 3
 * Copyright (C) 2011 EDIT
......
39 38
import eu.etaxonomy.cdm.model.media.Media;
40 39
import eu.etaxonomy.cdm.model.name.NonViralName;
41 40
import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
42
import eu.etaxonomy.cdm.model.occurrence.FieldObservation;
43
import eu.etaxonomy.cdm.model.occurrence.Specimen;
44 41
import eu.etaxonomy.cdm.model.reference.Reference;
45 42
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
46 43
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
......
97 94
import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
98 95

  
99 96
/**
100
 * <p>
101
 * DetailsViewer class.
102
 * </p>
97
 *
98
 * The DetailsViewer handles the content of the details view (
99
 * {@link DetailsViewPart}).<br>
100
 * Depending on the type of the selected element the section of the details view
101
 * are created.
103 102
 *
104 103
 * @author n.hoffmann
105 104
 * @created Feb 12, 2010
......
107 106
 */
108 107
public class DetailsViewer extends AbstractCdmDataViewer {
109 108

  
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, PreferencesUtil.getDerivedUnitConfigurator());
144
			} catch (DerivedUnitFacadeNotSupportedException e) {
145
				AbstractUtility.error(getClass(), e);
146
			}
147
		}
148
		super.setInput(input);
149
	}
150

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

  
158
		super.markViewPartDirty();
159
	}
160

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

  
163
	/*
164
	 * (non-Javadoc)
165
	 *
166
	 * @see org.eclipse.jface.viewers.Viewer#refresh()
167
	 */
168
	/** {@inheritDoc} */
169
	@Override
170
	protected void showParts() {
171
	    // FIXME (CM) : Need to clean out this code.
172
	    // Too much type checking to decide which detail view to display.
173
	    // Need to build in a mechanism where navigators / editors are 'aware'
174
	    // of the corresponding detail viewer.
175
		Object input = getInput();
109
    private ISelection selection;
110

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

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

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

  
151
    @Override
152
    protected void markViewPartDirty() {
153
        if (getInput() instanceof DerivedUnitFacade) {
154
            getViewPart().changed(((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
        // FIXME (CM) : Need to clean out this code.
171
        // Too much type checking to decide which detail view to display.
172
        // Need to build in a mechanism where navigators / editors are 'aware'
173
        // of the corresponding detail viewer.
174
        Object input = getInput();
176 175
        if (input instanceof TaxonBase) {
177
			createTaxonSections(rootElement);
178

  
179
		} else if (input instanceof NonViralName) {
180
			createNameSections(rootElement);
181

  
182
		} else if (input instanceof Reference) {
183
			createReferenceSections(rootElement);
184

  
185
		} else if (input instanceof Team) {
186
			createTeamDetailSection(rootElement);
187

  
188
		} else if (input instanceof Person) {
189
			createPersonDetailSection(rootElement);
190

  
191
		} else if (input instanceof TeamOrPersonBase) {
192
			createTeamOrPersonBaseDetailSection(rootElement);
193

  
194
		} else if (input instanceof DescriptionBase) {
195
			Set<Marker> descriptionMarkers = ((DescriptionBase) input).getMarkers();
196
			MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType);
197
			Boolean isUseDescription = false;
198
			for (Marker marker : descriptionMarkers) {
199
				if (marker.getMarkerType().equals(useMarkertype)) {
200
					isUseDescription = true;
201
				}
202
			}
203
			if (((DescriptionBase) input).isImageGallery()) {
204
				createImageGallerySection(rootElement);
205

  
206
			} else if (isUseDescription) {
207
				createUseDescriptionSection(rootElement);
208
			} else {
209
				createDescriptionSection(rootElement);
210

  
211
			}
212
		} else if (input instanceof DescriptionElementBase) {
213
			Set<Marker> descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
214
			MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType);
215
			Boolean isUseDescription = false;
216
			for (Marker marker : descriptionMarkers) {
217
				if (marker.getMarkerType().equals(useMarkertype)) {
218
					isUseDescription = true;
219
				}
220
			}
221

  
222
			if (isUseDescription == true && input instanceof CategoricalData ) {
223
				createUseRecordSection(rootElement);
224
			}
225
			else {
226
				createDescriptionElementSection(rootElement);
227
			}
228

  
229
		} else if (input instanceof Media) {
230
			createMediaElementSection(rootElement);
231

  
232
		} else if (input instanceof DerivedUnitFacade) {
233
			createDerivedUnitBaseElementSection(rootElement);
234

  
235
		} else if (input instanceof FeatureNodeContainer) {
236
			createFeatureDistributionSection(rootElement);
237

  
238
		} else if (input instanceof PolytomousKey) {
239
			//createPolytomousKeySection(rootElement);
240

  
241
		} else if ((input instanceof PolytomousKeyNode)
242
				|| (input instanceof PolytomousKeyRelationship)) {
243
			createPolytomousKeyNodeSection(rootElement);
244
		} else if (input instanceof User) {
245
			createUserSection(rootElement);
246
		} else if (input instanceof Group) {
247
			createGroupSection(rootElement);
248
		} else if (input instanceof TaxonRelationship) {
249
			createTaxonRelationshipSection(rootElement);
250
		} else if (input instanceof TermVocabulary) {
251
			createTermVocabularySection(rootElement);
252
		} else if (input instanceof DefinedTermBase) {
253
			createDefinedTermSection(rootElement);
254
		} else {
255
			destroySections();
256
		}
257
		layout();
258
	}
259

  
260

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

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

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

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

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

  
311
	/**
312
	 * createTaxonSections(RootElement parent)
313
	 * @param parent
314
	 */
315
	private void createTaxonSections(RootElement parent) {
316
		destroySections();
317

  
318
		TaxonBaseDetailSection taxonBaseDetailSection = (TaxonBaseDetailSection) formFactory
319
				.createCdmDetailSection(DetailType.TAXONBASE,
320
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
321

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

  
324
		NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
325
				.createCdmDetailSection(DetailType.NONVIRALNAME,
326
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
327
								| ExpandableComposite.EXPANDED);
328

  
329
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
330

  
331
		NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
332
				.createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
333
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
334

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

  
337
		NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
338
				.createEntityDetailSection(
339
						EntityDetailType.NOMENCLATURALSTATUS,
340
						getConversationHolder(), parent, ExpandableComposite.TWISTIE);
341

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

  
344
		ProtologueSection protologSection = (ProtologueSection) formFactory
345
				.createEntityDetailSection(EntityDetailType.PROTOLOG,
346
						getConversationHolder(), parent, ExpandableComposite.TWISTIE);
347

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

  
350
		TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
351
				.createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
352
						getConversationHolder(), parent, ExpandableComposite.TWISTIE);
353

  
354
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
355

  
356
		NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
357
				.createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
358
						getConversationHolder(), parent, ExpandableComposite.TWISTIE);
359

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

  
362
		ParsingMessagesSection parsingMessagesSection = (ParsingMessagesSection) formFactory
363
				.createCdmDetailSection(DetailType.PARSINGMESSAGE,
364
						getConversationHolder(), parent, this, ExpandableComposite.EXPANDED);
365

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

  
376
	/**
377
	 * createNameSections
378
	 * @param parent
379
	 */
380
	private void createNameSections(RootElement parent) {
381
		destroySections();
382
		NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
383
				.createCdmDetailSection(DetailType.NONVIRALNAME,
384
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
385
								| ExpandableComposite.EXPANDED);
386

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

  
389
		NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
390
				.createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
391
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
392

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

  
395
		NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
396
				.createEntityDetailSection(
397
						EntityDetailType.NOMENCLATURALSTATUS,
398
						getConversationHolder(), parent, ExpandableComposite.TWISTIE);
399

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

  
402
		ProtologueSection protologSection = (ProtologueSection) formFactory
403
				.createEntityDetailSection(EntityDetailType.PROTOLOG,
404
						getConversationHolder(), parent, ExpandableComposite.TWISTIE);
405

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

  
408
		TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
409
				.createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
410
						getConversationHolder(), parent, ExpandableComposite.TWISTIE);
411

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

  
414
		NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
415
				.createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
416
						getConversationHolder(), parent, ExpandableComposite.TWISTIE);
417

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

  
420
		addPart(nonViralNameSection);
421
		addPart(nomenclaturalStatusSection);
422
		addPart(protologSection);
423
		addPart(referenceDetailSection);
424
		addPart(typeDesignationSection);
425
		addPart(nameRelationshipSection);
426
	}
427

  
428
	/**
429
	 * createReferenceSections
430
	 * @param parent
431
	 */
432
	private void createReferenceSections(RootElement parent) {
433
		destroySections();
434

  
435
		ReferenceDetailSection referenceDetailSection = (ReferenceDetailSection) formFactory
436
				.createCdmDetailSection(DetailType.REFERENCEBASE,
437
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
438
								| ExpandableComposite.EXPANDED);
439

  
440
		addPart(referenceDetailSection);
441
	}
442

  
443
	/**
444
	 * createTeamOrPersonBaseDetailSection
445
	 * @param parent
446
	 */
447
	private void createTeamOrPersonBaseDetailSection(RootElement parent) {
448
		destroySections();
449
		TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = (TeamOrPersonBaseDetailSection) formFactory
450
				.createCdmDetailSection(DetailType.TEAMORPERSONBASE,
451
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
452
								| ExpandableComposite.EXPANDED);
453

  
454
		addPart(teamOrPersonBaseDetailSection);
455
	}
456

  
457
	/**
458
	 * createTeamDetailSection
459
	 * @param parent
460
	 */
461
	private void createTeamDetailSection(RootElement parent) {
462
		destroySections();
463
		TeamDetailSection teamDetailSection = (TeamDetailSection) formFactory
464
				.createCdmDetailSection(DetailType.TEAM,
465
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
466
								| ExpandableComposite.EXPANDED);
467

  
468
		addPart(teamDetailSection);
469
	}
470

  
471
	/**
472
	 * createPersonDetailSection
473
	 * @param parent
474
	 */
475
	private void createPersonDetailSection(RootElement parent) {
476
		destroySections();
477
		PersonDetailSection personDetailSection = (PersonDetailSection) formFactory
478
				.createCdmDetailSection(DetailType.PERSON,
479
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
480
								| ExpandableComposite.EXPANDED);
481
		addPart(personDetailSection);
482
	}
483

  
484
	/**
485
	 * createDescriptionElementSection
486
	 * @param parent
487
	 */
488
	private void createDescriptionElementSection(RootElement parent) {
489
		destroySections();
490

  
491
		DescriptionElementDetailSection descriptionElementDetailSection = (DescriptionElementDetailSection) formFactory
492
				.createCdmDetailSection(DetailType.DESCRIPTIONELEMENT,
493
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
494
								| ExpandableComposite.EXPANDED);
495

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

  
498
		DescriptionElementSourceSection descriptionElementSourceSection = (DescriptionElementSourceSection) formFactory
499
				.createEntityDetailSection(
500
						EntityDetailType.DESCRIPTIONELEMENTSOURCE,
501
						getConversationHolder(), parent, ExpandableComposite.TWISTIE);
502

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

  
505
		DescriptionElementMediaSection descriptionElementMediaSection = (DescriptionElementMediaSection) formFactory
506
				.createEntityDetailSection(
507
						EntityDetailType.DESCRIPTIONELEMENTMEDIA,
508
						getConversationHolder(), parent, ExpandableComposite.TWISTIE);
509

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

  
512
		addPart(descriptionElementDetailSection);
513
		addPart(descriptionElementSourceSection);
514
		addPart(descriptionElementMediaSection);
515
	}
516

  
517
	/**
518
	 * createDescriptionSection
519
	 * @param parent
520
	 */
521
	private void createDescriptionSection(RootElement parent) {
522
		destroySections();
523
		DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
524
				.createCdmDetailSection(DetailType.DESCRIPTION,
525
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
526
								| ExpandableComposite.EXPANDED);
527

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

  
530
		NaturalLanguageSection naturalLanguageSection = (NaturalLanguageSection) formFactory
531
				.createCdmDetailSection(DetailType.NATURAL_LANGUAGE,
532
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
533
								| ExpandableComposite.EXPANDED);
534

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

  
537
		DescribedSpecimenSection describedSpecimenSection = (DescribedSpecimenSection) formFactory
538
				.createEntityDetailSection(EntityDetailType.DESCRIBED_SPECIMEN,
539
						getConversationHolder(), parent, ExpandableComposite.TWISTIE);
540

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

  
543
		DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
544
				.createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
545
						getConversationHolder(), parent, ExpandableComposite.TWISTIE);
546

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

  
549
		ScopeSection scopeSection = (ScopeSection) formFactory
550
				.createEntityDetailSection(EntityDetailType.SCOPE,
551
						getConversationHolder(), parent, ExpandableComposite.TWISTIE);
552

  
553
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
554

  
555
		addPart(descriptionDetailSection);
556
		addPart(naturalLanguageSection);
557
		addPart(describedSpecimenSection);
558
		addPart(descriptionSourceSection);
559
		addPart(scopeSection);
560
	}
561

  
562
	/**
563
	 * Creates the use Description section
564
	 * @param parent
565
	 */
566
	private void createUseDescriptionSection(RootElement parent) {
567
		destroySections();
568
		DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
569
				.createCdmDetailSection(DetailType.DESCRIPTION,
570
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
571
								| ExpandableComposite.EXPANDED);
572

  
573
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
574

  
575
		DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
576
				.createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
577
						getConversationHolder(), parent, ExpandableComposite.TWISTIE
578
								| ExpandableComposite.EXPANDED);
579

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

  
582
		addPart(descriptionDetailSection);
583
		addPart(descriptionSourceSection);
584

  
585
	}
586

  
587

  
588
	/**
589
	 * @param rootElement
590
	 */
591
	private void createImageGallerySection(RootElement parent) {
592
		destroySections();
593
		DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
594
				.createCdmDetailSection(DetailType.DESCRIPTION,
595
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
596
								| ExpandableComposite.EXPANDED);
597

  
598
		addPart(descriptionDetailSection);
599
	}
600

  
601
	/**
602
	 * createMediaElementSection
603
	 * @param parent
604
	 */
605

  
606
	private void createMediaElementSection(RootElement parent) {
607
		destroySections();
608
		MediaDetailsSection mediaDetailSection = (MediaDetailsSection) formFactory
609
				.createCdmDetailSection(DetailType.MEDIA,
610
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
611
								| ExpandableComposite.EXPANDED);
612

  
613
		addPart(mediaDetailSection);
614
	}
615

  
616
	/**
617
	 * createDerivedUnitBaseElementSection
618
	 * @param parent
619
	 */
176
            createTaxonSections(rootElement);
177

  
178
        } else if (input instanceof NonViralName) {
179
            createNameSections(rootElement);
180

  
181
        } else if (input instanceof Reference) {
182
            createReferenceSections(rootElement);
183

  
184
        } else if (input instanceof Team) {
185
            createTeamDetailSection(rootElement);
186

  
187
        } else if (input instanceof Person) {
188
            createPersonDetailSection(rootElement);
189

  
190
        } else if (input instanceof TeamOrPersonBase) {
191
            createTeamOrPersonBaseDetailSection(rootElement);
192

  
193
        } else if (input instanceof DescriptionBase) {
194
            Set<Marker> descriptionMarkers = ((DescriptionBase) input).getMarkers();
195
            MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
196
                    UsageTermCollection.uuidUseMarkerType);
197
            Boolean isUseDescription = false;
198
            for (Marker marker : descriptionMarkers) {
199
                if (marker.getMarkerType().equals(useMarkertype)) {
200
                    isUseDescription = true;
201
                }
202
            }
203
            if (((DescriptionBase) input).isImageGallery()) {
204
                createImageGallerySection(rootElement);
205

  
206
            } else if (isUseDescription) {
207
                createUseDescriptionSection(rootElement);
208
            } else {
209
                createDescriptionSection(rootElement);
210

  
211
            }
212
        } else if (input instanceof DescriptionElementBase) {
213
            Set<Marker> descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
214
            MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
215
                    UsageTermCollection.uuidUseMarkerType);
216
            Boolean isUseDescription = false;
217
            for (Marker marker : descriptionMarkers) {
218
                if (marker.getMarkerType().equals(useMarkertype)) {
219
                    isUseDescription = true;
220
                }
221
            }
222

  
223
            if (isUseDescription == true && input instanceof CategoricalData) {
224
                createUseRecordSection(rootElement);
225
            } else {
226
                createDescriptionElementSection(rootElement);
227
            }
228

  
229
        } else if (input instanceof Media) {
230
            createMediaElementSection(rootElement);
231

  
232
        } else if (input instanceof DerivedUnitFacade) {
233
            createDerivedUnitBaseElementSection(rootElement);
234

  
235
        } else if (input instanceof FeatureNodeContainer) {
236
            createFeatureDistributionSection(rootElement);
237

  
238
        } else if (input instanceof PolytomousKey) {
239
            // createPolytomousKeySection(rootElement);
240

  
241
        } else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
242
            createPolytomousKeyNodeSection(rootElement);
243
        } else if (input instanceof User) {
244
            createUserSection(rootElement);
245
        } else if (input instanceof Group) {
246
            createGroupSection(rootElement);
247
        } else if (input instanceof TaxonRelationship) {
248
            createTaxonRelationshipSection(rootElement);
249
        } else if (input instanceof TermVocabulary) {
250
            createTermVocabularySection(rootElement);
251
        } else if (input instanceof DefinedTermBase) {
252
            createDefinedTermSection(rootElement);
253
        } else {
254
            destroySections();
255
        }
256
        layout();
257
    }
258

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

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

  
275
        addPart(groupDetailSection);
276
        addPart(memberDetailSection);
277
        addPart(grantedAuthorityDetailSection);
278
    }
279

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

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

  
306
    /**
307
     * createTaxonSections(RootElement parent)
308
     *
309
     * @param parent
310
     */
311
    private void createTaxonSections(RootElement parent) {
312
        destroySections();
313

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

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

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

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

  
325
        NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
326
                .createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE, getConversationHolder(), parent, this,
327
                        ExpandableComposite.TWISTIE);
328

  
329
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
330

  
331
        NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
332
                .createEntityDetailSection(EntityDetailType.NOMENCLATURALSTATUS, getConversationHolder(), parent,
333
                        ExpandableComposite.TWISTIE);
334

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

  
337
        ProtologueSection protologSection = (ProtologueSection) formFactory.createEntityDetailSection(
338
                EntityDetailType.PROTOLOG, getConversationHolder(), parent, ExpandableComposite.TWISTIE);
339

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

  
342
        TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory.createEntityDetailSection(
343
                EntityDetailType.TYPEDESIGNATION, getConversationHolder(), parent, ExpandableComposite.TWISTIE);
344

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

  
347
        NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
348
                .createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP, getConversationHolder(), parent,
349
                        ExpandableComposite.TWISTIE);
350

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

  
353
        ParsingMessagesSection parsingMessagesSection = (ParsingMessagesSection) formFactory.createCdmDetailSection(
354
                DetailType.PARSINGMESSAGE, getConversationHolder(), parent, this, ExpandableComposite.EXPANDED);
355

  
356
        addPart(taxonBaseDetailSection);
357
        addPart(nonViralNameSection);
358
        addPart(nomenclaturalStatusSection);
359
        addPart(protologSection);
360
        addPart(referenceDetailSection);
361
        addPart(typeDesignationSection);
362
        addPart(nameRelationshipSection);
363
        addPart(parsingMessagesSection);
364
    }
365

  
366
    /**
367
     * createNameSections
368
     *
369
     * @param parent
370
     */
371
    private void createNameSections(RootElement parent) {
372
        destroySections();
373
        NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory.createCdmDetailSection(
374
                DetailType.NONVIRALNAME, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
375
                        | ExpandableComposite.EXPANDED);
376

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

  
379
        NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
380
                .createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE, getConversationHolder(), parent, this,
381
                        ExpandableComposite.TWISTIE);
382

  
383
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
384

  
385
        NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
386
                .createEntityDetailSection(EntityDetailType.NOMENCLATURALSTATUS, getConversationHolder(), parent,
387
                        ExpandableComposite.TWISTIE);
388

  
389
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
390

  
391
        ProtologueSection protologSection = (ProtologueSection) formFactory.createEntityDetailSection(
392
                EntityDetailType.PROTOLOG, getConversationHolder(), parent, ExpandableComposite.TWISTIE);
393

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

  
396
        TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory.createEntityDetailSection(
397
                EntityDetailType.TYPEDESIGNATION, getConversationHolder(), parent, ExpandableComposite.TWISTIE);
398

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

  
401
        NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
402
                .createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP, getConversationHolder(), parent,
403
                        ExpandableComposite.TWISTIE);
404

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

  
407
        addPart(nonViralNameSection);
408
        addPart(nomenclaturalStatusSection);
409
        addPart(protologSection);
410
        addPart(referenceDetailSection);
411
        addPart(typeDesignationSection);
412
        addPart(nameRelationshipSection);
413
    }
414

  
415
    /**
416
     * createReferenceSections
417
     *
418
     * @param parent
419
     */
420
    private void createReferenceSections(RootElement parent) {
421
        destroySections();
422

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

  
427
        addPart(referenceDetailSection);
428
    }
429

  
430
    /**
431
     * createTeamOrPersonBaseDetailSection
432
     *
433
     * @param parent
434
     */
435
    private void createTeamOrPersonBaseDetailSection(RootElement parent) {
436
        destroySections();
437
        TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = (TeamOrPersonBaseDetailSection) formFactory
438
                .createCdmDetailSection(DetailType.TEAMORPERSONBASE, getConversationHolder(), parent, this,
439
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
440

  
441
        addPart(teamOrPersonBaseDetailSection);
442
    }
443

  
444
    /**
445
     * createTeamDetailSection
446
     *
447
     * @param parent
448
     */
449
    private void createTeamDetailSection(RootElement parent) {
450
        destroySections();
451
        TeamDetailSection teamDetailSection = (TeamDetailSection) formFactory.createCdmDetailSection(DetailType.TEAM,
452
                getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
453

  
454
        addPart(teamDetailSection);
455
    }
456

  
457
    /**
458
     * createPersonDetailSection
459
     *
460
     * @param parent
461
     */
462
    private void createPersonDetailSection(RootElement parent) {
463
        destroySections();
464
        PersonDetailSection personDetailSection = (PersonDetailSection) formFactory.createCdmDetailSection(
465
                DetailType.PERSON, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
466
                        | ExpandableComposite.EXPANDED);
467
        addPart(personDetailSection);
468
    }
469

  
470
    /**
471
     * createDescriptionElementSection
472
     *
473
     * @param parent
474
     */
475
    private void createDescriptionElementSection(RootElement parent) {
476
        destroySections();
477

  
478
        DescriptionElementDetailSection descriptionElementDetailSection = (DescriptionElementDetailSection) formFactory
479
                .createCdmDetailSection(DetailType.DESCRIPTIONELEMENT, getConversationHolder(), parent, this,
480
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
481

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

  
484
        DescriptionElementSourceSection descriptionElementSourceSection = (DescriptionElementSourceSection) formFactory
485
                .createEntityDetailSection(EntityDetailType.DESCRIPTIONELEMENTSOURCE, getConversationHolder(), parent,
486
                        ExpandableComposite.TWISTIE);
487

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

  
490
        DescriptionElementMediaSection descriptionElementMediaSection = (DescriptionElementMediaSection) formFactory
491
                .createEntityDetailSection(EntityDetailType.DESCRIPTIONELEMENTMEDIA, getConversationHolder(), parent,
492
                        ExpandableComposite.TWISTIE);
493

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

  
496
        addPart(descriptionElementDetailSection);
497
        addPart(descriptionElementSourceSection);
498
        addPart(descriptionElementMediaSection);
499
    }
500

  
501
    /**
502
     * createDescriptionSection
503
     *
504
     * @param parent
505
     */
506
    private void createDescriptionSection(RootElement parent) {
507
        destroySections();
508
        DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
509
                .createCdmDetailSection(DetailType.DESCRIPTION, getConversationHolder(), parent, this,
510
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
511

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

  
514
        NaturalLanguageSection naturalLanguageSection = (NaturalLanguageSection) formFactory.createCdmDetailSection(
515
                DetailType.NATURAL_LANGUAGE, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
516
                        | ExpandableComposite.EXPANDED);
517

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

  
520
        DescribedSpecimenSection describedSpecimenSection = (DescribedSpecimenSection) formFactory
521
                .createEntityDetailSection(EntityDetailType.DESCRIBED_SPECIMEN, getConversationHolder(), parent,
522
                        ExpandableComposite.TWISTIE);
523

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

  
526
        DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
527
                .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE, getConversationHolder(), parent,
528
                        ExpandableComposite.TWISTIE);
529

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

  
532
        ScopeSection scopeSection = (ScopeSection) formFactory.createEntityDetailSection(EntityDetailType.SCOPE,
533
                getConversationHolder(), parent, ExpandableComposite.TWISTIE);
534

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

  
537
        addPart(descriptionDetailSection);
538
        addPart(naturalLanguageSection);
539
        addPart(describedSpecimenSection);
540
        addPart(descriptionSourceSection);
541
        addPart(scopeSection);
542
    }
543

  
544
    /**
545
     * Creates the use Description section
546
     *
547
     * @param parent
548
     */
549
    private void createUseDescriptionSection(RootElement parent) {
550
        destroySections();
551
        DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
552
                .createCdmDetailSection(DetailType.DESCRIPTION, getConversationHolder(), parent, this,
553
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
554

  
555
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
556

  
557
        DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
558
                .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE, getConversationHolder(), parent,
559
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
560

  
561
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
562

  
563
        addPart(descriptionDetailSection);
564
        addPart(descriptionSourceSection);
565

  
566
    }
567

  
568
    /**
569
     * @param rootElement
570
     */
571
    private void createImageGallerySection(RootElement parent) {
572
        destroySections();
573
        DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
574
                .createCdmDetailSection(DetailType.DESCRIPTION, getConversationHolder(), parent, this,
575
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
576

  
577
        addPart(descriptionDetailSection);
578
    }
579

  
580
    /**
581
     * createMediaElementSection
582
     *
583
     * @param parent
584
     */
585

  
586
    private void createMediaElementSection(RootElement parent) {
587
        destroySections();
588
        MediaDetailsSection mediaDetailSection = (MediaDetailsSection) formFactory.createCdmDetailSection(
589
                DetailType.MEDIA, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
590
                        | ExpandableComposite.EXPANDED);
591

  
592
        addPart(mediaDetailSection);
593
    }
594

  
595
    /**
596
     * createDerivedUnitBaseElementSection
597
     *
598
     * @param parent
599
     */
620 600
    private void createDerivedUnitBaseElementSection(RootElement parent) {
621 601
        destroySections();
622
        
623
        GeneralDetailSection generalDetailSection = (GeneralDetailSection) formFactory.createCdmDetailSection(DetailType.DERIVED_UNIT_GENERAL, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
602

  
603
        GeneralDetailSection generalDetailSection = (GeneralDetailSection) formFactory.createCdmDetailSection(
604
                DetailType.DERIVED_UNIT_GENERAL, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
605
                        | ExpandableComposite.EXPANDED);
624 606

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

  
627
        GatheringEventDetailSection gatheringEventDetailSection = (GatheringEventDetailSection) formFactory.createCdmDetailSection(DetailType.GATHERING_EVENT, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
609
        GatheringEventDetailSection gatheringEventDetailSection = (GatheringEventDetailSection) formFactory
610
                .createCdmDetailSection(DetailType.GATHERING_EVENT, getConversationHolder(), parent, this,
611
                        ExpandableComposite.TWISTIE);
628 612

  
629 613
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
630 614

  
631
        FieldObservationDetailSection fieldObservationDetailSection = (FieldObservationDetailSection) formFactory.createCdmDetailSection(DetailType.FIELD_OBSERVATION, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
615
        FieldObservationDetailSection fieldObservationDetailSection = (FieldObservationDetailSection) formFactory
616
                .createCdmDetailSection(DetailType.FIELD_OBSERVATION, getConversationHolder(), parent, this,
617
                        ExpandableComposite.TWISTIE);
632 618

  
633 619
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
634 620

  
635
        DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = (DerivedUnitBaseDetailSection) formFactory.createCdmDetailSection(DetailType.DERIVED_UNIT, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
621
        DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = (DerivedUnitBaseDetailSection) formFactory
622
                .createCdmDetailSection(DetailType.DERIVED_UNIT, getConversationHolder(), parent, this,
623
                        ExpandableComposite.TWISTIE);
636 624

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

  
639
        DeterminationDetailSection determinationDetailSection = (DeterminationDetailSection) formFactory.createCdmDetailSection(DetailType.DETERMINATION, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
627
        DeterminationDetailSection determinationDetailSection = (DeterminationDetailSection) formFactory
628
                .createCdmDetailSection(DetailType.DETERMINATION, getConversationHolder(), parent, this,
629
                        ExpandableComposite.TWISTIE);
640 630

  
641 631
        addPart(generalDetailSection);
642 632
        addPart(gatheringEventDetailSection);
......
646 636

  
647 637
    }
648 638

  
649
	/**
650
	 * @param rootElement
651
	 */
652
	private void createFeatureDistributionSection(RootElement parent) {
653
		destroySections();
639
    /**
640
     * @param rootElement
641
     */
642
    private void createFeatureDistributionSection(RootElement parent) {
643
        destroySections();
654 644

  
655
		FeatureDistributionDetailSection featureDistributionSection = (FeatureDistributionDetailSection) formFactory
656
				.createCdmDetailSection(DetailType.FEATURE_DISTRIBUTION,
657
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
658
								| ExpandableComposite.EXPANDED);
645
        FeatureDistributionDetailSection featureDistributionSection = (FeatureDistributionDetailSection) formFactory
646
                .createCdmDetailSection(DetailType.FEATURE_DISTRIBUTION, getConversationHolder(), parent, this,
647
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
659 648

  
660
		addPart(featureDistributionSection);
661
	}
649
        addPart(featureDistributionSection);
650
    }
662 651

  
663
	/**
664
	 * createPolytomousKeyNodeSection
665
	 * @param parent
666
	 */
667
	private void createPolytomousKeyNodeSection(RootElement parent) {
668
		destroySections();
652
    /**
653
     * createPolytomousKeyNodeSection
654
     *
655
     * @param parent
656
     */
657
    private void createPolytomousKeyNodeSection(RootElement parent) {
658
        destroySections();
669 659

  
670 660
        PolytomousKeyDetailSection polytomousKeyDetailSection = (PolytomousKeyDetailSection) formFactory
671
                .createCdmDetailSection(DetailType.POLYTOMOUS_KEY,
672
                        getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
673
                               | ExpandableComposite.COMPACT);
661
                .createCdmDetailSection(DetailType.POLYTOMOUS_KEY, getConversationHolder(), parent, this,
662
                        ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
674 663

  
675 664
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
676 665

  
677 666
        PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = (PolytomousKeyNodeDetailSection) formFactory
678
                .createCdmDetailSection(DetailType.POLYTOMOUS_KEY_NODE,
679
                        getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
680
                                | ExpandableComposite.EXPANDED);
667
                .createCdmDetailSection(DetailType.POLYTOMOUS_KEY_NODE, getConversationHolder(), parent, this,
668
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
681 669

  
682 670
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
683 671

  
684
        TaxonomicScopeSection taxonomicScopeSection = (TaxonomicScopeSection) formFactory
685
                .createEntityDetailSection(EntityDetailType.TAXONOMIC_SCOPE,
686
                        getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
687

  
688
	    addPart(polytomousKeyDetailSection);
689
	    addPart(polytomousKeyNodeDetailSection);
690
	    addPart(taxonomicScopeSection);
691

  
692
	}
693

  
694
	/**
695
	 * create the UseRecordSection
696
	 * @param parent
697
	 */
698
	private void createUseRecordSection(RootElement parent) {
699
		destroySections();
700

  
701
		UseRecordDetailSection descriptionUseRecordSection = (UseRecordDetailSection) formFactory
702
				.createCdmDetailSection(DetailType.USE_RECORD,
703
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
704
								| ExpandableComposite.EXPANDED);
705

  
706
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
707

  
708
		addPart(descriptionUseRecordSection);
709

  
710

  
711
	}
712

  
713
	/**
714
	 * createUserSection
715
	 * @param parent
716
	 */
717
	private void createUserSection(RootElement parent) {
718
		destroySections();
719

  
720
		UserDetailSection userDetailSection = (UserDetailSection) formFactory
721
				.createCdmDetailSection(DetailType.USER,
722
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
723
								| ExpandableComposite.EXPANDED);
724

  
725
		GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) formFactory
726
				.createEntityDetailSection(EntityDetailType.GROUPS_BY_USER,
727
						getConversationHolder(), parent, ExpandableComposite.TWISTIE
728
								| ExpandableComposite.EXPANDED);
729

  
730
		addPart(userDetailSection);
731
		addPart(groupByUserDetailSection);
732
	}
733

  
734
	/**
735
	 * createTaxonRelationshipSection
736
	 * @param parent
737
	 */
738
	private void createTaxonRelationshipSection(RootElement parent) {
739
		destroySections();
740

  
741
		TaxonRelationshipDetailSection taxonRelationshipDetailSection = (TaxonRelationshipDetailSection) formFactory
742
				.createCdmDetailSection(DetailType.TAXON_RELATIONSHIP,
743
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
744
								| ExpandableComposite.EXPANDED);
745

  
746
		ReferencedEntityDetailSection referencedEntityBaseDetailSection = (ReferencedEntityDetailSection) formFactory
747
				.createCdmDetailSection(DetailType.REFERENCED_ENTITY,
748
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
749
								| ExpandableComposite.EXPANDED);
750
		addPart(taxonRelationshipDetailSection);
751
		addPart(referencedEntityBaseDetailSection);
752
	}
753

  
754
	/**
755
	 * @param rootElement
756
	 */
757
	private void createTermVocabularySection(RootElement parent) {
758
		destroySections();
759

  
760
		TermVocabularyDetailSection termVocabularyDetailSection = (TermVocabularyDetailSection) formFactory
761
				.createCdmDetailSection(DetailType.TERM_VOCABULARY,
762
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
763
								| ExpandableComposite.EXPANDED);
764
		addPart(termVocabularyDetailSection);
765
	}
766

  
767
	/**
768
	 * createDefinedTermSection
769
	 * @param parent
770
	 */
771
	private void createDefinedTermSection(RootElement parent) {
772
		destroySections();
773

  
774
		AbstractFormSection definedTermDetailSection = formFactory
775
				.createDefinedTermDetailSection(getInput().getClass(),
776
						getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
777
								| ExpandableComposite.EXPANDED);
778
		addPart(definedTermDetailSection);
779
	}
672
        TaxonomicScopeSection taxonomicScopeSection = (TaxonomicScopeSection) formFactory.createEntityDetailSection(
673
                EntityDetailType.TAXONOMIC_SCOPE, getConversationHolder(), parent, ExpandableComposite.TWISTIE
674
                        | ExpandableComposite.COMPACT);
675

  
676
        addPart(polytomousKeyDetailSection);
677
        addPart(polytomousKeyNodeDetailSection);
678
        addPart(taxonomicScopeSection);
679

  
680
    }
681

  
682
    /**
683
     * create the UseRecordSection
684
     *
685
     * @param parent
686
     */
687
    private void createUseRecordSection(RootElement parent) {
688
        destroySections();
689

  
690
        UseRecordDetailSection descriptionUseRecordSection = (UseRecordDetailSection) formFactory
691
                .createCdmDetailSection(DetailType.USE_RECORD, getConversationHolder(), parent, this,
692
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
693

  
694
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
695

  
696
        addPart(descriptionUseRecordSection);
697

  
698
    }
699

  
700
    /**
701
     * createUserSection
702
     *
703
     * @param parent
704
     */
705
    private void createUserSection(RootElement parent) {
706
        destroySections();
707

  
708
        UserDetailSection userDetailSection = (UserDetailSection) formFactory.createCdmDetailSection(DetailType.USER,
709
                getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
710

  
711
        GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) formFactory
712
                .createEntityDetailSection(EntityDetailType.GROUPS_BY_USER, getConversationHolder(), parent,
713
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
714

  
715
        addPart(userDetailSection);
716
        addPart(groupByUserDetailSection);
717
    }
718

  
719
    /**
720
     * createTaxonRelationshipSection
721
     *
722
     * @param parent
723
     */
724
    private void createTaxonRelationshipSection(RootElement parent) {
725
        destroySections();
726

  
727
        TaxonRelationshipDetailSection taxonRelationshipDetailSection = (TaxonRelationshipDetailSection) formFactory
728
                .createCdmDetailSection(DetailType.TAXON_RELATIONSHIP, getConversationHolder(), parent, this,
729
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
730

  
731
        ReferencedEntityDetailSection referencedEntityBaseDetailSection = (ReferencedEntityDetailSection) formFactory
732
                .createCdmDetailSection(DetailType.REFERENCED_ENTITY, getConversationHolder(), parent, this,
733
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
734
        addPart(taxonRelationshipDetailSection);
735
        addPart(referencedEntityBaseDetailSection);
736
    }
737

  
738
    /**
739
     * @param rootElement
740
     */
741
    private void createTermVocabularySection(RootElement parent) {
742
        destroySections();
743

  
744
        TermVocabularyDetailSection termVocabularyDetailSection = (TermVocabularyDetailSection) formFactory
745
                .createCdmDetailSection(DetailType.TERM_VOCABULARY, getConversationHolder(), parent, this,
746
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
747
        addPart(termVocabularyDetailSection);
748
    }
749

  
750
    /**
751
     * createDefinedTermSection
752
     *
753
     * @param parent
754
     */
755
    private void createDefinedTermSection(RootElement parent) {
756
        destroySections();
757

  
758
        AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(
759
                getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
760
                        | ExpandableComposite.EXPANDED);
761
        addPart(definedTermDetailSection);
762
    }
780 763
}

Also available in: Unified diff