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