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