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