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