1 package eu
.etaxonomy
.taxeditor
.view
.userecords
;
3 import org
.eclipse
.jface
.viewers
.ISelection
;
4 import org
.eclipse
.jface
.viewers
.SelectionChangedEvent
;
5 import org
.eclipse
.swt
.SWT
;
6 import org
.eclipse
.swt
.widgets
.Composite
;
7 import org
.eclipse
.ui
.forms
.widgets
.Section
;
9 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
10 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionBase
;
11 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
12 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
13 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
14 import eu
.etaxonomy
.taxeditor
.ui
.element
.RootElement
;
15 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
.DetailType
;
16 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
.EntityDetailType
;
17 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescribedSpecimenSection
;
18 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailSection
;
19 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailSection
;
20 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementMediaSection
;
21 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceSection
;
22 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceSection
;
23 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageSection
;
24 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeSection
;
25 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailSection
;
26 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusSection
;
27 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailSection
;
28 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueSection
;
29 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.TypeDesignationSection
;
30 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailSection
;
31 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailSection
;
32 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
33 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
34 import eu
.etaxonomy
.taxeditor
.ui
.section
.userecords
.UseRecordDetailSection
;
35 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailSection
;
36 import eu
.etaxonomy
.taxeditor
.view
.AbstractCdmDataViewer
;
37 import eu
.etaxonomy
.taxeditor
.view
.AbstractCdmViewPart
;
43 public class UseRecordsViewer
extends AbstractCdmDataViewer
{
45 private ISelection selection
;
47 public UseRecordsViewer(Composite parent
, AbstractCdmViewPart viewPart
) {
48 super(parent
, viewPart
);
51 protected void showParts() {
52 if (getInput() instanceof TaxonBase
) {
53 createTaxonSections(rootElement
);
55 } else if (getInput() instanceof DescriptionBase
) {
56 if (((DescriptionBase
) getInput()).isImageGallery()) {
57 createImageGallerySection(rootElement
);
60 createUseSection(rootElement
);
63 } else if (getInput() instanceof DescriptionElementBase
) {
64 createUseRecordSection(rootElement
);
66 } else if (getInput() instanceof TermVocabulary
) {
67 createTermVocabularySection(rootElement
);
71 /*if (getInput() instanceof TaxonBase) {
72 if (currentViewPart != VIEW_PART.TAXON) {
73 createTaxonSections(rootElement);
74 currentViewPart = VIEW_PART.TAXON;
76 } else if (getInput() instanceof Reference) {
77 if (currentViewPart != VIEW_PART.REFEERENCE) {
78 createReferenceSections(rootElement);
79 currentViewPart = VIEW_PART.REFEERENCE;
81 } else if (getInput() instanceof DescriptionBase) {
82 if (((DescriptionBase) getInput()).isImageGallery()) {
83 if (currentViewPart != VIEW_PART.IMAGE_GALLERY) {
84 createImageGallerySection(rootElement);
85 currentViewPart = VIEW_PART.IMAGE_GALLERY;
88 if (currentViewPart != VIEW_PART.DESCRIPTION) {
89 createDescriptionSection(rootElement);
90 currentViewPart = VIEW_PART.DESCRIPTION;
93 } else if (getInput() instanceof DescriptionElementBase) {
94 if (currentViewPart != VIEW_PART.DESCRIPTION_ELEMENT) {
95 createDescriptionElementSection(rootElement);
96 currentViewPart = VIEW_PART.DESCRIPTION_ELEMENT;
100 currentViewPart = VIEW_PART.EMPTY;
105 private void createTaxonSections(RootElement parent
) {
108 TaxonBaseDetailSection taxonBaseDetailSection
= (TaxonBaseDetailSection
) formFactory
109 .createCdmDetailSection(DetailType
.TAXONBASE
,
110 getConversationHolder(), parent
, this, Section
.TWISTIE
);
112 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
114 NonViralNameDetailSection nonViralNameSection
= (NonViralNameDetailSection
) formFactory
115 .createCdmDetailSection(DetailType
.NONVIRALNAME
,
116 getConversationHolder(), parent
, this, Section
.TWISTIE
119 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
121 NomenclaturalReferenceDetailSection referenceDetailSection
= (NomenclaturalReferenceDetailSection
) formFactory
122 .createCdmDetailSection(DetailType
.NOMENCLATURALREFERENCE
,
123 getConversationHolder(), parent
, this, Section
.TWISTIE
);
125 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
127 NomenclaturalStatusSection nomenclaturalStatusSection
= (NomenclaturalStatusSection
) formFactory
128 .createEntityDetailSection(
129 EntityDetailType
.NOMENCLATURALSTATUS
,
130 getConversationHolder(), parent
, Section
.TWISTIE
);
132 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
134 ProtologueSection protologSection
= (ProtologueSection
) formFactory
135 .createEntityDetailSection(EntityDetailType
.PROTOLOG
,
136 getConversationHolder(), parent
, Section
.TWISTIE
);
138 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
140 TypeDesignationSection typeDesignationSection
= (TypeDesignationSection
) formFactory
141 .createEntityDetailSection(EntityDetailType
.TYPEDESIGNATION
,
142 getConversationHolder(), parent
, Section
.TWISTIE
);
144 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
146 NameRelationshipDetailSection nameRelationshipSection
= (NameRelationshipDetailSection
) formFactory
147 .createEntityDetailSection(EntityDetailType
.NAME_RELATIONSHIP
,
148 getConversationHolder(), parent
, Section
.TWISTIE
);
150 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
152 ParsingMessagesSection parsingMessagesSection
= (ParsingMessagesSection
) formFactory
153 .createCdmDetailSection(DetailType
.PARSINGMESSAGE
,
154 getConversationHolder(), parent
, this, Section
.EXPANDED
);
156 addPart(taxonBaseDetailSection
);
157 addPart(nonViralNameSection
);
158 addPart(nomenclaturalStatusSection
);
159 addPart(protologSection
);
160 addPart(referenceDetailSection
);
161 addPart(typeDesignationSection
);
162 addPart(nameRelationshipSection
);
163 addPart(parsingMessagesSection
);
166 private void createTermVocabularySection(RootElement parent
) {
169 TermVocabularyDetailSection termVocabularyDetailSection
= (TermVocabularyDetailSection
) formFactory
170 .createCdmDetailSection(DetailType
.TERM_VOCABULARY
,
171 getConversationHolder(), parent
, this, Section
.TWISTIE
173 addPart(termVocabularyDetailSection
);
176 private void createUseRecordSection(RootElement parent
) {
179 UseRecordDetailSection descriptionUseRecordSection
= (UseRecordDetailSection
) formFactory
180 .createCdmDetailSection(DetailType
.USE_RECORD
,
181 getConversationHolder(), parent
, this, Section
.TWISTIE
184 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
186 addPart(descriptionUseRecordSection
);
191 private void createUseSection(RootElement parent
) {
193 DescriptionDetailSection descriptionDetailSection
= (DescriptionDetailSection
) formFactory
194 .createCdmDetailSection(DetailType
.DESCRIPTION
,
195 getConversationHolder(), parent
, this, Section
.TWISTIE
198 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
200 /*NaturalLanguageSection naturalLanguageSection = (NaturalLanguageSection) formFactory
201 .createCdmDetailSection(DetailType.NATURAL_LANGUAGE,
202 getConversationHolder(), parent, this, Section.TWISTIE
205 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
207 DescribedSpecimenSection describedSpecimenSection = (DescribedSpecimenSection) formFactory
208 .createEntityDetailSection(EntityDetailType.DESCRIBED_SPECIMEN,
209 getConversationHolder(), parent, Section.TWISTIE);
211 formFactory.createHorizontalSeparator(parent, SWT.BORDER);*/
213 DescriptionSourceSection descriptionSourceSection
= (DescriptionSourceSection
) formFactory
214 .createEntityDetailSection(EntityDetailType
.DESCRIPTIONSOURCE
,
215 getConversationHolder(), parent
, Section
.TWISTIE
);
217 /*formFactory.createHorizontalSeparator(parent, SWT.BORDER);
219 ScopeSection scopeSection = (ScopeSection) formFactory
220 .createEntityDetailSection(EntityDetailType.SCOPE,
221 getConversationHolder(), parent, Section.TWISTIE);
223 formFactory.createHorizontalSeparator(parent, SWT.BORDER);*/
225 addPart(descriptionDetailSection
);
226 addPart(descriptionSourceSection
);
232 private void createImageGallerySection(RootElement parent
) {
234 DescriptionDetailSection descriptionDetailSection
= (DescriptionDetailSection
) formFactory
235 .createCdmDetailSection(DetailType
.DESCRIPTION
,
236 getConversationHolder(), parent
, this, Section
.TWISTIE
239 addPart(descriptionDetailSection
);
242 private void createReferenceSections(RootElement parent
) {
245 ReferenceDetailSection referenceDetailSection
= (ReferenceDetailSection
) formFactory
246 .createCdmDetailSection(DetailType
.REFERENCEBASE
,
247 getConversationHolder(), parent
, this, Section
.TWISTIE
250 addPart(referenceDetailSection
);
254 public ISelection
getSelection() {
258 public void setSelection(ISelection selection
, boolean reveal
) {
259 this.selection
= selection
;
260 SelectionChangedEvent selectionChangedEvent
= new SelectionChangedEvent(
262 fireSelectionChanged(selectionChangedEvent
);