cleanup
[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 package eu.etaxonomy.taxeditor.view.e4.details;
10
11 import java.util.Collection;
12 import java.util.EnumSet;
13 import java.util.HashSet;
14 import java.util.Set;
15
16 import javax.inject.Inject;
17
18 import org.eclipse.e4.core.di.annotations.Optional;
19 import org.eclipse.e4.ui.di.UIEventTopic;
20 import org.eclipse.jface.viewers.ISelection;
21 import org.eclipse.jface.viewers.IStructuredSelection;
22 import org.eclipse.jface.viewers.SelectionChangedEvent;
23 import org.eclipse.jface.viewers.TreeNode;
24 import org.eclipse.swt.SWT;
25 import org.springframework.security.core.GrantedAuthority;
26
27 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
28 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
29 import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
30 import eu.etaxonomy.cdm.model.agent.Person;
31 import eu.etaxonomy.cdm.model.agent.Team;
32 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
33 import eu.etaxonomy.cdm.model.common.Marker;
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.PolytomousKeyNode;
40 import eu.etaxonomy.cdm.model.description.SpecimenDescription;
41 import eu.etaxonomy.cdm.model.description.TaxonDescription;
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.permission.CRUD;
52 import eu.etaxonomy.cdm.model.permission.Group;
53 import eu.etaxonomy.cdm.model.permission.User;
54 import eu.etaxonomy.cdm.model.reference.Reference;
55 import eu.etaxonomy.cdm.model.taxon.Synonym;
56 import eu.etaxonomy.cdm.model.taxon.Taxon;
57 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
58 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
59 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
60 import eu.etaxonomy.cdm.model.term.DefinedTermBase;
61 import eu.etaxonomy.cdm.model.term.TermNode;
62 import eu.etaxonomy.cdm.model.term.TermTree;
63 import eu.etaxonomy.cdm.model.term.TermType;
64 import eu.etaxonomy.cdm.model.term.TermVocabulary;
65 import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
66 import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
67 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
68 import eu.etaxonomy.taxeditor.editor.IBulkEditor;
69 import eu.etaxonomy.taxeditor.editor.IDistributionEditorPart;
70 import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
71 import eu.etaxonomy.taxeditor.l10n.Messages;
72 import eu.etaxonomy.taxeditor.model.AbstractUtility;
73 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
74 import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
75 import eu.etaxonomy.taxeditor.model.MessagingUtils;
76 import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
77 import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
78 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
79 import eu.etaxonomy.taxeditor.store.CdmStore;
80 import eu.etaxonomy.taxeditor.store.StoreUtil;
81 import eu.etaxonomy.taxeditor.store.UsageTermCollection;
82 import eu.etaxonomy.taxeditor.termtree.e4.ICharacterEditor;
83 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
84 import eu.etaxonomy.taxeditor.ui.element.RootElement;
85 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
86 import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
87 import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
88 import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
89 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
90 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailElement;
91 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
92 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
93 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
94 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
95 import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
96 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
97 import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
98 import eu.etaxonomy.taxeditor.ui.section.description.detail.DistributionDetailElement;
99 import eu.etaxonomy.taxeditor.ui.section.feature.CharacterDetailSection;
100 import eu.etaxonomy.taxeditor.ui.section.feature.CharacterNodeDetailSection;
101 import eu.etaxonomy.taxeditor.ui.section.feature.CharacterNodeDtoDetailSection;
102 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
103 import eu.etaxonomy.taxeditor.ui.section.feature.TermNodeDetailSection;
104 import eu.etaxonomy.taxeditor.ui.section.feature.TermTreeDetailSection;
105 import eu.etaxonomy.taxeditor.ui.section.feature.TermTreeDetailSectionForNode;
106 import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
107 import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
108 import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
109 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
110 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
111 import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
112 import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
113 import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
114 import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
115 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
116 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailSection;
117 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
118 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitFacadeDetailSection;
119 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitFacadeGeneralDetailSection;
120 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
121 import eu.etaxonomy.taxeditor.ui.section.occurrence.association.DerivedUnitTypeDesignationSection;
122 import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
123 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailSection;
124 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailSection;
125 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSamplePreparationPreservationSection;
126 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailSection;
127 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceContigFileCollectionDetailSection;
128 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailSection;
129 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollectionDetailSection;
130 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailSection;
131 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
132 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
133 import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
134 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalSourceDetailSection;
135 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
136 import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection;
137 import eu.etaxonomy.taxeditor.ui.section.supplemental.identifier.DerivedUnitFacadeIdentifierSection;
138 import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
139 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
140 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
141 import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
142 import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
143 import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
144 import eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailSection;
145 import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermMediaSection;
146 import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
147 import eu.etaxonomy.taxeditor.view.detail.CdmSectionPart;
148 import eu.etaxonomy.taxeditor.view.e4.AbstractCdmDataViewer;
149
150 /**
151 * The DetailsViewer handles the content of the details view (
152 * {@link DetailsPartE4}).<br>
153 * Depending on the type of the selected element the section of the details view
154 * are created.
155 *
156 * @author pplitzner
157 * @date 18.07.2017
158 */
159 public class DetailsViewerE4 extends AbstractCdmDataViewer {
160
161 private ISelection selection;
162 private boolean detailsEnabled = true;
163 private Object activePart;
164
165 public boolean isDetailsEnabled() {
166 return detailsEnabled;
167 }
168
169 public void setDetailsEnabled(boolean detailsEnabled) {
170 this.detailsEnabled = detailsEnabled;
171 }
172
173 public void setInput(Object input, Object activePart) {
174 this.activePart = activePart;
175 setInput(input);
176
177 }
178 // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
179 // since we are getting implementations of DerivedUnitBase from the bulk
180 // editor
181 // and not derived unit facade objects,
182
183 @Override
184 public void setInput(Object input) {
185
186 if(input instanceof TreeNode){
187 input = ((TreeNode) input).getValue();
188 }
189 if(input instanceof GbifResponse){
190 input = ((GbifResponse) input).getDerivedUnitFacade();
191 }
192 if (input instanceof DerivedUnit) {
193 DerivedUnit derivedUnit = (DerivedUnit)input;
194 if ((derivedUnit instanceof MediaSpecimen
195 || (derivedUnit instanceof DnaSample && derivedUnit.getRecordBasis() == SpecimenOrObservationType.DnaSample ))
196 && !(this.activePart instanceof IBulkEditor)){
197 //do nothing
198 }else{
199 try {
200 input = DerivedUnitFacade.NewInstance(derivedUnit,
201 PreferencesUtil.getDerivedUnitConfigurator());
202 } catch (DerivedUnitFacadeNotSupportedException e) {
203 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
204 }
205 }
206 }
207 else if(input instanceof FieldUnit){
208 input = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) input);
209 }
210 super.setInput(input);
211
212
213 }
214
215 @Override
216 protected void markViewPartDirty() {
217 if (getInput() instanceof DerivedUnitFacade) {
218 if(part instanceof IDerivedUnitFacadePart){
219 part.changed(getInput());
220 }
221 else{
222 DerivedUnitFacade facade = (DerivedUnitFacade) getInput();
223 if(facade.innerDerivedUnit()!=null){
224 part.changed(facade.innerDerivedUnit());
225 }
226 else if(facade.innerFieldUnit()!=null){
227 part.changed(facade.innerFieldUnit());
228 }
229 }
230 }
231 else{
232 super.markViewPartDirty();
233 }
234 }
235
236 @Override
237 protected void showParts() {
238 // FIXME (CM) : Need to clean out this code.
239 // Too much type checking to decide which detail view to display.
240 // Need to build in a mechanism where navigators / editors are 'aware'
241 // of the corresponding detail viewer.
242
243 Object input = getInput();
244 if (input == null){
245 return;
246 }
247 destroySections();
248 if (input instanceof TaxonBase) {
249 if(((TaxonBase<?>) input).getName()==null){
250 createEmptySection(Messages.DetailsViewerE4_TAXON_HAS_NO_NAME, rootElement);
251 }
252 else{
253 createTaxonSections(rootElement);
254 }
255 } else if (input instanceof TaxonName) {
256 createNameSections(rootElement);
257 } else if (input instanceof Reference) {
258 createReferenceSections(rootElement);
259
260 } else if (input instanceof Team) {
261 createTeamDetailSection(rootElement);
262
263 } else if (input instanceof Person) {
264 createPersonDetailSection(rootElement);
265
266 } else if (input instanceof TeamOrPersonBase) {
267 createTeamOrPersonBaseDetailSection(rootElement);
268
269 } else if (input instanceof DescriptionBase) {
270 if ((((DescriptionBase<?>)input).isComputed() || ((DescriptionBase<?>)input).isCloneForSource())&& PreferencesUtil.isComputedDesciptionHandlingDisabled()){
271 this.setDetailsEnabled(false);
272 }
273 if(input instanceof SpecimenDescription){
274 //TODO: add more sections to DetailsView for SpecimenDescription
275 createSpecimenDescriptionSection(rootElement);
276 }
277 else{
278 Set<Marker> descriptionMarkers = ((DescriptionBase<?>) input).getMarkers();
279
280 Boolean isUseDescription = false;
281 for (Marker marker : descriptionMarkers) {
282 if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
283 isUseDescription = true;
284 }
285 }
286 if (((DescriptionBase<?>) input).isImageGallery()) {
287 createImageGallerySection(rootElement);
288
289 } else if (isUseDescription) {
290 createUseDescriptionSection(rootElement);
291 } else if (input instanceof TaxonDescription){
292 createTaxonDescriptionSection(rootElement, !(((DescriptionBase<?>) input).isComputed() && PreferencesUtil.isComputedDesciptionHandlingDisabled()));
293
294 } else{
295 createDescriptionSection(rootElement, false, !(((DescriptionBase<?>) input).isComputed() && PreferencesUtil.isComputedDesciptionHandlingDisabled()));
296 }
297 }
298 } else if (input instanceof DescriptionElementBase){
299 Set<Marker> descriptionMarkers = new HashSet<>();
300 if(((DescriptionElementBase) input).getInDescription()!=null) {
301 descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
302 }
303
304 Boolean isUseDescription = false;
305 for (Marker marker : descriptionMarkers) {
306 if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
307 isUseDescription = true;
308 }
309 }
310 if (((DescriptionElementBase)input).getInDescription() != null && ((DescriptionElementBase)input).getInDescription().isComputed() && PreferencesUtil.isComputedDesciptionHandlingDisabled()){
311 this.setDetailsEnabled(false);
312 }
313 if (isUseDescription == true && input instanceof CategoricalData) {
314 createUseRecordSection(rootElement);
315 } else {
316 createDescriptionElementSection(rootElement, activePart);
317 }
318
319 } else if (input instanceof Media) {
320 createMediaElementSection(rootElement);
321 }
322 //FIXME hack to show more informative message to the user when
323 //DerivedUnit has more than one FieldUnit #4363
324 else if (input instanceof DerivedUnit && !(input instanceof MediaSpecimen) && !(input instanceof DnaSample)) {
325 DerivedUnit derivedUnit = (DerivedUnit)input;
326 try {
327 input = DerivedUnitFacade.NewInstance(derivedUnit,
328 PreferencesUtil.getDerivedUnitConfigurator());
329 } catch (DerivedUnitFacadeNotSupportedException e) {
330 createEmptySection(e.getMessage(), rootElement);
331 }
332 } else if (input instanceof DerivedUnitFacade) {
333 DerivedUnitFacade facade = (DerivedUnitFacade) input;
334 if(facade.getType() == SpecimenOrObservationType.FieldUnit){
335 if(facade.innerFieldUnit() == null){
336 MessagingUtils.error(DetailsViewerE4.class, "FieldUnit of facade is null", null); //$NON-NLS-1$
337 }
338 else{
339 createFieldUnitFacadeSection(rootElement);
340 }
341 }
342 else if(facade.getType() == SpecimenOrObservationType.PreservedSpecimen){
343 if(facade.innerDerivedUnit() == null){
344 MessagingUtils.error(DetailsViewerE4.class, "DerivedUnit of facade is null", null); //$NON-NLS-1$
345 }
346 else{
347 createDerivedUnitBaseElementSection(rootElement);
348 }
349 }
350 else if(facade.getType() == SpecimenOrObservationType.TissueSample){
351 //TissueSample should only be created by using it's own class
352 //in future using only one class with different SpecimenOrObservationTypes is desired
353 createTissueSampleSection(rootElement);
354 }else if (facade.innerDerivedUnit() instanceof DnaSample){
355 createEmptySection("DNA sample not supported by specimen list editor", rootElement);
356 }else if (facade.innerDerivedUnit() instanceof MediaSpecimen){
357 createEmptySection("Image specimen not supported by specimen list editor", rootElement);
358 }else if(facade.getType()==SpecimenOrObservationType.DnaSample){
359
360 if(facade.innerDerivedUnit().getRecordBasis()==SpecimenOrObservationType.TissueSample){
361 //this case seems to be very unlikely as innerDerivedUnit in real cases should more or less always have the same type
362 createTissueSampleSection(rootElement);
363 }
364 else if(facade.innerDerivedUnit().getRecordBasis()==SpecimenOrObservationType.DnaSample){
365 createDnaSampleSection(rootElement);
366 }
367 }else{
368 createDerivedUnitBaseElementSection(rootElement);
369 }
370 } else if (input instanceof DnaSample){
371 DnaSample dnaSample = (DnaSample)input;
372 if(dnaSample.getRecordBasis()==SpecimenOrObservationType.TissueSample){
373 createTissueSampleSection(rootElement);
374 }
375 else if(dnaSample.getRecordBasis()==SpecimenOrObservationType.DnaSample){
376 createDnaSampleSection(rootElement);
377 }
378 } else if (input instanceof MediaSpecimen){
379 createMediaSpecimenSection(rootElement);
380 }
381 else if(input instanceof Sequence){
382 createSequenceSection(rootElement);
383 }
384 else if(input instanceof SingleRead){
385 createSingleReadSection(rootElement);
386 }
387 else if (input instanceof FeatureNodeContainer) {
388 createFeatureDistributionSection(rootElement);
389
390 } else if (input instanceof TermNode) {
391 TermType type= ((TermNode<?>) input).getTermType();
392 if(type.equals(TermType.Character) ){
393 createCharacterNodeSection(rootElement);
394 }
395 else if(type.equals(TermType.Feature)){
396 createFeatureNodeSection(rootElement);
397 }
398
399 } else if (input instanceof TermTree) {
400 createFeatureTreeSection(rootElement);
401 } else if (input instanceof TermNodeDto) {
402 TermType type= ((TermNodeDto) input).getTerm().getTermType();
403 if(type.equals(TermType.Character) && activePart instanceof ICharacterEditor){
404 createCharacterNodeDtoSection(rootElement);
405 }
406 else if(type.equals(TermType.Feature) || type.equals(TermType.Character)){
407 createFeatureNodeSection(rootElement);
408 }
409
410 } else if (input instanceof TermTreeDto) {
411 createFeatureTreeSectionForDto(rootElement);
412
413 } else if (input instanceof Character) {
414 createCharacterSection(rootElement);
415
416 }else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
417 createPolytomousKeyNodeSection(rootElement);
418 } else if (input instanceof User) {
419 createUserSection(rootElement);
420 } else if (input instanceof Group) {
421 createGroupSection(rootElement);
422 } else if (input instanceof TaxonRelationship && ((TaxonRelationship)input).getType()!=null
423 && (((TaxonRelationship)input).getType().isAnyMisappliedName() || ((TaxonRelationship)input).getType().isAnySynonym() || ((TaxonRelationship)input).getType().isMisappliedName())){
424 createMisappliedNameSection(rootElement);
425 }else if (input instanceof TaxonRelationship ) {
426 createTaxonRelationshipSection(rootElement);
427 } else if (input instanceof TermVocabulary) {
428 createTermVocabularySection(rootElement);
429 } else if (input instanceof DefinedTermBase) {
430 createDefinedTermSection(rootElement);
431
432 } else if (input instanceof SelectionChangedEvent ) {
433 IStructuredSelection sel =(IStructuredSelection) ((SelectionChangedEvent)input).getSelection();
434 if (sel.getFirstElement()instanceof Distribution){
435 createDescriptionElementSection(rootElement);
436 }
437
438 // createDescriptionElementSection(rootElement);
439
440 }else {
441 createEmptySection(null, rootElement);
442 }
443 layout();
444 }
445
446 private void createGroupSection(RootElement parent) {
447 GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(GroupDetailSection.class, getInput().getClass().getCanonicalName()));
448 MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(MemberDetailSection.class, getInput().getClass().getCanonicalName()));
449 GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,StoreUtil.getSectionStyle(GrantedAuthorityDetailSection.class, getInput().getClass().getCanonicalName()));
450
451 addPart(groupDetailSection);
452 addPart(memberDetailSection);
453 addPart(grantedAuthorityDetailSection);
454 }
455
456 @Override
457 public ISelection getSelection() {
458 return selection;
459 }
460
461 @Override
462 public void setSelection(ISelection selection, boolean reveal) {
463
464 this.selection = selection;
465 if(this.selection!=null){
466 SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
467 fireSelectionChanged(selectionChangedEvent);
468 }
469 }
470
471 private void createTaxonSections(RootElement parent) {
472 NameDetailsConfigurator config = PreferencesUtil.getPreferredNameDetailsConfiguration();
473 EnumSet<CRUD> requiredCrud;
474 if(getInput() == null || StoreUtil.getCdmEntity(getInput()).getId() == 0) {
475 // new entity, not yet saved
476 requiredCrud = EnumSet.of(CRUD.CREATE);
477 } else {
478 requiredCrud = EnumSet.of(CRUD.UPDATE);
479 }
480 boolean hasPermission = CdmStore.currentAuthentiationHasPermission(StoreUtil.getCdmEntity(getInput()), requiredCrud);
481 TaxonBase<?> taxonBase = (TaxonBase<?>)getInput();
482 if (hasPermission){
483 // check for subtree permissions as well.
484
485 Taxon acceptedTaxon = null;
486 if (taxonBase instanceof Taxon){
487 acceptedTaxon = (Taxon)taxonBase;
488 }else{
489 acceptedTaxon = ((Synonym)taxonBase).getAcceptedTaxon();
490 }
491 if (acceptedTaxon != null){ //needs discussion if synonyms without accepted taxon should never be filtered by subtree permission(current implementation). See also #8849
492 Set<TaxonNode> nodes = acceptedTaxon.getTaxonNodes();
493 for (TaxonNode node: nodes){
494 hasPermission &= CdmStore.currentAuthentiationHasPermission(node, requiredCrud);
495 if (!hasPermission){
496 //check whether there are explicit TaxonNode rights
497 boolean taxonnodePermissionExists = false;
498 Collection<? extends GrantedAuthority> authorities = CdmStore.getCurrentAuthentiation().getAuthorities();
499 for (GrantedAuthority grantedAuthority: authorities){
500 if (grantedAuthority.getAuthority().startsWith("TAXONNODE")){
501 taxonnodePermissionExists = true;
502 }
503 }
504 if (!taxonnodePermissionExists){
505 hasPermission = true;
506 }
507 }
508 }
509 }
510 }
511 detailsEnabled = hasPermission;
512 ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
513 StoreUtil.getSectionStyle(ParsingMessagesSection.class, getInput().getClass().getCanonicalName(), true));
514 if (config == null){
515 TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
516 StoreUtil.getSectionStyle(TaxonBaseDetailSection.class, getInput().getClass().getCanonicalName(), true));
517 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
518 // boolean hasPermission = CdmStore.currentAuthentiationHasPermission(getInput(), Operation.UPDATE);
519 taxonBaseDetailSection.setEnabled(detailsEnabled);
520 addPart(taxonBaseDetailSection);
521 }else{
522 if (config.isTaxonSectionActivated()){
523 TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
524 StoreUtil.getSectionStyle(TaxonBaseDetailSection.class, getInput().getClass().getCanonicalName(), true));
525 taxonBaseDetailSection.setEnabled(detailsEnabled);
526 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
527 addPart(taxonBaseDetailSection);
528 }
529 }
530 //TODO: test code for secundum source section
531 // SecundumSourceSection sourceSection = formFactory.createSecundumDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(SecundumSourceSection.class, getInput().getClass().getCanonicalName(), true));
532 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
533 // addPart(sourceSection);
534 // if (taxonBase.getSecSource() == null){
535 // SecundumSource source = SecundumSource.NewSecundumInstance(taxonBase);
536 // taxonBase.setSecSource(source);
537 // sourceSection.setEntity(taxonBase);
538 // }else{
539 // sourceSection.setEntity(taxonBase);
540 // }
541 //
542 // if (config != null && !config.isSecEnabled()){
543 // sourceSection.setEnabled(false);
544 // }
545 NonViralNameDetailSection nonViralNameSection = formFactory
546 .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
547 StoreUtil.getSectionStyle(NonViralNameDetailSection.class, getInput().getClass().getCanonicalName(), true));
548 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
549 nonViralNameSection.setEnabled(detailsEnabled);
550 if (config == null || config.isNomenclaturalReferenceSectionActivated()){
551 NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
552 StoreUtil.getSectionStyle(NomenclaturalSourceDetailSection.class, getInput().getClass().getCanonicalName(), true));
553 referenceDetailSection.setEnabled(detailsEnabled);
554 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
555 addPart(referenceDetailSection);
556
557 }
558 if ( config == null || config.isNomenclaturalStatusSectionActivated()){
559 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
560 StoreUtil.getSectionStyle(NomenclaturalStatusSection.class, getInput().getClass().getCanonicalName(), true));
561 nomenclaturalStatusSection.setEnabled(detailsEnabled);
562 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
563 addPart(nomenclaturalStatusSection);
564 }
565
566 // if ( config == null || config.isProtologueActivated()){
567 // ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ProtologueSection.class, getInput().getClass().getCanonicalName()));
568 // protologSection.setEnabled(detailsEnabled);
569 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
570 // addPart(protologSection);
571 // }
572
573 if (config == null || config.isTypeDesignationSectionActivated()){
574 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(TypeDesignationSection.class, getInput().getClass().getCanonicalName()));
575 typeDesignationSection.setEnabled(detailsEnabled);
576 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
577 addPart(typeDesignationSection);
578 }
579
580 if (config == null || config.isNameRelationsSectionActivated()){
581 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(NameRelationshipDetailSection.class, getInput().getClass().getCanonicalName()));
582 nameRelationshipSection.setEnabled(detailsEnabled);
583 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
584 addPart(nameRelationshipSection);
585 }
586
587 addPart(parsingMessagesSection);
588 addPart(nonViralNameSection);
589 }
590
591 private void createNameSections(RootElement parent) {
592 NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(
593 getConversationHolder(), parent, this, false, StoreUtil.getSectionStyle(NonViralNameDetailSection.class, getInput().getClass().getCanonicalName(), true));
594
595 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
596
597 NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
598 StoreUtil.getSectionStyle(NomenclaturalSourceDetailSection.class, getInput().getClass().getCanonicalName(), true));
599 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
600
601 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
602 StoreUtil.getSectionStyle(NomenclaturalStatusSection.class, getInput().getClass().getCanonicalName(), true));
603 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
604
605 addPart(nonViralNameSection);
606 addPart(nomenclaturalStatusSection);
607 addPart(referenceDetailSection);
608
609 // ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ProtologueSection.class, getInput().getClass().getCanonicalName()));
610 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
611
612 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(TypeDesignationSection.class, getInput().getClass().getCanonicalName()));
613 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
614
615 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(NameRelationshipDetailSection.class, getInput().getClass().getCanonicalName()));
616 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
617 // addPart(protologSection);
618 addPart(typeDesignationSection);
619 addPart(nameRelationshipSection);
620 }
621
622 private void createReferenceSections(RootElement parent) {
623 ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this,
624 StoreUtil.getSectionStyle(ReferenceDetailSection.class, getInput().getClass().getCanonicalName(), true));
625
626 addPart(referenceDetailSection);
627 }
628
629 private void createTeamOrPersonBaseDetailSection(RootElement parent) {
630 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TeamOrPersonBaseDetailSection.class, getInput().getClass().getCanonicalName(), true));
631
632 addPart(teamOrPersonBaseDetailSection);
633 }
634
635 private void createTeamDetailSection(RootElement parent) {
636 TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(TeamDetailSection.class, getInput().getClass().getCanonicalName(), true));
637
638 addPart(teamDetailSection);
639 }
640
641 private void createPersonDetailSection(RootElement parent) {
642 PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(PersonDetailSection.class, getInput().getClass().getCanonicalName(), true));
643 addPart(personDetailSection);
644 }
645
646 private void createDescriptionElementSection(RootElement parent) {
647 createDescriptionElementSection(parent, null);
648 }
649
650 private void createDescriptionElementSection(RootElement parent, Object activePart) {
651 DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DescriptionElementDetailSection.class, getInput().getClass().getCanonicalName(), true));
652
653
654 // IntextReferenceSection intextReferenceSection = formFactory.createIntextReferenceSection(getConversationHolder(), parent, getSectionStyle(.class, getInput().getClass().getCanonicalName()));
655
656 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
657 DescriptionElementSourceSection descriptionElementSourceSection;
658 if (activePart != null && activePart instanceof IDistributionEditorPart){
659 Reference defaultSource =((IDistributionEditorPart)activePart).getEditor().getDefaultSource();
660 descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, defaultSource, StoreUtil.getSectionStyle(DescriptionElementSourceSection.class, getInput().getClass().getCanonicalName()));
661
662 }else{
663 descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DescriptionElementSourceSection.class, getInput().getClass().getCanonicalName()) );
664 descriptionElementSourceSection.setEnabled(this.detailsEnabled);
665
666 }
667
668
669 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
670
671 DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DescriptionElementMediaSection.class, getInput().getClass().getCanonicalName()));
672
673 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
674
675 addPart(descriptionElementDetailSection);
676 addPart(descriptionElementSourceSection);
677 addPart(descriptionElementMediaSection);
678 }
679
680 private void createDescriptionSection(RootElement parent, boolean isTaxonDescription, boolean isEnabled) {
681 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DescriptionDetailSection.class, getInput().getClass().getCanonicalName(), true));
682 descriptionDetailSection.setEnabled(isEnabled);
683 addPart(descriptionDetailSection);
684
685 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
686
687 if(isTaxonDescription) {
688 NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(
689 getConversationHolder(), parent, this, StoreUtil.getSectionStyle(NaturalLanguageSection.class, getInput().getClass().getCanonicalName(), true));
690 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
691 naturalLanguageSection.setEnabled(isEnabled);
692 addPart(naturalLanguageSection);
693 }
694 DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(
695 getConversationHolder(), parent, StoreUtil.getSectionStyle(DescriptionSourceSection.class, getInput().getClass().getCanonicalName(), true));
696 descriptionSourceSection.setEnabled(isEnabled);
697 addPart(descriptionSourceSection);
698
699 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
700
701 if(isTaxonDescription) {
702 ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ScopeSection.class, getInput().getClass().getCanonicalName()));
703 scopeSection.setEnabled(isEnabled);
704 addPart(scopeSection);
705 }
706 }
707
708 private void createTaxonDescriptionSection(RootElement parent, boolean isEnabled) {
709 createDescriptionSection(parent, true, isEnabled);
710 }
711
712 private void createSpecimenDescriptionSection(RootElement parent) {
713 createDescriptionSection(parent, false, true);
714 }
715
716 private void createUseDescriptionSection(RootElement parent) {
717 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DescriptionDetailSection.class, getInput().getClass().getCanonicalName()));
718
719 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
720
721 DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DescriptionSourceSection.class, getInput().getClass().getCanonicalName()));
722
723 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
724
725 addPart(descriptionDetailSection);
726 addPart(descriptionSourceSection);
727 }
728
729 private void createImageGallerySection(RootElement parent) {
730 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DescriptionDetailSection.class, getInput().getClass().getCanonicalName()));
731
732 addPart(descriptionDetailSection);
733 }
734
735 private void createMediaElementSection(RootElement parent) {
736 MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(MediaDetailsSection.class, getInput().getClass().getCanonicalName(), true));
737
738 addPart(mediaDetailSection);
739 }
740
741 private void createDerivedUnitBaseElementSection(RootElement parent) {
742 DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DerivedUnitGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
743 //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
744 if(!(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart)){
745 derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true);
746 }
747 addPart(derivedUnitGeneralDetailSection);
748
749 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
750
751 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DerivedUnitBaseDetailSection.class, getInput().getClass().getCanonicalName(), true));
752 addPart(derivedUnitBaseDetailSection);
753
754 //for editors working with facades
755 if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart){
756 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
757 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(GatheringEventDetailSection.class, getInput().getClass().getCanonicalName()));
758 addPart(gatheringEventDetailSection);
759
760 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
761 FieldUnitFacadeDetailSection fieldUnitDetailSection = formFactory.createFieldUnitFacadeDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(FieldUnitFacadeDetailSection.class, getInput().getClass().getCanonicalName()));
762 addPart(fieldUnitDetailSection);
763 }
764 else{
765
766 if(PreferencesUtil.isShowTaxonAssociations()){
767 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
768 TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TaxonAssociationDetailSection.class, getInput().getClass().getCanonicalName(), true));
769 addPart(taxonAssociationDetailSection);
770 }
771 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
772 DerivedUnitFacadeIdentifierSection identifierDetailSection = formFactory.createDerivedUnitFacadeIdentifierSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DerivedUnitFacadeIdentifierSection.class, getInput().getClass().getCanonicalName()));
773 addPart(identifierDetailSection);
774 }
775 if(!PreferencesUtil.isDeterminationOnlyForFieldUnits()){
776 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
777 DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DeterminationDetailSection.class, getInput().getClass().getCanonicalName()));
778 addPart(determinationDetailSection);
779 }
780
781 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
782 DerivedUnitTypeDesignationSection derivedUnitTypeDesignationSection = formFactory.createDerivedUnitTypeDesignationSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DerivedUnitTypeDesignationSection.class, getInput().getClass().getCanonicalName()));
783 addPart(derivedUnitTypeDesignationSection);
784 }
785
786 private void createFieldUnitFacadeSection(RootElement parent) {
787 FieldUnitFacadeGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitFacadeGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(FieldUnitFacadeGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
788
789 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
790
791 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(GatheringEventDetailSection.class, getInput().getClass().getCanonicalName()));
792
793 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
794
795 FieldUnitFacadeDetailSection fieldUnitDetailSection = formFactory.createFieldUnitFacadeDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(FieldUnitFacadeDetailSection.class, getInput().getClass().getCanonicalName()));
796
797 addPart(fielUnitGeneralDetailSection);
798 addPart(gatheringEventDetailSection);
799 addPart(fieldUnitDetailSection);
800
801 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
802 DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DeterminationDetailSection.class, getInput().getClass().getCanonicalName()));
803 addPart(determinationDetailSection);
804 }
805
806 private void createTissueSampleSection(RootElement parent) {
807 TissueSampleGeneralDetailSection section = formFactory.createTissueSampleGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TissueSampleGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
808
809 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
810
811 SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(SampleDesignationDetailSection.class, getInput().getClass().getCanonicalName(), true));
812
813 addPart(section);
814 addPart(sampleDesignationDetailSection);
815 }
816
817 private void createDnaSampleSection(RootElement parent) {
818 DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DnaSampleGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
819
820 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
821
822 DnaSamplePreparationPreservationSection preparationPreservationSection = formFactory.createDnaSamplePreparationPreservationSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DnaSamplePreparationPreservationSection.class, getInput().getClass().getCanonicalName(), true));
823
824 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
825
826 DnaQualityDetailSection qualitySection = formFactory.createDnaQualityDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DnaQualityDetailSection.class, getInput().getClass().getCanonicalName(), true));
827
828 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
829
830 SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(SampleDesignationDetailSection.class, getInput().getClass().getCanonicalName(), true));
831
832 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
833 DeterminationDetailSection determinationDetailSection = null;
834 if(!PreferencesUtil.isDeterminationOnlyForFieldUnits()){
835 determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DeterminationDetailSection.class, getInput().getClass().getCanonicalName()));
836 }
837 addPart(section);
838 addPart(preparationPreservationSection);
839 addPart(qualitySection);
840 addPart(sampleDesignationDetailSection);
841 if(!PreferencesUtil.isDeterminationOnlyForFieldUnits()){
842 addPart(determinationDetailSection);
843 }
844 }
845
846 private void createSequenceSection(RootElement parent) {
847 SequenceGeneralDetailSection section = formFactory.createSequenceGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(SequenceGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
848
849 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
850
851 SequenceReferenceCollectionDetailSection referenceSection = formFactory.createSequenceReferenceCollectionDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(SequenceReferenceCollectionDetailSection.class, getInput().getClass().getCanonicalName(), true));
852
853 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
854
855 SequenceContigFileCollectionDetailSection contigFileSection = formFactory.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(SequenceContigFileCollectionDetailSection.class, getInput().getClass().getCanonicalName(), true));
856
857 addPart(section);
858 addPart(referenceSection);
859 addPart(contigFileSection);
860 }
861
862 private void createSingleReadSection(RootElement parent) {
863 SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(SingleReadGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
864 addPart(section);
865
866 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
867
868 SingleReadPherogramCollectionDetailSection pherogramSection = formFactory.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(SingleReadPherogramCollectionDetailSection.class, getInput().getClass().getCanonicalName(), true));
869 addPart(pherogramSection);
870 }
871
872 private void createMediaSpecimenSection(RootElement parent) {
873 MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(MediaSpecimenGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
874 addPart(generalSection);
875
876 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
877
878 RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(RightsSection.class, getInput().getClass().getCanonicalName()));
879 // rightsSection.setEntity(generalSection.getEntity().innerDerivedUnit());
880 addPart(rightsSection);
881 }
882
883 private void createFeatureTreeSectionForDto(RootElement parent) {
884 TermTreeDetailSection section = formFactory.createFeatureTreeDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TermTreeDetailSection.class, getInput().getClass().getCanonicalName(), true));
885
886 addPart(section);
887 }
888 private void createFeatureTreeSection(RootElement parent) {
889 TermTreeDetailSectionForNode section = formFactory.createFeatureTreeDetailSectionForTree(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TermTreeDetailSection.class, getInput().getClass().getCanonicalName(), true));
890 addPart(section);
891 }
892
893 private void createFeatureNodeSection(RootElement parent) {
894 TermNodeDetailSection featureDistributionSection = formFactory.createFeatureNodeDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TermNodeDetailSection.class, getInput().getClass().getCanonicalName(), true));
895 addPart(featureDistributionSection);
896 }
897
898 private void createFeatureDistributionSection(RootElement parent) {
899 FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(FeatureDistributionDetailSection.class, getInput().getClass().getCanonicalName(), true));
900 addPart(featureDistributionSection);
901 }
902
903 private void createCharacterNodeSection(RootElement parent) {
904 CharacterNodeDetailSection featureDistributionSection = formFactory.createCharacterNodeDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(CharacterDetailSection.class, getInput().getClass().getCanonicalName(), true));
905 addPart(featureDistributionSection);
906 }
907
908 private void createCharacterNodeDtoSection(RootElement parent) {
909 CharacterNodeDtoDetailSection featureDistributionSection = formFactory.createCharacterNodeDtoDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(CharacterDetailSection.class, getInput().getClass().getCanonicalName(), true));
910 addPart(featureDistributionSection);
911 }
912
913 private void createCharacterSection(RootElement parent) {
914 CharacterDetailSection featureDistributionSection = formFactory.createCharacterDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(CharacterDetailSection.class, getInput().getClass().getCanonicalName(), true));
915 addPart(featureDistributionSection);
916 }
917
918 private void createPolytomousKeyNodeSection(RootElement parent) {
919 PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(PolytomousKeyDetailSection.class, getInput().getClass().getCanonicalName()));
920
921 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
922
923 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(PolytomousKeyNodeDetailSection.class, getInput().getClass().getCanonicalName(), true));
924
925 addPart(polytomousKeyDetailSection);
926 addPart(polytomousKeyNodeDetailSection);
927
928 }
929
930 private void createUseRecordSection(RootElement parent) {
931 UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,StoreUtil.getSectionStyle(UseRecordDetailSection.class, getInput().getClass().getCanonicalName(), true));
932 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
933 addPart(descriptionUseRecordSection);
934 }
935
936 private void createUserSection(RootElement parent) {
937 UserDetailSection userDetailSection = formFactory.createUserDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(UserDetailSection.class, getInput().getClass().getCanonicalName(), true));
938
939 GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(GroupsByUserDetailSection.class, getInput().getClass().getCanonicalName(), true));
940
941 addPart(userDetailSection);
942 addPart(groupByUserDetailSection);
943 }
944
945 private void createMisappliedNameSection(RootElement parent) {
946 TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this,
947 StoreUtil.getSectionStyle(TaxonRelationshipDetailSection.class, getInput().getClass().getCanonicalName(), true));
948 addPart(taxonRelationshipDetailSection);
949
950 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
951
952 NonViralNameDetailSection nonViralNameSection = formFactory
953 .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
954 StoreUtil.getSectionStyle(NonViralNameDetailSection.class, getInput().getClass().getCanonicalName(), true));
955 addPart(nonViralNameSection);
956
957 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
958
959 NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
960 StoreUtil.getSectionStyle(NomenclaturalSourceDetailSection.class, getInput().getClass().getCanonicalName(), true));
961 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
962 addPart(referenceDetailSection);
963
964 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
965 StoreUtil.getSectionStyle(NomenclaturalStatusSection.class, getInput().getClass().getCanonicalName(), true));
966 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
967 addPart(nomenclaturalStatusSection);
968
969 // ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ProtologueSection.class, getInput().getClass().getCanonicalName()));
970 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
971 // addPart(protologSection);
972
973 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(TypeDesignationSection.class, getInput().getClass().getCanonicalName()));
974 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
975 addPart(typeDesignationSection);
976
977 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(NameRelationshipDetailSection.class, getInput().getClass().getCanonicalName()));
978 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
979 addPart(nameRelationshipSection);
980 }
981
982 private void createTaxonRelationshipSection(RootElement parent) {
983 TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TaxonRelationshipDetailSection.class, getInput().getClass().getCanonicalName(), true));
984
985 ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(ReferencedEntityDetailSection.class, getInput().getClass().getCanonicalName(), true));
986 addPart(taxonRelationshipDetailSection);
987 addPart(referencedEntityBaseDetailSection);
988 }
989 private void createTermVocabularySection(RootElement parent) {
990 TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TermVocabularyDetailSection.class, getInput().getClass().getCanonicalName(), true));
991 addPart(termVocabularyDetailSection);
992 }
993
994 private void createDefinedTermSection(RootElement parent) {
995 DefinedTermDetailSection<?> definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DefinedTermDetailSection.class, getInput().getClass().getCanonicalName(), true));
996 addPart(definedTermDetailSection);
997 TermMediaSection termMediaSection = formFactory.createTermMediaSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DefinedTermDetailSection.class, getInput().getClass().getCanonicalName(), true));
998 addPart(termMediaSection);
999 }
1000
1001 @Override
1002 public void update(CdmDataChangeMap arg0) {
1003
1004 }
1005 @Inject
1006 @Optional
1007 private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_DETAILS)boolean refresh){
1008 if(refresh){
1009 refresh();
1010 }
1011 }
1012
1013 @Inject
1014 @Optional
1015 private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_DETAILS_DISTRIBUTION)String nameCache){
1016 if(nameCache != null && getInput() instanceof Distribution && this.activePart instanceof IDistributionEditorPart){
1017 if (part instanceof CdmSectionPart && ((CdmSectionPart<?>)part).getSection() instanceof DescriptionElementDetailSection){
1018 for (ICdmFormElement element: ((DescriptionElementDetailSection)((CdmSectionPart<?>)part).getSection()).getElements()){
1019 if (element instanceof DescriptionElementDetailElement){
1020 for(ICdmFormElement descriptionElement:((DescriptionElementDetailElement)element).getElements()){
1021 if (descriptionElement instanceof DistributionDetailElement){
1022 ((DistributionDetailElement) descriptionElement).setName(nameCache);
1023 }
1024 }
1025 }
1026 }
1027 }
1028 }
1029 }
1030 }