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