2e82a19679280392d70fd2cf582616d8d757cfd8
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / view / detail / DetailsViewer.java
1 // $Id$
2 /**
3 * Copyright (C) 2011 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.taxeditor.view.detail;
12
13 import java.util.Set;
14
15 import org.eclipse.jface.viewers.ISelection;
16 import org.eclipse.jface.viewers.SelectionChangedEvent;
17 import org.eclipse.swt.SWT;
18 import org.eclipse.swt.widgets.Composite;
19 import org.eclipse.ui.forms.widgets.Section;
20
21 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
22 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
23 import eu.etaxonomy.cdm.api.service.ITermService;
24 import eu.etaxonomy.cdm.model.agent.Person;
25 import eu.etaxonomy.cdm.model.agent.Team;
26 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
27 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
28 import eu.etaxonomy.cdm.model.common.Group;
29 import eu.etaxonomy.cdm.model.common.Marker;
30 import eu.etaxonomy.cdm.model.common.MarkerType;
31 import eu.etaxonomy.cdm.model.common.TermVocabulary;
32 import eu.etaxonomy.cdm.model.common.User;
33 import eu.etaxonomy.cdm.model.description.CategoricalData;
34 import eu.etaxonomy.cdm.model.description.DescriptionBase;
35 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
36 import eu.etaxonomy.cdm.model.description.PolytomousKey;
37 import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
38 import eu.etaxonomy.cdm.model.media.Media;
39 import eu.etaxonomy.cdm.model.name.NonViralName;
40 import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
41 import eu.etaxonomy.cdm.model.reference.Reference;
42 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
43 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
44
45 import eu.etaxonomy.taxeditor.editor.UsageTermCollection;
46 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
47 import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
48 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
49 import eu.etaxonomy.taxeditor.store.CdmStore;
50 import eu.etaxonomy.taxeditor.store.StoreUtil;
51 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
52 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType;
53 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType;
54 import eu.etaxonomy.taxeditor.ui.element.RootElement;
55 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
56 import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
57 import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
58 import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
59 import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
60 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
61 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
62 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
63 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
64 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
65 import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
66 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
67 import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
68 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
69 import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
70 import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
71 import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
72 import eu.etaxonomy.taxeditor.ui.section.key.GeographicalScopeDetailSection;
73 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
74 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
75 import eu.etaxonomy.taxeditor.ui.section.key.ScopeRestrictionSection;
76 import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
77 import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
78 import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
79 import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
80 import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
81 import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
82 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
83 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
84 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationDetailSection;
85 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
86 import eu.etaxonomy.taxeditor.ui.section.occurrence.GeneralDetailSection;
87 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
88 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
89 import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
90 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
91 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
92 import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
93 import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
94 import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
95 import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
96 import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
97 import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
98
99 /**
100 * <p>
101 * DetailsViewer class.
102 * </p>
103 *
104 * @author n.hoffmann
105 * @created Feb 12, 2010
106 * @version 1.0
107 */
108 public class DetailsViewer extends AbstractCdmDataViewer {
109
110 private ISelection selection;
111
112 /**
113 * <p>
114 * Constructor for DetailsViewer.
115 * </p>
116 *
117 * @param parent
118 * a {@link org.eclipse.swt.widgets.Composite} object.
119 * @param viewPart
120 * a {@link eu.etaxonomy.taxeditor.view.AbstractCdmViewPart}
121 * object.
122 */
123 public DetailsViewer(Composite parent, AbstractCdmViewPart viewPart) {
124 super(parent, viewPart);
125 }
126
127 // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
128 // since we are getting implementations of DerivedUnitBase from the bulk
129 // editor
130 // and not derived unit facade objects,
131
132 /*
133 * (non-Javadoc)
134 *
135 * @see
136 * eu.etaxonomy.taxeditor.editor.view.AbstractCdmDataViewer#setInput(java
137 * .lang.Object)
138 */
139 @Override
140 public void setInput(Object input) {
141 if (input instanceof DerivedUnitBase) {
142 try {
143 input = DerivedUnitFacade.NewInstance((DerivedUnitBase) input,
144 PreferencesUtil.getDerivedUnitConfigurator());
145 } catch (DerivedUnitFacadeNotSupportedException e) {
146 StoreUtil.error(getClass(), e);
147 }
148 }
149 super.setInput(input);
150 }
151
152 @Override
153 protected void markViewPartDirty() {
154 if (getInput() instanceof DerivedUnitFacade) {
155 getViewPart().changed(
156 ((DerivedUnitFacade) getInput()).innerDerivedUnit());
157 }
158
159 super.markViewPartDirty();
160 }
161
162 // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
163
164 /*
165 * (non-Javadoc)
166 *
167 * @see org.eclipse.jface.viewers.Viewer#refresh()
168 */
169 /** {@inheritDoc} */
170 @Override
171 protected void showParts() {
172 if (getInput() instanceof TaxonBase) {
173 createTaxonSections(rootElement);
174
175 } else if (getInput() instanceof NonViralName) {
176 createNameSections(rootElement);
177
178 } else if (getInput() instanceof Reference) {
179 createReferenceSections(rootElement);
180
181 } else if (getInput() instanceof Team) {
182 createTeamDetailSection(rootElement);
183
184 } else if (getInput() instanceof Person) {
185 createPersonDetailSection(rootElement);
186
187 } else if (getInput() instanceof TeamOrPersonBase) {
188 createTeamOrPersonBaseDetailSection(rootElement);
189
190 } else if (getInput() instanceof DescriptionBase) {
191 Set<Marker> descriptionMarkers = ((DescriptionBase) getInput()).getMarkers();
192 MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType);
193 Boolean isUseDescription = false;
194 for (Marker marker : descriptionMarkers) {
195 if (marker.getMarkerType().equals(useMarkertype)) {
196 isUseDescription = true;
197 }
198 }
199 if (((DescriptionBase) getInput()).isImageGallery()) {
200 createImageGallerySection(rootElement);
201
202 } else if (isUseDescription) {
203 createUseDescriptionSection(rootElement);
204 } else {
205 createDescriptionSection(rootElement);
206
207 }
208 } else if (getInput() instanceof DescriptionElementBase) {
209 Set<Marker> descriptionMarkers = ((DescriptionElementBase) getInput()).getInDescription().getMarkers();
210 MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType);
211 Boolean isUseDescription = false;
212 for (Marker marker : descriptionMarkers) {
213 if (marker.getMarkerType().equals(useMarkertype)) {
214 isUseDescription = true;
215 }
216 }
217
218 if (isUseDescription == true && getInput() instanceof CategoricalData ) {
219 createUseRecordSection(rootElement);
220 }
221 else {
222 createDescriptionElementSection(rootElement);
223 }
224
225 } else if (getInput() instanceof Media) {
226 createMediaElementSection(rootElement);
227
228 } else if (getInput() instanceof DerivedUnitFacade) {
229 createDerivedUnitBaseElementSection(rootElement);
230
231 } else if (getInput() instanceof FeatureNodeContainer) {
232 createFeatureDistributionSection(rootElement);
233
234 } else if (getInput() instanceof PolytomousKey) {
235 createPolytomousKeySection(rootElement);
236
237 } else if ((getInput() instanceof PolytomousKeyNode)
238 || (getInput() instanceof PolytomousKeyRelationship)) {
239 createPolytomousKeyNodeSection(rootElement);
240
241 } else if (getInput() instanceof User) {
242 createUserSection(rootElement);
243
244 } else if (getInput() instanceof Group) {
245 createGroupSection(rootElement);
246
247 } else if (getInput() instanceof TaxonRelationship) {
248 createTaxonRelationshipSection(rootElement);
249
250 } else if (getInput() instanceof TermVocabulary) {
251 createTermVocabularySection(rootElement);
252
253 } else if (getInput() instanceof DefinedTermBase) {
254 createDefinedTermSection(rootElement);
255 } else {
256 destroySections();
257 }
258 layout();
259 }
260
261
262 /**
263 * @param rootElement
264 */
265 private void createGroupSection(RootElement parent) {
266 destroySections();
267
268 GroupDetailSection groupDetailSection = (GroupDetailSection) formFactory
269 .createCdmDetailSection(DetailType.GROUP,
270 getConversationHolder(), parent, this, Section.TWISTIE
271 | Section.EXPANDED);
272 MemberDetailSection memberDetailSection = (MemberDetailSection) formFactory
273 .createEntityDetailSection(EntityDetailType.MEMBER,
274 getConversationHolder(), parent, Section.TWISTIE
275 | Section.EXPANDED);
276 GrantedAuthorityDetailSection grantedAuthorityDetailSection = (GrantedAuthorityDetailSection) formFactory
277 .createEntityDetailSection(EntityDetailType.GRANTED_AUTHORITY,
278 getConversationHolder(), parent, Section.TWISTIE
279 | Section.EXPANDED);
280
281 addPart(groupDetailSection);
282 addPart(memberDetailSection);
283 addPart(grantedAuthorityDetailSection);
284 }
285
286 /*
287 * (non-Javadoc)
288 *
289 * @see org.eclipse.jface.viewers.Viewer#getSelection()
290 */
291 /** {@inheritDoc} */
292 @Override
293 public ISelection getSelection() {
294 return selection;
295 }
296
297 /*
298 * (non-Javadoc)
299 *
300 * @see
301 * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
302 * .ISelection, boolean)
303 */
304 /** {@inheritDoc} */
305 @Override
306 public void setSelection(ISelection selection, boolean reveal) {
307 this.selection = selection;
308 SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(
309 this, selection);
310 fireSelectionChanged(selectionChangedEvent);
311 }
312
313 /**
314 * createTaxonSections(RootElement parent)
315 * @param parent
316 */
317 private void createTaxonSections(RootElement parent) {
318 destroySections();
319
320 TaxonBaseDetailSection taxonBaseDetailSection = (TaxonBaseDetailSection) formFactory
321 .createCdmDetailSection(DetailType.TAXONBASE,
322 getConversationHolder(), parent, this, Section.TWISTIE);
323
324 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
325
326 NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
327 .createCdmDetailSection(DetailType.NONVIRALNAME,
328 getConversationHolder(), parent, this, Section.TWISTIE
329 | Section.EXPANDED);
330
331 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
332
333 NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
334 .createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
335 getConversationHolder(), parent, this, Section.TWISTIE);
336
337 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
338
339 NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
340 .createEntityDetailSection(
341 EntityDetailType.NOMENCLATURALSTATUS,
342 getConversationHolder(), parent, Section.TWISTIE);
343
344 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
345
346 ProtologueSection protologSection = (ProtologueSection) formFactory
347 .createEntityDetailSection(EntityDetailType.PROTOLOG,
348 getConversationHolder(), parent, Section.TWISTIE);
349
350 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
351
352 TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
353 .createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
354 getConversationHolder(), parent, Section.TWISTIE);
355
356 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
357
358 NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
359 .createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
360 getConversationHolder(), parent, Section.TWISTIE);
361
362 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
363
364 ParsingMessagesSection parsingMessagesSection = (ParsingMessagesSection) formFactory
365 .createCdmDetailSection(DetailType.PARSINGMESSAGE,
366 getConversationHolder(), parent, this, Section.EXPANDED);
367
368 addPart(taxonBaseDetailSection);
369 addPart(nonViralNameSection);
370 addPart(nomenclaturalStatusSection);
371 addPart(protologSection);
372 addPart(referenceDetailSection);
373 addPart(typeDesignationSection);
374 addPart(nameRelationshipSection);
375 addPart(parsingMessagesSection);
376 }
377
378 /**
379 * createNameSections
380 * @param parent
381 */
382 private void createNameSections(RootElement parent) {
383 destroySections();
384 NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
385 .createCdmDetailSection(DetailType.NONVIRALNAME,
386 getConversationHolder(), parent, this, Section.TWISTIE
387 | Section.EXPANDED);
388
389 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
390
391 NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
392 .createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
393 getConversationHolder(), parent, this, Section.TWISTIE);
394
395 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
396
397 NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
398 .createEntityDetailSection(
399 EntityDetailType.NOMENCLATURALSTATUS,
400 getConversationHolder(), parent, Section.TWISTIE);
401
402 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
403
404 ProtologueSection protologSection = (ProtologueSection) formFactory
405 .createEntityDetailSection(EntityDetailType.PROTOLOG,
406 getConversationHolder(), parent, Section.TWISTIE);
407
408 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
409
410 TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
411 .createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
412 getConversationHolder(), parent, Section.TWISTIE);
413
414 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
415
416 NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
417 .createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
418 getConversationHolder(), parent, Section.TWISTIE);
419
420 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
421
422 addPart(nonViralNameSection);
423 addPart(nomenclaturalStatusSection);
424 addPart(protologSection);
425 addPart(referenceDetailSection);
426 addPart(typeDesignationSection);
427 addPart(nameRelationshipSection);
428 }
429
430 /**
431 * createReferenceSections
432 * @param parent
433 */
434 private void createReferenceSections(RootElement parent) {
435 destroySections();
436
437 ReferenceDetailSection referenceDetailSection = (ReferenceDetailSection) formFactory
438 .createCdmDetailSection(DetailType.REFERENCEBASE,
439 getConversationHolder(), parent, this, Section.TWISTIE
440 | Section.EXPANDED);
441
442 addPart(referenceDetailSection);
443 }
444
445 /**
446 * createTeamOrPersonBaseDetailSection
447 * @param parent
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 /**
460 * createTeamDetailSection
461 * @param parent
462 */
463 private void createTeamDetailSection(RootElement parent) {
464 destroySections();
465 TeamDetailSection teamDetailSection = (TeamDetailSection) formFactory
466 .createCdmDetailSection(DetailType.TEAM,
467 getConversationHolder(), parent, this, Section.TWISTIE
468 | Section.EXPANDED);
469
470 addPart(teamDetailSection);
471 }
472
473 /**
474 * createPersonDetailSection
475 * @param parent
476 */
477 private void createPersonDetailSection(RootElement parent) {
478 destroySections();
479 PersonDetailSection personDetailSection = (PersonDetailSection) formFactory
480 .createCdmDetailSection(DetailType.PERSON,
481 getConversationHolder(), parent, this, Section.TWISTIE
482 | Section.EXPANDED);
483 addPart(personDetailSection);
484 }
485
486 /**
487 * createDescriptionElementSection
488 * @param parent
489 */
490 private void createDescriptionElementSection(RootElement parent) {
491 destroySections();
492
493 DescriptionElementDetailSection descriptionElementDetailSection = (DescriptionElementDetailSection) formFactory
494 .createCdmDetailSection(DetailType.DESCRIPTIONELEMENT,
495 getConversationHolder(), parent, this, Section.TWISTIE
496 | Section.EXPANDED);
497
498 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
499
500 DescriptionElementSourceSection descriptionElementSourceSection = (DescriptionElementSourceSection) formFactory
501 .createEntityDetailSection(
502 EntityDetailType.DESCRIPTIONELEMENTSOURCE,
503 getConversationHolder(), parent, Section.TWISTIE);
504
505 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
506
507 DescriptionElementMediaSection descriptionElementMediaSection = (DescriptionElementMediaSection) formFactory
508 .createEntityDetailSection(
509 EntityDetailType.DESCRIPTIONELEMENTMEDIA,
510 getConversationHolder(), parent, Section.TWISTIE);
511
512 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
513
514 addPart(descriptionElementDetailSection);
515 addPart(descriptionElementSourceSection);
516 addPart(descriptionElementMediaSection);
517 }
518
519 /**
520 * createDescriptionSection
521 * @param parent
522 */
523 private void createDescriptionSection(RootElement parent) {
524 destroySections();
525 DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
526 .createCdmDetailSection(DetailType.DESCRIPTION,
527 getConversationHolder(), parent, this, Section.TWISTIE
528 | Section.EXPANDED);
529
530 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
531
532 NaturalLanguageSection naturalLanguageSection = (NaturalLanguageSection) formFactory
533 .createCdmDetailSection(DetailType.NATURAL_LANGUAGE,
534 getConversationHolder(), parent, this, Section.TWISTIE
535 | Section.EXPANDED);
536
537 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
538
539 DescribedSpecimenSection describedSpecimenSection = (DescribedSpecimenSection) formFactory
540 .createEntityDetailSection(EntityDetailType.DESCRIBED_SPECIMEN,
541 getConversationHolder(), parent, Section.TWISTIE);
542
543 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
544
545 DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
546 .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
547 getConversationHolder(), parent, Section.TWISTIE);
548
549 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
550
551 ScopeSection scopeSection = (ScopeSection) formFactory
552 .createEntityDetailSection(EntityDetailType.SCOPE,
553 getConversationHolder(), parent, Section.TWISTIE);
554
555 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
556
557 addPart(descriptionDetailSection);
558 addPart(naturalLanguageSection);
559 addPart(describedSpecimenSection);
560 addPart(descriptionSourceSection);
561 addPart(scopeSection);
562 }
563
564 /**
565 * Creates the use Description section
566 * @param parent
567 */
568 private void createUseDescriptionSection(RootElement parent) {
569 destroySections();
570 DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
571 .createCdmDetailSection(DetailType.DESCRIPTION,
572 getConversationHolder(), parent, this, Section.TWISTIE
573 | Section.EXPANDED);
574
575 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
576
577 DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
578 .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
579 getConversationHolder(), parent, Section.TWISTIE
580 | Section.EXPANDED);
581
582 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
583
584 addPart(descriptionDetailSection);
585 addPart(descriptionSourceSection);
586
587 }
588
589
590 /**
591 * @param rootElement
592 */
593 private void createImageGallerySection(RootElement parent) {
594 destroySections();
595 DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
596 .createCdmDetailSection(DetailType.DESCRIPTION,
597 getConversationHolder(), parent, this, Section.TWISTIE
598 | Section.EXPANDED);
599
600 addPart(descriptionDetailSection);
601 }
602
603 /**
604 * createMediaElementSection
605 * @param parent
606 */
607
608 private void createMediaElementSection(RootElement parent) {
609 destroySections();
610 MediaDetailsSection mediaDetailSection = (MediaDetailsSection) formFactory
611 .createCdmDetailSection(DetailType.MEDIA,
612 getConversationHolder(), parent, this, Section.TWISTIE
613 | Section.EXPANDED);
614
615 addPart(mediaDetailSection);
616 }
617
618 /**
619 * createDerivedUnitBaseElementSection
620 * @param parent
621 */
622 private void createDerivedUnitBaseElementSection(RootElement parent) {
623 destroySections();
624
625 GeneralDetailSection generalDetailSection = (GeneralDetailSection) formFactory
626 .createCdmDetailSection(DetailType.DERIVED_UNIT_GENERAL,
627 getConversationHolder(), parent, this, Section.TWISTIE
628 | Section.EXPANDED);
629
630 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
631
632 GatheringEventDetailSection gatheringEventDetailSection = (GatheringEventDetailSection) formFactory
633 .createCdmDetailSection(DetailType.GATHERING_EVENT,
634 getConversationHolder(), parent, this, Section.TWISTIE);
635
636 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
637
638 FieldObservationDetailSection fieldObservationDetailSection = (FieldObservationDetailSection) formFactory
639 .createCdmDetailSection(DetailType.FIELD_OBSERVATION,
640 getConversationHolder(), parent, this, Section.TWISTIE);
641
642 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
643
644 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = (DerivedUnitBaseDetailSection) formFactory
645 .createCdmDetailSection(DetailType.DERIVED_UNIT,
646 getConversationHolder(), parent, this, Section.TWISTIE);
647
648 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
649
650 DeterminationDetailSection determinationDetailSection = (DeterminationDetailSection) formFactory
651 .createCdmDetailSection(DetailType.DETERMINATION,
652 getConversationHolder(), parent, this, Section.TWISTIE);
653
654 addPart(generalDetailSection);
655 addPart(gatheringEventDetailSection);
656 addPart(fieldObservationDetailSection);
657 addPart(derivedUnitBaseDetailSection);
658 addPart(determinationDetailSection);
659
660 }
661
662 /**
663 * @param rootElement
664 */
665 private void createFeatureDistributionSection(RootElement parent) {
666 destroySections();
667
668 FeatureDistributionDetailSection featureDistributionSection = (FeatureDistributionDetailSection) formFactory
669 .createCdmDetailSection(DetailType.FEATURE_DISTRIBUTION,
670 getConversationHolder(), parent, this, Section.TWISTIE
671 | Section.EXPANDED);
672
673 addPart(featureDistributionSection);
674 }
675
676 private void createPolytomousKeySection(RootElement parent) {
677 destroySections();
678
679 PolytomousKeyDetailSection polytomousKeyDetailSection = (PolytomousKeyDetailSection) formFactory
680 .createCdmDetailSection(DetailType.POLYTOMOUS_KEY,
681 getConversationHolder(), parent, this, Section.TWISTIE
682 | Section.EXPANDED);
683
684 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
685
686 GeographicalScopeDetailSection geographicalScopeDetailSection = (GeographicalScopeDetailSection) formFactory
687 .createEntityDetailSection(EntityDetailType.GEOGRAPHICAL_SCOPE,
688 getConversationHolder(), parent, Section.TWISTIE);
689
690 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
691
692 ScopeRestrictionSection scopeRestrictionSection = (ScopeRestrictionSection) formFactory
693 .createEntityDetailSection(EntityDetailType.SCOPE_RESTRICTION,
694 getConversationHolder(), parent, Section.TWISTIE);
695
696 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
697
698 TaxonomicScopeSection taxonomicScopeSection = (TaxonomicScopeSection) formFactory
699 .createEntityDetailSection(EntityDetailType.TAXONOMIC_SCOPE,
700 getConversationHolder(), parent, Section.TWISTIE);
701
702 addPart(polytomousKeyDetailSection);
703 addPart(geographicalScopeDetailSection);
704 addPart(scopeRestrictionSection);
705 addPart(taxonomicScopeSection);
706 }
707
708 /**
709 * createPolytomousKeyNodeSection
710 * @param parent
711 */
712 private void createPolytomousKeyNodeSection(RootElement parent) {
713 destroySections();
714
715 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = (PolytomousKeyNodeDetailSection) formFactory
716 .createCdmDetailSection(DetailType.POLYTOMOUS_KEY_NODE,
717 getConversationHolder(), parent, this, Section.TWISTIE
718 | Section.EXPANDED);
719
720 addPart(polytomousKeyNodeDetailSection);
721 }
722
723 /**
724 * create the UseRecordSection
725 * @param parent
726 */
727 private void createUseRecordSection(RootElement parent) {
728 destroySections();
729
730 UseRecordDetailSection descriptionUseRecordSection = (UseRecordDetailSection) formFactory
731 .createCdmDetailSection(DetailType.USE_RECORD,
732 getConversationHolder(), parent, this, Section.TWISTIE
733 | Section.EXPANDED);
734
735 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
736
737 addPart(descriptionUseRecordSection);
738
739
740 }
741
742 /**
743 * createUserSection
744 * @param parent
745 */
746 private void createUserSection(RootElement parent) {
747 destroySections();
748
749 UserDetailSection userDetailSection = (UserDetailSection) formFactory
750 .createCdmDetailSection(DetailType.USER,
751 getConversationHolder(), parent, this, Section.TWISTIE
752 | Section.EXPANDED);
753
754 GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) formFactory
755 .createEntityDetailSection(EntityDetailType.GROUPS_BY_USER,
756 getConversationHolder(), parent, Section.TWISTIE
757 | Section.EXPANDED);
758
759 addPart(userDetailSection);
760 addPart(groupByUserDetailSection);
761 }
762
763 /**
764 * createTaxonRelationshipSection
765 * @param parent
766 */
767 private void createTaxonRelationshipSection(RootElement parent) {
768 destroySections();
769
770 TaxonRelationshipDetailSection taxonRelationshipDetailSection = (TaxonRelationshipDetailSection) formFactory
771 .createCdmDetailSection(DetailType.TAXON_RELATIONSHIP,
772 getConversationHolder(), parent, this, Section.TWISTIE
773 | Section.EXPANDED);
774
775 ReferencedEntityDetailSection referencedEntityBaseDetailSection = (ReferencedEntityDetailSection) formFactory
776 .createCdmDetailSection(DetailType.REFERENCED_ENTITY,
777 getConversationHolder(), parent, this, Section.TWISTIE
778 | Section.EXPANDED);
779 addPart(taxonRelationshipDetailSection);
780 addPart(referencedEntityBaseDetailSection);
781 }
782
783 /**
784 * @param rootElement
785 */
786 private void createTermVocabularySection(RootElement parent) {
787 destroySections();
788
789 TermVocabularyDetailSection termVocabularyDetailSection = (TermVocabularyDetailSection) formFactory
790 .createCdmDetailSection(DetailType.TERM_VOCABULARY,
791 getConversationHolder(), parent, this, Section.TWISTIE
792 | Section.EXPANDED);
793 addPart(termVocabularyDetailSection);
794 }
795
796 /**
797 * createDefinedTermSection
798 * @param parent
799 */
800 private void createDefinedTermSection(RootElement parent) {
801 destroySections();
802
803 AbstractFormSection definedTermDetailSection = formFactory
804 .createDefinedTermDetailSection(getInput().getClass(),
805 getConversationHolder(), parent, this, Section.TWISTIE
806 | Section.EXPANDED);
807 addPart(definedTermDetailSection);
808 }
809 }