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