- added special case handling for DerivateEditor so that the DetailsView only show...
[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.IDerivedUnitFacadePart;
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 //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
663 if(!(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart)){
664 derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true);
665 }
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 | ExpandableComposite.EXPANDED);
676 addPart(originalLabelDataSection);
677
678 //for editors working with facades
679 if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart){
680 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
681 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
682 addPart(gatheringEventDetailSection);
683
684 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
685 FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
686 addPart(fieldUnitDetailSection);
687 }
688
689 if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
690 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
691 DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
692 addPart(determinationDetailSection);
693 }
694 if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS)){
695 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
696 TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
697 addPart(taxonAssociationDetailSection);
698 }
699
700 }
701
702 private void createFieldUnitSection(RootElement parent) {
703 destroySections();
704
705 FieldUnitGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
706
707 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
708
709 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
710
711 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
712
713 FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
714
715 addPart(fielUnitGeneralDetailSection);
716 addPart(gatheringEventDetailSection);
717 addPart(fieldUnitDetailSection);
718
719 if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
720 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
721 DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
722 addPart(determinationDetailSection);
723 }
724 }
725
726 private void createTissueSampleSection(RootElement parent) {
727 destroySections();
728
729 TissueSampleGeneralDetailSection section = formFactory.createTissueSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
730
731 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
732
733 SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
734
735 addPart(section);
736 addPart(sampleDesignationDetailSection);
737 }
738
739 private void createDnaSampleSection(RootElement parent) {
740 destroySections();
741
742 DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
743
744 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
745
746 DnaQualityDetailSection qualitySection = formFactory.createDnaQualityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
747
748 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
749
750 SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
751
752 addPart(section);
753 addPart(qualitySection);
754 addPart(sampleDesignationDetailSection);
755 }
756
757 private void createAmplificationSection(RootElement parent) {
758 destroySections();
759 AmplificationGeneralDetailSection generalSection = formFactory.createAmplificationGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
760
761 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
762
763 AmplificationPrimerDetailSection primerSection = formFactory.createAmplificationPrimerDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
764
765 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
766
767 AmplificationCloningDetailSection cloningSection = formFactory.createAmplificationCloningDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
768
769 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
770
771 AmplificationGelPhotoCollectionDetailSection gelPhotoSection = formFactory.createAmplificationGelPhotoCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
772
773
774 addPart(generalSection);
775 addPart(primerSection);
776 addPart(cloningSection);
777 addPart(gelPhotoSection);
778 }
779
780 private void createSequenceSection(RootElement parent) {
781 destroySections();
782
783 SequenceGeneralDetailSection section = formFactory.createSequenceGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
784
785 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
786
787 SequenceReferenceCollectionDetailSection referenceSection = formFactory.createSequenceReferenceCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
788
789 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
790
791 SequenceContigFileCollectionDetailSection contigFileSection = formFactory.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
792
793
794 addPart(section);
795 addPart(referenceSection);
796 addPart(contigFileSection);
797 }
798
799 private void createSingleReadSection(RootElement parent) {
800 destroySections();
801
802 SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
803
804 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
805
806 SingleReadPherogramCollectionDetailSection pherogramSection = formFactory.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
807
808 addPart(section);
809 addPart(pherogramSection);
810 }
811
812 private void createMediaSpecimenSection(RootElement parent) {
813 destroySections();
814
815 MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
816 addPart(generalSection);
817
818 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
819
820 RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
821 addPart(rightsSection);
822
823 }
824
825
826
827 /**
828 * @param rootElement
829 */
830 private void createFeatureDistributionSection(RootElement parent) {
831 destroySections();
832
833 FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
834
835 addPart(featureDistributionSection);
836 }
837
838 /**
839 * createPolytomousKeyNodeSection
840 *
841 * @param parent
842 */
843 private void createPolytomousKeyNodeSection(RootElement parent) {
844 destroySections();
845
846 PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
847
848 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
849
850 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
851
852 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
853
854 TaxonomicScopeSection taxonomicScopeSection = formFactory.createTaxonomicScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
855
856 addPart(polytomousKeyDetailSection);
857 addPart(polytomousKeyNodeDetailSection);
858 addPart(taxonomicScopeSection);
859
860 }
861
862 /**
863 * create the UseRecordSection
864 *
865 * @param parent
866 */
867 private void createUseRecordSection(RootElement parent) {
868 destroySections();
869
870 UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
871
872 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
873
874 addPart(descriptionUseRecordSection);
875
876
877 }
878
879 /**
880 * createUserSection
881 *
882 * @param parent
883 */
884 private void createUserSection(RootElement parent) {
885 destroySections();
886
887 UserDetailSection userDetailSection = formFactory.createUserDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
888
889 GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
890
891 addPart(userDetailSection);
892 addPart(groupByUserDetailSection);
893 }
894
895 /**
896 * createTaxonRelationshipSection
897 *
898 * @param parent
899 */
900 private void createTaxonRelationshipSection(RootElement parent) {
901 destroySections();
902
903 TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
904
905 ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
906 addPart(taxonRelationshipDetailSection);
907 addPart(referencedEntityBaseDetailSection);
908 }
909
910 /**
911 * @param rootElement
912 */
913 private void createTermVocabularySection(RootElement parent) {
914 destroySections();
915
916 TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
917 addPart(termVocabularyDetailSection);
918 }
919
920 /**
921 * createDefinedTermSection
922 *
923 * @param parent
924 */
925 private void createDefinedTermSection(RootElement parent) {
926 destroySections();
927
928 AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
929 addPart(definedTermDetailSection);
930 }
931
932 }