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
.api
.service
.ITermService
;
26 import eu
.etaxonomy
.cdm
.ext
.occurrence
.gbif
.GbifResponse
;
27 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
28 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
29 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
30 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
31 import eu
.etaxonomy
.cdm
.model
.common
.Group
;
32 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
33 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
34 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
35 import eu
.etaxonomy
.cdm
.model
.common
.User
;
36 import eu
.etaxonomy
.cdm
.model
.description
.CategoricalData
;
37 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionBase
;
38 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
39 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKeyNode
;
40 import eu
.etaxonomy
.cdm
.model
.description
.SpecimenDescription
;
41 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
42 import eu
.etaxonomy
.cdm
.model
.molecular
.DnaSample
;
43 import eu
.etaxonomy
.cdm
.model
.molecular
.Sequence
;
44 import eu
.etaxonomy
.cdm
.model
.molecular
.SingleRead
;
45 import eu
.etaxonomy
.cdm
.model
.name
.NonViralName
;
46 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
47 import eu
.etaxonomy
.cdm
.model
.occurrence
.FieldUnit
;
48 import eu
.etaxonomy
.cdm
.model
.occurrence
.MediaSpecimen
;
49 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationType
;
50 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
51 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
52 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
53 import eu
.etaxonomy
.taxeditor
.editor
.UsageTermCollection
;
54 import eu
.etaxonomy
.taxeditor
.model
.AbstractUtility
;
55 import eu
.etaxonomy
.taxeditor
.model
.FeatureNodeContainer
;
56 import eu
.etaxonomy
.taxeditor
.model
.IDerivedUnitFacadePart
;
57 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
58 import eu
.etaxonomy
.taxeditor
.model
.PolytomousKeyRelationship
;
59 import eu
.etaxonomy
.taxeditor
.preference
.IPreferenceKeys
;
60 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
61 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
62 import eu
.etaxonomy
.taxeditor
.ui
.element
.AbstractFormSection
;
63 import eu
.etaxonomy
.taxeditor
.ui
.element
.RootElement
;
64 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailSection
;
65 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailSection
;
66 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamOrPersonBaseDetailSection
;
67 import eu
.etaxonomy
.taxeditor
.ui
.section
.common
.ReferencedEntityDetailSection
;
68 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescribedSpecimenSection
;
69 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailSection
;
70 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailSection
;
71 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementMediaSection
;
72 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceSection
;
73 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceSection
;
74 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection
;
75 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageSection
;
76 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeSection
;
77 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailSection
;
78 import eu
.etaxonomy
.taxeditor
.ui
.section
.grantedAuthority
.GrantedAuthorityDetailSection
;
79 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailSection
;
80 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailSection
;
81 import eu
.etaxonomy
.taxeditor
.ui
.section
.identifier
.IdentifierDetailSection
;
82 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailSection
;
83 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailSection
;
84 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.TaxonomicScopeSection
;
85 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailSection
;
86 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusSection
;
87 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailSection
;
88 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueSection
;
89 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.TypeDesignationSection
;
90 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailSection
;
91 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitGeneralDetailSection
;
92 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailSection
;
93 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.EmptySection
;
94 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldUnitDetailSection
;
95 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldUnitGeneralDetailSection
;
96 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailSection
;
97 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.OriginalLabelDataSection
;
98 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.association
.TaxonAssociationDetailSection
;
99 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.DnaQualityDetailSection
;
100 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.DnaSampleGeneralDetailSection
;
101 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SampleDesignationDetailSection
;
102 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SequenceContigFileCollectionDetailSection
;
103 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SequenceGeneralDetailSection
;
104 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SequenceReferenceCollectionDetailSection
;
105 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SingleReadGeneralDetailSection
;
106 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SingleReadPherogramCollectionDetailSection
;
107 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.TissueSampleGeneralDetailSection
;
108 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.media
.MediaSpecimenGeneralDetailSection
;
109 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailSection
;
110 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailSection
;
111 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
112 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
113 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
114 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailSection
;
115 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailSection
;
116 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailSection
;
117 import eu
.etaxonomy
.taxeditor
.ui
.section
.userecords
.UseRecordDetailSection
;
118 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailSection
;
119 import eu
.etaxonomy
.taxeditor
.view
.AbstractCdmDataViewer
;
120 import eu
.etaxonomy
.taxeditor
.view
.AbstractCdmViewPart
;
124 * The DetailsViewer handles the content of the details view (
125 * {@link DetailsViewPart}).<br>
126 * Depending on the type of the selected element the section of the details view
130 * @created Feb 12, 2010
133 public class DetailsViewer
extends AbstractCdmDataViewer
{
135 private ISelection selection
;
139 * Constructor for DetailsViewer.
143 * a {@link org.eclipse.swt.widgets.Composite} object.
145 * a {@link eu.etaxonomy.taxeditor.view.AbstractCdmViewPart}
148 public DetailsViewer(Composite parent
, AbstractCdmViewPart viewPart
) {
149 super(parent
, viewPart
);
152 // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
153 // since we are getting implementations of DerivedUnitBase from the bulk
155 // and not derived unit facade objects,
161 * eu.etaxonomy.taxeditor.editor.view.AbstractCdmDataViewer#setInput(java
165 public void setInput(Object input
) {
166 if(input
instanceof TreeNode
){
167 input
= ((TreeNode
) input
).getValue();
169 if(input
instanceof GbifResponse
){
170 input
= ((GbifResponse
) input
).getDerivedUnitFacade();
172 if (input
.getClass().equals(DerivedUnit
.class)) {
173 DerivedUnit derivedUnit
= (DerivedUnit
)input
;
175 input
= DerivedUnitFacade
.NewInstance(derivedUnit
,
176 PreferencesUtil
.getDerivedUnitConfigurator());
177 } catch (DerivedUnitFacadeNotSupportedException e
) {
178 // 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
181 else if(input
instanceof FieldUnit
){
182 input
= DerivedUnitFacade
.NewInstance(SpecimenOrObservationType
.FieldUnit
, (FieldUnit
) input
);
184 super.setInput(input
);
188 protected void markViewPartDirty() {
189 if (getInput() instanceof DerivedUnitFacade
) {
190 DerivedUnitFacade facade
= (DerivedUnitFacade
) getInput();
191 if(facade
.innerDerivedUnit()!=null){
192 getViewPart().changed(facade
.innerDerivedUnit());
194 else if(facade
.innerFieldUnit()!=null){
195 getViewPart().changed(facade
.innerFieldUnit());
199 super.markViewPartDirty();
203 // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
208 * @see org.eclipse.jface.viewers.Viewer#refresh()
212 protected void showParts() {
213 // FIXME (CM) : Need to clean out this code.
214 // Too much type checking to decide which detail view to display.
215 // Need to build in a mechanism where navigators / editors are 'aware'
216 // of the corresponding detail viewer.
217 Object input
= getInput();
220 if (input
instanceof TaxonBase
) {
221 createTaxonSections(rootElement
);
223 } else if (input
instanceof NonViralName
) {
224 createNameSections(rootElement
);
226 } else if (input
instanceof Reference
) {
227 createReferenceSections(rootElement
);
229 } else if (input
instanceof Team
) {
230 createTeamDetailSection(rootElement
);
232 } else if (input
instanceof Person
) {
233 createPersonDetailSection(rootElement
);
235 } else if (input
instanceof TeamOrPersonBase
) {
236 createTeamOrPersonBaseDetailSection(rootElement
);
238 } else if (input
instanceof DescriptionBase
) {
239 if(input
instanceof SpecimenDescription
){
240 //TODO: add more sections to DetailsView for SpecimenDescription
241 createSpecimenDescriptionSection(rootElement
);
244 Set
<Marker
> descriptionMarkers
= ((DescriptionBase
<?
>) input
).getMarkers();
245 MarkerType useMarkertype
= (MarkerType
) CdmStore
.getService(ITermService
.class).find(
246 UsageTermCollection
.uuidUseMarkerType
);
247 Boolean isUseDescription
= false;
248 for (Marker marker
: descriptionMarkers
) {
249 if (marker
.getMarkerType().equals(useMarkertype
)) {
250 isUseDescription
= true;
253 if (((DescriptionBase
<?
>) input
).isImageGallery()) {
254 createImageGallerySection(rootElement
);
256 } else if (isUseDescription
) {
257 createUseDescriptionSection(rootElement
);
259 createDescriptionSection(rootElement
);
263 } else if (input
instanceof DescriptionElementBase
) {
264 Set
<Marker
> descriptionMarkers
= ((DescriptionElementBase
) input
).getInDescription().getMarkers();
265 MarkerType useMarkertype
= (MarkerType
) CdmStore
.getService(ITermService
.class).find(
266 UsageTermCollection
.uuidUseMarkerType
);
267 Boolean isUseDescription
= false;
268 for (Marker marker
: descriptionMarkers
) {
269 if (marker
.getMarkerType().equals(useMarkertype
)) {
270 isUseDescription
= true;
274 if (isUseDescription
== true && input
instanceof CategoricalData
) {
275 createUseRecordSection(rootElement
);
277 createDescriptionElementSection(rootElement
);
280 } else if (input
instanceof Media
) {
281 createMediaElementSection(rootElement
);
283 } else if (input
instanceof DerivedUnitFacade
) {
284 if(((DerivedUnitFacade
) input
).getType()==SpecimenOrObservationType
.FieldUnit
){
285 if(((DerivedUnitFacade
) input
).innerFieldUnit()==null){
286 MessagingUtils
.error(DetailsViewer
.class, "FieldUnit of facade is null", null);
289 createFieldUnitSection(rootElement
);
292 else if(((DerivedUnitFacade
) input
).getType()==SpecimenOrObservationType
.PreservedSpecimen
){
293 if(((DerivedUnitFacade
) input
).innerDerivedUnit()==null){
294 MessagingUtils
.error(DetailsViewer
.class, "DerivedUnit of facade is null", null);
297 createDerivedUnitBaseElementSection(rootElement
);
300 else if(((DerivedUnitFacade
) input
).getType()==SpecimenOrObservationType
.TissueSample
){
301 //TissueSample should only be created by using it's own class
302 //in future using only one class with different SpecimenOrObservationTypes is desired
303 // createTissueSampleSection(rootElement);
306 createDerivedUnitBaseElementSection(rootElement
);
308 } else if (input
instanceof DnaSample
){
309 DnaSample dnaSample
= (DnaSample
)input
;
310 if(dnaSample
.getRecordBasis()==SpecimenOrObservationType
.TissueSample
){
311 createTissueSampleSection(rootElement
);
313 else if(dnaSample
.getRecordBasis()==SpecimenOrObservationType
.DnaSample
){
314 createDnaSampleSection(rootElement
);
316 } else if (input
instanceof MediaSpecimen
){
317 createMediaSpecimenSection(rootElement
);
319 else if(input
instanceof Sequence
){
320 createSequenceSection(rootElement
);
322 else if(input
instanceof SingleRead
){
323 createSingleReadSection(rootElement
);
325 else if (input
instanceof FeatureNodeContainer
) {
326 createFeatureDistributionSection(rootElement
);
328 }else if ((input
instanceof PolytomousKeyNode
) || (input
instanceof PolytomousKeyRelationship
)) {
329 createPolytomousKeyNodeSection(rootElement
);
330 } else if (input
instanceof User
) {
331 createUserSection(rootElement
);
332 } else if (input
instanceof Group
) {
333 createGroupSection(rootElement
);
334 } else if (input
instanceof TaxonRelationship
) {
335 createTaxonRelationshipSection(rootElement
);
336 } else if (input
instanceof TermVocabulary
) {
337 createTermVocabularySection(rootElement
);
338 } else if (input
instanceof DefinedTermBase
) {
339 createDefinedTermSection(rootElement
);
342 createEmptySection(rootElement
);
351 private void createEmptySection(RootElement parent
) {
354 EmptySection emptySection
= formFactory
.createEmptySection(formFactory
, parent
, SWT
.NONE
);
356 addPart(emptySection
);
362 private void createGroupSection(RootElement parent
) {
365 GroupDetailSection groupDetailSection
= formFactory
.createGroupDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
366 MemberDetailSection memberDetailSection
= formFactory
.createMemberDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
367 GrantedAuthorityDetailSection grantedAuthorityDetailSection
= formFactory
.createGrantedAuthorityDetailSection(getConversationHolder(), parent
,ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
369 addPart(groupDetailSection
);
370 addPart(memberDetailSection
);
371 addPart(grantedAuthorityDetailSection
);
377 * @see org.eclipse.jface.viewers.Viewer#getSelection()
381 public ISelection
getSelection() {
389 * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
390 * .ISelection, boolean)
394 public void setSelection(ISelection selection
, boolean reveal
) {
395 this.selection
= selection
;
396 if(this.selection
!=null){
397 SelectionChangedEvent selectionChangedEvent
= new SelectionChangedEvent(this, selection
);
398 fireSelectionChanged(selectionChangedEvent
);
403 * createTaxonSections(RootElement parent)
407 private void createTaxonSections(RootElement parent
) {
410 ParsingMessagesSection parsingMessagesSection
= formFactory
.createParsingMessagesSection(getConversationHolder(), parent
, this,
411 ExpandableComposite
.EXPANDED
| ExpandableComposite
.EXPANDED
);
413 TaxonBaseDetailSection taxonBaseDetailSection
= formFactory
.createTaxonBaseDetailSection(getConversationHolder(), parent
, this,
414 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
415 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
417 NonViralNameDetailSection nonViralNameSection
= formFactory
.createNonViralNameDetailSection(getConversationHolder(), parent
, this,
418 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
419 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
421 NomenclaturalReferenceDetailSection referenceDetailSection
= formFactory
.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent
, this,
422 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
423 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
425 NomenclaturalStatusSection nomenclaturalStatusSection
= formFactory
.createNomenclaturalStatusSection(getConversationHolder(), parent
,
426 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
427 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
430 if(!PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.IS_RL
)){
431 ProtologueSection protologSection
= formFactory
.createProtologueSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
432 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
434 TypeDesignationSection typeDesignationSection
= formFactory
.createTypeDesignationSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
435 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
437 NameRelationshipDetailSection nameRelationshipSection
= formFactory
.createNameRelationshipDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
438 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
440 addPart(protologSection
);
441 addPart(typeDesignationSection
);
442 addPart(nameRelationshipSection
);
446 addPart(parsingMessagesSection
);
447 addPart(taxonBaseDetailSection
);
448 addPart(nonViralNameSection
);
449 addPart(nomenclaturalStatusSection
);
450 addPart(referenceDetailSection
);
458 private void createNameSections(RootElement parent
) {
460 NonViralNameDetailSection nonViralNameSection
= formFactory
.createNonViralNameDetailSection(getConversationHolder(), parent
, this,
461 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
462 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
464 NomenclaturalReferenceDetailSection referenceDetailSection
= formFactory
.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent
, this,
465 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
466 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
468 NomenclaturalStatusSection nomenclaturalStatusSection
= formFactory
.createNomenclaturalStatusSection(getConversationHolder(), parent
,
469 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
470 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
472 addPart(nonViralNameSection
);
473 addPart(nomenclaturalStatusSection
);
474 addPart(referenceDetailSection
);
476 if(!PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.IS_RL
)){
477 ProtologueSection protologSection
= formFactory
.createProtologueSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
478 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
480 TypeDesignationSection typeDesignationSection
= formFactory
.createTypeDesignationSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
481 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
483 NameRelationshipDetailSection nameRelationshipSection
= formFactory
.createNameRelationshipDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
484 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
485 addPart(protologSection
);
486 addPart(typeDesignationSection
);
487 addPart(nameRelationshipSection
);
492 * createReferenceSections
496 private void createReferenceSections(RootElement parent
) {
499 ReferenceDetailSection referenceDetailSection
= formFactory
.createReferenceDetailSection(getConversationHolder(), parent
, this,
500 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
502 addPart(referenceDetailSection
);
506 * createTeamOrPersonBaseDetailSection
510 private void createTeamOrPersonBaseDetailSection(RootElement parent
) {
512 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection
= formFactory
.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
514 addPart(teamOrPersonBaseDetailSection
);
518 * createTeamDetailSection
522 private void createTeamDetailSection(RootElement parent
) {
524 TeamDetailSection teamDetailSection
= formFactory
.createTeamDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
526 addPart(teamDetailSection
);
530 * createPersonDetailSection
534 private void createPersonDetailSection(RootElement parent
) {
536 PersonDetailSection personDetailSection
= formFactory
.createPersonDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
537 addPart(personDetailSection
);
541 * createDescriptionElementSection
545 private void createDescriptionElementSection(RootElement parent
) {
548 DescriptionElementDetailSection descriptionElementDetailSection
= formFactory
.createDescriptionElementDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
550 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
552 DescriptionElementSourceSection descriptionElementSourceSection
= formFactory
.createDescriptionElementSourceSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
554 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
556 DescriptionElementMediaSection descriptionElementMediaSection
= formFactory
.createDescriptionElementMediaSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
558 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
560 addPart(descriptionElementDetailSection
);
561 addPart(descriptionElementSourceSection
);
562 addPart(descriptionElementMediaSection
);
566 * createDescriptionSection
570 private void createDescriptionSection(RootElement parent
) {
572 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
574 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
576 NaturalLanguageSection naturalLanguageSection
= formFactory
.createNaturalLanguageSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
578 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
580 DescribedSpecimenSection describedSpecimenSection
= formFactory
.createDescribedSpecimenSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
582 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
584 // DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
585 // .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
586 // getConversationHolder(), parent, Section.TWISTIE);
588 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
590 ScopeSection scopeSection
= formFactory
.createScopeSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
592 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
594 addPart(descriptionDetailSection
);
595 addPart(naturalLanguageSection
);
596 addPart(describedSpecimenSection
);
597 // addPart(descriptionSourceSection);
598 addPart(scopeSection
);
602 * createDescriptionSection
606 private void createSpecimenDescriptionSection(RootElement parent
) {
608 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
609 addPart(descriptionDetailSection
);
613 * Creates the use Description section
617 private void createUseDescriptionSection(RootElement parent
) {
619 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
621 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
623 DescriptionSourceSection descriptionSourceSection
= formFactory
.createDescriptionSourceSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
625 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
627 addPart(descriptionDetailSection
);
628 addPart(descriptionSourceSection
);
636 private void createImageGallerySection(RootElement parent
) {
638 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
640 addPart(descriptionDetailSection
);
644 * createMediaElementSection
649 private void createMediaElementSection(RootElement parent
) {
652 MediaDetailsSection mediaDetailSection
= formFactory
.createMediaDetailsSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
654 addPart(mediaDetailSection
);
658 * createDerivedUnitBaseElementSection
662 private void createDerivedUnitBaseElementSection(RootElement parent
) {
665 DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection
= formFactory
.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
666 //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
667 if(!(AbstractUtility
.getActivePart() instanceof IDerivedUnitFacadePart
)){
668 derivedUnitGeneralDetailSection
.setShowOnlyDerivedUnitData(true);
670 addPart(derivedUnitGeneralDetailSection
);
672 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
674 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection
= formFactory
.createDerivedUnitBaseDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
675 addPart(derivedUnitBaseDetailSection
);
677 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
679 OriginalLabelDataSection originalLabelDataSection
= formFactory
.createOriginalLabelDataSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
680 addPart(originalLabelDataSection
);
682 //for editors working with facades
683 if(AbstractUtility
.getActivePart() instanceof IDerivedUnitFacadePart
){
684 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
685 GatheringEventDetailSection gatheringEventDetailSection
= formFactory
.createGatheringEventDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
686 addPart(gatheringEventDetailSection
);
688 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
689 FieldUnitDetailSection fieldUnitDetailSection
= formFactory
.createFieldUnitDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
690 addPart(fieldUnitDetailSection
);
693 if(!PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.DETERMINATION_ONLY_FOR_FIELD_UNITS
)){
694 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
695 DeterminationDetailSection determinationDetailSection
= formFactory
.createDeterminationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
696 addPart(determinationDetailSection
);
698 if(PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_TAXON_ASSOCIATIONS
)){
699 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
700 TaxonAssociationDetailSection taxonAssociationDetailSection
= formFactory
.createTaxonAssociationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
701 addPart(taxonAssociationDetailSection
);
706 private void createFieldUnitSection(RootElement parent
) {
709 FieldUnitGeneralDetailSection fielUnitGeneralDetailSection
= formFactory
.createFieldUnitGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
711 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
713 GatheringEventDetailSection gatheringEventDetailSection
= formFactory
.createGatheringEventDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
715 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
717 FieldUnitDetailSection fieldUnitDetailSection
= formFactory
.createFieldUnitDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
719 addPart(fielUnitGeneralDetailSection
);
720 addPart(gatheringEventDetailSection
);
721 addPart(fieldUnitDetailSection
);
723 if(PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.DETERMINATION_ONLY_FOR_FIELD_UNITS
)){
724 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
725 DeterminationDetailSection determinationDetailSection
= formFactory
.createDeterminationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
726 addPart(determinationDetailSection
);
730 private void createTissueSampleSection(RootElement parent
) {
733 TissueSampleGeneralDetailSection section
= formFactory
.createTissueSampleGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
735 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
737 SampleDesignationDetailSection sampleDesignationDetailSection
= formFactory
.createSampleDesignationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
740 addPart(sampleDesignationDetailSection
);
743 private void createDnaSampleSection(RootElement parent
) {
746 DnaSampleGeneralDetailSection section
= formFactory
.createDnaSampleGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
748 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
750 DnaQualityDetailSection qualitySection
= formFactory
.createDnaQualityDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
752 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
754 SampleDesignationDetailSection sampleDesignationDetailSection
= formFactory
.createSampleDesignationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
757 addPart(qualitySection
);
758 addPart(sampleDesignationDetailSection
);
761 private void createSequenceSection(RootElement parent
) {
764 SequenceGeneralDetailSection section
= formFactory
.createSequenceGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
766 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
768 SequenceReferenceCollectionDetailSection referenceSection
= formFactory
.createSequenceReferenceCollectionDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
770 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
772 SequenceContigFileCollectionDetailSection contigFileSection
= formFactory
.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
776 addPart(referenceSection
);
777 addPart(contigFileSection
);
780 private void createSingleReadSection(RootElement parent
) {
783 SingleReadGeneralDetailSection section
= formFactory
.createSingleReadGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
786 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
788 SingleReadPherogramCollectionDetailSection pherogramSection
= formFactory
.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
789 addPart(pherogramSection
);
793 private void createMediaSpecimenSection(RootElement parent
) {
796 MediaSpecimenGeneralDetailSection generalSection
= formFactory
.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
797 addPart(generalSection
);
799 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
801 RightsSection rightsSection
= formFactory
.createRightsSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
802 addPart(rightsSection
);
811 private void createFeatureDistributionSection(RootElement parent
) {
814 FeatureDistributionDetailSection featureDistributionSection
= formFactory
.createFeatureDistributionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
816 addPart(featureDistributionSection
);
820 * createPolytomousKeyNodeSection
824 private void createPolytomousKeyNodeSection(RootElement parent
) {
827 PolytomousKeyDetailSection polytomousKeyDetailSection
= formFactory
.createPolytomousKeyDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.COMPACT
);
829 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
831 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection
= formFactory
.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
833 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
835 TaxonomicScopeSection taxonomicScopeSection
= formFactory
.createTaxonomicScopeSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.COMPACT
);
837 addPart(polytomousKeyDetailSection
);
838 addPart(polytomousKeyNodeDetailSection
);
839 addPart(taxonomicScopeSection
);
844 * create the UseRecordSection
848 private void createUseRecordSection(RootElement parent
) {
851 UseRecordDetailSection descriptionUseRecordSection
= formFactory
.createUseRecordDetailSection(getConversationHolder(), parent
, this,ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
853 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
855 addPart(descriptionUseRecordSection
);
865 private void createUserSection(RootElement parent
) {
868 UserDetailSection userDetailSection
= formFactory
.createUserDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
870 GroupsByUserDetailSection groupByUserDetailSection
= formFactory
.createGroupsByUserDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
872 addPart(userDetailSection
);
873 addPart(groupByUserDetailSection
);
877 * createTaxonRelationshipSection
881 private void createTaxonRelationshipSection(RootElement parent
) {
884 TaxonRelationshipDetailSection taxonRelationshipDetailSection
= formFactory
.createTaxonRelationshipDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
886 ReferencedEntityDetailSection referencedEntityBaseDetailSection
= formFactory
.createReferencedEntityDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
887 addPart(taxonRelationshipDetailSection
);
888 addPart(referencedEntityBaseDetailSection
);
894 private void createTermVocabularySection(RootElement parent
) {
897 TermVocabularyDetailSection termVocabularyDetailSection
= formFactory
.createTermVocabularyDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
898 addPart(termVocabularyDetailSection
);
902 * createDefinedTermSection
906 private void createDefinedTermSection(RootElement parent
) {
909 AbstractFormSection definedTermDetailSection
= formFactory
.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
910 addPart(definedTermDetailSection
);