reintegrated model changes from branch 3.3-MC-SNAPSHOT
[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.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.AbstractUtility;
48 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
49 import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
50 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
51 import eu.etaxonomy.taxeditor.store.CdmStore;
52 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
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 DerivedUnit) {
141 try {
142 input = DerivedUnitFacade.NewInstance((DerivedUnit) 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 /**
261 * @param rootElement
262 */
263 private void createGroupSection(RootElement parent) {
264 destroySections();
265
266 GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
267 MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
268 GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
269
270 addPart(groupDetailSection);
271 addPart(memberDetailSection);
272 addPart(grantedAuthorityDetailSection);
273 }
274
275 /*
276 * (non-Javadoc)
277 *
278 * @see org.eclipse.jface.viewers.Viewer#getSelection()
279 */
280 /** {@inheritDoc} */
281 @Override
282 public ISelection getSelection() {
283 return selection;
284 }
285
286 /*
287 * (non-Javadoc)
288 *
289 * @see
290 * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
291 * .ISelection, boolean)
292 */
293 /** {@inheritDoc} */
294 @Override
295 public void setSelection(ISelection selection, boolean reveal) {
296 this.selection = selection;
297 SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
298 fireSelectionChanged(selectionChangedEvent);
299 }
300
301 /**
302 * createTaxonSections(RootElement parent)
303 *
304 * @param parent
305 */
306 private void createTaxonSections(RootElement parent) {
307 destroySections();
308
309 TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
310
311 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
312
313 NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
314 | ExpandableComposite.EXPANDED);
315
316 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
317
318 NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
319
320 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
321
322 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE);
323
324 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
325
326 ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
327
328 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
329
330 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
331
332 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
333
334 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
335
336 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
337
338 ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this, ExpandableComposite.EXPANDED);
339
340 addPart(taxonBaseDetailSection);
341 addPart(nonViralNameSection);
342 addPart(nomenclaturalStatusSection);
343 addPart(protologSection);
344 addPart(referenceDetailSection);
345 addPart(typeDesignationSection);
346 addPart(nameRelationshipSection);
347 addPart(parsingMessagesSection);
348 }
349
350 /**
351 * createNameSections
352 *
353 * @param parent
354 */
355 private void createNameSections(RootElement parent) {
356 destroySections();
357 NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
358
359 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
360
361 NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
362
363 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
364
365 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
366
367 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
368
369 ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
370
371 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
372
373 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
374
375 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
376
377 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
378
379 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
380
381 addPart(nonViralNameSection);
382 addPart(nomenclaturalStatusSection);
383 addPart(protologSection);
384 addPart(referenceDetailSection);
385 addPart(typeDesignationSection);
386 addPart(nameRelationshipSection);
387 }
388
389 /**
390 * createReferenceSections
391 *
392 * @param parent
393 */
394 private void createReferenceSections(RootElement parent) {
395 destroySections();
396
397 ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
398
399 addPart(referenceDetailSection);
400 }
401
402 /**
403 * createTeamOrPersonBaseDetailSection
404 *
405 * @param parent
406 */
407 private void createTeamOrPersonBaseDetailSection(RootElement parent) {
408 destroySections();
409 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
410
411 addPart(teamOrPersonBaseDetailSection);
412 }
413
414 /**
415 * createTeamDetailSection
416 *
417 * @param parent
418 */
419 private void createTeamDetailSection(RootElement parent) {
420 destroySections();
421 TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
422
423 addPart(teamDetailSection);
424 }
425
426 /**
427 * createPersonDetailSection
428 *
429 * @param parent
430 */
431 private void createPersonDetailSection(RootElement parent) {
432 destroySections();
433 PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
434 addPart(personDetailSection);
435 }
436
437 /**
438 * createDescriptionElementSection
439 *
440 * @param parent
441 */
442 private void createDescriptionElementSection(RootElement parent) {
443 destroySections();
444
445 DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
446
447 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
448
449 DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
450
451 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
452
453 DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
454
455 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
456
457 addPart(descriptionElementDetailSection);
458 addPart(descriptionElementSourceSection);
459 addPart(descriptionElementMediaSection);
460 }
461
462 /**
463 * createDescriptionSection
464 *
465 * @param parent
466 */
467 private void createDescriptionSection(RootElement parent) {
468 destroySections();
469 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
470
471 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
472
473 NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
474
475 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
476
477 DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
478
479 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
480
481 // DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
482 // .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
483 // getConversationHolder(), parent, Section.TWISTIE);
484 //
485 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
486
487 ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
488
489 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
490
491 addPart(descriptionDetailSection);
492 addPart(naturalLanguageSection);
493 addPart(describedSpecimenSection);
494 // addPart(descriptionSourceSection);
495 addPart(scopeSection);
496 }
497
498 /**
499 * Creates the use Description section
500 *
501 * @param parent
502 */
503 private void createUseDescriptionSection(RootElement parent) {
504 destroySections();
505 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
506
507 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
508
509 DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
510
511 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
512
513 addPart(descriptionDetailSection);
514 addPart(descriptionSourceSection);
515
516 }
517
518
519 /**
520 * @param rootElement
521 */
522 private void createImageGallerySection(RootElement parent) {
523 destroySections();
524 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
525
526 addPart(descriptionDetailSection);
527 }
528
529 /**
530 * createMediaElementSection
531 *
532 * @param parent
533 */
534
535 private void createMediaElementSection(RootElement parent) {
536 destroySections();
537 MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
538
539 addPart(mediaDetailSection);
540 }
541
542 /**
543 * createDerivedUnitBaseElementSection
544 *
545 * @param parent
546 */
547 private void createDerivedUnitBaseElementSection(RootElement parent) {
548 destroySections();
549
550 GeneralDetailSection generalDetailSection = formFactory.createGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
551
552 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
553
554 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
555
556 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
557
558 FieldObservationDetailSection fieldObservationDetailSection = formFactory.createFieldObservationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
559
560 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
561
562 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
563
564 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
565
566 DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
567
568 addPart(generalDetailSection);
569 addPart(gatheringEventDetailSection);
570 addPart(fieldObservationDetailSection);
571 addPart(derivedUnitBaseDetailSection);
572 addPart(determinationDetailSection);
573
574 }
575
576 /**
577 * @param rootElement
578 */
579 private void createFeatureDistributionSection(RootElement parent) {
580 destroySections();
581
582 FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
583
584 addPart(featureDistributionSection);
585 }
586
587 /**
588 * createPolytomousKeyNodeSection
589 *
590 * @param parent
591 */
592 private void createPolytomousKeyNodeSection(RootElement parent) {
593 destroySections();
594
595 PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
596
597 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
598
599 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
600
601 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
602
603 TaxonomicScopeSection taxonomicScopeSection = formFactory.createTaxonomicScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
604
605 addPart(polytomousKeyDetailSection);
606 addPart(polytomousKeyNodeDetailSection);
607 addPart(taxonomicScopeSection);
608
609 }
610
611 /**
612 * create the UseRecordSection
613 *
614 * @param parent
615 */
616 private void createUseRecordSection(RootElement parent) {
617 destroySections();
618
619 UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
620
621 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
622
623 addPart(descriptionUseRecordSection);
624
625
626 }
627
628 /**
629 * createUserSection
630 *
631 * @param parent
632 */
633 private void createUserSection(RootElement parent) {
634 destroySections();
635
636 UserDetailSection userDetailSection = formFactory.createUserDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
637
638 GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
639
640 addPart(userDetailSection);
641 addPart(groupByUserDetailSection);
642 }
643
644 /**
645 * createTaxonRelationshipSection
646 *
647 * @param parent
648 */
649 private void createTaxonRelationshipSection(RootElement parent) {
650 destroySections();
651
652 TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
653
654 ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
655 addPart(taxonRelationshipDetailSection);
656 addPart(referencedEntityBaseDetailSection);
657 }
658
659 /**
660 * @param rootElement
661 */
662 private void createTermVocabularySection(RootElement parent) {
663 destroySections();
664
665 TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
666 addPart(termVocabularyDetailSection);
667 }
668
669 /**
670 * createDefinedTermSection
671 *
672 * @param parent
673 */
674 private void createDefinedTermSection(RootElement parent) {
675 destroySections();
676
677 AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
678 addPart(definedTermDetailSection);
679 }
680
681 private void createFODetailsView(RootElement parent) {
682 destroySections();
683
684 GeneralDetailSection generalDetailSection = formFactory.createFOSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
685
686 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
687
688 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
689
690 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
691
692 FieldObservationDetailSection fieldObservationDetailSection = formFactory.createFODetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
693
694 addPart(generalDetailSection);
695 addPart(gatheringEventDetailSection);
696 addPart(fieldObservationDetailSection);
697 }
698 }