4 * Copyright (C) 2011 EDIT
5 * European Distributed Institute of Taxonomy
6 * http://www.e-taxonomy.eu
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.
12 package eu
.etaxonomy
.taxeditor
.view
.detail
;
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
;
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
;
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
127 * @created Feb 12, 2010
130 public class DetailsViewer
extends AbstractCdmDataViewer
{
132 private ISelection selection
;
136 * Constructor for DetailsViewer.
140 * a {@link org.eclipse.swt.widgets.Composite} object.
142 * a {@link eu.etaxonomy.taxeditor.view.AbstractCdmViewPart}
145 public DetailsViewer(Composite parent
, AbstractCdmViewPart viewPart
) {
146 super(parent
, viewPart
);
149 // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
150 // since we are getting implementations of DerivedUnitBase from the bulk
152 // and not derived unit facade objects,
155 public void setInput(Object input
) {
156 if(input
instanceof TreeNode
){
157 input
= ((TreeNode
) input
).getValue();
159 if(input
instanceof GbifResponse
){
160 input
= ((GbifResponse
) input
).getDerivedUnitFacade();
162 if (input
.getClass().equals(DerivedUnit
.class)) {
163 DerivedUnit derivedUnit
= (DerivedUnit
)input
;
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
171 else if(input
instanceof FieldUnit
){
172 input
= DerivedUnitFacade
.NewInstance(SpecimenOrObservationType
.FieldUnit
, (FieldUnit
) input
);
174 super.setInput(input
);
178 protected void markViewPartDirty() {
179 if (getInput() instanceof DerivedUnitFacade
) {
180 DerivedUnitFacade facade
= (DerivedUnitFacade
) getInput();
181 if(facade
.innerDerivedUnit()!=null){
182 getViewPart().changed(facade
.innerDerivedUnit());
184 else if(facade
.innerFieldUnit()!=null){
185 getViewPart().changed(facade
.innerFieldUnit());
189 super.markViewPartDirty();
193 // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
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();
206 if (input
instanceof TaxonBase
) {
207 createTaxonSections(rootElement
);
209 } else if (input
instanceof NonViralName
) {
210 createNameSections(rootElement
);
212 } else if (input
instanceof Reference
) {
213 createReferenceSections(rootElement
);
215 } else if (input
instanceof Team
) {
216 createTeamDetailSection(rootElement
);
218 } else if (input
instanceof Person
) {
219 createPersonDetailSection(rootElement
);
221 } else if (input
instanceof TeamOrPersonBase
) {
222 createTeamOrPersonBaseDetailSection(rootElement
);
224 } else if (input
instanceof DescriptionBase
) {
225 if(input
instanceof SpecimenDescription
){
226 //TODO: add more sections to DetailsView for SpecimenDescription
227 createSpecimenDescriptionSection(rootElement
);
230 Set
<Marker
> descriptionMarkers
= ((DescriptionBase
<?
>) input
).getMarkers();
232 Boolean isUseDescription
= false;
233 for (Marker marker
: descriptionMarkers
) {
234 if (marker
.getMarkerType()!= null && marker
.getMarkerType().getUuid().equals(UsageTermCollection
.uuidUseMarkerType
)) {
235 isUseDescription
= true;
238 if (((DescriptionBase
<?
>) input
).isImageGallery()) {
239 createImageGallerySection(rootElement
);
241 } else if (isUseDescription
) {
242 createUseDescriptionSection(rootElement
);
244 createDescriptionSection(rootElement
);
248 } else if (input
instanceof DescriptionElementBase
) {
249 Set
<Marker
> descriptionMarkers
= ((DescriptionElementBase
) input
).getInDescription().getMarkers();
251 Boolean isUseDescription
= false;
252 for (Marker marker
: descriptionMarkers
) {
253 if (marker
.getMarkerType()!= null && marker
.getMarkerType().getUuid().equals(UsageTermCollection
.uuidUseMarkerType
)) {
254 isUseDescription
= true;
258 if (isUseDescription
== true && input
instanceof CategoricalData
) {
259 createUseRecordSection(rootElement
);
261 createDescriptionElementSection(rootElement
);
264 } else if (input
instanceof Media
) {
265 createMediaElementSection(rootElement
);
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);
273 createFieldUnitSection(rootElement
);
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);
281 createDerivedUnitBaseElementSection(rootElement
);
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);
290 createDerivedUnitBaseElementSection(rootElement
);
292 } else if (input
instanceof DnaSample
){
293 DnaSample dnaSample
= (DnaSample
)input
;
294 if(dnaSample
.getRecordBasis()==SpecimenOrObservationType
.TissueSample
){
295 createTissueSampleSection(rootElement
);
297 else if(dnaSample
.getRecordBasis()==SpecimenOrObservationType
.DnaSample
){
298 createDnaSampleSection(rootElement
);
300 } else if (input
instanceof MediaSpecimen
){
301 createMediaSpecimenSection(rootElement
);
303 else if(input
instanceof Sequence
){
304 createSequenceSection(rootElement
);
306 else if(input
instanceof SingleRead
){
307 createSingleReadSection(rootElement
);
309 else if (input
instanceof FeatureNodeContainer
) {
310 createFeatureDistributionSection(rootElement
);
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
);
326 createEmptySection(rootElement
);
335 private void createEmptySection(RootElement parent
) {
338 EmptySection emptySection
= formFactory
.createEmptySection(formFactory
, parent
, SWT
.NONE
);
340 addPart(emptySection
);
346 private void createGroupSection(RootElement parent
) {
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
);
353 addPart(groupDetailSection
);
354 addPart(memberDetailSection
);
355 addPart(grantedAuthorityDetailSection
);
361 * @see org.eclipse.jface.viewers.Viewer#getSelection()
365 public ISelection
getSelection() {
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
);
380 * createTaxonSections(RootElement parent)
384 private void createTaxonSections(RootElement parent
) {
387 ParsingMessagesSection parsingMessagesSection
= formFactory
.createParsingMessagesSection(getConversationHolder(), parent
, this,
388 ExpandableComposite
.EXPANDED
| ExpandableComposite
.EXPANDED
);
390 TaxonBaseDetailSection taxonBaseDetailSection
= formFactory
.createTaxonBaseDetailSection(getConversationHolder(), parent
, this,
391 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
392 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
394 NonViralNameDetailSection nonViralNameSection
= formFactory
.createNonViralNameDetailSection(getConversationHolder(), parent
, this,
395 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
396 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
398 NomenclaturalReferenceDetailSection referenceDetailSection
= formFactory
.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent
, this,
399 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
400 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
402 NomenclaturalStatusSection nomenclaturalStatusSection
= formFactory
.createNomenclaturalStatusSection(getConversationHolder(), parent
,
403 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
404 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
407 if(!PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.IS_RL
)){
408 ProtologueSection protologSection
= formFactory
.createProtologueSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
409 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
411 TypeDesignationSection typeDesignationSection
= formFactory
.createTypeDesignationSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
412 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
414 NameRelationshipDetailSection nameRelationshipSection
= formFactory
.createNameRelationshipDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
415 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
417 addPart(protologSection
);
418 addPart(typeDesignationSection
);
419 addPart(nameRelationshipSection
);
423 addPart(parsingMessagesSection
);
424 addPart(taxonBaseDetailSection
);
425 addPart(nonViralNameSection
);
426 addPart(nomenclaturalStatusSection
);
427 addPart(referenceDetailSection
);
435 private void createNameSections(RootElement parent
) {
437 NonViralNameDetailSection nonViralNameSection
= formFactory
.createNonViralNameDetailSection(getConversationHolder(), parent
, this,
438 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
439 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
441 NomenclaturalReferenceDetailSection referenceDetailSection
= formFactory
.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent
, this,
442 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
443 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
445 NomenclaturalStatusSection nomenclaturalStatusSection
= formFactory
.createNomenclaturalStatusSection(getConversationHolder(), parent
,
446 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
447 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
449 addPart(nonViralNameSection
);
450 addPart(nomenclaturalStatusSection
);
451 addPart(referenceDetailSection
);
453 if(!PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.IS_RL
)){
454 ProtologueSection protologSection
= formFactory
.createProtologueSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
455 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
457 TypeDesignationSection typeDesignationSection
= formFactory
.createTypeDesignationSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
458 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
460 NameRelationshipDetailSection nameRelationshipSection
= formFactory
.createNameRelationshipDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
461 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
462 addPart(protologSection
);
463 addPart(typeDesignationSection
);
464 addPart(nameRelationshipSection
);
469 * createReferenceSections
473 private void createReferenceSections(RootElement parent
) {
476 ReferenceDetailSection referenceDetailSection
= formFactory
.createReferenceDetailSection(getConversationHolder(), parent
, this,
477 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
479 addPart(referenceDetailSection
);
483 * createTeamOrPersonBaseDetailSection
487 private void createTeamOrPersonBaseDetailSection(RootElement parent
) {
489 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection
= formFactory
.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
491 addPart(teamOrPersonBaseDetailSection
);
495 * createTeamDetailSection
499 private void createTeamDetailSection(RootElement parent
) {
501 TeamDetailSection teamDetailSection
= formFactory
.createTeamDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
503 addPart(teamDetailSection
);
507 * createPersonDetailSection
511 private void createPersonDetailSection(RootElement parent
) {
513 PersonDetailSection personDetailSection
= formFactory
.createPersonDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
514 addPart(personDetailSection
);
518 * createDescriptionElementSection
522 private void createDescriptionElementSection(RootElement parent
) {
525 DescriptionElementDetailSection descriptionElementDetailSection
= formFactory
.createDescriptionElementDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
527 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
529 DescriptionElementSourceSection descriptionElementSourceSection
= formFactory
.createDescriptionElementSourceSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
531 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
533 DescriptionElementMediaSection descriptionElementMediaSection
= formFactory
.createDescriptionElementMediaSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
535 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
537 addPart(descriptionElementDetailSection
);
538 addPart(descriptionElementSourceSection
);
539 addPart(descriptionElementMediaSection
);
543 * createDescriptionSection
547 private void createDescriptionSection(RootElement parent
) {
549 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
551 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
553 NaturalLanguageSection naturalLanguageSection
= formFactory
.createNaturalLanguageSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
555 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
557 DescribedSpecimenSection describedSpecimenSection
= formFactory
.createDescribedSpecimenSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
559 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
561 // DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
562 // .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
563 // getConversationHolder(), parent, Section.TWISTIE);
565 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
567 ScopeSection scopeSection
= formFactory
.createScopeSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
569 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
571 addPart(descriptionDetailSection
);
572 addPart(naturalLanguageSection
);
573 addPart(describedSpecimenSection
);
574 // addPart(descriptionSourceSection);
575 addPart(scopeSection
);
579 * createDescriptionSection
583 private void createSpecimenDescriptionSection(RootElement parent
) {
585 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
586 addPart(descriptionDetailSection
);
590 * Creates the use Description section
594 private void createUseDescriptionSection(RootElement parent
) {
596 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
598 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
600 DescriptionSourceSection descriptionSourceSection
= formFactory
.createDescriptionSourceSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
602 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
604 addPart(descriptionDetailSection
);
605 addPart(descriptionSourceSection
);
613 private void createImageGallerySection(RootElement parent
) {
615 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
617 addPart(descriptionDetailSection
);
621 * createMediaElementSection
626 private void createMediaElementSection(RootElement parent
) {
629 MediaDetailsSection mediaDetailSection
= formFactory
.createMediaDetailsSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
631 addPart(mediaDetailSection
);
635 * createDerivedUnitBaseElementSection
639 private void createDerivedUnitBaseElementSection(RootElement parent
) {
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);
647 addPart(derivedUnitGeneralDetailSection
);
649 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
651 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection
= formFactory
.createDerivedUnitBaseDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
652 addPart(derivedUnitBaseDetailSection
);
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
);
660 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
661 FieldUnitDetailSection fieldUnitDetailSection
= formFactory
.createFieldUnitDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
662 addPart(fieldUnitDetailSection
);
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
);
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
);
676 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
677 IdentifierDetailSection identifierDetailSection
= formFactory
.createIdentifierDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
678 addPart(identifierDetailSection
);
682 private void createFieldUnitSection(RootElement parent
) {
685 FieldUnitGeneralDetailSection fielUnitGeneralDetailSection
= formFactory
.createFieldUnitGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
687 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
689 GatheringEventDetailSection gatheringEventDetailSection
= formFactory
.createGatheringEventDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
691 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
693 FieldUnitDetailSection fieldUnitDetailSection
= formFactory
.createFieldUnitDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
695 addPart(fielUnitGeneralDetailSection
);
696 addPart(gatheringEventDetailSection
);
697 addPart(fieldUnitDetailSection
);
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
);
706 private void createTissueSampleSection(RootElement parent
) {
709 TissueSampleGeneralDetailSection section
= formFactory
.createTissueSampleGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
711 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
713 SampleDesignationDetailSection sampleDesignationDetailSection
= formFactory
.createSampleDesignationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
716 addPart(sampleDesignationDetailSection
);
719 private void createDnaSampleSection(RootElement parent
) {
722 DnaSampleGeneralDetailSection section
= formFactory
.createDnaSampleGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
724 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
726 DnaSamplePreparationPreservationSection preparationPreservationSection
= formFactory
.createDnaSamplePreparationPreservationSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
728 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
730 DnaQualityDetailSection qualitySection
= formFactory
.createDnaQualityDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
732 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
734 SampleDesignationDetailSection sampleDesignationDetailSection
= formFactory
.createSampleDesignationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
737 addPart(preparationPreservationSection
);
738 addPart(qualitySection
);
739 addPart(sampleDesignationDetailSection
);
742 private void createSequenceSection(RootElement parent
) {
745 SequenceGeneralDetailSection section
= formFactory
.createSequenceGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
747 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
749 SequenceReferenceCollectionDetailSection referenceSection
= formFactory
.createSequenceReferenceCollectionDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
751 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
753 SequenceContigFileCollectionDetailSection contigFileSection
= formFactory
.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
757 addPart(referenceSection
);
758 addPart(contigFileSection
);
761 private void createSingleReadSection(RootElement parent
) {
764 SingleReadGeneralDetailSection section
= formFactory
.createSingleReadGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
767 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
769 SingleReadPherogramCollectionDetailSection pherogramSection
= formFactory
.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
770 addPart(pherogramSection
);
774 private void createMediaSpecimenSection(RootElement parent
) {
777 MediaSpecimenGeneralDetailSection generalSection
= formFactory
.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
778 addPart(generalSection
);
780 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
782 RightsSection rightsSection
= formFactory
.createRightsSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
783 addPart(rightsSection
);
792 private void createFeatureDistributionSection(RootElement parent
) {
795 FeatureDistributionDetailSection featureDistributionSection
= formFactory
.createFeatureDistributionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
797 addPart(featureDistributionSection
);
801 * createPolytomousKeyNodeSection
805 private void createPolytomousKeyNodeSection(RootElement parent
) {
808 PolytomousKeyDetailSection polytomousKeyDetailSection
= formFactory
.createPolytomousKeyDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.COMPACT
);
810 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
812 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection
= formFactory
.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
814 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
816 TaxonomicScopeSection taxonomicScopeSection
= formFactory
.createTaxonomicScopeSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.COMPACT
);
818 addPart(polytomousKeyDetailSection
);
819 addPart(polytomousKeyNodeDetailSection
);
820 addPart(taxonomicScopeSection
);
825 * create the UseRecordSection
829 private void createUseRecordSection(RootElement parent
) {
832 UseRecordDetailSection descriptionUseRecordSection
= formFactory
.createUseRecordDetailSection(getConversationHolder(), parent
, this,ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
834 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
836 addPart(descriptionUseRecordSection
);
846 private void createUserSection(RootElement parent
) {
849 UserDetailSection userDetailSection
= formFactory
.createUserDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
851 GroupsByUserDetailSection groupByUserDetailSection
= formFactory
.createGroupsByUserDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
853 addPart(userDetailSection
);
854 addPart(groupByUserDetailSection
);
858 * createTaxonRelationshipSection
862 private void createTaxonRelationshipSection(RootElement parent
) {
865 TaxonRelationshipDetailSection taxonRelationshipDetailSection
= formFactory
.createTaxonRelationshipDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
867 ReferencedEntityDetailSection referencedEntityBaseDetailSection
= formFactory
.createReferencedEntityDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
868 addPart(taxonRelationshipDetailSection
);
869 addPart(referencedEntityBaseDetailSection
);
875 private void createTermVocabularySection(RootElement parent
) {
878 TermVocabularyDetailSection termVocabularyDetailSection
= formFactory
.createTermVocabularyDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
879 addPart(termVocabularyDetailSection
);
883 * createDefinedTermSection
887 private void createDefinedTermSection(RootElement parent
) {
890 AbstractFormSection
<?
> definedTermDetailSection
= formFactory
.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
891 addPart(definedTermDetailSection
);