e9ed4f3d393429d18390ac80262673ebe7bef048
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / view / detail / DetailsViewer.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 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 org.eclipse.jface.viewers.ISelection;
14 import org.eclipse.jface.viewers.SelectionChangedEvent;
15 import org.eclipse.swt.SWT;
16 import org.eclipse.swt.widgets.Composite;
17 import org.eclipse.ui.forms.widgets.Section;
18
19 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
20 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
21 import eu.etaxonomy.cdm.model.agent.Person;
22 import eu.etaxonomy.cdm.model.agent.Team;
23 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
24 import eu.etaxonomy.cdm.model.common.Group;
25 import eu.etaxonomy.cdm.model.common.User;
26 import eu.etaxonomy.cdm.model.description.DescriptionBase;
27 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
28 import eu.etaxonomy.cdm.model.description.PolytomousKey;
29 import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
30 import eu.etaxonomy.cdm.model.media.Media;
31 import eu.etaxonomy.cdm.model.name.NonViralName;
32 import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
33 import eu.etaxonomy.cdm.model.reference.Reference;
34 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
35 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
36 import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
37 import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
38 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
39 import eu.etaxonomy.taxeditor.store.StoreUtil;
40 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
41 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EntityDetailType;
42 import eu.etaxonomy.taxeditor.ui.forms.RootElement;
43 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
44 import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
45 import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
46 import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
47 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
48 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
49 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
50 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
51 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
52 import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
53 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
54 import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
55 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
56 import eu.etaxonomy.taxeditor.ui.section.group.GrantedAuthorityDetailSection;
57 import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
58 import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
59 import eu.etaxonomy.taxeditor.ui.section.key.GeographicalScopeDetailSection;
60 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
61 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
62 import eu.etaxonomy.taxeditor.ui.section.key.ScopeRestrictionSection;
63 import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
64 import eu.etaxonomy.taxeditor.ui.section.name.HybridDetailSection;
65 import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
66 import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
67 import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
68 import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
69 import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
70 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
71 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
72 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationDetailSection;
73 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
74 import eu.etaxonomy.taxeditor.ui.section.occurrence.GeneralDetailSection;
75 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
76 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
77 import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
78 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
79 import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
80 import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
81 import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
82 import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
83
84 /**
85 * <p>
86 * DetailsViewer class.
87 * </p>
88 *
89 * @author n.hoffmann
90 * @created Feb 12, 2010
91 * @version 1.0
92 */
93 public class DetailsViewer extends AbstractCdmDataViewer {
94
95 private enum VIEW_PART {
96 TAXON, NAME, REFEERENCE, TEAM, PERSON, DESCRIPTION, DESCRIPTION_ELEMENT, EMPTY, IMAGE_GALLERY, MEDIA, TEAM_OR_PERSON_BASE, DERIVED_UNIT, FEATURE_DISTRIBUTION, POLYTOMOUS_KEY, POLYTOMOUS_KEY_NODE, USER, GROUP
97 }
98
99 private VIEW_PART currentViewPart;
100
101 private ISelection selection;
102
103 /**
104 * <p>
105 * Constructor for DetailsViewer.
106 * </p>
107 *
108 * @param parent
109 * a {@link org.eclipse.swt.widgets.Composite} object.
110 * @param viewPart
111 * a {@link eu.etaxonomy.taxeditor.view.AbstractCdmViewPart}
112 * object.
113 */
114 public DetailsViewer(Composite parent, AbstractCdmViewPart viewPart) {
115 super(parent, viewPart);
116 }
117
118 // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
119 // since we are getting implementations of DerivedUnitBase from the bulk
120 // editor
121 // and not derived unit facade objects,
122
123 /*
124 * (non-Javadoc)
125 *
126 * @see
127 * eu.etaxonomy.taxeditor.editor.view.AbstractCdmDataViewer#setInput(java
128 * .lang.Object)
129 */
130 @Override
131 public void setInput(Object input) {
132 if (input instanceof DerivedUnitBase) {
133 try {
134 input = DerivedUnitFacade.NewInstance((DerivedUnitBase) input,
135 PreferencesUtil.getDerivedUnitConfigurator());
136 } catch (DerivedUnitFacadeNotSupportedException e) {
137 StoreUtil.error(getClass(), e);
138 }
139 }
140 super.setInput(input);
141 }
142
143 @Override
144 protected void markViewPartDirty() {
145 if (getInput() instanceof DerivedUnitFacade) {
146 getViewPart().changed(
147 ((DerivedUnitFacade) getInput()).innerDerivedUnit());
148 }
149
150 super.markViewPartDirty();
151 }
152
153 // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
154
155 /*
156 * (non-Javadoc)
157 *
158 * @see org.eclipse.jface.viewers.Viewer#refresh()
159 */
160 /** {@inheritDoc} */
161 @Override
162 protected void showParts() {
163 if (getInput() instanceof TaxonBase) {
164 if (currentViewPart != VIEW_PART.TAXON) {
165 createTaxonSections(rootElement);
166 currentViewPart = VIEW_PART.TAXON;
167
168 // preserve a pointer to the AbstractNameComposite
169 // MultiPageTaxonEditor editor =
170 // EditorUtil.getActiveMultiPageTaxonEditor();
171 // if(editor != null){
172 // TaxonNameEditor page = (TaxonNameEditor)
173 // editor.getPage(Page.NAME);
174 // for(AbstractGroupedContainer container :
175 // page.getGroupedContainers()){
176 // if(container.getData() == getInput()){
177 // sourceContainer = container;
178 // }
179 // }
180 // }
181 }
182 } else if (getInput() instanceof NonViralName) {
183 if (currentViewPart != VIEW_PART.NAME) {
184 createNameSections(rootElement);
185 currentViewPart = VIEW_PART.NAME;
186 }
187 } else if (getInput() instanceof Reference) {
188 if (currentViewPart != VIEW_PART.REFEERENCE) {
189 createReferenceSections(rootElement);
190 currentViewPart = VIEW_PART.REFEERENCE;
191 }
192 } else if (getInput() instanceof Team) {
193 if (currentViewPart != VIEW_PART.TEAM) {
194 createTeamDetailSection(rootElement);
195 currentViewPart = VIEW_PART.TEAM;
196 }
197 } else if (getInput() instanceof Person) {
198 if (currentViewPart != VIEW_PART.PERSON) {
199 createPersonDetailSection(rootElement);
200 currentViewPart = VIEW_PART.PERSON;
201 }
202 } else if (getInput() instanceof TeamOrPersonBase) {
203 // fallback
204 if (currentViewPart != VIEW_PART.TEAM_OR_PERSON_BASE) {
205 createTeamOrPersonBaseDetailSection(rootElement);
206 currentViewPart = VIEW_PART.TEAM_OR_PERSON_BASE;
207 }
208 } else if (getInput() instanceof DescriptionBase) {
209 if (((DescriptionBase) getInput()).isImageGallery()) {
210 if (currentViewPart != VIEW_PART.IMAGE_GALLERY) {
211 createImageGallerySection(rootElement);
212 currentViewPart = VIEW_PART.IMAGE_GALLERY;
213 }
214 } else {
215 if (currentViewPart != VIEW_PART.DESCRIPTION) {
216 createDescriptionSection(rootElement);
217 currentViewPart = VIEW_PART.DESCRIPTION;
218 }
219 }
220 } else if (getInput() instanceof DescriptionElementBase) {
221 if (currentViewPart != VIEW_PART.DESCRIPTION_ELEMENT) {
222 createDescriptionElementSection(rootElement);
223 currentViewPart = VIEW_PART.DESCRIPTION_ELEMENT;
224 }
225 } else if (getInput() instanceof Media) {
226 if (currentViewPart != VIEW_PART.MEDIA) {
227 createMediaElementSection(rootElement);
228 currentViewPart = VIEW_PART.MEDIA;
229 }
230 } else if (getInput() instanceof DerivedUnitFacade) {
231 if (currentViewPart != VIEW_PART.DERIVED_UNIT) {
232 createDerivedUnitBaseElementSection(rootElement);
233 currentViewPart = VIEW_PART.DERIVED_UNIT;
234 }
235 } else if (getInput() instanceof FeatureNodeContainer) {
236 if (currentViewPart != VIEW_PART.FEATURE_DISTRIBUTION) {
237 createFeatureDistributionSection(rootElement);
238 currentViewPart = VIEW_PART.FEATURE_DISTRIBUTION;
239 }
240 } else if (getInput() instanceof PolytomousKey) {
241 if (currentViewPart != VIEW_PART.POLYTOMOUS_KEY) {
242 createPolytomousKeySection(rootElement);
243 currentViewPart = VIEW_PART.POLYTOMOUS_KEY;
244 }
245 } else if ((getInput() instanceof PolytomousKeyNode)
246 || (getInput() instanceof PolytomousKeyRelationship)) {
247 if (currentViewPart != VIEW_PART.POLYTOMOUS_KEY_NODE) {
248 createPolytomousKeyNodeSection(rootElement);
249 currentViewPart = VIEW_PART.POLYTOMOUS_KEY_NODE;
250 }
251 } else if (getInput() instanceof User) {
252 if (currentViewPart != VIEW_PART.USER) {
253 createUserSection(rootElement);
254 currentViewPart = VIEW_PART.USER;
255 }
256 } else if (getInput() instanceof Group) {
257 if (currentViewPart != VIEW_PART.GROUP) {
258 createGroupSection(rootElement);
259 currentViewPart = VIEW_PART.GROUP;
260 }
261 } else {
262 destroySections();
263 currentViewPart = VIEW_PART.EMPTY;
264 }
265
266 layout();
267 }
268
269 /**
270 * @param rootElement
271 */
272 private void createGroupSection(RootElement parent) {
273 destroySections();
274
275 GroupDetailSection groupDetailSection = (GroupDetailSection) formFactory
276 .createCdmDetailSection(DetailType.GROUP,
277 getConversationHolder(), parent, this, Section.TWISTIE
278 | Section.EXPANDED);
279 MemberDetailSection memberDetailSection = (MemberDetailSection) formFactory
280 .createEntityDetailSection(EntityDetailType.MEMBER,
281 getConversationHolder(), parent, Section.TWISTIE
282 | Section.EXPANDED);
283 GrantedAuthorityDetailSection grantedAuthorityDetailSection = (GrantedAuthorityDetailSection) formFactory
284 .createEntityDetailSection(EntityDetailType.GRANTED_AUTHORITY,
285 getConversationHolder(), parent, Section.TWISTIE
286 | Section.EXPANDED);
287
288 addPart(groupDetailSection);
289 addPart(memberDetailSection);
290 addPart(grantedAuthorityDetailSection);
291 }
292
293 /*
294 * (non-Javadoc)
295 *
296 * @see org.eclipse.jface.viewers.Viewer#getSelection()
297 */
298 /** {@inheritDoc} */
299 @Override
300 public ISelection getSelection() {
301 return selection;
302 }
303
304 /*
305 * (non-Javadoc)
306 *
307 * @see
308 * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
309 * .ISelection, boolean)
310 */
311 /** {@inheritDoc} */
312 @Override
313 public void setSelection(ISelection selection, boolean reveal) {
314 this.selection = selection;
315 SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(
316 this, selection);
317 fireSelectionChanged(selectionChangedEvent);
318 }
319
320 private void createTaxonSections(RootElement parent) {
321 destroySections();
322
323 TaxonBaseDetailSection taxonBaseDetailSection = (TaxonBaseDetailSection) formFactory
324 .createCdmDetailSection(DetailType.TAXONBASE,
325 getConversationHolder(), parent, this, Section.TWISTIE);
326
327 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
328
329 NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
330 .createCdmDetailSection(DetailType.NONVIRALNAME,
331 getConversationHolder(), parent, this, Section.TWISTIE
332 | Section.EXPANDED);
333
334 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
335
336 NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
337 .createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
338 getConversationHolder(), parent, this, Section.TWISTIE);
339
340 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
341
342 NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
343 .createEntityDetailSection(
344 EntityDetailType.NOMENCLATURALSTATUS,
345 getConversationHolder(), parent, Section.TWISTIE);
346
347 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
348
349 ProtologueSection protologSection = (ProtologueSection) formFactory
350 .createEntityDetailSection(EntityDetailType.PROTOLOG,
351 getConversationHolder(), parent, Section.TWISTIE);
352
353 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
354
355 TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
356 .createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
357 getConversationHolder(), parent, Section.TWISTIE);
358
359 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
360
361 NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
362 .createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
363 getConversationHolder(), parent, Section.TWISTIE);
364
365 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
366
367 HybridDetailSection hybridDetailSection = (HybridDetailSection) formFactory
368 .createCdmDetailSection(DetailType.HYBRID,
369 getConversationHolder(), parent, this, Section.TWISTIE);
370
371 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
372
373 ParsingMessagesSection parsingMessagesSection = (ParsingMessagesSection) formFactory
374 .createCdmDetailSection(DetailType.PARSINGMESSAGE,
375 getConversationHolder(), parent, this, Section.EXPANDED);
376
377 addPart(taxonBaseDetailSection);
378 addPart(nonViralNameSection);
379 addPart(nomenclaturalStatusSection);
380 addPart(protologSection);
381 addPart(referenceDetailSection);
382 addPart(typeDesignationSection);
383 addPart(nameRelationshipSection);
384 addPart(hybridDetailSection);
385 addPart(parsingMessagesSection);
386 }
387
388 private void createNameSections(RootElement parent) {
389 destroySections();
390 NonViralNameDetailSection nonViralNameSection = (NonViralNameDetailSection) formFactory
391 .createCdmDetailSection(DetailType.NONVIRALNAME,
392 getConversationHolder(), parent, this, Section.TWISTIE
393 | Section.EXPANDED);
394
395 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
396
397 NomenclaturalReferenceDetailSection referenceDetailSection = (NomenclaturalReferenceDetailSection) formFactory
398 .createCdmDetailSection(DetailType.NOMENCLATURALREFERENCE,
399 getConversationHolder(), parent, this, Section.TWISTIE);
400
401 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
402
403 NomenclaturalStatusSection nomenclaturalStatusSection = (NomenclaturalStatusSection) formFactory
404 .createEntityDetailSection(
405 EntityDetailType.NOMENCLATURALSTATUS,
406 getConversationHolder(), parent, Section.TWISTIE);
407
408 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
409
410 ProtologueSection protologSection = (ProtologueSection) formFactory
411 .createEntityDetailSection(EntityDetailType.PROTOLOG,
412 getConversationHolder(), parent, Section.TWISTIE);
413
414 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
415
416 TypeDesignationSection typeDesignationSection = (TypeDesignationSection) formFactory
417 .createEntityDetailSection(EntityDetailType.TYPEDESIGNATION,
418 getConversationHolder(), parent, Section.TWISTIE);
419
420 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
421
422 NameRelationshipDetailSection nameRelationshipSection = (NameRelationshipDetailSection) formFactory
423 .createEntityDetailSection(EntityDetailType.NAME_RELATIONSHIP,
424 getConversationHolder(), parent, Section.TWISTIE);
425
426 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
427
428 HybridDetailSection hybridDetailSection = (HybridDetailSection) formFactory
429 .createCdmDetailSection(DetailType.HYBRID,
430 getConversationHolder(), parent, this, Section.TWISTIE);
431
432 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
433
434 addPart(nonViralNameSection);
435 addPart(nomenclaturalStatusSection);
436 addPart(protologSection);
437 addPart(referenceDetailSection);
438 addPart(typeDesignationSection);
439 addPart(nameRelationshipSection);
440 addPart(hybridDetailSection);
441 }
442
443 private void createReferenceSections(RootElement parent) {
444 destroySections();
445
446 ReferenceDetailSection referenceDetailSection = (ReferenceDetailSection) formFactory
447 .createCdmDetailSection(DetailType.REFERENCEBASE,
448 getConversationHolder(), parent, this, Section.TWISTIE
449 | Section.EXPANDED);
450
451 addPart(referenceDetailSection);
452 }
453
454 private void createTeamOrPersonBaseDetailSection(RootElement parent) {
455 destroySections();
456 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = (TeamOrPersonBaseDetailSection) formFactory
457 .createCdmDetailSection(DetailType.TEAMORPERSONBASE,
458 getConversationHolder(), parent, this, Section.TWISTIE
459 | Section.EXPANDED);
460
461 addPart(teamOrPersonBaseDetailSection);
462 }
463
464 private void createTeamDetailSection(RootElement parent) {
465 destroySections();
466 TeamDetailSection teamDetailSection = (TeamDetailSection) formFactory
467 .createCdmDetailSection(DetailType.TEAM,
468 getConversationHolder(), parent, this, Section.TWISTIE
469 | Section.EXPANDED);
470
471 addPart(teamDetailSection);
472 }
473
474 private void createPersonDetailSection(RootElement parent) {
475 destroySections();
476 PersonDetailSection personDetailSection = (PersonDetailSection) formFactory
477 .createCdmDetailSection(DetailType.PERSON,
478 getConversationHolder(), parent, this, Section.TWISTIE
479 | Section.EXPANDED);
480 addPart(personDetailSection);
481 }
482
483 private void createDescriptionElementSection(RootElement parent) {
484 destroySections();
485
486 DescriptionElementDetailSection descriptionElementDetailSection = (DescriptionElementDetailSection) formFactory
487 .createCdmDetailSection(DetailType.DESCRIPTIONELEMENT,
488 getConversationHolder(), parent, this, Section.TWISTIE
489 | Section.EXPANDED);
490
491 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
492
493 DescriptionElementSourceSection descriptionElementSourceSection = (DescriptionElementSourceSection) formFactory
494 .createEntityDetailSection(
495 EntityDetailType.DESCRIPTIONELEMENTSOURCE,
496 getConversationHolder(), parent, Section.TWISTIE);
497
498 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
499
500 DescriptionElementMediaSection descriptionElementMediaSection = (DescriptionElementMediaSection) formFactory
501 .createEntityDetailSection(
502 EntityDetailType.DESCRIPTIONELEMENTMEDIA,
503 getConversationHolder(), parent, Section.TWISTIE);
504
505 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
506
507 addPart(descriptionElementDetailSection);
508 addPart(descriptionElementSourceSection);
509 addPart(descriptionElementMediaSection);
510 }
511
512 private void createDescriptionSection(RootElement parent) {
513 destroySections();
514 DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
515 .createCdmDetailSection(DetailType.DESCRIPTION,
516 getConversationHolder(), parent, this, Section.TWISTIE
517 | Section.EXPANDED);
518
519 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
520
521 NaturalLanguageSection naturalLanguageSection = (NaturalLanguageSection) formFactory
522 .createCdmDetailSection(DetailType.NATURAL_LANGUAGE,
523 getConversationHolder(), parent, this, Section.TWISTIE
524 | Section.EXPANDED);
525
526 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
527
528 DescribedSpecimenSection describedSpecimenSection = (DescribedSpecimenSection) formFactory
529 .createEntityDetailSection(EntityDetailType.DESCRIBED_SPECIMEN,
530 getConversationHolder(), parent, Section.TWISTIE);
531
532 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
533
534 DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
535 .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
536 getConversationHolder(), parent, Section.TWISTIE);
537
538 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
539
540 ScopeSection scopeSection = (ScopeSection) formFactory
541 .createEntityDetailSection(EntityDetailType.SCOPE,
542 getConversationHolder(), parent, Section.TWISTIE);
543
544 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
545
546 addPart(descriptionDetailSection);
547 addPart(naturalLanguageSection);
548 addPart(describedSpecimenSection);
549 addPart(descriptionSourceSection);
550 addPart(scopeSection);
551 }
552
553 /**
554 * @param rootElement
555 */
556 private void createImageGallerySection(RootElement parent) {
557 destroySections();
558 DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
559 .createCdmDetailSection(DetailType.DESCRIPTION,
560 getConversationHolder(), parent, this, Section.TWISTIE
561 | Section.EXPANDED);
562
563 addPart(descriptionDetailSection);
564 }
565
566 private void createMediaElementSection(RootElement parent) {
567 destroySections();
568 MediaDetailsSection mediaDetailSection = (MediaDetailsSection) formFactory
569 .createCdmDetailSection(DetailType.MEDIA,
570 getConversationHolder(), parent, this, Section.TWISTIE
571 | Section.EXPANDED);
572
573 addPart(mediaDetailSection);
574 }
575
576 private void createDerivedUnitBaseElementSection(RootElement parent) {
577 destroySections();
578
579 GeneralDetailSection generalDetailSection = (GeneralDetailSection) formFactory
580 .createCdmDetailSection(DetailType.DERIVED_UNIT_GENERAL,
581 getConversationHolder(), parent, this, Section.TWISTIE
582 | Section.EXPANDED);
583
584 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
585
586 GatheringEventDetailSection gatheringEventDetailSection = (GatheringEventDetailSection) formFactory
587 .createCdmDetailSection(DetailType.GATHERING_EVENT,
588 getConversationHolder(), parent, this, Section.TWISTIE);
589
590 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
591
592 FieldObservationDetailSection fieldObservationDetailSection = (FieldObservationDetailSection) formFactory
593 .createCdmDetailSection(DetailType.FIELD_OBSERVATION,
594 getConversationHolder(), parent, this, Section.TWISTIE);
595
596 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
597
598 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = (DerivedUnitBaseDetailSection) formFactory
599 .createCdmDetailSection(DetailType.DERIVED_UNIT,
600 getConversationHolder(), parent, this, Section.TWISTIE);
601
602 Object getBoolean;
603 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
604
605 DeterminationDetailSection determinationDetailSection = (DeterminationDetailSection) formFactory
606 .createCdmDetailSection(DetailType.DETERMINATION,
607 getConversationHolder(), parent, this, Section.TWISTIE);
608
609
610 addPart(generalDetailSection);
611 addPart(gatheringEventDetailSection);
612 addPart(fieldObservationDetailSection);
613 addPart(derivedUnitBaseDetailSection);
614 addPart(determinationDetailSection);
615
616 }
617
618 /**
619 * @param rootElement
620 */
621 private void createFeatureDistributionSection(RootElement parent) {
622 destroySections();
623
624 FeatureDistributionDetailSection featureDistributionSection = (FeatureDistributionDetailSection) formFactory
625 .createCdmDetailSection(DetailType.FEATURE_DISTRIBUTION,
626 getConversationHolder(), parent, this, Section.TWISTIE
627 | Section.EXPANDED);
628
629 addPart(featureDistributionSection);
630 }
631
632 private void createPolytomousKeySection(RootElement parent) {
633 destroySections();
634
635 PolytomousKeyDetailSection polytomousKeyDetailSection = (PolytomousKeyDetailSection) formFactory
636 .createCdmDetailSection(DetailType.POLYTOMOUS_KEY,
637 getConversationHolder(), parent, this, Section.TWISTIE
638 | Section.EXPANDED);
639
640 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
641
642 GeographicalScopeDetailSection geographicalScopeDetailSection = (GeographicalScopeDetailSection) formFactory
643 .createEntityDetailSection(EntityDetailType.GEOGRAPHICAL_SCOPE,
644 getConversationHolder(), parent, Section.TWISTIE);
645
646 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
647
648 ScopeRestrictionSection scopeRestrictionSection = (ScopeRestrictionSection) formFactory
649 .createEntityDetailSection(EntityDetailType.SCOPE_RESTRICTION,
650 getConversationHolder(), parent, Section.TWISTIE);
651
652 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
653
654 TaxonomicScopeSection taxonomicScopeSection = (TaxonomicScopeSection) formFactory
655 .createEntityDetailSection(EntityDetailType.TAXONOMIC_SCOPE,
656 getConversationHolder(), parent, Section.TWISTIE);
657
658 addPart(polytomousKeyDetailSection);
659 addPart(geographicalScopeDetailSection);
660 addPart(scopeRestrictionSection);
661 addPart(taxonomicScopeSection);
662 }
663
664 private void createPolytomousKeyNodeSection(RootElement parent) {
665 destroySections();
666
667 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = (PolytomousKeyNodeDetailSection) formFactory
668 .createCdmDetailSection(DetailType.POLYTOMOUS_KEY_NODE,
669 getConversationHolder(), parent, this, Section.TWISTIE
670 | Section.EXPANDED);
671
672 addPart(polytomousKeyNodeDetailSection);
673 }
674
675 private void createUserSection(RootElement parent) {
676 destroySections();
677
678 UserDetailSection userDetailSection = (UserDetailSection) formFactory
679 .createCdmDetailSection(DetailType.USER,
680 getConversationHolder(), parent, this, Section.TWISTIE
681 | Section.EXPANDED);
682
683 GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) formFactory
684 .createEntityDetailSection(EntityDetailType.GROUPS_BY_USER,
685 getConversationHolder(), parent, Section.TWISTIE
686 | Section.EXPANDED);
687
688 addPart(userDetailSection);
689 addPart(groupByUserDetailSection);
690 }
691 }