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