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