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