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
.events
.ExpansionEvent
;
22 import org
.eclipse
.ui
.forms
.events
.IExpansionListener
;
23 import org
.eclipse
.ui
.forms
.widgets
.ExpandableComposite
;
24 import org
.eclipse
.ui
.forms
.widgets
.Section
;
26 import eu
.etaxonomy
.cdm
.api
.facade
.DerivedUnitFacade
;
27 import eu
.etaxonomy
.cdm
.api
.facade
.DerivedUnitFacadeNotSupportedException
;
28 import eu
.etaxonomy
.cdm
.ext
.occurrence
.gbif
.GbifResponse
;
29 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
30 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
31 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
32 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
33 import eu
.etaxonomy
.cdm
.model
.common
.Group
;
34 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
35 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
36 import eu
.etaxonomy
.cdm
.model
.common
.User
;
37 import eu
.etaxonomy
.cdm
.model
.description
.CategoricalData
;
38 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionBase
;
39 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
40 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKeyNode
;
41 import eu
.etaxonomy
.cdm
.model
.description
.SpecimenDescription
;
42 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
43 import eu
.etaxonomy
.cdm
.model
.molecular
.DnaSample
;
44 import eu
.etaxonomy
.cdm
.model
.molecular
.Sequence
;
45 import eu
.etaxonomy
.cdm
.model
.molecular
.SingleRead
;
46 import eu
.etaxonomy
.cdm
.model
.name
.NonViralName
;
47 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
48 import eu
.etaxonomy
.cdm
.model
.occurrence
.FieldUnit
;
49 import eu
.etaxonomy
.cdm
.model
.occurrence
.MediaSpecimen
;
50 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationType
;
51 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
52 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
53 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
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
.UsageTermCollection
;
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
.DescriptionDetailSection
;
69 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailSection
;
70 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementMediaSection
;
71 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceSection
;
72 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceSection
;
73 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection
;
74 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageSection
;
75 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeSection
;
76 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailSection
;
77 import eu
.etaxonomy
.taxeditor
.ui
.section
.grantedAuthority
.GrantedAuthorityDetailSection
;
78 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailSection
;
79 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailSection
;
80 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailSection
;
81 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailSection
;
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
.DerivedUnitTypeDesignationSection
;
95 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.association
.TaxonAssociationDetailSection
;
96 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.DnaQualityDetailSection
;
97 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.DnaSampleGeneralDetailSection
;
98 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.DnaSamplePreparationPreservationSection
;
99 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SampleDesignationDetailSection
;
100 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SequenceContigFileCollectionDetailSection
;
101 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SequenceGeneralDetailSection
;
102 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SequenceReferenceCollectionDetailSection
;
103 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SingleReadGeneralDetailSection
;
104 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SingleReadPherogramCollectionDetailSection
;
105 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.TissueSampleGeneralDetailSection
;
106 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.media
.MediaSpecimenGeneralDetailSection
;
107 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailSection
;
108 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailSection
;
109 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
110 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.identifier
.DerivedUnitFacadeIdentifierSection
;
111 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
112 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
113 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailSection
;
114 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailSection
;
115 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailSection
;
116 import eu
.etaxonomy
.taxeditor
.ui
.section
.userecords
.UseRecordDetailSection
;
117 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailSection
;
118 import eu
.etaxonomy
.taxeditor
.view
.AbstractCdmDataViewer
;
119 import eu
.etaxonomy
.taxeditor
.view
.AbstractCdmViewPart
;
123 * The DetailsViewer handles the content of the details view (
124 * {@link DetailsViewPart}).<br>
125 * Depending on the type of the selected element the section of the details view
129 * @created Feb 12, 2010
132 public class DetailsViewer
extends AbstractCdmDataViewer
{
134 private ISelection selection
;
136 public DetailsViewer(Composite parent
, AbstractCdmViewPart viewPart
) {
137 super(parent
, viewPart
);
140 // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
141 // since we are getting implementations of DerivedUnitBase from the bulk
143 // and not derived unit facade objects,
146 public void setInput(Object input
) {
147 if(input
instanceof TreeNode
){
148 input
= ((TreeNode
) input
).getValue();
150 if(input
instanceof GbifResponse
){
151 input
= ((GbifResponse
) input
).getDerivedUnitFacade();
153 if (input
.getClass().equals(DerivedUnit
.class)) {
154 DerivedUnit derivedUnit
= (DerivedUnit
)input
;
156 input
= DerivedUnitFacade
.NewInstance(derivedUnit
,
157 PreferencesUtil
.getDerivedUnitConfigurator());
158 } catch (DerivedUnitFacadeNotSupportedException e
) {
159 // 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
162 else if(input
instanceof FieldUnit
){
163 input
= DerivedUnitFacade
.NewInstance(SpecimenOrObservationType
.FieldUnit
, (FieldUnit
) input
);
165 super.setInput(input
);
169 protected void markViewPartDirty() {
170 if (getInput() instanceof DerivedUnitFacade
) {
171 DerivedUnitFacade facade
= (DerivedUnitFacade
) getInput();
172 if(facade
.innerDerivedUnit()!=null){
173 getViewPart().changed(facade
.innerDerivedUnit());
175 else if(facade
.innerFieldUnit()!=null){
176 getViewPart().changed(facade
.innerFieldUnit());
180 super.markViewPartDirty();
184 // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
189 protected void showParts() {
190 // FIXME (CM) : Need to clean out this code.
191 // Too much type checking to decide which detail view to display.
192 // Need to build in a mechanism where navigators / editors are 'aware'
193 // of the corresponding detail viewer.
194 Object input
= getInput();
197 if (input
instanceof TaxonBase
) {
198 if(((TaxonBase
) input
).getName()==null){
199 createEmptySection(rootElement
);
202 createTaxonSections(rootElement
);
205 } else if (input
instanceof NonViralName
) {
206 createNameSections(rootElement
);
208 } else if (input
instanceof Reference
) {
209 createReferenceSections(rootElement
);
211 } else if (input
instanceof Team
) {
212 createTeamDetailSection(rootElement
);
214 } else if (input
instanceof Person
) {
215 createPersonDetailSection(rootElement
);
217 } else if (input
instanceof TeamOrPersonBase
) {
218 createTeamOrPersonBaseDetailSection(rootElement
);
220 } else if (input
instanceof DescriptionBase
) {
221 if(input
instanceof SpecimenDescription
){
222 //TODO: add more sections to DetailsView for SpecimenDescription
223 createSpecimenDescriptionSection(rootElement
);
226 Set
<Marker
> descriptionMarkers
= ((DescriptionBase
<?
>) input
).getMarkers();
228 Boolean isUseDescription
= false;
229 for (Marker marker
: descriptionMarkers
) {
230 if (marker
.getMarkerType()!= null && marker
.getMarkerType().getUuid().equals(UsageTermCollection
.uuidUseMarkerType
)) {
231 isUseDescription
= true;
234 if (((DescriptionBase
<?
>) input
).isImageGallery()) {
235 createImageGallerySection(rootElement
);
237 } else if (isUseDescription
) {
238 createUseDescriptionSection(rootElement
);
240 createDescriptionSection(rootElement
);
244 } else if (input
instanceof DescriptionElementBase
) {
245 Set
<Marker
> descriptionMarkers
= ((DescriptionElementBase
) input
).getInDescription().getMarkers();
247 Boolean isUseDescription
= false;
248 for (Marker marker
: descriptionMarkers
) {
249 if (marker
.getMarkerType()!= null && marker
.getMarkerType().getUuid().equals(UsageTermCollection
.uuidUseMarkerType
)) {
250 isUseDescription
= true;
254 if (isUseDescription
== true && input
instanceof CategoricalData
) {
255 createUseRecordSection(rootElement
);
257 createDescriptionElementSection(rootElement
);
260 } else if (input
instanceof Media
) {
261 createMediaElementSection(rootElement
);
263 } else if (input
instanceof DerivedUnitFacade
) {
264 if(((DerivedUnitFacade
) input
).getType()==SpecimenOrObservationType
.FieldUnit
){
265 if(((DerivedUnitFacade
) input
).innerFieldUnit()==null){
266 MessagingUtils
.error(DetailsViewer
.class, "FieldUnit of facade is null", null);
269 createFieldUnitSection(rootElement
);
272 else if(((DerivedUnitFacade
) input
).getType()==SpecimenOrObservationType
.PreservedSpecimen
){
273 if(((DerivedUnitFacade
) input
).innerDerivedUnit()==null){
274 MessagingUtils
.error(DetailsViewer
.class, "DerivedUnit of facade is null", null);
277 createDerivedUnitBaseElementSection(rootElement
);
280 else if(((DerivedUnitFacade
) input
).getType()==SpecimenOrObservationType
.TissueSample
){
281 //TissueSample should only be created by using it's own class
282 //in future using only one class with different SpecimenOrObservationTypes is desired
283 // createTissueSampleSection(rootElement);
286 createDerivedUnitBaseElementSection(rootElement
);
288 } else if (input
instanceof DnaSample
){
289 DnaSample dnaSample
= (DnaSample
)input
;
290 if(dnaSample
.getRecordBasis()==SpecimenOrObservationType
.TissueSample
){
291 createTissueSampleSection(rootElement
);
293 else if(dnaSample
.getRecordBasis()==SpecimenOrObservationType
.DnaSample
){
294 createDnaSampleSection(rootElement
);
296 } else if (input
instanceof MediaSpecimen
){
297 createMediaSpecimenSection(rootElement
);
299 else if(input
instanceof Sequence
){
300 createSequenceSection(rootElement
);
302 else if(input
instanceof SingleRead
){
303 createSingleReadSection(rootElement
);
305 else if (input
instanceof FeatureNodeContainer
) {
306 createFeatureDistributionSection(rootElement
);
308 }else if ((input
instanceof PolytomousKeyNode
) || (input
instanceof PolytomousKeyRelationship
)) {
309 createPolytomousKeyNodeSection(rootElement
);
310 } else if (input
instanceof User
) {
311 createUserSection(rootElement
);
312 } else if (input
instanceof Group
) {
313 createGroupSection(rootElement
);
314 } else if (input
instanceof TaxonRelationship
) {
315 createTaxonRelationshipSection(rootElement
);
316 } else if (input
instanceof TermVocabulary
) {
317 createTermVocabularySection(rootElement
);
318 } else if (input
instanceof DefinedTermBase
) {
319 createDefinedTermSection(rootElement
);
322 createEmptySection(rootElement
);
328 private void createEmptySection(RootElement parent
) {
331 EmptySection emptySection
= formFactory
.createEmptySection(formFactory
, parent
, SWT
.NONE
);
333 addPart(emptySection
);
336 private void createGroupSection(RootElement parent
) {
339 GroupDetailSection groupDetailSection
= formFactory
.createGroupDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
340 MemberDetailSection memberDetailSection
= formFactory
.createMemberDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
341 GrantedAuthorityDetailSection grantedAuthorityDetailSection
= formFactory
.createGrantedAuthorityDetailSection(getConversationHolder(), parent
,ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
343 addPart(groupDetailSection
, true);
344 addPart(memberDetailSection
, true);
345 addPart(grantedAuthorityDetailSection
, true);
350 public ISelection
getSelection() {
356 public void setSelection(ISelection selection
, boolean reveal
) {
357 this.selection
= selection
;
358 if(this.selection
!=null){
359 SelectionChangedEvent selectionChangedEvent
= new SelectionChangedEvent(this, selection
);
360 fireSelectionChanged(selectionChangedEvent
);
364 private void createTaxonSections(RootElement parent
) {
367 ParsingMessagesSection parsingMessagesSection
= formFactory
.createParsingMessagesSection(getConversationHolder(), parent
, this,
368 ExpandableComposite
.EXPANDED
| ExpandableComposite
.EXPANDED
);
369 if (!PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_SIMPLE_NAME_DETAILS_SECTION
)){
370 TaxonBaseDetailSection taxonBaseDetailSection
= formFactory
.createTaxonBaseDetailSection(getConversationHolder(), parent
, this,
371 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
372 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
374 addPart(taxonBaseDetailSection
, true);
376 NonViralNameDetailSection nonViralNameSection
= formFactory
377 .createNonViralNameDetailSection(getConversationHolder(), parent
, this, true,
378 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
379 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
380 if (!PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_SIMPLE_NAME_DETAILS_SECTION
)){
381 NomenclaturalReferenceDetailSection referenceDetailSection
= formFactory
.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent
, this,
382 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
383 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
385 NomenclaturalStatusSection nomenclaturalStatusSection
= formFactory
.createNomenclaturalStatusSection(getConversationHolder(), parent
,
386 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
387 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
389 addPart(nomenclaturalStatusSection
, true);
390 addPart(referenceDetailSection
, true);
393 if(!PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.IS_RL
) && !PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_SIMPLE_NAME_DETAILS_SECTION
)){
394 ProtologueSection protologSection
= formFactory
.createProtologueSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
395 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
397 TypeDesignationSection typeDesignationSection
= formFactory
.createTypeDesignationSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
398 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
400 NameRelationshipDetailSection nameRelationshipSection
= formFactory
.createNameRelationshipDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
401 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
403 addPart(protologSection
, false);
404 addPart(typeDesignationSection
, false);
405 addPart(nameRelationshipSection
, false);
408 addPart(parsingMessagesSection
, true);
410 addPart(nonViralNameSection
, true);
414 private void createNameSections(RootElement parent
) {
416 NonViralNameDetailSection nonViralNameSection
= formFactory
.createNonViralNameDetailSection(
417 getConversationHolder(), parent
, this, false, ExpandableComposite
.TWISTIE
418 | 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
);
429 addPart(nonViralNameSection
, true);
430 addPart(nomenclaturalStatusSection
, true);
431 addPart(referenceDetailSection
, true);
433 if(!PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.IS_RL
)){
434 ProtologueSection protologSection
= formFactory
.createProtologueSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
435 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
437 TypeDesignationSection typeDesignationSection
= formFactory
.createTypeDesignationSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
438 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
440 NameRelationshipDetailSection nameRelationshipSection
= formFactory
.createNameRelationshipDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
441 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
442 addPart(protologSection
, false);
443 addPart(typeDesignationSection
, false);
444 addPart(nameRelationshipSection
, false);
448 private void createReferenceSections(RootElement parent
) {
451 ReferenceDetailSection referenceDetailSection
= formFactory
.createReferenceDetailSection(getConversationHolder(), parent
, this,
452 ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
454 addPart(referenceDetailSection
, true);
457 private void createTeamOrPersonBaseDetailSection(RootElement parent
) {
459 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection
= formFactory
.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
461 addPart(teamOrPersonBaseDetailSection
, true);
464 private void createTeamDetailSection(RootElement parent
) {
466 TeamDetailSection teamDetailSection
= formFactory
.createTeamDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
468 addPart(teamDetailSection
, true);
471 private void createPersonDetailSection(RootElement parent
) {
473 PersonDetailSection personDetailSection
= formFactory
.createPersonDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
474 addPart(personDetailSection
, true);
477 private void createDescriptionElementSection(RootElement parent
) {
480 DescriptionElementDetailSection descriptionElementDetailSection
= formFactory
.createDescriptionElementDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
482 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
484 DescriptionElementSourceSection descriptionElementSourceSection
= formFactory
.createDescriptionElementSourceSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
486 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
488 DescriptionElementMediaSection descriptionElementMediaSection
= formFactory
.createDescriptionElementMediaSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
490 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
492 addPart(descriptionElementDetailSection
, true);
493 addPart(descriptionElementSourceSection
, false);
494 addPart(descriptionElementMediaSection
, false);
497 private void createDescriptionSection(RootElement parent
) {
499 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
501 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
503 NaturalLanguageSection naturalLanguageSection
= formFactory
.createNaturalLanguageSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
505 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
507 // DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
509 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
511 // DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
512 // .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
513 // getConversationHolder(), parent, Section.TWISTIE);
515 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
517 ScopeSection scopeSection
= formFactory
.createScopeSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
519 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
521 addPart(descriptionDetailSection
, true);
522 addPart(naturalLanguageSection
, true);
523 // addPart(describedSpecimenSection);
524 // addPart(descriptionSourceSection);
525 addPart(scopeSection
, false);
528 private void createSpecimenDescriptionSection(RootElement parent
) {
530 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
531 addPart(descriptionDetailSection
, true);
534 private void createUseDescriptionSection(RootElement parent
) {
536 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
538 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
540 DescriptionSourceSection descriptionSourceSection
= formFactory
.createDescriptionSourceSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
542 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
544 addPart(descriptionDetailSection
, true);
545 addPart(descriptionSourceSection
, true);
549 private void createImageGallerySection(RootElement parent
) {
551 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
553 addPart(descriptionDetailSection
, true);
556 private void createMediaElementSection(RootElement parent
) {
559 MediaDetailsSection mediaDetailSection
= formFactory
.createMediaDetailsSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
561 addPart(mediaDetailSection
, true);
564 private void createDerivedUnitBaseElementSection(RootElement parent
) {
567 DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection
= formFactory
.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
568 //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
569 if(!(AbstractUtility
.getActivePart() instanceof IDerivedUnitFacadePart
)){
570 derivedUnitGeneralDetailSection
.setShowOnlyDerivedUnitData(true);
572 addPart(derivedUnitGeneralDetailSection
, true);
574 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
576 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection
= formFactory
.createDerivedUnitBaseDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
577 addPart(derivedUnitBaseDetailSection
, true);
579 //for editors working with facades
580 if(AbstractUtility
.getActivePart() instanceof IDerivedUnitFacadePart
){
581 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
582 GatheringEventDetailSection gatheringEventDetailSection
= formFactory
.createGatheringEventDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
583 addPart(gatheringEventDetailSection
, false);
585 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
586 FieldUnitDetailSection fieldUnitDetailSection
= formFactory
.createFieldUnitDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
587 addPart(fieldUnitDetailSection
, false);
591 if(PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_TAXON_ASSOCIATIONS
)){
592 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
593 TaxonAssociationDetailSection taxonAssociationDetailSection
= formFactory
.createTaxonAssociationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
594 addPart(taxonAssociationDetailSection
, true);
596 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
597 DerivedUnitFacadeIdentifierSection identifierDetailSection
= formFactory
.createDerivedUnitFacadeIdentifierSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
598 addPart(identifierDetailSection
, false);
600 if(!PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.DETERMINATION_ONLY_FOR_FIELD_UNITS
)){
601 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
602 DeterminationDetailSection determinationDetailSection
= formFactory
.createDeterminationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
603 addPart(determinationDetailSection
, false);
606 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
607 DerivedUnitTypeDesignationSection derivedUnitTypeDesignationSection
= formFactory
.createDerivedUnitTypeDesignationSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
608 addPart(derivedUnitTypeDesignationSection
, false);
612 private void createFieldUnitSection(RootElement parent
) {
615 FieldUnitGeneralDetailSection fielUnitGeneralDetailSection
= formFactory
.createFieldUnitGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
617 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
619 GatheringEventDetailSection gatheringEventDetailSection
= formFactory
.createGatheringEventDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
621 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
623 FieldUnitDetailSection fieldUnitDetailSection
= formFactory
.createFieldUnitDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
625 addPart(fielUnitGeneralDetailSection
, true);
626 addPart(gatheringEventDetailSection
, false);
627 addPart(fieldUnitDetailSection
, false);
629 if(PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.DETERMINATION_ONLY_FOR_FIELD_UNITS
)){
630 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
631 DeterminationDetailSection determinationDetailSection
= formFactory
.createDeterminationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
632 addPart(determinationDetailSection
, false);
636 private void createTissueSampleSection(RootElement parent
) {
639 TissueSampleGeneralDetailSection section
= formFactory
.createTissueSampleGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
641 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
643 SampleDesignationDetailSection sampleDesignationDetailSection
= formFactory
.createSampleDesignationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
645 addPart(section
, true);
646 addPart(sampleDesignationDetailSection
, true);
649 private void createDnaSampleSection(RootElement parent
) {
652 DnaSampleGeneralDetailSection section
= formFactory
.createDnaSampleGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
654 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
656 DnaSamplePreparationPreservationSection preparationPreservationSection
= formFactory
.createDnaSamplePreparationPreservationSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
658 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
660 DnaQualityDetailSection qualitySection
= formFactory
.createDnaQualityDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
662 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
664 SampleDesignationDetailSection sampleDesignationDetailSection
= formFactory
.createSampleDesignationDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
666 addPart(section
, true);
667 addPart(preparationPreservationSection
, true);
668 addPart(qualitySection
, true);
669 addPart(sampleDesignationDetailSection
, true);
672 private void createSequenceSection(RootElement parent
) {
675 SequenceGeneralDetailSection section
= formFactory
.createSequenceGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
677 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
679 SequenceReferenceCollectionDetailSection referenceSection
= formFactory
.createSequenceReferenceCollectionDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
681 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
683 SequenceContigFileCollectionDetailSection contigFileSection
= formFactory
.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
686 addPart(section
, true);
687 addPart(referenceSection
, true);
688 addPart(contigFileSection
, true);
691 private void createSingleReadSection(RootElement parent
) {
694 SingleReadGeneralDetailSection section
= formFactory
.createSingleReadGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
695 addPart(section
, true);
697 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
699 SingleReadPherogramCollectionDetailSection pherogramSection
= formFactory
.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
700 addPart(pherogramSection
, true);
704 private void createMediaSpecimenSection(RootElement parent
) {
707 MediaSpecimenGeneralDetailSection generalSection
= formFactory
.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
708 addPart(generalSection
, true);
710 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
712 RightsSection rightsSection
= formFactory
.createRightsSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
713 addPart(rightsSection
, false);
717 private void createFeatureDistributionSection(RootElement parent
) {
720 FeatureDistributionDetailSection featureDistributionSection
= formFactory
.createFeatureDistributionDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
722 addPart(featureDistributionSection
, true);
725 private void createPolytomousKeyNodeSection(RootElement parent
) {
728 PolytomousKeyDetailSection polytomousKeyDetailSection
= formFactory
.createPolytomousKeyDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
);
730 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
732 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection
= formFactory
.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
734 addPart(polytomousKeyDetailSection
, true);
735 addPart(polytomousKeyNodeDetailSection
, true);
739 private void createUseRecordSection(RootElement parent
) {
742 UseRecordDetailSection descriptionUseRecordSection
= formFactory
.createUseRecordDetailSection(getConversationHolder(), parent
, this,ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
744 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
746 addPart(descriptionUseRecordSection
, true);
751 private void createUserSection(RootElement parent
) {
754 UserDetailSection userDetailSection
= formFactory
.createUserDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
756 GroupsByUserDetailSection groupByUserDetailSection
= formFactory
.createGroupsByUserDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
758 addPart(userDetailSection
, true);
759 addPart(groupByUserDetailSection
, true);
762 private void createTaxonRelationshipSection(RootElement parent
) {
765 TaxonRelationshipDetailSection taxonRelationshipDetailSection
= formFactory
.createTaxonRelationshipDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
767 ReferencedEntityDetailSection referencedEntityBaseDetailSection
= formFactory
.createReferencedEntityDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
768 addPart(taxonRelationshipDetailSection
, true);
769 addPart(referencedEntityBaseDetailSection
, true);
772 private void createTermVocabularySection(RootElement parent
) {
775 TermVocabularyDetailSection termVocabularyDetailSection
= formFactory
.createTermVocabularyDetailSection(getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
776 addPart(termVocabularyDetailSection
, true);
779 private void createDefinedTermSection(RootElement parent
) {
782 AbstractFormSection
<?
> definedTermDetailSection
= formFactory
.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent
, this, ExpandableComposite
.TWISTIE
| ExpandableComposite
.EXPANDED
);
783 addPart(definedTermDetailSection
, true);
786 protected void addPart(AbstractFormSection section
, boolean isDefaultExpanded
){
787 super.addPart(section
);
788 PreferencesUtil
.getPreferenceStore().setDefault(section
.getClass().getCanonicalName()+";"+getInput().getClass().getCanonicalName(), isDefaultExpanded
);
789 section
.setExpanded(PreferencesUtil
.getPreferenceStore().getBoolean(section
.getClass().getCanonicalName()+";"+getInput().getClass().getCanonicalName()));
790 section
.addExpansionListener(new ExpandListener(section
));
793 private class ExpandListener
implements IExpansionListener
{
795 private Section section
;
797 public ExpandListener(Section section
) {
799 this.section
= section
;
803 public void expansionStateChanging(ExpansionEvent e
) {
807 public void expansionStateChanged(ExpansionEvent e
) {
808 PreferencesUtil
.getPreferenceStore().setValue(section
.getClass().getCanonicalName()+";"+getInput().getClass().getCanonicalName(), e
.getState());