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