- completely removed EntityDetailType enum and all its uses
[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.RootElement;
52 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
53 import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
54 import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
55 import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
56 import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
57 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
58 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
59 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
60 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
61 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
62 import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
63 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
64 import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
65 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
66 import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
67 import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
68 import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
69 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
70 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
71 import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
72 import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
73 import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
74 import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
75 import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
76 import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
77 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
78 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
79 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationDetailSection;
80 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
81 import eu.etaxonomy.taxeditor.ui.section.occurrence.GeneralDetailSection;
82 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
83 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
84 import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
85 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
86 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
87 import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
88 import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
89 import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
90 import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
91 import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
92 import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
93
94 /**
95 *
96 * The DetailsViewer handles the content of the details view (
97 * {@link DetailsViewPart}).<br>
98 * Depending on the type of the selected element the section of the details view
99 * are created.
100 *
101 * @author n.hoffmann
102 * @created Feb 12, 2010
103 * @version 1.0
104 */
105 public class DetailsViewer extends AbstractCdmDataViewer {
106
107 private ISelection selection;
108
109 /**
110 * <p>
111 * Constructor for DetailsViewer.
112 * </p>
113 *
114 * @param parent
115 * a {@link org.eclipse.swt.widgets.Composite} object.
116 * @param viewPart
117 * a {@link eu.etaxonomy.taxeditor.view.AbstractCdmViewPart}
118 * object.
119 */
120 public DetailsViewer(Composite parent, AbstractCdmViewPart viewPart) {
121 super(parent, viewPart);
122 }
123
124 // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
125 // since we are getting implementations of DerivedUnitBase from the bulk
126 // editor
127 // and not derived unit facade objects,
128
129 /*
130 * (non-Javadoc)
131 *
132 * @see
133 * eu.etaxonomy.taxeditor.editor.view.AbstractCdmDataViewer#setInput(java
134 * .lang.Object)
135 */
136 @Override
137 public void setInput(Object input) {
138 if (input instanceof DerivedUnitBase) {
139 try {
140 input = DerivedUnitFacade.NewInstance((DerivedUnitBase) input,
141 PreferencesUtil.getDerivedUnitConfigurator());
142 } catch (DerivedUnitFacadeNotSupportedException e) {
143 AbstractUtility.error(getClass(), e);
144 }
145 }
146 super.setInput(input);
147 }
148
149 @Override
150 protected void markViewPartDirty() {
151 if (getInput() instanceof DerivedUnitFacade) {
152 getViewPart().changed(((DerivedUnitFacade) getInput()).innerDerivedUnit());
153 }
154
155 super.markViewPartDirty();
156 }
157
158 // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
159
160 /*
161 * (non-Javadoc)
162 *
163 * @see org.eclipse.jface.viewers.Viewer#refresh()
164 */
165 /** {@inheritDoc} */
166 @Override
167 protected void showParts() {
168 // FIXME (CM) : Need to clean out this code.
169 // Too much type checking to decide which detail view to display.
170 // Need to build in a mechanism where navigators / editors are 'aware'
171 // of the corresponding detail viewer.
172 Object input = getInput();
173 if (input instanceof TaxonBase) {
174 createTaxonSections(rootElement);
175
176 } else if (input instanceof NonViralName) {
177 createNameSections(rootElement);
178
179 } else if (input instanceof Reference) {
180 createReferenceSections(rootElement);
181
182 } else if (input instanceof Team) {
183 createTeamDetailSection(rootElement);
184
185 } else if (input instanceof Person) {
186 createPersonDetailSection(rootElement);
187
188 } else if (input instanceof TeamOrPersonBase) {
189 createTeamOrPersonBaseDetailSection(rootElement);
190
191 } else if (input instanceof DescriptionBase) {
192 Set<Marker> descriptionMarkers = ((DescriptionBase) input).getMarkers();
193 MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
194 UsageTermCollection.uuidUseMarkerType);
195 Boolean isUseDescription = false;
196 for (Marker marker : descriptionMarkers) {
197 if (marker.getMarkerType().equals(useMarkertype)) {
198 isUseDescription = true;
199 }
200 }
201 if (((DescriptionBase) input).isImageGallery()) {
202 createImageGallerySection(rootElement);
203
204 } else if (isUseDescription) {
205 createUseDescriptionSection(rootElement);
206 } else {
207 createDescriptionSection(rootElement);
208
209 }
210 } else if (input instanceof DescriptionElementBase) {
211 Set<Marker> descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
212 MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
213 UsageTermCollection.uuidUseMarkerType);
214 Boolean isUseDescription = false;
215 for (Marker marker : descriptionMarkers) {
216 if (marker.getMarkerType().equals(useMarkertype)) {
217 isUseDescription = true;
218 }
219 }
220
221 if (isUseDescription == true && input instanceof CategoricalData) {
222 createUseRecordSection(rootElement);
223 } else {
224 createDescriptionElementSection(rootElement);
225 }
226
227 } else if (input instanceof Media) {
228 createMediaElementSection(rootElement);
229
230 } else if (input instanceof DerivedUnitFacade) {
231 createDerivedUnitBaseElementSection(rootElement);
232
233 } else if (input instanceof FeatureNodeContainer) {
234 createFeatureDistributionSection(rootElement);
235
236 } else if (input instanceof PolytomousKey) {
237 // createPolytomousKeySection(rootElement);
238
239 } else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
240 createPolytomousKeyNodeSection(rootElement);
241 } else if (input instanceof User) {
242 createUserSection(rootElement);
243 } else if (input instanceof Group) {
244 createGroupSection(rootElement);
245 } else if (input instanceof TaxonRelationship) {
246 createTaxonRelationshipSection(rootElement);
247 } else if (input instanceof TermVocabulary) {
248 createTermVocabularySection(rootElement);
249 } else if (input instanceof DefinedTermBase) {
250 createDefinedTermSection(rootElement);
251 } else {
252 destroySections();
253 }
254 layout();
255 }
256
257 /**
258 * @param rootElement
259 */
260 private void createGroupSection(RootElement parent) {
261 destroySections();
262
263 GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
264 MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
265 GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
266
267 addPart(groupDetailSection);
268 addPart(memberDetailSection);
269 addPart(grantedAuthorityDetailSection);
270 }
271
272 /*
273 * (non-Javadoc)
274 *
275 * @see org.eclipse.jface.viewers.Viewer#getSelection()
276 */
277 /** {@inheritDoc} */
278 @Override
279 public ISelection getSelection() {
280 return selection;
281 }
282
283 /*
284 * (non-Javadoc)
285 *
286 * @see
287 * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
288 * .ISelection, boolean)
289 */
290 /** {@inheritDoc} */
291 @Override
292 public void setSelection(ISelection selection, boolean reveal) {
293 this.selection = selection;
294 SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
295 fireSelectionChanged(selectionChangedEvent);
296 }
297
298 /**
299 * createTaxonSections(RootElement parent)
300 *
301 * @param parent
302 */
303 private void createTaxonSections(RootElement parent) {
304 destroySections();
305
306 TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
307
308 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
309
310 NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
311 | ExpandableComposite.EXPANDED);
312
313 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
314
315 NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
316
317 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
318
319 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE);
320
321 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
322
323 ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
324
325 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
326
327 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
328
329 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
330
331 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
332
333 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
334
335 ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this, ExpandableComposite.EXPANDED);
336
337 addPart(taxonBaseDetailSection);
338 addPart(nonViralNameSection);
339 addPart(nomenclaturalStatusSection);
340 addPart(protologSection);
341 addPart(referenceDetailSection);
342 addPart(typeDesignationSection);
343 addPart(nameRelationshipSection);
344 addPart(parsingMessagesSection);
345 }
346
347 /**
348 * createNameSections
349 *
350 * @param parent
351 */
352 private void createNameSections(RootElement parent) {
353 destroySections();
354 NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
355
356 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
357
358 NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
359
360 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
361
362 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
363
364 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
365
366 ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
367
368 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
369
370 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
371
372 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
373
374 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
375
376 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
377
378 addPart(nonViralNameSection);
379 addPart(nomenclaturalStatusSection);
380 addPart(protologSection);
381 addPart(referenceDetailSection);
382 addPart(typeDesignationSection);
383 addPart(nameRelationshipSection);
384 }
385
386 /**
387 * createReferenceSections
388 *
389 * @param parent
390 */
391 private void createReferenceSections(RootElement parent) {
392 destroySections();
393
394 ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
395
396 addPart(referenceDetailSection);
397 }
398
399 /**
400 * createTeamOrPersonBaseDetailSection
401 *
402 * @param parent
403 */
404 private void createTeamOrPersonBaseDetailSection(RootElement parent) {
405 destroySections();
406 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
407
408 addPart(teamOrPersonBaseDetailSection);
409 }
410
411 /**
412 * createTeamDetailSection
413 *
414 * @param parent
415 */
416 private void createTeamDetailSection(RootElement parent) {
417 destroySections();
418 TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
419
420 addPart(teamDetailSection);
421 }
422
423 /**
424 * createPersonDetailSection
425 *
426 * @param parent
427 */
428 private void createPersonDetailSection(RootElement parent) {
429 destroySections();
430 PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
431 addPart(personDetailSection);
432 }
433
434 /**
435 * createDescriptionElementSection
436 *
437 * @param parent
438 */
439 private void createDescriptionElementSection(RootElement parent) {
440 destroySections();
441
442 DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
443
444 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
445
446 DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
447
448 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
449
450 DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
451
452 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
453
454 addPart(descriptionElementDetailSection);
455 addPart(descriptionElementSourceSection);
456 addPart(descriptionElementMediaSection);
457 }
458
459 /**
460 * createDescriptionSection
461 *
462 * @param parent
463 */
464 private void createDescriptionSection(RootElement parent) {
465 destroySections();
466 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
467
468 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
469
470 NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
471
472 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
473
474 DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
475
476 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
477
478 DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
479
480 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
481
482 ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
483
484 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
485
486 addPart(descriptionDetailSection);
487 addPart(naturalLanguageSection);
488 addPart(describedSpecimenSection);
489 addPart(descriptionSourceSection);
490 addPart(scopeSection);
491 }
492
493 /**
494 * Creates the use Description section
495 *
496 * @param parent
497 */
498 private void createUseDescriptionSection(RootElement parent) {
499 destroySections();
500 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
501
502 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
503
504 DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
505
506 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
507
508 addPart(descriptionDetailSection);
509 addPart(descriptionSourceSection);
510
511 }
512
513 /**
514 * @param rootElement
515 */
516 private void createImageGallerySection(RootElement parent) {
517 destroySections();
518 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
519
520 addPart(descriptionDetailSection);
521 }
522
523 /**
524 * createMediaElementSection
525 *
526 * @param parent
527 */
528
529 private void createMediaElementSection(RootElement parent) {
530 destroySections();
531 MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
532
533 addPart(mediaDetailSection);
534 }
535
536 /**
537 * createDerivedUnitBaseElementSection
538 *
539 * @param parent
540 */
541 private void createDerivedUnitBaseElementSection(RootElement parent) {
542 destroySections();
543
544 GeneralDetailSection generalDetailSection = formFactory.createGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
545
546 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
547
548 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
549
550 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
551
552 FieldObservationDetailSection fieldObservationDetailSection = formFactory.createFieldObservationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
553
554 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
555
556 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
557
558 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
559
560 DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
561
562 addPart(generalDetailSection);
563 addPart(gatheringEventDetailSection);
564 addPart(fieldObservationDetailSection);
565 addPart(derivedUnitBaseDetailSection);
566 addPart(determinationDetailSection);
567 }
568
569 /**
570 * @param rootElement
571 */
572 private void createFeatureDistributionSection(RootElement parent) {
573 destroySections();
574
575 FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
576
577 addPart(featureDistributionSection);
578 }
579
580 /**
581 * createPolytomousKeyNodeSection
582 *
583 * @param parent
584 */
585 private void createPolytomousKeyNodeSection(RootElement parent) {
586 destroySections();
587
588 PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
589
590 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
591
592 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
593
594 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
595
596 TaxonomicScopeSection taxonomicScopeSection = formFactory.createTaxonomicScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
597
598 addPart(polytomousKeyDetailSection);
599 addPart(polytomousKeyNodeDetailSection);
600 addPart(taxonomicScopeSection);
601
602 }
603
604 /**
605 * create the UseRecordSection
606 *
607 * @param parent
608 */
609 private void createUseRecordSection(RootElement parent) {
610 destroySections();
611
612 UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
613
614 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
615
616 addPart(descriptionUseRecordSection);
617
618 }
619
620 /**
621 * createUserSection
622 *
623 * @param parent
624 */
625 private void createUserSection(RootElement parent) {
626 destroySections();
627
628 UserDetailSection userDetailSection = formFactory.createUserDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
629
630 GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
631
632 addPart(userDetailSection);
633 addPart(groupByUserDetailSection);
634 }
635
636 /**
637 * createTaxonRelationshipSection
638 *
639 * @param parent
640 */
641 private void createTaxonRelationshipSection(RootElement parent) {
642 destroySections();
643
644 TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
645
646 ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
647 addPart(taxonRelationshipDetailSection);
648 addPart(referencedEntityBaseDetailSection);
649 }
650
651 /**
652 * @param rootElement
653 */
654 private void createTermVocabularySection(RootElement parent) {
655 destroySections();
656
657 TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
658 addPart(termVocabularyDetailSection);
659 }
660
661 /**
662 * createDefinedTermSection
663 *
664 * @param parent
665 */
666 private void createDefinedTermSection(RootElement parent) {
667 destroySections();
668
669 AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
670 addPart(definedTermDetailSection);
671 }
672
673 private void createFODetailsView(RootElement parent) {
674 destroySections();
675
676 GeneralDetailSection generalDetailSection = formFactory.createFOSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
677
678 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
679
680 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
681
682 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
683
684 FieldObservationDetailSection fieldObservationDetailSection = formFactory.createFODetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
685
686 addPart(generalDetailSection);
687 addPart(gatheringEventDetailSection);
688 addPart(fieldObservationDetailSection);
689 }
690 }