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