- formatted code
[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.ExpandableComposite;
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.DerivedUnitBase;
42 import eu.etaxonomy.cdm.model.occurrence.FieldObservation;
43 import eu.etaxonomy.cdm.model.occurrence.Specimen;
44 import eu.etaxonomy.cdm.model.reference.Reference;
45 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
46 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
47 import eu.etaxonomy.taxeditor.editor.UsageTermCollection;
48 import eu.etaxonomy.taxeditor.model.AbstractUtility;
49 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
50 import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
51 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
52 import eu.etaxonomy.taxeditor.store.CdmStore;
53 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
54 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType;
55 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType;
56 import eu.etaxonomy.taxeditor.ui.element.RootElement;
57 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
58 import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
59 import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
60 import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
61 import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
62 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
63 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
64 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
65 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
66 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
67 import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
68 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
69 import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
70 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
71 import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
72 import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
73 import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
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.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, PreferencesUtil.getDerivedUnitConfigurator());
144 } catch (DerivedUnitFacadeNotSupportedException e) {
145 AbstractUtility.error(getClass(), e);
146 }
147 }
148 super.setInput(input);
149 }
150
151 @Override
152 protected void markViewPartDirty() {
153 if (getInput() instanceof DerivedUnitFacade) {
154 getViewPart().changed(
155 ((DerivedUnitFacade) getInput()).innerDerivedUnit());
156 }
157
158 super.markViewPartDirty();
159 }
160
161 // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
162
163 /*
164 * (non-Javadoc)
165 *
166 * @see org.eclipse.jface.viewers.Viewer#refresh()
167 */
168 /** {@inheritDoc} */
169 @Override
170 protected void showParts() {
171 // FIXME (CM) : Need to clean out this code.
172 // Too much type checking to decide which detail view to display.
173 // Need to build in a mechanism where navigators / editors are 'aware'
174 // of the corresponding detail viewer.
175 Object input = getInput();
176 if (input instanceof TaxonBase) {
177 createTaxonSections(rootElement);
178
179 } else if (input instanceof NonViralName) {
180 createNameSections(rootElement);
181
182 } else if (input instanceof Reference) {
183 createReferenceSections(rootElement);
184
185 } else if (input instanceof Team) {
186 createTeamDetailSection(rootElement);
187
188 } else if (input instanceof Person) {
189 createPersonDetailSection(rootElement);
190
191 } else if (input instanceof TeamOrPersonBase) {
192 createTeamOrPersonBaseDetailSection(rootElement);
193
194 } else if (input instanceof DescriptionBase) {
195 Set<Marker> descriptionMarkers = ((DescriptionBase) input).getMarkers();
196 MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType);
197 Boolean isUseDescription = false;
198 for (Marker marker : descriptionMarkers) {
199 if (marker.getMarkerType().equals(useMarkertype)) {
200 isUseDescription = true;
201 }
202 }
203 if (((DescriptionBase) input).isImageGallery()) {
204 createImageGallerySection(rootElement);
205
206 } else if (isUseDescription) {
207 createUseDescriptionSection(rootElement);
208 } else {
209 createDescriptionSection(rootElement);
210
211 }
212 } else if (input instanceof DescriptionElementBase) {
213 Set<Marker> descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
214 MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType);
215 Boolean isUseDescription = false;
216 for (Marker marker : descriptionMarkers) {
217 if (marker.getMarkerType().equals(useMarkertype)) {
218 isUseDescription = true;
219 }
220 }
221
222 if (isUseDescription == true && input instanceof CategoricalData ) {
223 createUseRecordSection(rootElement);
224 }
225 else {
226 createDescriptionElementSection(rootElement);
227 }
228
229 } else if (input instanceof Media) {
230 createMediaElementSection(rootElement);
231
232 } else if (input instanceof DerivedUnitFacade) {
233 createDerivedUnitBaseElementSection(rootElement);
234
235 } else if (input instanceof FeatureNodeContainer) {
236 createFeatureDistributionSection(rootElement);
237
238 } else if (input instanceof PolytomousKey) {
239 //createPolytomousKeySection(rootElement);
240
241 } else if ((input instanceof PolytomousKeyNode)
242 || (input instanceof PolytomousKeyRelationship)) {
243 createPolytomousKeyNodeSection(rootElement);
244 } else if (input instanceof User) {
245 createUserSection(rootElement);
246 } else if (input instanceof Group) {
247 createGroupSection(rootElement);
248 } else if (input instanceof TaxonRelationship) {
249 createTaxonRelationshipSection(rootElement);
250 } else if (input instanceof TermVocabulary) {
251 createTermVocabularySection(rootElement);
252 } else if (input instanceof DefinedTermBase) {
253 createDefinedTermSection(rootElement);
254 } else {
255 destroySections();
256 }
257 layout();
258 }
259
260
261 /**
262 * @param rootElement
263 */
264 private void createGroupSection(RootElement parent) {
265 destroySections();
266
267 GroupDetailSection groupDetailSection = (GroupDetailSection) formFactory
268 .createCdmDetailSection(DetailType.GROUP,
269 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
270 | ExpandableComposite.EXPANDED);
271 MemberDetailSection memberDetailSection = (MemberDetailSection) formFactory
272 .createEntityDetailSection(EntityDetailType.MEMBER,
273 getConversationHolder(), parent, ExpandableComposite.TWISTIE
274 | ExpandableComposite.EXPANDED);
275 GrantedAuthorityDetailSection grantedAuthorityDetailSection = (GrantedAuthorityDetailSection) formFactory
276 .createEntityDetailSection(EntityDetailType.GRANTED_AUTHORITY,
277 getConversationHolder(), parent, ExpandableComposite.TWISTIE
278 | ExpandableComposite.EXPANDED);
279
280 addPart(groupDetailSection);
281 addPart(memberDetailSection);
282 addPart(grantedAuthorityDetailSection);
283 }
284
285 /*
286 * (non-Javadoc)
287 *
288 * @see org.eclipse.jface.viewers.Viewer#getSelection()
289 */
290 /** {@inheritDoc} */
291 @Override
292 public ISelection getSelection() {
293 return selection;
294 }
295
296 /*
297 * (non-Javadoc)
298 *
299 * @see
300 * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
301 * .ISelection, boolean)
302 */
303 /** {@inheritDoc} */
304 @Override
305 public void setSelection(ISelection selection, boolean reveal) {
306 this.selection = selection;
307 SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
308 fireSelectionChanged(selectionChangedEvent);
309 }
310
311 /**
312 * createTaxonSections(RootElement parent)
313 * @param parent
314 */
315 private void createTaxonSections(RootElement parent) {
316 destroySections();
317
318 TaxonBaseDetailSection taxonBaseDetailSection = (TaxonBaseDetailSection) formFactory
319 .createCdmDetailSection(DetailType.TAXONBASE,
320 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
321
322 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
323
324 NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
325 .createCdmDetailSection(DetailType.NONVIRALNAME,
326 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
327 | ExpandableComposite.EXPANDED);
328
329 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
330
331 NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
332 .createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
333 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
334
335 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
336
337 NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
338 .createEntityDetailSection(
339 EntityDetailType.NOMENCLATURALSTATUS,
340 getConversationHolder(), parent, ExpandableComposite.TWISTIE);
341
342 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
343
344 ProtologueSection protologSection = (ProtologueSection) formFactory
345 .createEntityDetailSection(EntityDetailType.PROTOLOG,
346 getConversationHolder(), parent, ExpandableComposite.TWISTIE);
347
348 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
349
350 TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
351 .createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
352 getConversationHolder(), parent, ExpandableComposite.TWISTIE);
353
354 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
355
356 NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
357 .createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
358 getConversationHolder(), parent, ExpandableComposite.TWISTIE);
359
360 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
361
362 ParsingMessagesSection parsingMessagesSection = (ParsingMessagesSection) formFactory
363 .createCdmDetailSection(DetailType.PARSINGMESSAGE,
364 getConversationHolder(), parent, this, ExpandableComposite.EXPANDED);
365
366 addPart(taxonBaseDetailSection);
367 addPart(nonViralNameSection);
368 addPart(nomenclaturalStatusSection);
369 addPart(protologSection);
370 addPart(referenceDetailSection);
371 addPart(typeDesignationSection);
372 addPart(nameRelationshipSection);
373 addPart(parsingMessagesSection);
374 }
375
376 /**
377 * createNameSections
378 * @param parent
379 */
380 private void createNameSections(RootElement parent) {
381 destroySections();
382 NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
383 .createCdmDetailSection(DetailType.NONVIRALNAME,
384 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
385 | ExpandableComposite.EXPANDED);
386
387 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
388
389 NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
390 .createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
391 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
392
393 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
394
395 NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
396 .createEntityDetailSection(
397 EntityDetailType.NOMENCLATURALSTATUS,
398 getConversationHolder(), parent, ExpandableComposite.TWISTIE);
399
400 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
401
402 ProtologueSection protologSection = (ProtologueSection) formFactory
403 .createEntityDetailSection(EntityDetailType.PROTOLOG,
404 getConversationHolder(), parent, ExpandableComposite.TWISTIE);
405
406 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
407
408 TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
409 .createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
410 getConversationHolder(), parent, ExpandableComposite.TWISTIE);
411
412 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
413
414 NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
415 .createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
416 getConversationHolder(), parent, ExpandableComposite.TWISTIE);
417
418 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
419
420 addPart(nonViralNameSection);
421 addPart(nomenclaturalStatusSection);
422 addPart(protologSection);
423 addPart(referenceDetailSection);
424 addPart(typeDesignationSection);
425 addPart(nameRelationshipSection);
426 }
427
428 /**
429 * createReferenceSections
430 * @param parent
431 */
432 private void createReferenceSections(RootElement parent) {
433 destroySections();
434
435 ReferenceDetailSection referenceDetailSection = (ReferenceDetailSection) formFactory
436 .createCdmDetailSection(DetailType.REFERENCEBASE,
437 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
438 | ExpandableComposite.EXPANDED);
439
440 addPart(referenceDetailSection);
441 }
442
443 /**
444 * createTeamOrPersonBaseDetailSection
445 * @param parent
446 */
447 private void createTeamOrPersonBaseDetailSection(RootElement parent) {
448 destroySections();
449 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = (TeamOrPersonBaseDetailSection) formFactory
450 .createCdmDetailSection(DetailType.TEAMORPERSONBASE,
451 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
452 | ExpandableComposite.EXPANDED);
453
454 addPart(teamOrPersonBaseDetailSection);
455 }
456
457 /**
458 * createTeamDetailSection
459 * @param parent
460 */
461 private void createTeamDetailSection(RootElement parent) {
462 destroySections();
463 TeamDetailSection teamDetailSection = (TeamDetailSection) formFactory
464 .createCdmDetailSection(DetailType.TEAM,
465 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
466 | ExpandableComposite.EXPANDED);
467
468 addPart(teamDetailSection);
469 }
470
471 /**
472 * createPersonDetailSection
473 * @param parent
474 */
475 private void createPersonDetailSection(RootElement parent) {
476 destroySections();
477 PersonDetailSection personDetailSection = (PersonDetailSection) formFactory
478 .createCdmDetailSection(DetailType.PERSON,
479 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
480 | ExpandableComposite.EXPANDED);
481 addPart(personDetailSection);
482 }
483
484 /**
485 * createDescriptionElementSection
486 * @param parent
487 */
488 private void createDescriptionElementSection(RootElement parent) {
489 destroySections();
490
491 DescriptionElementDetailSection descriptionElementDetailSection = (DescriptionElementDetailSection) formFactory
492 .createCdmDetailSection(DetailType.DESCRIPTIONELEMENT,
493 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
494 | ExpandableComposite.EXPANDED);
495
496 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
497
498 DescriptionElementSourceSection descriptionElementSourceSection = (DescriptionElementSourceSection) formFactory
499 .createEntityDetailSection(
500 EntityDetailType.DESCRIPTIONELEMENTSOURCE,
501 getConversationHolder(), parent, ExpandableComposite.TWISTIE);
502
503 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
504
505 DescriptionElementMediaSection descriptionElementMediaSection = (DescriptionElementMediaSection) formFactory
506 .createEntityDetailSection(
507 EntityDetailType.DESCRIPTIONELEMENTMEDIA,
508 getConversationHolder(), parent, ExpandableComposite.TWISTIE);
509
510 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
511
512 addPart(descriptionElementDetailSection);
513 addPart(descriptionElementSourceSection);
514 addPart(descriptionElementMediaSection);
515 }
516
517 /**
518 * createDescriptionSection
519 * @param parent
520 */
521 private void createDescriptionSection(RootElement parent) {
522 destroySections();
523 DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
524 .createCdmDetailSection(DetailType.DESCRIPTION,
525 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
526 | ExpandableComposite.EXPANDED);
527
528 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
529
530 NaturalLanguageSection naturalLanguageSection = (NaturalLanguageSection) formFactory
531 .createCdmDetailSection(DetailType.NATURAL_LANGUAGE,
532 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
533 | ExpandableComposite.EXPANDED);
534
535 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
536
537 DescribedSpecimenSection describedSpecimenSection = (DescribedSpecimenSection) formFactory
538 .createEntityDetailSection(EntityDetailType.DESCRIBED_SPECIMEN,
539 getConversationHolder(), parent, ExpandableComposite.TWISTIE);
540
541 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
542
543 DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
544 .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
545 getConversationHolder(), parent, ExpandableComposite.TWISTIE);
546
547 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
548
549 ScopeSection scopeSection = (ScopeSection) formFactory
550 .createEntityDetailSection(EntityDetailType.SCOPE,
551 getConversationHolder(), parent, ExpandableComposite.TWISTIE);
552
553 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
554
555 addPart(descriptionDetailSection);
556 addPart(naturalLanguageSection);
557 addPart(describedSpecimenSection);
558 addPart(descriptionSourceSection);
559 addPart(scopeSection);
560 }
561
562 /**
563 * Creates the use Description section
564 * @param parent
565 */
566 private void createUseDescriptionSection(RootElement parent) {
567 destroySections();
568 DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
569 .createCdmDetailSection(DetailType.DESCRIPTION,
570 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
571 | ExpandableComposite.EXPANDED);
572
573 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
574
575 DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
576 .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
577 getConversationHolder(), parent, ExpandableComposite.TWISTIE
578 | ExpandableComposite.EXPANDED);
579
580 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
581
582 addPart(descriptionDetailSection);
583 addPart(descriptionSourceSection);
584
585 }
586
587
588 /**
589 * @param rootElement
590 */
591 private void createImageGallerySection(RootElement parent) {
592 destroySections();
593 DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
594 .createCdmDetailSection(DetailType.DESCRIPTION,
595 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
596 | ExpandableComposite.EXPANDED);
597
598 addPart(descriptionDetailSection);
599 }
600
601 /**
602 * createMediaElementSection
603 * @param parent
604 */
605
606 private void createMediaElementSection(RootElement parent) {
607 destroySections();
608 MediaDetailsSection mediaDetailSection = (MediaDetailsSection) formFactory
609 .createCdmDetailSection(DetailType.MEDIA,
610 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
611 | ExpandableComposite.EXPANDED);
612
613 addPart(mediaDetailSection);
614 }
615
616 /**
617 * createDerivedUnitBaseElementSection
618 * @param parent
619 */
620 private void createDerivedUnitBaseElementSection(RootElement parent) {
621 destroySections();
622
623 GeneralDetailSection generalDetailSection = (GeneralDetailSection) formFactory.createCdmDetailSection(DetailType.DERIVED_UNIT_GENERAL, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
624
625 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
626
627 GatheringEventDetailSection gatheringEventDetailSection = (GatheringEventDetailSection) formFactory.createCdmDetailSection(DetailType.GATHERING_EVENT, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
628
629 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
630
631 FieldObservationDetailSection fieldObservationDetailSection = (FieldObservationDetailSection) formFactory.createCdmDetailSection(DetailType.FIELD_OBSERVATION, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
632
633 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
634
635 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = (DerivedUnitBaseDetailSection) formFactory.createCdmDetailSection(DetailType.DERIVED_UNIT, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
636
637 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
638
639 DeterminationDetailSection determinationDetailSection = (DeterminationDetailSection) formFactory.createCdmDetailSection(DetailType.DETERMINATION, getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
640
641 addPart(generalDetailSection);
642 addPart(gatheringEventDetailSection);
643 addPart(fieldObservationDetailSection);
644 addPart(derivedUnitBaseDetailSection);
645 addPart(determinationDetailSection);
646
647 }
648
649 /**
650 * @param rootElement
651 */
652 private void createFeatureDistributionSection(RootElement parent) {
653 destroySections();
654
655 FeatureDistributionDetailSection featureDistributionSection = (FeatureDistributionDetailSection) formFactory
656 .createCdmDetailSection(DetailType.FEATURE_DISTRIBUTION,
657 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
658 | ExpandableComposite.EXPANDED);
659
660 addPart(featureDistributionSection);
661 }
662
663 /**
664 * createPolytomousKeyNodeSection
665 * @param parent
666 */
667 private void createPolytomousKeyNodeSection(RootElement parent) {
668 destroySections();
669
670 PolytomousKeyDetailSection polytomousKeyDetailSection = (PolytomousKeyDetailSection) formFactory
671 .createCdmDetailSection(DetailType.POLYTOMOUS_KEY,
672 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
673 | ExpandableComposite.COMPACT);
674
675 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
676
677 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = (PolytomousKeyNodeDetailSection) formFactory
678 .createCdmDetailSection(DetailType.POLYTOMOUS_KEY_NODE,
679 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
680 | ExpandableComposite.EXPANDED);
681
682 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
683
684 TaxonomicScopeSection taxonomicScopeSection = (TaxonomicScopeSection) formFactory
685 .createEntityDetailSection(EntityDetailType.TAXONOMIC_SCOPE,
686 getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
687
688 addPart(polytomousKeyDetailSection);
689 addPart(polytomousKeyNodeDetailSection);
690 addPart(taxonomicScopeSection);
691
692 }
693
694 /**
695 * create the UseRecordSection
696 * @param parent
697 */
698 private void createUseRecordSection(RootElement parent) {
699 destroySections();
700
701 UseRecordDetailSection descriptionUseRecordSection = (UseRecordDetailSection) formFactory
702 .createCdmDetailSection(DetailType.USE_RECORD,
703 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
704 | ExpandableComposite.EXPANDED);
705
706 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
707
708 addPart(descriptionUseRecordSection);
709
710
711 }
712
713 /**
714 * createUserSection
715 * @param parent
716 */
717 private void createUserSection(RootElement parent) {
718 destroySections();
719
720 UserDetailSection userDetailSection = (UserDetailSection) formFactory
721 .createCdmDetailSection(DetailType.USER,
722 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
723 | ExpandableComposite.EXPANDED);
724
725 GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) formFactory
726 .createEntityDetailSection(EntityDetailType.GROUPS_BY_USER,
727 getConversationHolder(), parent, ExpandableComposite.TWISTIE
728 | ExpandableComposite.EXPANDED);
729
730 addPart(userDetailSection);
731 addPart(groupByUserDetailSection);
732 }
733
734 /**
735 * createTaxonRelationshipSection
736 * @param parent
737 */
738 private void createTaxonRelationshipSection(RootElement parent) {
739 destroySections();
740
741 TaxonRelationshipDetailSection taxonRelationshipDetailSection = (TaxonRelationshipDetailSection) formFactory
742 .createCdmDetailSection(DetailType.TAXON_RELATIONSHIP,
743 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
744 | ExpandableComposite.EXPANDED);
745
746 ReferencedEntityDetailSection referencedEntityBaseDetailSection = (ReferencedEntityDetailSection) formFactory
747 .createCdmDetailSection(DetailType.REFERENCED_ENTITY,
748 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
749 | ExpandableComposite.EXPANDED);
750 addPart(taxonRelationshipDetailSection);
751 addPart(referencedEntityBaseDetailSection);
752 }
753
754 /**
755 * @param rootElement
756 */
757 private void createTermVocabularySection(RootElement parent) {
758 destroySections();
759
760 TermVocabularyDetailSection termVocabularyDetailSection = (TermVocabularyDetailSection) formFactory
761 .createCdmDetailSection(DetailType.TERM_VOCABULARY,
762 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
763 | ExpandableComposite.EXPANDED);
764 addPart(termVocabularyDetailSection);
765 }
766
767 /**
768 * createDefinedTermSection
769 * @param parent
770 */
771 private void createDefinedTermSection(RootElement parent) {
772 destroySections();
773
774 AbstractFormSection definedTermDetailSection = formFactory
775 .createDefinedTermDetailSection(getInput().getClass(),
776 getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
777 | ExpandableComposite.EXPANDED);
778 addPart(definedTermDetailSection);
779 }
780 }