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 if(((TaxonBase
) input
).getName()==null){
208 createEmptySection(rootElement
);
211 createTaxonSections(rootElement
);
214 } else if (input
instanceof NonViralName
) {
215 createNameSections(rootElement
);
217 } else if (input
instanceof Reference
) {
218 createReferenceSections(rootElement
);
220 } else if (input
instanceof Team
) {
221 createTeamDetailSection(rootElement
);
223 } else if (input
instanceof Person
) {
224 createPersonDetailSection(rootElement
);
226 } else if (input
instanceof TeamOrPersonBase
) {
227 createTeamOrPersonBaseDetailSection(rootElement
);
229 } else if (input
instanceof DescriptionBase
) {
230 if(input
instanceof SpecimenDescription
){
231 //TODO: add more sections to DetailsView for SpecimenDescription
232 createSpecimenDescriptionSection(rootElement
);
235 Set
<Marker
> descriptionMarkers
= ((DescriptionBase
<?
>) input
).getMarkers();
237 Boolean isUseDescription
= false;
238 for (Marker marker
: descriptionMarkers
) {
239 if (marker
.getMarkerType()!= null && marker
.getMarkerType().getUuid().equals(UsageTermCollection
.uuidUseMarkerType
)) {
240 isUseDescription
= true;
243 if (((DescriptionBase
<?
>) input
).isImageGallery()) {
244 createImageGallerySection(rootElement
);
246 } else if (isUseDescription
) {
247 createUseDescriptionSection(rootElement
);
249 createDescriptionSection(rootElement
);
253 } else if (input
instanceof DescriptionElementBase
) {
254 Set
<Marker
> descriptionMarkers
= ((DescriptionElementBase
) input
).getInDescription().getMarkers();
256 Boolean isUseDescription
= false;
257 for (Marker marker
: descriptionMarkers
) {
258 if (marker
.getMarkerType()!= null && marker
.getMarkerType().getUuid().equals(UsageTermCollection
.uuidUseMarkerType
)) {
259 isUseDescription
= true;
263 if (isUseDescription
== true && input
instanceof CategoricalData
) {
264 createUseRecordSection(rootElement
);
266 createDescriptionElementSection(rootElement
);
269 } else if (input
instanceof Media
) {
270 createMediaElementSection(rootElement
);
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);
278 createFieldUnitSection(rootElement
);
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);
286 createDerivedUnitBaseElementSection(rootElement
);
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);
295 createDerivedUnitBaseElementSection(rootElement
);
297 } else if (input
instanceof DnaSample
){
298 DnaSample dnaSample
= (DnaSample
)input
;
299 if(dnaSample
.getRecordBasis()==SpecimenOrObservationType
.TissueSample
){
300 createTissueSampleSection(rootElement
);
302 else if(dnaSample
.getRecordBasis()==SpecimenOrObservationType
.DnaSample
){
303 createDnaSampleSection(rootElement
);
305 } else if (input
instanceof MediaSpecimen
){
306 createMediaSpecimenSection(rootElement
);
308 else if(input
instanceof Sequence
){
309 createSequenceSection(rootElement
);
311 else if(input
instanceof SingleRead
){
312 createSingleReadSection(rootElement
);
314 else if (input
instanceof FeatureNodeContainer
) {
315 createFeatureDistributionSection(rootElement
);
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
);
331 createEmptySection(rootElement
);
340 private void createEmptySection(RootElement parent
) {
343 EmptySection emptySection
= formFactory
.createEmptySection(formFactory
, parent
, SWT
.NONE
);
345 addPart(emptySection
);
351 private void createGroupSection(RootElement parent
) {
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
);
358 addPart(groupDetailSection
);
359 addPart(memberDetailSection
);
360 addPart(grantedAuthorityDetailSection
);
366 * @see org.eclipse.jface.viewers.Viewer#getSelection()
370 public ISelection
getSelection() {
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
);
385 * createTaxonSections(RootElement parent)
389 private void createTaxonSections(RootElement parent
) {
392 ParsingMessagesSection parsingMessagesSection
= formFactory
.createParsingMessagesSection(getConversationHolder(), parent
, this,
393 ExpandableComposite
.EXPANDED
| ExpandableComposite
.EXPANDED
);
395 TaxonBaseDetailSection taxonBaseDetailSection
= formFactory
.createTaxonBaseDetailSection(getConversationHolder(), parent
, this,
396 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
397 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
399 NonViralNameDetailSection nonViralNameSection
= formFactory
.createNonViralNameDetailSection(getConversationHolder(), parent
, this,
400 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
401 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
403 NomenclaturalReferenceDetailSection referenceDetailSection
= formFactory
.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent
, this,
404 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
405 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
407 NomenclaturalStatusSection nomenclaturalStatusSection
= formFactory
.createNomenclaturalStatusSection(getConversationHolder(), parent
,
408 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
409 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
412 if(!PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.IS_RL
)){
413 ProtologueSection protologSection
= formFactory
.createProtologueSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
414 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
416 TypeDesignationSection typeDesignationSection
= formFactory
.createTypeDesignationSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
417 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
419 NameRelationshipDetailSection nameRelationshipSection
= formFactory
.createNameRelationshipDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
420 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
422 addPart(protologSection
);
423 addPart(typeDesignationSection
);
424 addPart(nameRelationshipSection
);
428 addPart(parsingMessagesSection
);
429 addPart(taxonBaseDetailSection
);
430 addPart(nonViralNameSection
);
431 addPart(nomenclaturalStatusSection
);
432 addPart(referenceDetailSection
);
440 private void createNameSections(RootElement parent
) {
442 NonViralNameDetailSection nonViralNameSection
= formFactory
.createNonViralNameDetailSection(getConversationHolder(), parent
, this,
443 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
444 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
446 NomenclaturalReferenceDetailSection referenceDetailSection
= formFactory
.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent
, this,
447 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
448 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
450 NomenclaturalStatusSection nomenclaturalStatusSection
= formFactory
.createNomenclaturalStatusSection(getConversationHolder(), parent
,
451 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
452 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
454 addPart(nonViralNameSection
);
455 addPart(nomenclaturalStatusSection
);
456 addPart(referenceDetailSection
);
458 if(!PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.IS_RL
)){
459 ProtologueSection protologSection
= formFactory
.createProtologueSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
460 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
462 TypeDesignationSection typeDesignationSection
= formFactory
.createTypeDesignationSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
463 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
465 NameRelationshipDetailSection nameRelationshipSection
= formFactory
.createNameRelationshipDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
466 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
467 addPart(protologSection
);
468 addPart(typeDesignationSection
);
469 addPart(nameRelationshipSection
);
474 * createReferenceSections
478 private void createReferenceSections(RootElement parent
) {
481 ReferenceDetailSection referenceDetailSection
= formFactory
.createReferenceDetailSection(getConversationHolder(), parent
, this,
482 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
484 addPart(referenceDetailSection
);
488 * createTeamOrPersonBaseDetailSection
492 private void createTeamOrPersonBaseDetailSection(RootElement parent
) {
494 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection
= formFactory
.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
496 addPart(teamOrPersonBaseDetailSection
);
500 * createTeamDetailSection
504 private void createTeamDetailSection(RootElement parent
) {
506 TeamDetailSection teamDetailSection
= formFactory
.createTeamDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
508 addPart(teamDetailSection
);
512 * createPersonDetailSection
516 private void createPersonDetailSection(RootElement parent
) {
518 PersonDetailSection personDetailSection
= formFactory
.createPersonDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
519 addPart(personDetailSection
);
523 * createDescriptionElementSection
527 private void createDescriptionElementSection(RootElement parent
) {
530 DescriptionElementDetailSection descriptionElementDetailSection
= formFactory
.createDescriptionElementDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
532 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
534 DescriptionElementSourceSection descriptionElementSourceSection
= formFactory
.createDescriptionElementSourceSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
536 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
538 DescriptionElementMediaSection descriptionElementMediaSection
= formFactory
.createDescriptionElementMediaSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
540 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
542 addPart(descriptionElementDetailSection
);
543 addPart(descriptionElementSourceSection
);
544 addPart(descriptionElementMediaSection
);
548 * createDescriptionSection
552 private void createDescriptionSection(RootElement parent
) {
554 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
556 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
558 NaturalLanguageSection naturalLanguageSection
= formFactory
.createNaturalLanguageSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
560 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
562 DescribedSpecimenSection describedSpecimenSection
= formFactory
.createDescribedSpecimenSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
564 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
566 // DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
567 // .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
568 // getConversationHolder(), parent, Section.TWISTIE);
570 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
572 ScopeSection scopeSection
= formFactory
.createScopeSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
574 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
576 addPart(descriptionDetailSection
);
577 addPart(naturalLanguageSection
);
578 addPart(describedSpecimenSection
);
579 // addPart(descriptionSourceSection);
580 addPart(scopeSection
);
584 * createDescriptionSection
588 private void createSpecimenDescriptionSection(RootElement parent
) {
590 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
591 addPart(descriptionDetailSection
);
595 * Creates the use Description section
599 private void createUseDescriptionSection(RootElement parent
) {
601 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
603 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
605 DescriptionSourceSection descriptionSourceSection
= formFactory
.createDescriptionSourceSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
607 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
609 addPart(descriptionDetailSection
);
610 addPart(descriptionSourceSection
);
618 private void createImageGallerySection(RootElement parent
) {
620 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
622 addPart(descriptionDetailSection
);
626 * createMediaElementSection
631 private void createMediaElementSection(RootElement parent
) {
634 MediaDetailsSection mediaDetailSection
= formFactory
.createMediaDetailsSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
636 addPart(mediaDetailSection
);
640 * createDerivedUnitBaseElementSection
644 private void createDerivedUnitBaseElementSection(RootElement parent
) {
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);
652 addPart(derivedUnitGeneralDetailSection
);
654 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
656 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection
= formFactory
.createDerivedUnitBaseDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
657 addPart(derivedUnitBaseDetailSection
);
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
);
665 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
666 FieldUnitDetailSection fieldUnitDetailSection
= formFactory
.createFieldUnitDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
667 addPart(fieldUnitDetailSection
);
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
);
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
);
681 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
682 IdentifierDetailSection identifierDetailSection
= formFactory
.createIdentifierDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
683 addPart(identifierDetailSection
);
687 private void createFieldUnitSection(RootElement parent
) {
690 FieldUnitGeneralDetailSection fielUnitGeneralDetailSection
= formFactory
.createFieldUnitGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
692 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
694 GatheringEventDetailSection gatheringEventDetailSection
= formFactory
.createGatheringEventDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
696 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
698 FieldUnitDetailSection fieldUnitDetailSection
= formFactory
.createFieldUnitDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
700 addPart(fielUnitGeneralDetailSection
);
701 addPart(gatheringEventDetailSection
);
702 addPart(fieldUnitDetailSection
);
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
);
711 private void createTissueSampleSection(RootElement parent
) {
714 TissueSampleGeneralDetailSection section
= formFactory
.createTissueSampleGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
716 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
718 SampleDesignationDetailSection sampleDesignationDetailSection
= formFactory
.createSampleDesignationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
721 addPart(sampleDesignationDetailSection
);
724 private void createDnaSampleSection(RootElement parent
) {
727 DnaSampleGeneralDetailSection section
= formFactory
.createDnaSampleGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
729 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
731 DnaSamplePreparationPreservationSection preparationPreservationSection
= formFactory
.createDnaSamplePreparationPreservationSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
733 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
735 DnaQualityDetailSection qualitySection
= formFactory
.createDnaQualityDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
737 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
739 SampleDesignationDetailSection sampleDesignationDetailSection
= formFactory
.createSampleDesignationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
742 addPart(preparationPreservationSection
);
743 addPart(qualitySection
);
744 addPart(sampleDesignationDetailSection
);
747 private void createSequenceSection(RootElement parent
) {
750 SequenceGeneralDetailSection section
= formFactory
.createSequenceGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
752 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
754 SequenceReferenceCollectionDetailSection referenceSection
= formFactory
.createSequenceReferenceCollectionDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
756 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
758 SequenceContigFileCollectionDetailSection contigFileSection
= formFactory
.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
762 addPart(referenceSection
);
763 addPart(contigFileSection
);
766 private void createSingleReadSection(RootElement parent
) {
769 SingleReadGeneralDetailSection section
= formFactory
.createSingleReadGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
772 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
774 SingleReadPherogramCollectionDetailSection pherogramSection
= formFactory
.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
775 addPart(pherogramSection
);
779 private void createMediaSpecimenSection(RootElement parent
) {
782 MediaSpecimenGeneralDetailSection generalSection
= formFactory
.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
783 addPart(generalSection
);
785 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
787 RightsSection rightsSection
= formFactory
.createRightsSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
788 addPart(rightsSection
);
797 private void createFeatureDistributionSection(RootElement parent
) {
800 FeatureDistributionDetailSection featureDistributionSection
= formFactory
.createFeatureDistributionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
802 addPart(featureDistributionSection
);
806 * createPolytomousKeyNodeSection
810 private void createPolytomousKeyNodeSection(RootElement parent
) {
813 PolytomousKeyDetailSection polytomousKeyDetailSection
= formFactory
.createPolytomousKeyDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.COMPACT
);
815 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
817 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection
= formFactory
.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
819 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
821 TaxonomicScopeSection taxonomicScopeSection
= formFactory
.createTaxonomicScopeSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.COMPACT
);
823 addPart(polytomousKeyDetailSection
);
824 addPart(polytomousKeyNodeDetailSection
);
825 addPart(taxonomicScopeSection
);
830 * create the UseRecordSection
834 private void createUseRecordSection(RootElement parent
) {
837 UseRecordDetailSection descriptionUseRecordSection
= formFactory
.createUseRecordDetailSection(getConversationHolder(), parent
, this,ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
839 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
841 addPart(descriptionUseRecordSection
);
851 private void createUserSection(RootElement parent
) {
854 UserDetailSection userDetailSection
= formFactory
.createUserDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
856 GroupsByUserDetailSection groupByUserDetailSection
= formFactory
.createGroupsByUserDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
858 addPart(userDetailSection
);
859 addPart(groupByUserDetailSection
);
863 * createTaxonRelationshipSection
867 private void createTaxonRelationshipSection(RootElement parent
) {
870 TaxonRelationshipDetailSection taxonRelationshipDetailSection
= formFactory
.createTaxonRelationshipDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
872 ReferencedEntityDetailSection referencedEntityBaseDetailSection
= formFactory
.createReferencedEntityDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
873 addPart(taxonRelationshipDetailSection
);
874 addPart(referencedEntityBaseDetailSection
);
880 private void createTermVocabularySection(RootElement parent
) {
883 TermVocabularyDetailSection termVocabularyDetailSection
= formFactory
.createTermVocabularyDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
884 addPart(termVocabularyDetailSection
);
888 * createDefinedTermSection
892 private void createDefinedTermSection(RootElement parent
) {
895 AbstractFormSection
<?
> definedTermDetailSection
= formFactory
.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
896 addPart(definedTermDetailSection
);