AT: committing latest changes to the Tax Editor to fix the issue with the description...
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / view / detail / DetailsViewer.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.taxeditor.view.detail;
12
13 import java.util.Set;
14 import java.util.UUID;
15
16 import org.eclipse.jface.viewers.ISelection;
17 import org.eclipse.jface.viewers.SelectionChangedEvent;
18 import org.eclipse.swt.SWT;
19 import org.eclipse.swt.widgets.Composite;
20 import org.eclipse.ui.forms.widgets.Section;
21
22 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
23 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
24 import eu.etaxonomy.cdm.api.service.ITermService;
25 import eu.etaxonomy.cdm.model.agent.Person;
26 import eu.etaxonomy.cdm.model.agent.Team;
27 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
28 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
29 import eu.etaxonomy.cdm.model.common.Group;
30 import eu.etaxonomy.cdm.model.common.Marker;
31 import eu.etaxonomy.cdm.model.common.MarkerType;
32 import eu.etaxonomy.cdm.model.common.TermVocabulary;
33 import eu.etaxonomy.cdm.model.common.User;
34 import eu.etaxonomy.cdm.model.description.CategoricalData;
35 import eu.etaxonomy.cdm.model.description.DescriptionBase;
36 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
37 import eu.etaxonomy.cdm.model.description.PolytomousKey;
38 import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
39 import eu.etaxonomy.cdm.model.description.TextData;
40 import eu.etaxonomy.cdm.model.media.Media;
41 import eu.etaxonomy.cdm.model.name.NonViralName;
42 import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
43 import eu.etaxonomy.cdm.model.reference.Reference;
44 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
45 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
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.group.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(UUID.fromString("2e6e42d9-e92a-41f4-899b-03c0ac64f039"));
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(UUID.fromString("2e6e42d9-e92a-41f4-899b-03c0ac64f039"));
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 private void createTaxonSections(RootElement parent) {
314 destroySections();
315
316 TaxonBaseDetailSection taxonBaseDetailSection = (TaxonBaseDetailSection) formFactory
317 .createCdmDetailSection(DetailType.TAXONBASE,
318 getConversationHolder(), parent, this, Section.TWISTIE);
319
320 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
321
322 NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
323 .createCdmDetailSection(DetailType.NONVIRALNAME,
324 getConversationHolder(), parent, this, Section.TWISTIE
325 | Section.EXPANDED);
326
327 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
328
329 NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
330 .createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
331 getConversationHolder(), parent, this, Section.TWISTIE);
332
333 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
334
335 NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
336 .createEntityDetailSection(
337 EntityDetailType.NOMENCLATURALSTATUS,
338 getConversationHolder(), parent, Section.TWISTIE);
339
340 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
341
342 ProtologueSection protologSection = (ProtologueSection) formFactory
343 .createEntityDetailSection(EntityDetailType.PROTOLOG,
344 getConversationHolder(), parent, Section.TWISTIE);
345
346 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
347
348 TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
349 .createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
350 getConversationHolder(), parent, Section.TWISTIE);
351
352 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
353
354 NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
355 .createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
356 getConversationHolder(), parent, Section.TWISTIE);
357
358 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
359
360 ParsingMessagesSection parsingMessagesSection = (ParsingMessagesSection) formFactory
361 .createCdmDetailSection(DetailType.PARSINGMESSAGE,
362 getConversationHolder(), parent, this, Section.EXPANDED);
363
364 addPart(taxonBaseDetailSection);
365 addPart(nonViralNameSection);
366 addPart(nomenclaturalStatusSection);
367 addPart(protologSection);
368 addPart(referenceDetailSection);
369 addPart(typeDesignationSection);
370 addPart(nameRelationshipSection);
371 addPart(parsingMessagesSection);
372 }
373
374 private void createNameSections(RootElement parent) {
375 destroySections();
376 NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
377 .createCdmDetailSection(DetailType.NONVIRALNAME,
378 getConversationHolder(), parent, this, Section.TWISTIE
379 | Section.EXPANDED);
380
381 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
382
383 NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
384 .createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
385 getConversationHolder(), parent, this, Section.TWISTIE);
386
387 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
388
389 NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
390 .createEntityDetailSection(
391 EntityDetailType.NOMENCLATURALSTATUS,
392 getConversationHolder(), parent, Section.TWISTIE);
393
394 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
395
396 ProtologueSection protologSection = (ProtologueSection) formFactory
397 .createEntityDetailSection(EntityDetailType.PROTOLOG,
398 getConversationHolder(), parent, Section.TWISTIE);
399
400 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
401
402 TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
403 .createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
404 getConversationHolder(), parent, Section.TWISTIE);
405
406 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
407
408 NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
409 .createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
410 getConversationHolder(), parent, Section.TWISTIE);
411
412 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
413
414 addPart(nonViralNameSection);
415 addPart(nomenclaturalStatusSection);
416 addPart(protologSection);
417 addPart(referenceDetailSection);
418 addPart(typeDesignationSection);
419 addPart(nameRelationshipSection);
420 }
421
422 private void createReferenceSections(RootElement parent) {
423 destroySections();
424
425 ReferenceDetailSection referenceDetailSection = (ReferenceDetailSection) formFactory
426 .createCdmDetailSection(DetailType.REFERENCEBASE,
427 getConversationHolder(), parent, this, Section.TWISTIE
428 | Section.EXPANDED);
429
430 addPart(referenceDetailSection);
431 }
432
433 private void createTeamOrPersonBaseDetailSection(RootElement parent) {
434 destroySections();
435 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = (TeamOrPersonBaseDetailSection) formFactory
436 .createCdmDetailSection(DetailType.TEAMORPERSONBASE,
437 getConversationHolder(), parent, this, Section.TWISTIE
438 | Section.EXPANDED);
439
440 addPart(teamOrPersonBaseDetailSection);
441 }
442
443 private void createTeamDetailSection(RootElement parent) {
444 destroySections();
445 TeamDetailSection teamDetailSection = (TeamDetailSection) formFactory
446 .createCdmDetailSection(DetailType.TEAM,
447 getConversationHolder(), parent, this, Section.TWISTIE
448 | Section.EXPANDED);
449
450 addPart(teamDetailSection);
451 }
452
453 private void createPersonDetailSection(RootElement parent) {
454 destroySections();
455 PersonDetailSection personDetailSection = (PersonDetailSection) formFactory
456 .createCdmDetailSection(DetailType.PERSON,
457 getConversationHolder(), parent, this, Section.TWISTIE
458 | Section.EXPANDED);
459 addPart(personDetailSection);
460 }
461
462 private void createDescriptionElementSection(RootElement parent) {
463 destroySections();
464
465 DescriptionElementDetailSection descriptionElementDetailSection = (DescriptionElementDetailSection) formFactory
466 .createCdmDetailSection(DetailType.DESCRIPTIONELEMENT,
467 getConversationHolder(), parent, this, Section.TWISTIE
468 | Section.EXPANDED);
469
470 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
471
472 DescriptionElementSourceSection descriptionElementSourceSection = (DescriptionElementSourceSection) formFactory
473 .createEntityDetailSection(
474 EntityDetailType.DESCRIPTIONELEMENTSOURCE,
475 getConversationHolder(), parent, Section.TWISTIE);
476
477 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
478
479 DescriptionElementMediaSection descriptionElementMediaSection = (DescriptionElementMediaSection) formFactory
480 .createEntityDetailSection(
481 EntityDetailType.DESCRIPTIONELEMENTMEDIA,
482 getConversationHolder(), parent, Section.TWISTIE);
483
484 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
485
486 addPart(descriptionElementDetailSection);
487 addPart(descriptionElementSourceSection);
488 addPart(descriptionElementMediaSection);
489 }
490
491 private void createDescriptionSection(RootElement parent) {
492 destroySections();
493 DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
494 .createCdmDetailSection(DetailType.DESCRIPTION,
495 getConversationHolder(), parent, this, Section.TWISTIE
496 | Section.EXPANDED);
497
498 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
499
500 NaturalLanguageSection naturalLanguageSection = (NaturalLanguageSection) formFactory
501 .createCdmDetailSection(DetailType.NATURAL_LANGUAGE,
502 getConversationHolder(), parent, this, Section.TWISTIE
503 | Section.EXPANDED);
504
505 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
506
507 DescribedSpecimenSection describedSpecimenSection = (DescribedSpecimenSection) formFactory
508 .createEntityDetailSection(EntityDetailType.DESCRIBED_SPECIMEN,
509 getConversationHolder(), parent, Section.TWISTIE);
510
511 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
512
513 DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
514 .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
515 getConversationHolder(), parent, Section.TWISTIE);
516
517 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
518
519 ScopeSection scopeSection = (ScopeSection) formFactory
520 .createEntityDetailSection(EntityDetailType.SCOPE,
521 getConversationHolder(), parent, Section.TWISTIE);
522
523 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
524
525 addPart(descriptionDetailSection);
526 addPart(naturalLanguageSection);
527 addPart(describedSpecimenSection);
528 addPart(descriptionSourceSection);
529 addPart(scopeSection);
530 }
531
532 private void createUseDescriptionSection(RootElement parent) {
533 destroySections();
534 DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
535 .createCdmDetailSection(DetailType.DESCRIPTION,
536 getConversationHolder(), parent, this, Section.TWISTIE
537 | Section.EXPANDED);
538
539 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
540
541 DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
542 .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
543 getConversationHolder(), parent, Section.TWISTIE
544 | Section.EXPANDED);
545
546 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
547
548 addPart(descriptionDetailSection);
549 addPart(descriptionSourceSection);
550
551 }
552
553
554 /**
555 * @param rootElement
556 */
557 private void createImageGallerySection(RootElement parent) {
558 destroySections();
559 DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
560 .createCdmDetailSection(DetailType.DESCRIPTION,
561 getConversationHolder(), parent, this, Section.TWISTIE
562 | Section.EXPANDED);
563
564 addPart(descriptionDetailSection);
565 }
566
567 private void createMediaElementSection(RootElement parent) {
568 destroySections();
569 MediaDetailsSection mediaDetailSection = (MediaDetailsSection) formFactory
570 .createCdmDetailSection(DetailType.MEDIA,
571 getConversationHolder(), parent, this, Section.TWISTIE
572 | Section.EXPANDED);
573
574 addPart(mediaDetailSection);
575 }
576
577 private void createDerivedUnitBaseElementSection(RootElement parent) {
578 destroySections();
579
580 GeneralDetailSection generalDetailSection = (GeneralDetailSection) formFactory
581 .createCdmDetailSection(DetailType.DERIVED_UNIT_GENERAL,
582 getConversationHolder(), parent, this, Section.TWISTIE
583 | Section.EXPANDED);
584
585 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
586
587 GatheringEventDetailSection gatheringEventDetailSection = (GatheringEventDetailSection) formFactory
588 .createCdmDetailSection(DetailType.GATHERING_EVENT,
589 getConversationHolder(), parent, this, Section.TWISTIE);
590
591 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
592
593 FieldObservationDetailSection fieldObservationDetailSection = (FieldObservationDetailSection) formFactory
594 .createCdmDetailSection(DetailType.FIELD_OBSERVATION,
595 getConversationHolder(), parent, this, Section.TWISTIE);
596
597 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
598
599 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = (DerivedUnitBaseDetailSection) formFactory
600 .createCdmDetailSection(DetailType.DERIVED_UNIT,
601 getConversationHolder(), parent, this, Section.TWISTIE);
602
603 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
604
605 DeterminationDetailSection determinationDetailSection = (DeterminationDetailSection) formFactory
606 .createCdmDetailSection(DetailType.DETERMINATION,
607 getConversationHolder(), parent, this, Section.TWISTIE);
608
609 addPart(generalDetailSection);
610 addPart(gatheringEventDetailSection);
611 addPart(fieldObservationDetailSection);
612 addPart(derivedUnitBaseDetailSection);
613 addPart(determinationDetailSection);
614
615 }
616
617 /**
618 * @param rootElement
619 */
620 private void createFeatureDistributionSection(RootElement parent) {
621 destroySections();
622
623 FeatureDistributionDetailSection featureDistributionSection = (FeatureDistributionDetailSection) formFactory
624 .createCdmDetailSection(DetailType.FEATURE_DISTRIBUTION,
625 getConversationHolder(), parent, this, Section.TWISTIE
626 | Section.EXPANDED);
627
628 addPart(featureDistributionSection);
629 }
630
631 private void createPolytomousKeySection(RootElement parent) {
632 destroySections();
633
634 PolytomousKeyDetailSection polytomousKeyDetailSection = (PolytomousKeyDetailSection) formFactory
635 .createCdmDetailSection(DetailType.POLYTOMOUS_KEY,
636 getConversationHolder(), parent, this, Section.TWISTIE
637 | Section.EXPANDED);
638
639 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
640
641 GeographicalScopeDetailSection geographicalScopeDetailSection = (GeographicalScopeDetailSection) formFactory
642 .createEntityDetailSection(EntityDetailType.GEOGRAPHICAL_SCOPE,
643 getConversationHolder(), parent, Section.TWISTIE);
644
645 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
646
647 ScopeRestrictionSection scopeRestrictionSection = (ScopeRestrictionSection) formFactory
648 .createEntityDetailSection(EntityDetailType.SCOPE_RESTRICTION,
649 getConversationHolder(), parent, Section.TWISTIE);
650
651 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
652
653 TaxonomicScopeSection taxonomicScopeSection = (TaxonomicScopeSection) formFactory
654 .createEntityDetailSection(EntityDetailType.TAXONOMIC_SCOPE,
655 getConversationHolder(), parent, Section.TWISTIE);
656
657 addPart(polytomousKeyDetailSection);
658 addPart(geographicalScopeDetailSection);
659 addPart(scopeRestrictionSection);
660 addPart(taxonomicScopeSection);
661 }
662
663 private void createPolytomousKeyNodeSection(RootElement parent) {
664 destroySections();
665
666 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = (PolytomousKeyNodeDetailSection) formFactory
667 .createCdmDetailSection(DetailType.POLYTOMOUS_KEY_NODE,
668 getConversationHolder(), parent, this, Section.TWISTIE
669 | Section.EXPANDED);
670
671 addPart(polytomousKeyNodeDetailSection);
672 }
673
674 private void createUseRecordSection(RootElement parent) {
675 destroySections();
676
677 UseRecordDetailSection descriptionUseRecordSection = (UseRecordDetailSection) formFactory
678 .createCdmDetailSection(DetailType.USE_RECORD,
679 getConversationHolder(), parent, this, Section.TWISTIE
680 | Section.EXPANDED);
681
682 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
683
684 addPart(descriptionUseRecordSection);
685
686
687 }
688
689 private void createUserSection(RootElement parent) {
690 destroySections();
691
692 UserDetailSection userDetailSection = (UserDetailSection) formFactory
693 .createCdmDetailSection(DetailType.USER,
694 getConversationHolder(), parent, this, Section.TWISTIE
695 | Section.EXPANDED);
696
697 GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) formFactory
698 .createEntityDetailSection(EntityDetailType.GROUPS_BY_USER,
699 getConversationHolder(), parent, Section.TWISTIE
700 | Section.EXPANDED);
701
702 addPart(userDetailSection);
703 addPart(groupByUserDetailSection);
704 }
705
706 private void createTaxonRelationshipSection(RootElement parent) {
707 destroySections();
708
709 TaxonRelationshipDetailSection taxonRelationshipDetailSection = (TaxonRelationshipDetailSection) formFactory
710 .createCdmDetailSection(DetailType.TAXON_RELATIONSHIP,
711 getConversationHolder(), parent, this, Section.TWISTIE
712 | Section.EXPANDED);
713
714 ReferencedEntityDetailSection referencedEntityBaseDetailSection = (ReferencedEntityDetailSection) formFactory
715 .createCdmDetailSection(DetailType.REFERENCED_ENTITY,
716 getConversationHolder(), parent, this, Section.TWISTIE
717 | Section.EXPANDED);
718 addPart(taxonRelationshipDetailSection);
719 addPart(referencedEntityBaseDetailSection);
720 }
721
722 /**
723 * @param rootElement
724 */
725 private void createTermVocabularySection(RootElement parent) {
726 destroySections();
727
728 TermVocabularyDetailSection termVocabularyDetailSection = (TermVocabularyDetailSection) formFactory
729 .createCdmDetailSection(DetailType.TERM_VOCABULARY,
730 getConversationHolder(), parent, this, Section.TWISTIE
731 | Section.EXPANDED);
732 addPart(termVocabularyDetailSection);
733 }
734
735 private void createDefinedTermSection(RootElement parent) {
736 destroySections();
737
738 AbstractFormSection definedTermDetailSection = formFactory
739 .createDefinedTermDetailSection(getInput().getClass(),
740 getConversationHolder(), parent, this, Section.TWISTIE
741 | Section.EXPANDED);
742 addPart(definedTermDetailSection);
743 }
744 }