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