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