- added interface IDerivedUnitFacadeEditor to tag editors that are working with...
[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.AbstractUtility;
56 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
57 import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadeEditor;
58 import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
59 import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
60 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
61 import eu.etaxonomy.taxeditor.store.CdmStore;
62 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
63 import eu.etaxonomy.taxeditor.ui.element.RootElement;
64 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
65 import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
66 import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
67 import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
68 import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
69 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
70 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
71 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
72 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
73 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
74 import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
75 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
76 import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
77 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
78 import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
79 import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
80 import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
81 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
82 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
83 import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
84 import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
85 import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
86 import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
87 import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
88 import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
89 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
90 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailSection;
91 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
92 import eu.etaxonomy.taxeditor.ui.section.occurrence.EmptySection;
93 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
94 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
95 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
96 import eu.etaxonomy.taxeditor.ui.section.occurrence.OriginalLabelDataSection;
97 import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
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.MediaSpecimenGeneralDetailSection;
112 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
113 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
114 import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection;
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 //TissueSample should only be created by using it's own class
295 //in future using only one class with different SpecimenOrObservationTypes is desired
296 // createTissueSampleSection(rootElement);
297 }
298 else{
299 createDerivedUnitBaseElementSection(rootElement);
300 }
301 } else if (input instanceof DnaSample){
302 DnaSample dnaSample = (DnaSample)input;
303 if(dnaSample.getRecordBasis()==SpecimenOrObservationType.TissueSample){
304 createTissueSampleSection(rootElement);
305 }
306 else if(dnaSample.getRecordBasis()==SpecimenOrObservationType.DnaSample){
307 createDnaSampleSection(rootElement);
308 }
309 } else if (input instanceof MediaSpecimen){
310 createMediaSpecimenSection(rootElement);
311 }
312 else if(input instanceof Amplification){
313 createAmplificationSection(rootElement);
314 }
315 else if(input instanceof Sequence){
316 createSequenceSection(rootElement);
317 }
318 else if(input instanceof SingleRead){
319 createSingleReadSection(rootElement);
320 }
321 else if (input instanceof FeatureNodeContainer) {
322 createFeatureDistributionSection(rootElement);
323
324 }else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
325 createPolytomousKeyNodeSection(rootElement);
326 } else if (input instanceof User) {
327 createUserSection(rootElement);
328 } else if (input instanceof Group) {
329 createGroupSection(rootElement);
330 } else if (input instanceof TaxonRelationship) {
331 createTaxonRelationshipSection(rootElement);
332 } else if (input instanceof TermVocabulary) {
333 createTermVocabularySection(rootElement);
334 } else if (input instanceof DefinedTermBase) {
335 createDefinedTermSection(rootElement);
336 }
337 else {
338 createEmptySection(rootElement);
339 }
340 layout();
341 }
342
343
344 /**
345 * @param rootElement
346 */
347 private void createEmptySection(RootElement parent) {
348 destroySections();
349
350 EmptySection emptySection = formFactory.createEmptySection(formFactory, parent, SWT.NONE);
351
352 addPart(emptySection);
353 }
354
355 /**
356 * @param rootElement
357 */
358 private void createGroupSection(RootElement parent) {
359 destroySections();
360
361 GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
362 MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
363 GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
364
365 addPart(groupDetailSection);
366 addPart(memberDetailSection);
367 addPart(grantedAuthorityDetailSection);
368 }
369
370 /*
371 * (non-Javadoc)
372 *
373 * @see org.eclipse.jface.viewers.Viewer#getSelection()
374 */
375 /** {@inheritDoc} */
376 @Override
377 public ISelection getSelection() {
378 return selection;
379 }
380
381 /*
382 * (non-Javadoc)
383 *
384 * @see
385 * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
386 * .ISelection, boolean)
387 */
388 /** {@inheritDoc} */
389 @Override
390 public void setSelection(ISelection selection, boolean reveal) {
391 this.selection = selection;
392 if(this.selection!=null){
393 SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
394 fireSelectionChanged(selectionChangedEvent);
395 }
396 }
397
398 /**
399 * createTaxonSections(RootElement parent)
400 *
401 * @param parent
402 */
403 private void createTaxonSections(RootElement parent) {
404 destroySections();
405
406 ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
407 ExpandableComposite.EXPANDED | ExpandableComposite.EXPANDED);
408
409 TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
410 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
411 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
412
413 NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this,
414 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
415 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
416
417 NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
418 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
419 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
420
421 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
422 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
423 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
424
425 //TODO RL
426 if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
427 ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
428 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
429
430 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
431 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
432
433 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
434 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
435
436 addPart(protologSection);
437 addPart(typeDesignationSection);
438 addPart(nameRelationshipSection);
439 }
440
441
442 addPart(parsingMessagesSection);
443 addPart(taxonBaseDetailSection);
444 addPart(nonViralNameSection);
445 addPart(nomenclaturalStatusSection);
446 addPart(referenceDetailSection);
447 }
448
449 /**
450 * createNameSections
451 *
452 * @param parent
453 */
454 private void createNameSections(RootElement parent) {
455 destroySections();
456 NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this,
457 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
458 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
459
460 NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
461 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
462 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
463
464 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
465 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
466 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
467
468 addPart(nonViralNameSection);
469 addPart(nomenclaturalStatusSection);
470 addPart(referenceDetailSection);
471 //TODO RL
472 if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
473 ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
474 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
475
476 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
477 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
478
479 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
480 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
481 addPart(protologSection);
482 addPart(typeDesignationSection);
483 addPart(nameRelationshipSection);
484 }
485 }
486
487 /**
488 * createReferenceSections
489 *
490 * @param parent
491 */
492 private void createReferenceSections(RootElement parent) {
493 destroySections();
494
495 ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this,
496 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
497
498 addPart(referenceDetailSection);
499 }
500
501 /**
502 * createTeamOrPersonBaseDetailSection
503 *
504 * @param parent
505 */
506 private void createTeamOrPersonBaseDetailSection(RootElement parent) {
507 destroySections();
508 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
509
510 addPart(teamOrPersonBaseDetailSection);
511 }
512
513 /**
514 * createTeamDetailSection
515 *
516 * @param parent
517 */
518 private void createTeamDetailSection(RootElement parent) {
519 destroySections();
520 TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
521
522 addPart(teamDetailSection);
523 }
524
525 /**
526 * createPersonDetailSection
527 *
528 * @param parent
529 */
530 private void createPersonDetailSection(RootElement parent) {
531 destroySections();
532 PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
533 addPart(personDetailSection);
534 }
535
536 /**
537 * createDescriptionElementSection
538 *
539 * @param parent
540 */
541 private void createDescriptionElementSection(RootElement parent) {
542 destroySections();
543
544 DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
545
546 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
547
548 DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
549
550 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
551
552 DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
553
554 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
555
556 addPart(descriptionElementDetailSection);
557 addPart(descriptionElementSourceSection);
558 addPart(descriptionElementMediaSection);
559 }
560
561 /**
562 * createDescriptionSection
563 *
564 * @param parent
565 */
566 private void createDescriptionSection(RootElement parent) {
567 destroySections();
568 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
569
570 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
571
572 NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
573
574 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
575
576 DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
577
578 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
579
580 // DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
581 // .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
582 // getConversationHolder(), parent, Section.TWISTIE);
583 //
584 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
585
586 ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
587
588 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
589
590 addPart(descriptionDetailSection);
591 addPart(naturalLanguageSection);
592 addPart(describedSpecimenSection);
593 // addPart(descriptionSourceSection);
594 addPart(scopeSection);
595 }
596
597 /**
598 * createDescriptionSection
599 *
600 * @param parent
601 */
602 private void createSpecimenDescriptionSection(RootElement parent) {
603 destroySections();
604 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
605 addPart(descriptionDetailSection);
606 }
607
608 /**
609 * Creates the use Description section
610 *
611 * @param parent
612 */
613 private void createUseDescriptionSection(RootElement parent) {
614 destroySections();
615 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
616
617 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
618
619 DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
620
621 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
622
623 addPart(descriptionDetailSection);
624 addPart(descriptionSourceSection);
625
626 }
627
628
629 /**
630 * @param rootElement
631 */
632 private void createImageGallerySection(RootElement parent) {
633 destroySections();
634 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
635
636 addPart(descriptionDetailSection);
637 }
638
639 /**
640 * createMediaElementSection
641 *
642 * @param parent
643 */
644
645 private void createMediaElementSection(RootElement parent) {
646 destroySections();
647
648 MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
649
650 addPart(mediaDetailSection);
651 }
652
653 /**
654 * createDerivedUnitBaseElementSection
655 *
656 * @param parent
657 */
658 private void createDerivedUnitBaseElementSection(RootElement parent) {
659 destroySections();
660
661 DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
662 addPart(derivedUnitGeneralDetailSection);
663
664 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
665
666 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
667 addPart(derivedUnitBaseDetailSection);
668
669 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
670
671 OriginalLabelDataSection originalLabelDataSection = formFactory.createOriginalLabelDataSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
672 addPart(originalLabelDataSection);
673
674 //for editors working with facades
675 if(AbstractUtility.getActiveEditor() instanceof IDerivedUnitFacadeEditor){
676 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
677 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
678 addPart(gatheringEventDetailSection);
679
680 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
681 FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
682 addPart(fieldUnitDetailSection);
683 }
684
685 if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
686 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
687 DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
688 addPart(determinationDetailSection);
689 }
690 if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS)){
691 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
692 TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
693 addPart(taxonAssociationDetailSection);
694 }
695
696 }
697
698 private void createFieldUnitSection(RootElement parent) {
699 destroySections();
700
701 FieldUnitGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
702
703 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
704
705 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
706
707 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
708
709 FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
710
711 addPart(fielUnitGeneralDetailSection);
712 addPart(gatheringEventDetailSection);
713 addPart(fieldUnitDetailSection);
714
715 if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
716 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
717 DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
718 addPart(determinationDetailSection);
719 }
720 }
721
722 private void createTissueSampleSection(RootElement parent) {
723 destroySections();
724
725 TissueSampleGeneralDetailSection section = formFactory.createTissueSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
726
727 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
728
729 SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
730
731 addPart(section);
732 addPart(sampleDesignationDetailSection);
733 }
734
735 private void createDnaSampleSection(RootElement parent) {
736 destroySections();
737
738 DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
739
740 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
741
742 DnaQualityDetailSection qualitySection = formFactory.createDnaQualityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
743
744 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
745
746 SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
747
748 addPart(section);
749 addPart(qualitySection);
750 addPart(sampleDesignationDetailSection);
751 }
752
753 private void createAmplificationSection(RootElement parent) {
754 destroySections();
755 AmplificationGeneralDetailSection generalSection = formFactory.createAmplificationGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
756
757 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
758
759 AmplificationPrimerDetailSection primerSection = formFactory.createAmplificationPrimerDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
760
761 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
762
763 AmplificationCloningDetailSection cloningSection = formFactory.createAmplificationCloningDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
764
765 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
766
767 AmplificationGelPhotoCollectionDetailSection gelPhotoSection = formFactory.createAmplificationGelPhotoCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
768
769
770 addPart(generalSection);
771 addPart(primerSection);
772 addPart(cloningSection);
773 addPart(gelPhotoSection);
774 }
775
776 private void createSequenceSection(RootElement parent) {
777 destroySections();
778
779 SequenceGeneralDetailSection section = formFactory.createSequenceGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
780
781 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
782
783 SequenceReferenceCollectionDetailSection referenceSection = formFactory.createSequenceReferenceCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
784
785 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
786
787 SequenceContigFileCollectionDetailSection contigFileSection = formFactory.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
788
789
790 addPart(section);
791 addPart(referenceSection);
792 addPart(contigFileSection);
793 }
794
795 private void createSingleReadSection(RootElement parent) {
796 destroySections();
797
798 SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
799
800 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
801
802 SingleReadPherogramCollectionDetailSection pherogramSection = formFactory.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
803
804 addPart(section);
805 addPart(pherogramSection);
806 }
807
808 private void createMediaSpecimenSection(RootElement parent) {
809 destroySections();
810
811 MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
812 addPart(generalSection);
813
814 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
815
816 RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
817 addPart(rightsSection);
818
819 }
820
821
822
823 /**
824 * @param rootElement
825 */
826 private void createFeatureDistributionSection(RootElement parent) {
827 destroySections();
828
829 FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
830
831 addPart(featureDistributionSection);
832 }
833
834 /**
835 * createPolytomousKeyNodeSection
836 *
837 * @param parent
838 */
839 private void createPolytomousKeyNodeSection(RootElement parent) {
840 destroySections();
841
842 PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
843
844 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
845
846 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
847
848 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
849
850 TaxonomicScopeSection taxonomicScopeSection = formFactory.createTaxonomicScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
851
852 addPart(polytomousKeyDetailSection);
853 addPart(polytomousKeyNodeDetailSection);
854 addPart(taxonomicScopeSection);
855
856 }
857
858 /**
859 * create the UseRecordSection
860 *
861 * @param parent
862 */
863 private void createUseRecordSection(RootElement parent) {
864 destroySections();
865
866 UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
867
868 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
869
870 addPart(descriptionUseRecordSection);
871
872
873 }
874
875 /**
876 * createUserSection
877 *
878 * @param parent
879 */
880 private void createUserSection(RootElement parent) {
881 destroySections();
882
883 UserDetailSection userDetailSection = formFactory.createUserDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
884
885 GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
886
887 addPart(userDetailSection);
888 addPart(groupByUserDetailSection);
889 }
890
891 /**
892 * createTaxonRelationshipSection
893 *
894 * @param parent
895 */
896 private void createTaxonRelationshipSection(RootElement parent) {
897 destroySections();
898
899 TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
900
901 ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
902 addPart(taxonRelationshipDetailSection);
903 addPart(referencedEntityBaseDetailSection);
904 }
905
906 /**
907 * @param rootElement
908 */
909 private void createTermVocabularySection(RootElement parent) {
910 destroySections();
911
912 TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
913 addPart(termVocabularyDetailSection);
914 }
915
916 /**
917 * createDefinedTermSection
918 *
919 * @param parent
920 */
921 private void createDefinedTermSection(RootElement parent) {
922 destroySections();
923
924 AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
925 addPart(definedTermDetailSection);
926 }
927
928 }