Implementation of AlignmentEditorPasteHandler changed.
[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 createTaxonSections(rootElement);
208
209 } else if (input instanceof NonViralName) {
210 createNameSections(rootElement);
211
212 } else if (input instanceof Reference) {
213 createReferenceSections(rootElement);
214
215 } else if (input instanceof Team) {
216 createTeamDetailSection(rootElement);
217
218 } else if (input instanceof Person) {
219 createPersonDetailSection(rootElement);
220
221 } else if (input instanceof TeamOrPersonBase) {
222 createTeamOrPersonBaseDetailSection(rootElement);
223
224 } else if (input instanceof DescriptionBase) {
225 if(input instanceof SpecimenDescription){
226 //TODO: add more sections to DetailsView for SpecimenDescription
227 createSpecimenDescriptionSection(rootElement);
228 }
229 else{
230 Set<Marker> descriptionMarkers = ((DescriptionBase<?>) input).getMarkers();
231
232 Boolean isUseDescription = false;
233 for (Marker marker : descriptionMarkers) {
234 if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
235 isUseDescription = true;
236 }
237 }
238 if (((DescriptionBase<?>) input).isImageGallery()) {
239 createImageGallerySection(rootElement);
240
241 } else if (isUseDescription) {
242 createUseDescriptionSection(rootElement);
243 } else {
244 createDescriptionSection(rootElement);
245
246 }
247 }
248 } else if (input instanceof DescriptionElementBase) {
249 Set<Marker> descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
250
251 Boolean isUseDescription = false;
252 for (Marker marker : descriptionMarkers) {
253 if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
254 isUseDescription = true;
255 }
256 }
257
258 if (isUseDescription == true && input instanceof CategoricalData) {
259 createUseRecordSection(rootElement);
260 } else {
261 createDescriptionElementSection(rootElement);
262 }
263
264 } else if (input instanceof Media) {
265 createMediaElementSection(rootElement);
266
267 } else if (input instanceof DerivedUnitFacade) {
268 if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.FieldUnit){
269 if(((DerivedUnitFacade) input).innerFieldUnit()==null){
270 MessagingUtils.error(DetailsViewer.class, "FieldUnit of facade is null", null);
271 }
272 else{
273 createFieldUnitSection(rootElement);
274 }
275 }
276 else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.PreservedSpecimen){
277 if(((DerivedUnitFacade) input).innerDerivedUnit()==null){
278 MessagingUtils.error(DetailsViewer.class, "DerivedUnit of facade is null", null);
279 }
280 else{
281 createDerivedUnitBaseElementSection(rootElement);
282 }
283 }
284 else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.TissueSample){
285 //TissueSample should only be created by using it's own class
286 //in future using only one class with different SpecimenOrObservationTypes is desired
287 // createTissueSampleSection(rootElement);
288 }
289 else{
290 createDerivedUnitBaseElementSection(rootElement);
291 }
292 } else if (input instanceof DnaSample){
293 DnaSample dnaSample = (DnaSample)input;
294 if(dnaSample.getRecordBasis()==SpecimenOrObservationType.TissueSample){
295 createTissueSampleSection(rootElement);
296 }
297 else if(dnaSample.getRecordBasis()==SpecimenOrObservationType.DnaSample){
298 createDnaSampleSection(rootElement);
299 }
300 } else if (input instanceof MediaSpecimen){
301 createMediaSpecimenSection(rootElement);
302 }
303 else if(input instanceof Sequence){
304 createSequenceSection(rootElement);
305 }
306 else if(input instanceof SingleRead){
307 createSingleReadSection(rootElement);
308 }
309 else if (input instanceof FeatureNodeContainer) {
310 createFeatureDistributionSection(rootElement);
311
312 }else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
313 createPolytomousKeyNodeSection(rootElement);
314 } else if (input instanceof User) {
315 createUserSection(rootElement);
316 } else if (input instanceof Group) {
317 createGroupSection(rootElement);
318 } else if (input instanceof TaxonRelationship) {
319 createTaxonRelationshipSection(rootElement);
320 } else if (input instanceof TermVocabulary) {
321 createTermVocabularySection(rootElement);
322 } else if (input instanceof DefinedTermBase) {
323 createDefinedTermSection(rootElement);
324 }
325 else {
326 createEmptySection(rootElement);
327 }
328 layout();
329 }
330
331
332 /**
333 * @param rootElement
334 */
335 private void createEmptySection(RootElement parent) {
336 destroySections();
337
338 EmptySection emptySection = formFactory.createEmptySection(formFactory, parent, SWT.NONE);
339
340 addPart(emptySection);
341 }
342
343 /**
344 * @param rootElement
345 */
346 private void createGroupSection(RootElement parent) {
347 destroySections();
348
349 GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
350 MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
351 GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
352
353 addPart(groupDetailSection);
354 addPart(memberDetailSection);
355 addPart(grantedAuthorityDetailSection);
356 }
357
358 /*
359 * (non-Javadoc)
360 *
361 * @see org.eclipse.jface.viewers.Viewer#getSelection()
362 */
363 /** {@inheritDoc} */
364 @Override
365 public ISelection getSelection() {
366 return selection;
367 }
368
369 /** {@inheritDoc} */
370 @Override
371 public void setSelection(ISelection selection, boolean reveal) {
372 this.selection = selection;
373 if(this.selection!=null){
374 SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
375 fireSelectionChanged(selectionChangedEvent);
376 }
377 }
378
379 /**
380 * createTaxonSections(RootElement parent)
381 *
382 * @param parent
383 */
384 private void createTaxonSections(RootElement parent) {
385 destroySections();
386
387 ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
388 ExpandableComposite.EXPANDED | ExpandableComposite.EXPANDED);
389
390 TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
391 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
392 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
393
394 NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this,
395 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
396 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
397
398 NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
399 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
400 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
401
402 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
403 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
404 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
405
406 //TODO RL
407 if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
408 ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
409 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
410
411 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
412 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
413
414 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
415 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
416
417 addPart(protologSection);
418 addPart(typeDesignationSection);
419 addPart(nameRelationshipSection);
420 }
421
422
423 addPart(parsingMessagesSection);
424 addPart(taxonBaseDetailSection);
425 addPart(nonViralNameSection);
426 addPart(nomenclaturalStatusSection);
427 addPart(referenceDetailSection);
428 }
429
430 /**
431 * createNameSections
432 *
433 * @param parent
434 */
435 private void createNameSections(RootElement parent) {
436 destroySections();
437 NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this,
438 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
439 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
440
441 NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
442 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
443 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
444
445 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
446 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
447 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
448
449 addPart(nonViralNameSection);
450 addPart(nomenclaturalStatusSection);
451 addPart(referenceDetailSection);
452 //TODO RL
453 if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
454 ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
455 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
456
457 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
458 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
459
460 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
461 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
462 addPart(protologSection);
463 addPart(typeDesignationSection);
464 addPart(nameRelationshipSection);
465 }
466 }
467
468 /**
469 * createReferenceSections
470 *
471 * @param parent
472 */
473 private void createReferenceSections(RootElement parent) {
474 destroySections();
475
476 ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this,
477 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
478
479 addPart(referenceDetailSection);
480 }
481
482 /**
483 * createTeamOrPersonBaseDetailSection
484 *
485 * @param parent
486 */
487 private void createTeamOrPersonBaseDetailSection(RootElement parent) {
488 destroySections();
489 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
490
491 addPart(teamOrPersonBaseDetailSection);
492 }
493
494 /**
495 * createTeamDetailSection
496 *
497 * @param parent
498 */
499 private void createTeamDetailSection(RootElement parent) {
500 destroySections();
501 TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
502
503 addPart(teamDetailSection);
504 }
505
506 /**
507 * createPersonDetailSection
508 *
509 * @param parent
510 */
511 private void createPersonDetailSection(RootElement parent) {
512 destroySections();
513 PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
514 addPart(personDetailSection);
515 }
516
517 /**
518 * createDescriptionElementSection
519 *
520 * @param parent
521 */
522 private void createDescriptionElementSection(RootElement parent) {
523 destroySections();
524
525 DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
526
527 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
528
529 DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
530
531 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
532
533 DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
534
535 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
536
537 addPart(descriptionElementDetailSection);
538 addPart(descriptionElementSourceSection);
539 addPart(descriptionElementMediaSection);
540 }
541
542 /**
543 * createDescriptionSection
544 *
545 * @param parent
546 */
547 private void createDescriptionSection(RootElement parent) {
548 destroySections();
549 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
550
551 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
552
553 NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
554
555 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
556
557 DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
558
559 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
560
561 // DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
562 // .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
563 // getConversationHolder(), parent, Section.TWISTIE);
564 //
565 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
566
567 ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
568
569 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
570
571 addPart(descriptionDetailSection);
572 addPart(naturalLanguageSection);
573 addPart(describedSpecimenSection);
574 // addPart(descriptionSourceSection);
575 addPart(scopeSection);
576 }
577
578 /**
579 * createDescriptionSection
580 *
581 * @param parent
582 */
583 private void createSpecimenDescriptionSection(RootElement parent) {
584 destroySections();
585 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
586 addPart(descriptionDetailSection);
587 }
588
589 /**
590 * Creates the use Description section
591 *
592 * @param parent
593 */
594 private void createUseDescriptionSection(RootElement parent) {
595 destroySections();
596 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
597
598 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
599
600 DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
601
602 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
603
604 addPart(descriptionDetailSection);
605 addPart(descriptionSourceSection);
606
607 }
608
609
610 /**
611 * @param rootElement
612 */
613 private void createImageGallerySection(RootElement parent) {
614 destroySections();
615 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
616
617 addPart(descriptionDetailSection);
618 }
619
620 /**
621 * createMediaElementSection
622 *
623 * @param parent
624 */
625
626 private void createMediaElementSection(RootElement parent) {
627 destroySections();
628
629 MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
630
631 addPart(mediaDetailSection);
632 }
633
634 /**
635 * createDerivedUnitBaseElementSection
636 *
637 * @param parent
638 */
639 private void createDerivedUnitBaseElementSection(RootElement parent) {
640 destroySections();
641
642 DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
643 //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
644 if(!(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart)){
645 derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true);
646 }
647 addPart(derivedUnitGeneralDetailSection);
648
649 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
650
651 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
652 addPart(derivedUnitBaseDetailSection);
653
654 //for editors working with facades
655 if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart){
656 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
657 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
658 addPart(gatheringEventDetailSection);
659
660 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
661 FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
662 addPart(fieldUnitDetailSection);
663 }
664
665 if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
666 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
667 DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
668 addPart(determinationDetailSection);
669 }
670 if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS)){
671 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
672 TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
673 addPart(taxonAssociationDetailSection);
674 }
675
676 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
677 IdentifierDetailSection identifierDetailSection = formFactory.createIdentifierDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
678 addPart(identifierDetailSection);
679
680 }
681
682 private void createFieldUnitSection(RootElement parent) {
683 destroySections();
684
685 FieldUnitGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
686
687 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
688
689 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
690
691 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
692
693 FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
694
695 addPart(fielUnitGeneralDetailSection);
696 addPart(gatheringEventDetailSection);
697 addPart(fieldUnitDetailSection);
698
699 if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
700 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
701 DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
702 addPart(determinationDetailSection);
703 }
704 }
705
706 private void createTissueSampleSection(RootElement parent) {
707 destroySections();
708
709 TissueSampleGeneralDetailSection section = formFactory.createTissueSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
710
711 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
712
713 SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
714
715 addPart(section);
716 addPart(sampleDesignationDetailSection);
717 }
718
719 private void createDnaSampleSection(RootElement parent) {
720 destroySections();
721
722 DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
723
724 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
725
726 DnaSamplePreparationPreservationSection preparationPreservationSection = formFactory.createDnaSamplePreparationPreservationSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
727
728 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
729
730 DnaQualityDetailSection qualitySection = formFactory.createDnaQualityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
731
732 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
733
734 SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
735
736 addPart(section);
737 addPart(preparationPreservationSection);
738 addPart(qualitySection);
739 addPart(sampleDesignationDetailSection);
740 }
741
742 private void createSequenceSection(RootElement parent) {
743 destroySections();
744
745 SequenceGeneralDetailSection section = formFactory.createSequenceGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
746
747 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
748
749 SequenceReferenceCollectionDetailSection referenceSection = formFactory.createSequenceReferenceCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
750
751 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
752
753 SequenceContigFileCollectionDetailSection contigFileSection = formFactory.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
754
755
756 addPart(section);
757 addPart(referenceSection);
758 addPart(contigFileSection);
759 }
760
761 private void createSingleReadSection(RootElement parent) {
762 destroySections();
763
764 SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
765 addPart(section);
766
767 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
768
769 SingleReadPherogramCollectionDetailSection pherogramSection = formFactory.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
770 addPart(pherogramSection);
771
772 }
773
774 private void createMediaSpecimenSection(RootElement parent) {
775 destroySections();
776
777 MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
778 addPart(generalSection);
779
780 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
781
782 RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
783 addPart(rightsSection);
784
785 }
786
787
788
789 /**
790 * @param rootElement
791 */
792 private void createFeatureDistributionSection(RootElement parent) {
793 destroySections();
794
795 FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
796
797 addPart(featureDistributionSection);
798 }
799
800 /**
801 * createPolytomousKeyNodeSection
802 *
803 * @param parent
804 */
805 private void createPolytomousKeyNodeSection(RootElement parent) {
806 destroySections();
807
808 PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
809
810 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
811
812 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
813
814 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
815
816 TaxonomicScopeSection taxonomicScopeSection = formFactory.createTaxonomicScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
817
818 addPart(polytomousKeyDetailSection);
819 addPart(polytomousKeyNodeDetailSection);
820 addPart(taxonomicScopeSection);
821
822 }
823
824 /**
825 * create the UseRecordSection
826 *
827 * @param parent
828 */
829 private void createUseRecordSection(RootElement parent) {
830 destroySections();
831
832 UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
833
834 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
835
836 addPart(descriptionUseRecordSection);
837
838
839 }
840
841 /**
842 * createUserSection
843 *
844 * @param parent
845 */
846 private void createUserSection(RootElement parent) {
847 destroySections();
848
849 UserDetailSection userDetailSection = formFactory.createUserDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
850
851 GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
852
853 addPart(userDetailSection);
854 addPart(groupByUserDetailSection);
855 }
856
857 /**
858 * createTaxonRelationshipSection
859 *
860 * @param parent
861 */
862 private void createTaxonRelationshipSection(RootElement parent) {
863 destroySections();
864
865 TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
866
867 ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
868 addPart(taxonRelationshipDetailSection);
869 addPart(referencedEntityBaseDetailSection);
870 }
871
872 /**
873 * @param rootElement
874 */
875 private void createTermVocabularySection(RootElement parent) {
876 destroySections();
877
878 TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
879 addPart(termVocabularyDetailSection);
880 }
881
882 /**
883 * createDefinedTermSection
884 *
885 * @param parent
886 */
887 private void createDefinedTermSection(RootElement parent) {
888 destroySections();
889
890 AbstractFormSection<?> definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
891 addPart(definedTermDetailSection);
892 }
893
894 }