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