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
.name
.NameRelationshipDetailSection
;
82 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusSection
;
83 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailSection
;
84 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueSection
;
85 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.TypeDesignationSection
;
86 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailSection
;
87 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitGeneralDetailSection
;
88 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailSection
;
89 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.EmptySection
;
90 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldUnitDetailSection
;
91 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldUnitGeneralDetailSection
;
92 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailSection
;
93 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.association
.TaxonAssociationDetailSection
;
94 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.DnaQualityDetailSection
;
95 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.DnaSampleGeneralDetailSection
;
96 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.DnaSamplePreparationPreservationSection
;
97 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SampleDesignationDetailSection
;
98 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SequenceContigFileCollectionDetailSection
;
99 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SequenceGeneralDetailSection
;
100 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SequenceReferenceCollectionDetailSection
;
101 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SingleReadGeneralDetailSection
;
102 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SingleReadPherogramCollectionDetailSection
;
103 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.TissueSampleGeneralDetailSection
;
104 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.media
.MediaSpecimenGeneralDetailSection
;
105 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailSection
;
106 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailSection
;
107 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
108 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
109 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
110 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailSection
;
111 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailSection
;
112 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailSection
;
113 import eu
.etaxonomy
.taxeditor
.ui
.section
.userecords
.UseRecordDetailSection
;
114 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailSection
;
115 import eu
.etaxonomy
.taxeditor
.view
.AbstractCdmDataViewer
;
116 import eu
.etaxonomy
.taxeditor
.view
.AbstractCdmViewPart
;
120 * The DetailsViewer handles the content of the details view (
121 * {@link DetailsViewPart}).<br>
122 * Depending on the type of the selected element the section of the details view
126 * @created Feb 12, 2010
129 public class DetailsViewer
extends AbstractCdmDataViewer
{
131 private ISelection selection
;
133 public DetailsViewer(Composite parent
, AbstractCdmViewPart viewPart
) {
134 super(parent
, viewPart
);
137 // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
138 // since we are getting implementations of DerivedUnitBase from the bulk
140 // and not derived unit facade objects,
143 public void setInput(Object input
) {
144 if(input
instanceof TreeNode
){
145 input
= ((TreeNode
) input
).getValue();
147 if(input
instanceof GbifResponse
){
148 input
= ((GbifResponse
) input
).getDerivedUnitFacade();
150 if (input
.getClass().equals(DerivedUnit
.class)) {
151 DerivedUnit derivedUnit
= (DerivedUnit
)input
;
153 input
= DerivedUnitFacade
.NewInstance(derivedUnit
,
154 PreferencesUtil
.getDerivedUnitConfigurator());
155 } catch (DerivedUnitFacadeNotSupportedException e
) {
156 // MessagingUtils.error(getClass(), e); //nothing should happen, later on the Details View will show an according information that it is not possible to open this data
159 else if(input
instanceof FieldUnit
){
160 input
= DerivedUnitFacade
.NewInstance(SpecimenOrObservationType
.FieldUnit
, (FieldUnit
) input
);
162 super.setInput(input
);
166 protected void markViewPartDirty() {
167 if (getInput() instanceof DerivedUnitFacade
) {
168 DerivedUnitFacade facade
= (DerivedUnitFacade
) getInput();
169 if(facade
.innerDerivedUnit()!=null){
170 getViewPart().changed(facade
.innerDerivedUnit());
172 else if(facade
.innerFieldUnit()!=null){
173 getViewPart().changed(facade
.innerFieldUnit());
177 super.markViewPartDirty();
181 // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
186 protected void showParts() {
187 // FIXME (CM) : Need to clean out this code.
188 // Too much type checking to decide which detail view to display.
189 // Need to build in a mechanism where navigators / editors are 'aware'
190 // of the corresponding detail viewer.
191 Object input
= getInput();
194 if (input
instanceof TaxonBase
) {
195 if(((TaxonBase
) input
).getName()==null){
196 createEmptySection(rootElement
);
199 createTaxonSections(rootElement
);
202 } else if (input
instanceof NonViralName
) {
203 createNameSections(rootElement
);
205 } else if (input
instanceof Reference
) {
206 createReferenceSections(rootElement
);
208 } else if (input
instanceof Team
) {
209 createTeamDetailSection(rootElement
);
211 } else if (input
instanceof Person
) {
212 createPersonDetailSection(rootElement
);
214 } else if (input
instanceof TeamOrPersonBase
) {
215 createTeamOrPersonBaseDetailSection(rootElement
);
217 } else if (input
instanceof DescriptionBase
) {
218 if(input
instanceof SpecimenDescription
){
219 //TODO: add more sections to DetailsView for SpecimenDescription
220 createSpecimenDescriptionSection(rootElement
);
223 Set
<Marker
> descriptionMarkers
= ((DescriptionBase
<?
>) input
).getMarkers();
225 Boolean isUseDescription
= false;
226 for (Marker marker
: descriptionMarkers
) {
227 if (marker
.getMarkerType()!= null && marker
.getMarkerType().getUuid().equals(UsageTermCollection
.uuidUseMarkerType
)) {
228 isUseDescription
= true;
231 if (((DescriptionBase
<?
>) input
).isImageGallery()) {
232 createImageGallerySection(rootElement
);
234 } else if (isUseDescription
) {
235 createUseDescriptionSection(rootElement
);
237 createDescriptionSection(rootElement
);
241 } else if (input
instanceof DescriptionElementBase
) {
242 Set
<Marker
> descriptionMarkers
= ((DescriptionElementBase
) input
).getInDescription().getMarkers();
244 Boolean isUseDescription
= false;
245 for (Marker marker
: descriptionMarkers
) {
246 if (marker
.getMarkerType()!= null && marker
.getMarkerType().getUuid().equals(UsageTermCollection
.uuidUseMarkerType
)) {
247 isUseDescription
= true;
251 if (isUseDescription
== true && input
instanceof CategoricalData
) {
252 createUseRecordSection(rootElement
);
254 createDescriptionElementSection(rootElement
);
257 } else if (input
instanceof Media
) {
258 createMediaElementSection(rootElement
);
260 } else if (input
instanceof DerivedUnitFacade
) {
261 if(((DerivedUnitFacade
) input
).getType()==SpecimenOrObservationType
.FieldUnit
){
262 if(((DerivedUnitFacade
) input
).innerFieldUnit()==null){
263 MessagingUtils
.error(DetailsViewer
.class, "FieldUnit of facade is null", null);
266 createFieldUnitSection(rootElement
);
269 else if(((DerivedUnitFacade
) input
).getType()==SpecimenOrObservationType
.PreservedSpecimen
){
270 if(((DerivedUnitFacade
) input
).innerDerivedUnit()==null){
271 MessagingUtils
.error(DetailsViewer
.class, "DerivedUnit of facade is null", null);
274 createDerivedUnitBaseElementSection(rootElement
);
277 else if(((DerivedUnitFacade
) input
).getType()==SpecimenOrObservationType
.TissueSample
){
278 //TissueSample should only be created by using it's own class
279 //in future using only one class with different SpecimenOrObservationTypes is desired
280 // createTissueSampleSection(rootElement);
283 createDerivedUnitBaseElementSection(rootElement
);
285 } else if (input
instanceof DnaSample
){
286 DnaSample dnaSample
= (DnaSample
)input
;
287 if(dnaSample
.getRecordBasis()==SpecimenOrObservationType
.TissueSample
){
288 createTissueSampleSection(rootElement
);
290 else if(dnaSample
.getRecordBasis()==SpecimenOrObservationType
.DnaSample
){
291 createDnaSampleSection(rootElement
);
293 } else if (input
instanceof MediaSpecimen
){
294 createMediaSpecimenSection(rootElement
);
296 else if(input
instanceof Sequence
){
297 createSequenceSection(rootElement
);
299 else if(input
instanceof SingleRead
){
300 createSingleReadSection(rootElement
);
302 else if (input
instanceof FeatureNodeContainer
) {
303 createFeatureDistributionSection(rootElement
);
305 }else if ((input
instanceof PolytomousKeyNode
) || (input
instanceof PolytomousKeyRelationship
)) {
306 createPolytomousKeyNodeSection(rootElement
);
307 } else if (input
instanceof User
) {
308 createUserSection(rootElement
);
309 } else if (input
instanceof Group
) {
310 createGroupSection(rootElement
);
311 } else if (input
instanceof TaxonRelationship
) {
312 createTaxonRelationshipSection(rootElement
);
313 } else if (input
instanceof TermVocabulary
) {
314 createTermVocabularySection(rootElement
);
315 } else if (input
instanceof DefinedTermBase
) {
316 createDefinedTermSection(rootElement
);
319 createEmptySection(rootElement
);
325 private void createEmptySection(RootElement parent
) {
328 EmptySection emptySection
= formFactory
.createEmptySection(formFactory
, parent
, SWT
.NONE
);
330 addPart(emptySection
);
333 private void createGroupSection(RootElement parent
) {
336 GroupDetailSection groupDetailSection
= formFactory
.createGroupDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
337 MemberDetailSection memberDetailSection
= formFactory
.createMemberDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
338 GrantedAuthorityDetailSection grantedAuthorityDetailSection
= formFactory
.createGrantedAuthorityDetailSection(getConversationHolder(), parent
,ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
340 addPart(groupDetailSection
);
341 addPart(memberDetailSection
);
342 addPart(grantedAuthorityDetailSection
);
347 public ISelection
getSelection() {
353 public void setSelection(ISelection selection
, boolean reveal
) {
354 this.selection
= selection
;
355 if(this.selection
!=null){
356 SelectionChangedEvent selectionChangedEvent
= new SelectionChangedEvent(this, selection
);
357 fireSelectionChanged(selectionChangedEvent
);
361 private void createTaxonSections(RootElement parent
) {
364 ParsingMessagesSection parsingMessagesSection
= formFactory
.createParsingMessagesSection(getConversationHolder(), parent
, this,
365 ExpandableComposite
.EXPANDED
| ExpandableComposite
.EXPANDED
);
367 TaxonBaseDetailSection taxonBaseDetailSection
= formFactory
.createTaxonBaseDetailSection(getConversationHolder(), parent
, this,
368 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
369 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
371 NonViralNameDetailSection nonViralNameSection
= formFactory
.createNonViralNameDetailSection(getConversationHolder(), parent
, this,
372 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
373 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
375 NomenclaturalReferenceDetailSection referenceDetailSection
= formFactory
.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent
, this,
376 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
377 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
379 NomenclaturalStatusSection nomenclaturalStatusSection
= formFactory
.createNomenclaturalStatusSection(getConversationHolder(), parent
,
380 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
381 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
384 if(!PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.IS_RL
)){
385 ProtologueSection protologSection
= formFactory
.createProtologueSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
386 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
388 TypeDesignationSection typeDesignationSection
= formFactory
.createTypeDesignationSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
389 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
391 NameRelationshipDetailSection nameRelationshipSection
= formFactory
.createNameRelationshipDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
392 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
394 addPart(protologSection
);
395 addPart(typeDesignationSection
);
396 addPart(nameRelationshipSection
);
399 addPart(parsingMessagesSection
);
400 addPart(taxonBaseDetailSection
);
401 addPart(nonViralNameSection
);
402 addPart(nomenclaturalStatusSection
);
403 addPart(referenceDetailSection
);
406 private void createNameSections(RootElement parent
) {
408 NonViralNameDetailSection nonViralNameSection
= formFactory
.createNonViralNameDetailSection(getConversationHolder(), parent
, this,
409 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
410 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
412 NomenclaturalReferenceDetailSection referenceDetailSection
= formFactory
.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent
, this,
413 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
414 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
416 NomenclaturalStatusSection nomenclaturalStatusSection
= formFactory
.createNomenclaturalStatusSection(getConversationHolder(), parent
,
417 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
418 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
420 addPart(nonViralNameSection
);
421 addPart(nomenclaturalStatusSection
);
422 addPart(referenceDetailSection
);
424 if(!PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.IS_RL
)){
425 ProtologueSection protologSection
= formFactory
.createProtologueSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
426 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
428 TypeDesignationSection typeDesignationSection
= formFactory
.createTypeDesignationSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
429 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
431 NameRelationshipDetailSection nameRelationshipSection
= formFactory
.createNameRelationshipDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
432 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
433 addPart(protologSection
);
434 addPart(typeDesignationSection
);
435 addPart(nameRelationshipSection
);
439 private void createReferenceSections(RootElement parent
) {
442 ReferenceDetailSection referenceDetailSection
= formFactory
.createReferenceDetailSection(getConversationHolder(), parent
, this,
443 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
445 addPart(referenceDetailSection
);
448 private void createTeamOrPersonBaseDetailSection(RootElement parent
) {
450 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection
= formFactory
.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
452 addPart(teamOrPersonBaseDetailSection
);
455 private void createTeamDetailSection(RootElement parent
) {
457 TeamDetailSection teamDetailSection
= formFactory
.createTeamDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
459 addPart(teamDetailSection
);
462 private void createPersonDetailSection(RootElement parent
) {
464 PersonDetailSection personDetailSection
= formFactory
.createPersonDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
465 addPart(personDetailSection
);
468 private void createDescriptionElementSection(RootElement parent
) {
471 DescriptionElementDetailSection descriptionElementDetailSection
= formFactory
.createDescriptionElementDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
473 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
475 DescriptionElementSourceSection descriptionElementSourceSection
= formFactory
.createDescriptionElementSourceSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
477 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
479 DescriptionElementMediaSection descriptionElementMediaSection
= formFactory
.createDescriptionElementMediaSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
481 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
483 addPart(descriptionElementDetailSection
);
484 addPart(descriptionElementSourceSection
);
485 addPart(descriptionElementMediaSection
);
488 private void createDescriptionSection(RootElement parent
) {
490 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
492 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
494 NaturalLanguageSection naturalLanguageSection
= formFactory
.createNaturalLanguageSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
496 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
498 DescribedSpecimenSection describedSpecimenSection
= formFactory
.createDescribedSpecimenSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
500 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
502 // DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
503 // .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
504 // getConversationHolder(), parent, Section.TWISTIE);
506 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
508 ScopeSection scopeSection
= formFactory
.createScopeSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
510 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
512 addPart(descriptionDetailSection
);
513 addPart(naturalLanguageSection
);
514 addPart(describedSpecimenSection
);
515 // addPart(descriptionSourceSection);
516 addPart(scopeSection
);
519 private void createSpecimenDescriptionSection(RootElement parent
) {
521 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
522 addPart(descriptionDetailSection
);
525 private void createUseDescriptionSection(RootElement parent
) {
527 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
529 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
531 DescriptionSourceSection descriptionSourceSection
= formFactory
.createDescriptionSourceSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
533 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
535 addPart(descriptionDetailSection
);
536 addPart(descriptionSourceSection
);
540 private void createImageGallerySection(RootElement parent
) {
542 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
544 addPart(descriptionDetailSection
);
547 private void createMediaElementSection(RootElement parent
) {
550 MediaDetailsSection mediaDetailSection
= formFactory
.createMediaDetailsSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
552 addPart(mediaDetailSection
);
555 private void createDerivedUnitBaseElementSection(RootElement parent
) {
558 DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection
= formFactory
.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
559 //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
560 if(!(AbstractUtility
.getActivePart() instanceof IDerivedUnitFacadePart
)){
561 derivedUnitGeneralDetailSection
.setShowOnlyDerivedUnitData(true);
563 addPart(derivedUnitGeneralDetailSection
);
565 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
567 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection
= formFactory
.createDerivedUnitBaseDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
568 addPart(derivedUnitBaseDetailSection
);
570 //for editors working with facades
571 if(AbstractUtility
.getActivePart() instanceof IDerivedUnitFacadePart
){
572 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
573 GatheringEventDetailSection gatheringEventDetailSection
= formFactory
.createGatheringEventDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
574 addPart(gatheringEventDetailSection
);
576 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
577 FieldUnitDetailSection fieldUnitDetailSection
= formFactory
.createFieldUnitDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
578 addPart(fieldUnitDetailSection
);
581 if(!PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.DETERMINATION_ONLY_FOR_FIELD_UNITS
)){
582 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
583 DeterminationDetailSection determinationDetailSection
= formFactory
.createDeterminationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
584 addPart(determinationDetailSection
);
586 if(PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_TAXON_ASSOCIATIONS
)){
587 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
588 TaxonAssociationDetailSection taxonAssociationDetailSection
= formFactory
.createTaxonAssociationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
589 addPart(taxonAssociationDetailSection
);
592 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
593 IdentifierDetailSection identifierDetailSection
= formFactory
.createIdentifierDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
594 addPart(identifierDetailSection
);
598 private void createFieldUnitSection(RootElement parent
) {
601 FieldUnitGeneralDetailSection fielUnitGeneralDetailSection
= formFactory
.createFieldUnitGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
603 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
605 GatheringEventDetailSection gatheringEventDetailSection
= formFactory
.createGatheringEventDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
607 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
609 FieldUnitDetailSection fieldUnitDetailSection
= formFactory
.createFieldUnitDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
611 addPart(fielUnitGeneralDetailSection
);
612 addPart(gatheringEventDetailSection
);
613 addPart(fieldUnitDetailSection
);
615 if(PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.DETERMINATION_ONLY_FOR_FIELD_UNITS
)){
616 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
617 DeterminationDetailSection determinationDetailSection
= formFactory
.createDeterminationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
618 addPart(determinationDetailSection
);
622 private void createTissueSampleSection(RootElement parent
) {
625 TissueSampleGeneralDetailSection section
= formFactory
.createTissueSampleGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
627 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
629 SampleDesignationDetailSection sampleDesignationDetailSection
= formFactory
.createSampleDesignationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
632 addPart(sampleDesignationDetailSection
);
635 private void createDnaSampleSection(RootElement parent
) {
638 DnaSampleGeneralDetailSection section
= formFactory
.createDnaSampleGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
640 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
642 DnaSamplePreparationPreservationSection preparationPreservationSection
= formFactory
.createDnaSamplePreparationPreservationSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
644 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
646 DnaQualityDetailSection qualitySection
= formFactory
.createDnaQualityDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
648 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
650 SampleDesignationDetailSection sampleDesignationDetailSection
= formFactory
.createSampleDesignationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
653 addPart(preparationPreservationSection
);
654 addPart(qualitySection
);
655 addPart(sampleDesignationDetailSection
);
658 private void createSequenceSection(RootElement parent
) {
661 SequenceGeneralDetailSection section
= formFactory
.createSequenceGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
663 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
665 SequenceReferenceCollectionDetailSection referenceSection
= formFactory
.createSequenceReferenceCollectionDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
667 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
669 SequenceContigFileCollectionDetailSection contigFileSection
= formFactory
.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
673 addPart(referenceSection
);
674 addPart(contigFileSection
);
677 private void createSingleReadSection(RootElement parent
) {
680 SingleReadGeneralDetailSection section
= formFactory
.createSingleReadGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
683 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
685 SingleReadPherogramCollectionDetailSection pherogramSection
= formFactory
.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
686 addPart(pherogramSection
);
690 private void createMediaSpecimenSection(RootElement parent
) {
693 MediaSpecimenGeneralDetailSection generalSection
= formFactory
.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
694 addPart(generalSection
);
696 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
698 RightsSection rightsSection
= formFactory
.createRightsSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
699 addPart(rightsSection
);
703 private void createFeatureDistributionSection(RootElement parent
) {
706 FeatureDistributionDetailSection featureDistributionSection
= formFactory
.createFeatureDistributionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
708 addPart(featureDistributionSection
);
711 private void createPolytomousKeyNodeSection(RootElement parent
) {
714 PolytomousKeyDetailSection polytomousKeyDetailSection
= formFactory
.createPolytomousKeyDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
716 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
718 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection
= formFactory
.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
720 addPart(polytomousKeyDetailSection
);
721 addPart(polytomousKeyNodeDetailSection
);
725 private void createUseRecordSection(RootElement parent
) {
728 UseRecordDetailSection descriptionUseRecordSection
= formFactory
.createUseRecordDetailSection(getConversationHolder(), parent
, this,ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
730 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
732 addPart(descriptionUseRecordSection
);
737 private void createUserSection(RootElement parent
) {
740 UserDetailSection userDetailSection
= formFactory
.createUserDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
742 GroupsByUserDetailSection groupByUserDetailSection
= formFactory
.createGroupsByUserDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
744 addPart(userDetailSection
);
745 addPart(groupByUserDetailSection
);
748 private void createTaxonRelationshipSection(RootElement parent
) {
751 TaxonRelationshipDetailSection taxonRelationshipDetailSection
= formFactory
.createTaxonRelationshipDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
753 ReferencedEntityDetailSection referencedEntityBaseDetailSection
= formFactory
.createReferencedEntityDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
754 addPart(taxonRelationshipDetailSection
);
755 addPart(referencedEntityBaseDetailSection
);
758 private void createTermVocabularySection(RootElement parent
) {
761 TermVocabularyDetailSection termVocabularyDetailSection
= formFactory
.createTermVocabularyDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
762 addPart(termVocabularyDetailSection
);
765 private void createDefinedTermSection(RootElement parent
) {
768 AbstractFormSection
<?
> definedTermDetailSection
= formFactory
.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
769 addPart(definedTermDetailSection
);