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