4 package eu
.etaxonomy
.taxeditor
.ui
.forms
;
7 import java
.util
.ArrayList
;
8 import java
.util
.HashSet
;
13 import org
.eclipse
.jface
.util
.IPropertyChangeListener
;
14 import org
.eclipse
.jface
.viewers
.ISelection
;
15 import org
.eclipse
.jface
.viewers
.ISelectionProvider
;
16 import org
.eclipse
.jface
.window
.Window
;
17 import org
.eclipse
.swt
.SWT
;
18 import org
.eclipse
.swt
.custom
.StyledText
;
19 import org
.eclipse
.swt
.events
.FocusAdapter
;
20 import org
.eclipse
.swt
.events
.FocusEvent
;
21 import org
.eclipse
.swt
.events
.FocusListener
;
22 import org
.eclipse
.swt
.events
.MouseAdapter
;
23 import org
.eclipse
.swt
.events
.MouseEvent
;
24 import org
.eclipse
.swt
.events
.MouseListener
;
25 import org
.eclipse
.swt
.events
.SelectionEvent
;
26 import org
.eclipse
.swt
.events
.SelectionListener
;
27 import org
.eclipse
.swt
.events
.TypedEvent
;
28 import org
.eclipse
.swt
.graphics
.Color
;
29 import org
.eclipse
.swt
.graphics
.Font
;
30 import org
.eclipse
.swt
.widgets
.Composite
;
31 import org
.eclipse
.swt
.widgets
.Control
;
32 import org
.eclipse
.swt
.widgets
.Display
;
33 import org
.eclipse
.swt
.widgets
.Event
;
34 import org
.eclipse
.swt
.widgets
.Label
;
35 import org
.eclipse
.ui
.forms
.IFormColors
;
36 import org
.eclipse
.ui
.forms
.widgets
.FormToolkit
;
37 import org
.eclipse
.ui
.forms
.widgets
.Section
;
38 import org
.eclipse
.ui
.forms
.widgets
.TableWrapData
;
39 import org
.eclipse
.ui
.forms
.widgets
.TableWrapLayout
;
40 import org
.eclipse
.ui
.internal
.forms
.widgets
.FormFonts
;
41 import org
.joda
.time
.Partial
;
43 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
44 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
45 import eu
.etaxonomy
.cdm
.model
.agent
.Institution
;
46 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
47 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
48 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
49 import eu
.etaxonomy
.cdm
.model
.common
.Annotation
;
50 import eu
.etaxonomy
.cdm
.model
.common
.AnnotationType
;
51 import eu
.etaxonomy
.cdm
.model
.common
.Credit
;
52 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
53 import eu
.etaxonomy
.cdm
.model
.common
.DescriptionElementSource
;
54 import eu
.etaxonomy
.cdm
.model
.common
.Extension
;
55 import eu
.etaxonomy
.cdm
.model
.common
.ExtensionType
;
56 import eu
.etaxonomy
.cdm
.model
.common
.IAnnotatableEntity
;
57 import eu
.etaxonomy
.cdm
.model
.common
.ICdmBase
;
58 import eu
.etaxonomy
.cdm
.model
.common
.IVersionableEntity
;
59 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableSource
;
60 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
61 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
62 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
63 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
64 import eu
.etaxonomy
.cdm
.model
.common
.TimePeriod
;
65 import eu
.etaxonomy
.cdm
.model
.common
.VersionableEntity
;
66 import eu
.etaxonomy
.cdm
.model
.description
.CategoricalData
;
67 import eu
.etaxonomy
.cdm
.model
.description
.CommonTaxonName
;
68 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
69 import eu
.etaxonomy
.cdm
.model
.description
.Distribution
;
70 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
71 import eu
.etaxonomy
.cdm
.model
.description
.FeatureTree
;
72 import eu
.etaxonomy
.cdm
.model
.description
.IndividualsAssociation
;
73 import eu
.etaxonomy
.cdm
.model
.description
.KeyStatement
;
74 import eu
.etaxonomy
.cdm
.model
.description
.MeasurementUnit
;
75 import eu
.etaxonomy
.cdm
.model
.description
.Modifier
;
76 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKey
;
77 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKeyNode
;
78 import eu
.etaxonomy
.cdm
.model
.description
.PresenceAbsenceTermBase
;
79 import eu
.etaxonomy
.cdm
.model
.description
.QuantitativeData
;
80 import eu
.etaxonomy
.cdm
.model
.description
.Scope
;
81 import eu
.etaxonomy
.cdm
.model
.description
.Sex
;
82 import eu
.etaxonomy
.cdm
.model
.description
.Stage
;
83 import eu
.etaxonomy
.cdm
.model
.description
.State
;
84 import eu
.etaxonomy
.cdm
.model
.description
.StateData
;
85 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasure
;
86 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasurementValue
;
87 import eu
.etaxonomy
.cdm
.model
.description
.TaxonInteraction
;
88 import eu
.etaxonomy
.cdm
.model
.description
.TextData
;
89 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
90 import eu
.etaxonomy
.cdm
.model
.location
.NamedAreaType
;
91 import eu
.etaxonomy
.cdm
.model
.location
.Point
;
92 import eu
.etaxonomy
.cdm
.model
.location
.ReferenceSystem
;
93 import eu
.etaxonomy
.cdm
.model
.media
.ImageFile
;
94 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
95 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
96 import eu
.etaxonomy
.cdm
.model
.media
.Rights
;
97 import eu
.etaxonomy
.cdm
.model
.media
.RightsTerm
;
98 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationship
;
99 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationshipType
;
100 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignation
;
101 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignationStatus
;
102 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
103 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatusType
;
104 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
105 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignation
;
106 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignationStatus
;
107 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
108 import eu
.etaxonomy
.cdm
.model
.occurrence
.Collection
;
109 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
110 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnitBase
;
111 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationEvent
;
112 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationModifier
;
113 import eu
.etaxonomy
.cdm
.model
.occurrence
.FieldObservation
;
114 import eu
.etaxonomy
.cdm
.model
.occurrence
.PreservationMethod
;
115 import eu
.etaxonomy
.cdm
.model
.occurrence
.Specimen
;
116 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
117 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
118 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
119 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
120 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
121 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
122 import eu
.etaxonomy
.cdm
.strategy
.parser
.ParserProblem
;
123 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
124 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.IOpenUrlEnabled
;
125 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.OpenUrlSelectorElement
;
126 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
127 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
128 import eu
.etaxonomy
.taxeditor
.ui
.section
.EmptyElement
;
129 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailElement
;
130 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailSection
;
131 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailElement
;
132 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailSection
;
133 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailElement
;
134 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailSection
;
135 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberElement
;
136 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberSection
;
137 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamOrPersonBaseDetailSection
;
138 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailElement
;
139 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailSection
;
140 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailElement
;
141 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailSection
;
142 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DerivedUnitElement
;
143 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescribedSpecimenSection
;
144 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailElement
;
145 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailSection
;
146 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailElement
;
147 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailSection
;
148 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementMediaSection
;
149 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceElement
;
150 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceSection
;
151 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceElement
;
152 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceSection
;
153 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierElement
;
154 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierSection
;
155 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageDetailElement
;
156 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageSection
;
157 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeElement
;
158 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeSection
;
159 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataElement
;
160 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataSection
;
161 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueElement
;
162 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueSection
;
163 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.AbstractDetailedDescriptionDetailElement
;
164 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CategoricalDataDetailElement
;
165 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CommonNameDetailElement
;
166 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.DistributionDetailElement
;
167 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.IndividualsAssociationDetailElement
;
168 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.QuantitativeDataDetailElement
;
169 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TaxonInteractionDetailElement
;
170 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TextDataDetailElement
;
171 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailElement
;
172 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailSection
;
173 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.GeographicalScopeDetailSection
;
174 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailElement
;
175 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailSection
;
176 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailElement
;
177 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailSection
;
178 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.ScopeRestrictionSection
;
179 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailElement
;
180 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailSection
;
181 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailElement
;
182 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailSection
;
183 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailElement
;
184 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailSection
;
185 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailElement
;
186 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailSection
;
187 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameTypeDesignationElement
;
188 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusElement
;
189 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusSection
;
190 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailElement
;
191 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailSection
;
192 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueElement
;
193 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueSection
;
194 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.SpecimenTypeDesignationElement
;
195 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.TypeDesignationSection
;
196 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectingAreasDetailSection
;
197 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectionDetailElement
;
198 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailElement
;
199 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailSection
;
200 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailElement
;
201 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailSection
;
202 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationEventDetailElement
;
203 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationEventDetailSection
;
204 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailElement
;
205 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailSection
;
206 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailElement
;
207 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailSection
;
208 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailElement
;
209 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailSection
;
210 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.NamedAreaDetailElement
;
211 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SourceCollectionDetailSection
;
212 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailElement
;
213 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailSection
;
214 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailElement
;
215 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailSection
;
216 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailElement
;
217 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailSection
;
218 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationElement
;
219 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationSection
;
220 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditElement
;
221 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditSection
;
222 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionElement
;
223 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionSection
;
224 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.HeadlineSection
;
225 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.IdentifiableSourceElement
;
226 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ImageFileElement
;
227 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerElement
;
228 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerSection
;
229 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MediaElement
;
230 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MediaRepresentationElement
;
231 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MediaRepresentationPartSection
;
232 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MediaRepresentationSection
;
233 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MediaSection
;
234 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsElement
;
235 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
236 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.SourceSection
;
237 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionElement
;
238 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionSection
;
239 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessageElement
;
240 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
241 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailElement
;
242 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
243 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailElement
;
244 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailSection
;
245 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailElement
;
246 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailSection
;
247 import eu
.etaxonomy
.taxeditor
.ui
.selection
.AbstractSelectionElement
;
248 import eu
.etaxonomy
.taxeditor
.ui
.selection
.AgentSelectionElement
;
249 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ClassificationSelectionElement
;
250 import eu
.etaxonomy
.taxeditor
.ui
.selection
.CollectionSelectionElement
;
251 import eu
.etaxonomy
.taxeditor
.ui
.selection
.DerivedUnitBaseSelectionElement
;
252 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FeatureSelectionElement
;
253 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FeatureTreeSelectionElement
;
254 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FieldObservationSelectionElement
;
255 import eu
.etaxonomy
.taxeditor
.ui
.selection
.InstitutionSelectionElement
;
256 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NameSelectionElement
;
257 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NamedAreaSelectionElement
;
258 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NomenclaturalAuthorTeamSelectionElement
;
259 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PersonSelectionElement
;
260 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PolytomousKeyNodeSelectionElement
;
261 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PolytomousKeySelectionElement
;
262 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ReferenceSelectionElement
;
263 import eu
.etaxonomy
.taxeditor
.ui
.selection
.SynonymSelectionElement
;
264 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonBaseSelectionElement
;
265 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonNodeSelectionElement
;
266 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonSelectionElement
;
267 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TeamSelectionElement
;
268 import eu
.etaxonomy
.taxeditor
.ui
.term
.AbstractEnumComboElement
;
269 import eu
.etaxonomy
.taxeditor
.ui
.term
.AbstractTermComboElement
;
270 import eu
.etaxonomy
.taxeditor
.ui
.term
.AnnotationTypeComboElement
;
271 import eu
.etaxonomy
.taxeditor
.ui
.term
.DeterminationModifierComboElement
;
272 import eu
.etaxonomy
.taxeditor
.ui
.term
.EmptyComboElement
;
273 import eu
.etaxonomy
.taxeditor
.ui
.term
.ExtensionTypeComboElement
;
274 import eu
.etaxonomy
.taxeditor
.ui
.term
.LanguageComboElement
;
275 import eu
.etaxonomy
.taxeditor
.ui
.term
.MarkerTypeComboElement
;
276 import eu
.etaxonomy
.taxeditor
.ui
.term
.MeasurementUnitComboElement
;
277 import eu
.etaxonomy
.taxeditor
.ui
.term
.ModifierComboElement
;
278 import eu
.etaxonomy
.taxeditor
.ui
.term
.NameRelationshipTypeComboElement
;
279 import eu
.etaxonomy
.taxeditor
.ui
.term
.NameTypeDesignationStatusComboElement
;
280 import eu
.etaxonomy
.taxeditor
.ui
.term
.NamedAreaTypeComboElement
;
281 import eu
.etaxonomy
.taxeditor
.ui
.term
.NomenclaturalCodeComboElement
;
282 import eu
.etaxonomy
.taxeditor
.ui
.term
.NomenclaturalStatusTypeComboElement
;
283 import eu
.etaxonomy
.taxeditor
.ui
.term
.PresenceAbsenceTermComboElement
;
284 import eu
.etaxonomy
.taxeditor
.ui
.term
.PreservationMethodComboElement
;
285 import eu
.etaxonomy
.taxeditor
.ui
.term
.RankComboElement
;
286 import eu
.etaxonomy
.taxeditor
.ui
.term
.ReferenceSystemComboElement
;
287 import eu
.etaxonomy
.taxeditor
.ui
.term
.ReferenceTypeComboElement
;
288 import eu
.etaxonomy
.taxeditor
.ui
.term
.RightsTypeComboElement
;
289 import eu
.etaxonomy
.taxeditor
.ui
.term
.ScopeComboElement
;
290 import eu
.etaxonomy
.taxeditor
.ui
.term
.SexComboElement
;
291 import eu
.etaxonomy
.taxeditor
.ui
.term
.SpecimenTypeDesignationStatusComboElement
;
292 import eu
.etaxonomy
.taxeditor
.ui
.term
.StageComboElement
;
293 import eu
.etaxonomy
.taxeditor
.ui
.term
.StateComboElement
;
294 import eu
.etaxonomy
.taxeditor
.ui
.term
.StatisticalMeasureComboElement
;
297 * <p>CdmFormFactory class.</p>
300 * @created Feb 24, 2010
303 public class CdmFormFactory
extends FormToolkit
{
305 private BoldFontHolder2 boldFontHolder2
;
306 private MouseListener selectionMouseHandler
;
307 private FocusListener selectionFocusHandler
;
309 private Set selectionListenerList
= new HashSet();
311 private List
<IPropertyChangeListener
> propertyChangeListeners
= new ArrayList
<IPropertyChangeListener
>();
313 private int orientation
= Window
.getDefaultOrientation();
314 private ISelectionProvider selectionProvider
;
319 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
321 public static final TableWrapLayout
LAYOUT(){
322 return LAYOUT(1, false);
328 * @param columns a int.
329 * @param equalWidth a boolean.
330 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
332 public static final TableWrapLayout
LAYOUT(int columns
, boolean equalWidth
){
333 TableWrapLayout layout
= new TableWrapLayout();
334 layout
.topMargin
= 0;
335 layout
.rightMargin
= 0;
336 layout
.bottomMargin
= 0;
337 layout
.leftMargin
= 0;
338 layout
.numColumns
= columns
;
339 layout
.makeColumnsEqualWidth
= equalWidth
;
340 layout
.verticalSpacing
= 0;
341 layout
.horizontalSpacing
= 0;
348 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
350 public static final TableWrapData
FILL(){
357 * @param horizontalSpan a int.
358 * @param verticalSpan a int.
359 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
361 public static final TableWrapData
FILL(int horizontalSpan
, int verticalSpan
){
362 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.FILL_GRAB
);
363 layoutData
.colspan
= horizontalSpan
;
364 layoutData
.rowspan
= verticalSpan
;
371 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
373 public static final TableWrapData
LEFT(){
374 return new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
);
380 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
382 public static final TableWrapData
RIGHT(){
383 return new TableWrapData(TableWrapData
.RIGHT
, TableWrapData
.TOP
);
387 * <p>FILL_HORIZONTALLY</p>
389 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
391 public static final TableWrapData
FILL_HORIZONTALLY(){
392 return FILL_HORIZONTALLY(1, 1);
396 * <p>FILL_HORIZONTALLY</p>
398 * @param horizontalSpan a int.
399 * @param verticalSpan a int.
400 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
402 public static final TableWrapData
FILL_HORIZONTALLY(int horizontalSpan
, int verticalSpan
){
403 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
);
404 layoutData
.colspan
= horizontalSpan
;
405 layoutData
.rowspan
= verticalSpan
;
409 /** Constant <code>EMPTY_SELECTION</code> */
410 public static ISelection EMPTY_SELECTION
= new ISelection() {
411 public boolean isEmpty() {
416 private class SelectionMouseHandler
extends MouseAdapter
{
418 public void mouseDown(MouseEvent e
) {
419 notifySelectionListeners(e
);
423 private class SelectionFocusHandler
extends FocusAdapter
{
425 public void focusGained(FocusEvent e
) {
426 notifySelectionListeners(e
);
430 private void notifySelectionListeners(TypedEvent e
){
431 Event event
= new Event();
432 event
.widget
= e
.widget
;
433 SelectionEvent selectionEvent
= new SelectionEvent(event
);
435 for(Object listener
: selectionListenerList
){
436 ((SelectionListener
) listener
).widgetSelected(selectionEvent
);
441 * <p>Constructor for CdmFormFactory.</p>
443 * @param display a {@link org.eclipse.swt.widgets.Display} object.
444 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
446 public CdmFormFactory(Display display
, ISelectionProvider selectionProvider
) {
448 this.selectionProvider
= selectionProvider
;
453 * <p>Constructor for CdmFormFactory.</p>
455 * @param display a {@link org.eclipse.swt.widgets.Display} object.
457 public CdmFormFactory(Display display
){
465 private void init() {
466 boldFontHolder2
= new BoldFontHolder2();
467 selectionMouseHandler
= new SelectionMouseHandler();
468 selectionFocusHandler
= new SelectionFocusHandler();
472 * Creates an instance initialized with the correct selectionProvider
474 * Make sure to remove the instance when the entityComposite disposes via
475 * destroySelectionArbitrator(..)
477 * @param entityElement a {@link eu.etaxonomy.taxeditor.ui.forms.IEntityElement} object.
478 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator} object.
480 public SelectionArbitrator
createSelectionArbitrator(IEntityElement entityElement
){
481 SelectionArbitrator selectionArbitrator
= new SelectionArbitrator(entityElement
);
482 selectionArbitrator
.addSelectionProvider(selectionProvider
);
483 selectionProvider
.addSelectionChangedListener(selectionArbitrator
);
484 addSelectionListener(selectionArbitrator
);
485 return selectionArbitrator
;
489 * <p>destroySelectionArbitrator</p>
491 * @param selectionArbitrator a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator} object.
493 public void destroySelectionArbitrator(SelectionArbitrator selectionArbitrator
){
494 removeSelectionListener(selectionArbitrator
);
495 if(selectionProvider
!= null){
496 selectionProvider
.removeSelectionChangedListener(selectionArbitrator
);
498 StoreUtil
.error(this.getClass(), "Tried to destroy a selection listener from this factories listeners but was null", null);
504 public void adapt(Composite composite
) {
505 composite
.addMouseListener(selectionMouseHandler
);
506 super.adapt(composite
);
512 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractCdmFormElement} object.
514 public void adapt(AbstractCdmFormElement formElement
){
515 formElement
.setPropertyChangeListeners(propertyChangeListeners
);
520 public void adapt(Control control
, boolean trackFocus
, boolean trackKeyboard
) {
522 control
.addFocusListener(selectionFocusHandler
);
524 super.adapt(control
, trackFocus
, trackKeyboard
);
528 * <p>destroyElement</p>
530 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
532 public void destroyElement(ICdmFormElement formElement
){
533 // return if element was not initialized
534 if(formElement
== null){
537 // destroy selection arbitrator, if any
538 if(formElement
instanceof ISelectableElement
){
539 destroySelectionArbitrator(((ISelectableElement
) formElement
).getSelectionArbitrator());
541 // remove this element form its parents list of elements
542 // ICdmFormElement parentElement = formElement.getParentElement();
543 // if(parentElement != null){
544 // parentElement.removeElement(formElement);
546 // call destroy on child elements recursively
547 for(ICdmFormElement childElement
: formElement
.getElements()){
548 destroyElement(childElement
);
550 // dispose of the controls
551 for(Control control
: formElement
.getControls()){
552 // we added the layoutComposite of the parental element as the layout composite to this formElement
553 // but we do not want to destroy it.
554 if(control
.equals(formElement
.getLayoutComposite())){
565 * <p>createEmptyCell</p>
567 * @param parent a {@link org.eclipse.swt.widgets.Composite} object.
568 * @return a {@link org.eclipse.swt.widgets.Label} object.
570 public Label
createEmptyCell(Composite parent
){
571 return this.createLabel(parent
, null);
575 * <p>createMultilineTextWithLabel</p>
577 * @param labelString a {@link java.lang.String} object.
578 * @param textHeight a int.
579 * @param style a int.
580 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
581 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement} object.
583 public TextWithLabelElement
createMultilineTextWithLabel(ICdmFormElement parentElement
, String labelString
, int textHeight
, int style
){
584 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, labelString
, "", textHeight
, style
);
586 parentElement
.addElement(element
);
592 * <p>createMultiLanguageTextElement</p>
594 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
595 * @param labelString a {@link java.lang.String} object.
596 * @param multilanguageText a {@link java.util.Map} object.
597 * @param textHeight a int.
598 * @param style a int.
599 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.MultilanguageTextElement} object.
601 public MultilanguageTextElement
createMultiLanguageTextElement(
602 ICdmFormElement parentElement
, String labelString
, Map
<Language
, LanguageString
> multilanguageText
, int textHeight
,
604 MultilanguageTextElement element
= new MultilanguageTextElement(this, parentElement
, labelString
, multilanguageText
, textHeight
, style
);
606 parentElement
.addElement(element
);
610 public KeyStatementElement
createKeyStatementElement(ICdmFormElement parentElement
, String labelString
,
611 KeyStatement keyStatement
, int textHeight
, int style
){
612 KeyStatementElement element
= new KeyStatementElement(this, parentElement
, labelString
, keyStatement
, textHeight
, style
);
614 parentElement
.addElement(element
);
620 * <p>createTextWithLabelElement</p>
622 * @param labelString a {@link java.lang.String} object.
623 * @param initialText a {@link java.lang.String} object.
624 * @param style a int.
625 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
626 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement} object.
628 public TextWithLabelElement
createTextWithLabelElement(ICdmFormElement parentElement
, String labelString
, String initialText
, int style
){
629 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, labelString
, initialText
, null, style
);
631 parentElement
.addElement(element
);
635 public UriWithLabelElement
createUriWithLabelElement(ICdmFormElement parentElement
, String labelString
, URI initialUri
, int style
){
636 UriWithLabelElement element
= new UriWithLabelElement(this, parentElement
, labelString
, initialUri
, null, style
);
638 parentElement
.addElement(element
);
649 public OpenUrlSelectorElement
createOpenUrlSelectorElement(
650 ICdmFormElement parentElement
, String labelString
, IOpenUrlEnabled openUrlEnabled
, int style
) {
651 OpenUrlSelectorElement element
= new OpenUrlSelectorElement(this, parentElement
, labelString
, openUrlEnabled
, style
);
653 parentElement
.addElement(element
);
658 * <p>createIntegerTextWithLabelElement</p>
660 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
661 * @param labelString a {@link java.lang.String} object.
662 * @param initialInteger a {@link java.lang.Integer} object.
663 * @param style a int.
664 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement} object.
666 public NumberWithLabelElement
createIntegerTextWithLabelElement(ICdmFormElement parentElement
, String labelString
, Integer initialInteger
, int style
){
667 NumberWithLabelElement element
= new NumberWithLabelElement(this, parentElement
, labelString
, initialInteger
, style
);
669 parentElement
.addElement(element
);
675 * <p>createFloatTextWithLabelElement</p>
677 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
678 * @param labelString a {@link java.lang.String} object.
679 * @param initialFloat a float.
680 * @param style a int.
681 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement} object.
683 public NumberWithLabelElement
createFloatTextWithLabelElement(
684 ICdmFormElement parentElement
, String labelString
, float initialFloat
,
686 NumberWithLabelElement element
= new NumberWithLabelElement(this, parentElement
, labelString
, initialFloat
, style
);
688 parentElement
.addElement(element
);
693 * <p>createLanguageStringWithLabelElement</p>
695 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
696 * @param labelString a {@link java.lang.String} object.
697 * @param languageString a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
698 * @param style a int.
699 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement} object.
701 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(ICdmFormElement parentElement
, String labelString
, LanguageString languageString
, int style
){
702 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(this, parentElement
, labelString
, languageString
, style
);
704 parentElement
.addElement(element
);
709 * <p>createLanguageStringWithLabelElement</p>
711 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
712 * @param labelString a {@link java.lang.String} object.
713 * @param languageString a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
714 * @param height a int.
715 * @param style a int.
716 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement} object.
718 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(ICdmFormElement parentElement
, String labelString
, LanguageString languageString
, int height
, int style
){
719 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(this, parentElement
, labelString
, languageString
, height
, style
);
721 parentElement
.addElement(element
);
726 * <p>createTextElement</p>
728 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
729 * @param initialText a {@link java.lang.String} object.
730 * @param style a int.
731 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement} object.
733 public TextWithLabelElement
createTextElement(ICdmFormElement parentElement
, String initialText
, int style
){
734 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, null, initialText
, null, style
);
736 parentElement
.addElement(element
);
741 * <p>createKeyValueViewerElement</p>
743 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
744 * @param keyHeading a {@link java.lang.String} object.
745 * @param valueHeading a {@link java.lang.String} object.
746 * @param map a {@link java.util.Map} object.
747 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.KeyValueViewerElement} object.
749 public KeyValueViewerElement
createKeyValueViewerElement(ICdmFormElement parentElement
, String keyHeading
, String valueHeading
, Map
<Object
, Object
> map
){
750 KeyValueViewerElement element
= new KeyValueViewerElement(this, parentElement
, keyHeading
, valueHeading
, map
);
752 parentElement
.addElement(element
);
757 public static enum TermComboType
{
761 NOMENCLATURALSTATUSTYPE
,
766 PRESENCEABSENCESTATUS
,
768 NAMETYPEDESIGNATIONSTATUS
,
769 SPECIMENTYPEDESIGNATIONSTATUS
,
779 DETERMINATION_MODIFIER
,
784 * <p>createTermComboElement</p>
786 * @param termComboType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.TermComboType} object.
787 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
788 * @param labelString a {@link java.lang.String} object.
789 * @param selection a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase} object.
790 * @param style a int.
791 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractTermComboElement} object.
793 public AbstractTermComboElement
createTermComboElement(TermComboType termComboType
, ICdmFormElement parentElement
, String labelString
, DefinedTermBase selection
, int style
){
794 AbstractTermComboElement element
= null;
796 switch(termComboType
){
798 element
= new EmptyComboElement
<DefinedTermBase
>(this, parentElement
, labelString
, style
);
801 element
= new ExtensionTypeComboElement(this, parentElement
, labelString
, (ExtensionType
) selection
, style
);
804 element
= new LanguageComboElement(this, parentElement
, labelString
, (Language
) selection
, style
);
807 element
= new MarkerTypeComboElement(this, parentElement
, labelString
, (MarkerType
) selection
, style
);
809 case NOMENCLATURALSTATUSTYPE
:
810 element
= new NomenclaturalStatusTypeComboElement(this, parentElement
, labelString
, (NomenclaturalStatusType
) selection
, style
);
813 element
= new RankComboElement(this, parentElement
, labelString
, (Rank
) selection
, style
);
816 element
= new RightsTypeComboElement(this, parentElement
, labelString
, (RightsTerm
) selection
, style
);
818 case NAMERELATIONSHIP
:
819 element
= new NameRelationshipTypeComboElement(this, parentElement
, labelString
, (NameRelationshipType
) selection
, style
);
822 element
= new NamedAreaTypeComboElement(this, parentElement
, labelString
, (NamedAreaType
) selection
, style
);
825 element
= new AnnotationTypeComboElement(this, parentElement
, labelString
, (AnnotationType
) selection
, style
);
827 case PRESENCEABSENCESTATUS
:
828 element
= new PresenceAbsenceTermComboElement(this, parentElement
, labelString
, (PresenceAbsenceTermBase
) selection
, style
);
830 case NAMETYPEDESIGNATIONSTATUS
:
831 element
= new NameTypeDesignationStatusComboElement(this, parentElement
, labelString
, (NameTypeDesignationStatus
) selection
, style
);
833 case SPECIMENTYPEDESIGNATIONSTATUS
:
834 element
= new SpecimenTypeDesignationStatusComboElement(this, parentElement
, labelString
, (SpecimenTypeDesignationStatus
) selection
, style
);
837 element
= new SexComboElement(this, parentElement
, labelString
, (Sex
) selection
, style
);
840 element
= new StageComboElement(this, parentElement
, labelString
, (Stage
) selection
, style
);
842 case PRESERVATION_METHOD
:
843 element
= new PreservationMethodComboElement(this, parentElement
, labelString
, (PreservationMethod
) selection
, style
);
845 case MEASUREMENT_UNIT
:
846 element
= new MeasurementUnitComboElement(this, parentElement
, labelString
, (MeasurementUnit
) selection
, style
);
849 element
= new StateComboElement(this, parentElement
, labelString
, (State
) selection
, style
);
852 element
= new ScopeComboElement(this, parentElement
, labelString
, (Scope
) selection
, style
);
855 element
= new ModifierComboElement(this, parentElement
, labelString
, (Modifier
) selection
, style
);
857 case STATISTICAL_MEASURE
:
858 element
= new StatisticalMeasureComboElement(this, parentElement
, labelString
, (StatisticalMeasure
) selection
, style
);
860 case DETERMINATION_MODIFIER
:
861 element
= new DeterminationModifierComboElement(this, parentElement
, labelString
, (DeterminationModifier
) selection
, style
);
863 case REFERENCE_SYSTEM
:
864 element
= new ReferenceSystemComboElement(this, parentElement
, labelString
, (ReferenceSystem
) selection
, style
);
869 parentElement
.addElement(element
);
873 public static enum EnumComboType
{
879 * <p>createEnumComboElement</p>
881 * @param enumComboType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EnumComboType} object.
882 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
883 * @param style a int.
884 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement} object.
886 public AbstractEnumComboElement
createEnumComboElement(EnumComboType enumComboType
, ICdmFormElement parentElement
, int style
){
887 AbstractEnumComboElement element
= null;
889 switch(enumComboType
){
891 element
= new ReferenceTypeComboElement(this, parentElement
, "Reference Type", null, style
);
893 case NOMENCLATURALCODE
:
894 element
= new NomenclaturalCodeComboElement(this, parentElement
, "Nomenclatural Code", null, style
);
898 parentElement
.addElement(element
);
903 * <p>createBrowserElement</p>
905 * @param imageUri a {@link java.net.URI} object.
906 * @param style a int.
907 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
908 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.BrowserElement} object.
910 public BrowserElement
createBrowserElement(ICdmFormElement parentElement
, URI imageUri
, int style
){
911 BrowserElement element
= new BrowserElement(this, parentElement
, imageUri
, style
);
913 parentElement
.addElement(element
);
918 * <p>createImageElement</p>
920 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
921 * @param imageUri a {@link java.net.URI} object.
922 * @param style a int.
923 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.ImageElement} object.
925 public ImageElement
createImageElement(ICdmFormElement parentElement
, URI imageUri
, int style
) {
926 ImageElement element
= new ImageElement(this, parentElement
, imageUri
, style
);
928 parentElement
.addElement(element
);
933 * <p>createTextActionElement</p>
935 * @param labelString a {@link java.lang.String} object.
936 * @param initialText a {@link java.lang.String} object.
937 * @param style a int.
938 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
939 * @param buttonLabel a {@link java.lang.String} object.
940 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextActionElement} object.
942 public TextActionElement
createTextActionElement(ICdmFormElement parentElement
, String labelString
, String buttonLabel
, String initialText
, int style
){
943 TextActionElement element
= new TextActionElement(this, parentElement
, labelString
, buttonLabel
, initialText
, style
);
945 parentElement
.addElement(element
);
952 * @created Mar 5, 2010
955 public static enum SelectionType
{
978 * <p>createCheckbox</p>
980 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
981 * @param label a {@link java.lang.String} object.
982 * @param initialState a boolean.
983 * @param style a int.
984 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.CheckboxElement} object.
986 public CheckboxElement
createCheckbox(ICdmFormElement parentElement
, String label
, boolean initialState
, int style
) {
987 CheckboxElement element
= new CheckboxElement(this, parentElement
, label
, initialState
, style
| orientation
);
989 parentElement
.addElement(element
);
996 * Creates a section as a part of the form.
998 * @return the section widget
999 * @param section a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object.
1001 public Section
adapt(AbstractFormSection section
) {
1002 section
.setMenu(section
.getLayoutComposite().getMenu());
1003 adapt(section
, true, true);
1005 // handle focus and property change events for cdm use
1006 section
.addFocusListener(selectionFocusHandler
);
1007 section
.setPropertyChangeListeners(propertyChangeListeners
);
1009 if (section
.getToggle() != null) {
1010 section
.getToggle().setHoverDecorationColor(getColors()
1011 .getColor(IFormColors
.TB_TOGGLE_HOVER
));
1012 section
.getToggle().setDecorationColor(getColors()
1013 .getColor(IFormColors
.TB_TOGGLE
));
1016 section
.setFont(boldFontHolder2
.getBoldFont(section
.getLayoutComposite().getFont()));
1018 if ((section
.getStyle() & Section
.TITLE_BAR
) != 0
1019 || (section
.getStyle() & Section
.SHORT_TITLE_BAR
) != 0) {
1020 getColors().initializeSectionToolBarColors();
1021 section
.setTitleBarBackground(getColors().getColor(IFormColors
.TB_BG
));
1022 section
.setTitleBarBorderColor(getColors()
1023 .getColor(IFormColors
.TB_BORDER
));
1025 // call setTitleBarForeground regardless as it also sets the label color
1026 section
.setTitleBarForeground(getColors()
1027 .getColor(IFormColors
.TB_TOGGLE
));
1031 private class BoldFontHolder2
{
1032 private Font normalFont
;
1034 private Font boldFont
;
1036 public BoldFontHolder2() {
1039 public Font
getBoldFont(Font font
) {
1040 createBoldFont(font
);
1044 private void createBoldFont(Font font
) {
1045 if (normalFont
== null || !normalFont
.equals(font
)) {
1049 if (boldFont
== null) {
1050 boldFont
= FormFonts
.getInstance().getBoldFont(getColors().getDisplay(),
1055 public void dispose() {
1056 if (boldFont
!= null) {
1057 FormFonts
.getInstance().markFinished(boldFont
, getColors().getDisplay());
1064 * <p>createToggleableTextField</p>
1066 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1067 * @param labelString a {@link java.lang.String} object.
1068 * @param initialText a {@link java.lang.String} object.
1069 * @param initialState a boolean.
1070 * @param style a int.
1071 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.ToggleableTextElement} object.
1073 public ToggleableTextElement
createToggleableTextField(ICdmFormElement parentElement
,
1074 String labelString
, String initialText
, boolean initialState
, int style
) {
1075 ToggleableTextElement element
= new ToggleableTextElement(this, parentElement
,
1076 labelString
, initialText
, initialState
, style
| orientation
);
1078 parentElement
.addElement(element
);
1083 * <p>createTimePeriodElement</p>
1085 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1086 * @param labelString a {@link java.lang.String} object.
1087 * @param timePeriod a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1088 * @param style a int.
1089 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TimePeriodElement} object.
1091 public TimePeriodElement
createTimePeriodElement(
1092 ICdmFormElement parentElement
, String labelString
, TimePeriod timePeriod
, int style
) {
1093 TimePeriodElement element
= new TimePeriodElement(this, parentElement
, labelString
, timePeriod
, style
);
1095 parentElement
.addElement(element
);
1101 * <p>createPointElement</p>
1103 * @param style a int.
1104 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1105 * @param point a {@link eu.etaxonomy.cdm.model.location.Point} object.
1106 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.PointElement} object.
1108 public PointElement
createPointElement(ICdmFormElement parentElement
,
1109 Point point
, int style
) {
1110 PointElement element
= new PointElement(this, parentElement
, point
, style
);
1112 parentElement
.addElement(element
);
1117 * <p>createDateDetailSection</p>
1119 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1120 * @param style a int.
1121 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.DateDetailSection} object.
1123 public DateDetailSection
createDateDetailSection(ICdmFormElement parentElement
, int style
){
1124 DateDetailSection section
= new DateDetailSection(this, parentElement
, style
);
1125 parentElement
.addElement(section
);
1131 * <p>createPartialElement</p>
1133 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1134 * @param labelString a {@link java.lang.String} object.
1135 * @param partial a {@link org.joda.time.Partial} object.
1136 * @param style a int.
1137 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.PartialElement} object.
1139 public PartialElement
createPartialElement(ICdmFormElement parentElement
, String labelString
, Partial partial
, int style
){
1140 PartialElement element
= new PartialElement(this, parentElement
, labelString
, style
);
1142 parentElement
.addElement(element
);
1147 * <p>addSelectionListener</p>
1149 * @param listener a {@link org.eclipse.swt.events.SelectionListener} object.
1151 public void addSelectionListener(SelectionListener listener
){
1152 selectionListenerList
.add(listener
);
1156 * <p>removeSelectionListener</p>
1158 * @param listener a {@link org.eclipse.swt.events.SelectionListener} object.
1160 public void removeSelectionListener(SelectionListener listener
){
1161 if(listener
== null){
1162 StoreUtil
.error(this.getClass(), "Tried to remove a selection listener from this factories listeners but was null", null);
1164 selectionListenerList
.remove(listener
);
1169 * <p>addPropertyChangeListener</p>
1171 * @param listener a {@link org.eclipse.jface.util.IPropertyChangeListener} object.
1173 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
1174 propertyChangeListeners
.add(0, listener
);
1178 * <p>removePropertyChangeListener</p>
1180 * @param listener a {@link org.eclipse.jface.util.IPropertyChangeListener} object.
1182 public void removePropertyChangeListener(IPropertyChangeListener listener
){
1183 propertyChangeListeners
.remove(listener
);
1189 * <p>createHorizontalSeparator</p>
1191 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1192 * @param style a int.
1193 * @return a {@link org.eclipse.swt.widgets.Label} object.
1195 public Label
createHorizontalSeparator(ICdmFormElement parentElement
, int style
) {
1196 Label separator
= this.createSeparator(parentElement
.getLayoutComposite(), SWT
.HORIZONTAL
| style
);
1197 separator
.setLayoutData(FILL_HORIZONTALLY());
1202 * <p>createVersionElement</p>
1204 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1205 * @param entity a {@link eu.etaxonomy.cdm.model.common.VersionableEntity} object.
1206 * @param style a int.
1207 * @return a {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement} object.
1209 public VersionElement
createVersionElement(ICdmFormElement parentElement
, VersionableEntity entity
,
1211 VersionElement element
= new VersionElement(this, parentElement
, entity
, style
);
1213 parentElement
.addElement(element
);
1218 * <p>createVersionSection</p>
1220 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1221 * @param style a int.
1222 * @return a {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection} object.
1224 public VersionSection
createVersionSection(ICdmFormElement parentElement
, int style
) {
1225 VersionSection section
= new VersionSection(this, parentElement
, style
);
1226 parentElement
.addElement(section
);
1232 * <p>createEmptyElement</p>
1234 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1235 * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1237 public EmptyElement
createEmptyElement(ICdmFormElement parentElement
) {
1238 EmptyElement element
= new EmptyElement(this, parentElement
, null, SWT
.NULL
);
1240 parentElement
.addElement(element
);
1245 * <p>createHeadlineSection</p>
1247 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1248 * @return a {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection} object.
1250 public HeadlineSection
createHeadlineSection(ICdmFormElement parentElement
) {
1251 HeadlineSection section
= new HeadlineSection(this, parentElement
, SWT
.NULL
);
1252 parentElement
.addElement(section
);
1259 * <p>createParsingMessageElement</p>
1261 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1262 * @param parserProblem a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem} object.
1263 * @param style a int.
1264 * @return a {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement} object.
1266 public ParsingMessageElement
createParsingMessageElement(
1267 ICdmFormElement parentElement
, ParserProblem parserProblem
, int style
) {
1268 ParsingMessageElement element
= new ParsingMessageElement(this, parentElement
, parserProblem
, style
);
1270 parentElement
.addElement(element
);
1280 public static enum DetailType
{
1284 NOMENCLATURALREFERENCE
,
1296 DERIVED_UNIT_FACADE
,
1298 DERIVED_UNIT
, NATURAL_LANGUAGE
,
1299 FEATURE_DISTRIBUTION
,
1304 POLYTOMOUS_KEY_NODE
,
1306 DERIVED_UNIT_GENERAL
,
1313 * <p>createCdmDetailSection</p>
1315 * @param detailType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType} object.
1316 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1317 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1318 * @param style a int.
1319 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1320 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object.
1322 public AbstractFormSection
createCdmDetailSection(DetailType detailType
, ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1323 AbstractFormSection section
= null;
1326 case SCIENTIFICNAME
:
1327 section
= new NameDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1330 section
= new ReferenceDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1332 case NOMENCLATURALREFERENCE
:
1333 section
= new NomenclaturalReferenceDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1336 section
= new TaxonBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1339 section
= new AuthorshipDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1341 case TEAMORPERSONBASE
:
1342 section
= new TeamOrPersonBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1345 section
= new TeamDetailSection(this, conversation
, parentElement
, null, style
);
1348 section
= new PersonDetailSection(this, conversation
, parentElement
, null, style
);
1351 section
= new DescriptionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1353 case DESCRIPTIONELEMENT
:
1354 section
= new DescriptionElementDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1356 case PARSINGMESSAGE
:
1357 section
= new ParsingMessagesSection(this, conversation
, parentElement
, selectionProvider
, style
);
1360 section
= new NonViralNameDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1363 section
= new eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection(this, conversation
, parentElement
, selectionProvider
, style
);
1365 case DERIVED_UNIT_FACADE
:
1366 section
= new DerivedUnitFacadeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1368 case FIELD_OBSERVATION
:
1369 section
= new FieldObservationDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1371 case GATHERING_EVENT
:
1372 section
= new GatheringEventDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1375 section
= new DerivedUnitBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1377 case NATURAL_LANGUAGE
:
1378 section
= new NaturalLanguageSection(this, conversation
, parentElement
, selectionProvider
, style
);
1380 case FEATURE_DISTRIBUTION
:
1381 section
= new FeatureDistributionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1383 case CLASSIFICATION
:
1384 section
= new ClassificationDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1387 section
= new TaxonNodeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1389 case POLYTOMOUS_KEY
:
1390 section
= new PolytomousKeyDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1392 case POLYTOMOUS_KEY_NODE
:
1393 section
= new PolytomousKeyNodeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1396 section
= new InstitutionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1398 case DERIVED_UNIT_GENERAL
:
1399 section
= new GeneralDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1402 section
= new HybridDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1405 section
= new UserDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1407 case GROUPS_BY_USER
:
1408 section
= new GroupsByUserDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1412 if(section
== null){
1413 throw new RuntimeException("You tried to create a cdm detail section that is not implemented yet.");
1416 parentElement
.addElement(section
);
1422 * <p>createCdmDetailElement</p>
1424 * @param detailType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType} object.
1425 * @param style a int.
1426 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1427 * @return a {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement} object.
1429 public AbstractCdmDetailElement
createCdmDetailElement(DetailType detailType
, ICdmFormElement parentElement
, int style
){
1430 AbstractCdmDetailElement element
= null;
1433 case SCIENTIFICNAME
:
1434 element
= new NameDetailElement(this, parentElement
, style
);
1437 element
= new ReferenceDetailElement(this, parentElement
, style
);
1439 case NOMENCLATURALREFERENCE
:
1440 element
= new NomenclaturalReferenceDetailElement(this, parentElement
, style
);
1443 element
= new TaxonBaseDetailElement(this, parentElement
, style
);
1446 element
= new AuthorshipDetailElement(this, parentElement
, style
);
1449 element
= new TeamDetailElement(this, parentElement
, style
);
1452 element
= new PersonDetailElement(this, parentElement
, style
);
1455 element
= new DescriptionDetailElement(this, parentElement
, style
);
1457 case DESCRIPTIONELEMENT
:
1458 element
= new DescriptionElementDetailElement(this, parentElement
, style
);
1461 element
= new NonViralNameDetailElement(this, parentElement
);
1463 case DERIVED_UNIT_FACADE
:
1464 element
= new DerivedUnitFacadeDetailElement(this, parentElement
);
1466 case FIELD_OBSERVATION
:
1467 element
= new FieldObservationDetailElement(this, parentElement
);
1469 case GATHERING_EVENT
:
1470 element
= new GatheringEventDetailElement(this, parentElement
);
1473 element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1475 case NATURAL_LANGUAGE
:
1476 element
= new NaturalLanguageDetailElement(this, parentElement
);
1478 case FEATURE_DISTRIBUTION
:
1479 element
= new FeatureDistributionDetailElement(this, parentElement
);
1481 case CLASSIFICATION
:
1482 element
= new ClassificationDetailElement(this, parentElement
);
1485 element
= new TaxonNodeDetailElement(this, parentElement
);
1488 element
= new CollectionDetailElement(this, parentElement
);
1490 case POLYTOMOUS_KEY
:
1491 element
= new PolytomousKeyDetailElement(this, parentElement
);
1493 case POLYTOMOUS_KEY_NODE
:
1494 element
= new PolytomousKeyNodeDetailElement(this, parentElement
);
1497 element
= new InstitutionDetailElement(this, parentElement
);
1499 case DERIVED_UNIT_GENERAL
:
1500 element
= new GeneralDetailElement(this, parentElement
);
1503 element
= new HybridDetailElement(this, parentElement
);
1506 element
= new UserDetailElement(this, parentElement
);
1508 case GROUPS_BY_USER
:
1509 element
= new GroupsByUserDetailElement(this, parentElement
);
1513 if(element
== null){
1514 StoreUtil
.error(this.getClass(), "Detail element was not created. Seems like the case was not implemented for the requested detail type: " + detailType
, null);
1518 parentElement
.addElement(element
);
1524 * @author n.hoffmann
1525 * @created Mar 5, 2010
1528 public static enum EntityDetailType
{
1533 DESCRIPTIONELEMENTSOURCE
,
1537 DESCRIPTIONELEMENTMEDIA
,
1538 MEDIAREPRESENTATION
,
1539 MEDIAREPRESENTATIONPART
,
1541 NOMENCLATURALSTATUS
,
1550 STATISTICAL_MEASUREMENT_VALUE
,
1553 DETERMINATION_EVENT
,
1554 SPECIMEN_COLLECTION
,
1555 IDENTIFIABLE_SOURCE_COLLECTION
,
1561 * <p>createEntityDetailSection</p>
1563 * @param entityDetailType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EntityDetailType} object.
1564 * @param style a int.
1565 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1566 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1567 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object.
1569 public AbstractFormSection
createEntityDetailSection(EntityDetailType entityDetailType
, ConversationHolder conversation
, ICdmFormElement parentElement
, int style
){
1570 AbstractFormSection section
= null;
1572 switch(entityDetailType
){
1574 section
= new TeamDetailSection(this, conversation
, parentElement
, null, style
);
1577 section
= new TeamMemberSection(this, conversation
, parentElement
, style
);
1580 section
= new AnnotationSection(this, conversation
, parentElement
, style
);
1583 section
= new CreditSection(this, conversation
, parentElement
, style
);
1585 case DESCRIPTIONELEMENTSOURCE
:
1586 section
= new DescriptionElementSourceSection(this, conversation
, parentElement
, style
);
1589 section
= new ExtensionSection(this, conversation
, parentElement
, style
);
1592 section
= new MarkerSection(this, conversation
, parentElement
, style
);
1595 section
= new MediaSection(this, conversation
, parentElement
, style
);
1597 case DESCRIPTIONELEMENTMEDIA
:
1598 section
= new DescriptionElementMediaSection(this, conversation
, parentElement
, style
);
1600 case MEDIAREPRESENTATION
:
1601 section
= new MediaRepresentationSection(this, conversation
, parentElement
, style
);
1603 case MEDIAREPRESENTATIONPART
:
1604 section
= new MediaRepresentationPartSection(this, conversation
, parentElement
, style
);
1607 section
= new ModifierSection(this, conversation
, parentElement
, style
);
1609 case NOMENCLATURALSTATUS
:
1610 section
= new NomenclaturalStatusSection(this, conversation
, parentElement
, style
);
1612 case NAME_RELATIONSHIP
:
1613 section
= new NameRelationshipDetailSection(this, conversation
, parentElement
, style
);
1616 section
= new ProtologueSection(this, conversation
, parentElement
, style
);
1619 section
= new RightsSection(this, conversation
, parentElement
, style
);
1622 section
= new SourceSection(this, conversation
, parentElement
, style
);
1625 section
= new ScopeSection(this, conversation
, parentElement
, style
);
1627 case DESCRIPTIONSOURCE
:
1628 section
= new DescriptionSourceSection(this, conversation
, parentElement
, style
);
1630 case TYPEDESIGNATION
:
1631 section
= new TypeDesignationSection(this, conversation
, parentElement
, style
);
1634 section
= new StateDataSection(this, conversation
, parentElement
, style
);
1636 case STATISTICAL_MEASUREMENT_VALUE
:
1637 section
= new StatisticalMeasurementValueSection(this, conversation
, parentElement
, style
);
1639 case DESCRIBED_SPECIMEN
:
1640 section
= new DescribedSpecimenSection(this, conversation
, parentElement
, style
);
1642 case COLLECTING_AREA
:
1643 section
= new CollectingAreasDetailSection(this, conversation
, parentElement
, style
);
1645 case DETERMINATION_EVENT
:
1646 section
= new DeterminationEventDetailSection(this, conversation
, parentElement
, style
);
1648 case SPECIMEN_COLLECTION
:
1649 section
= new SpecimenCollectionDetailSection(this, conversation
, parentElement
, style
);
1651 case IDENTIFIABLE_SOURCE_COLLECTION
:
1652 section
= new SourceCollectionDetailSection(this, conversation
, parentElement
, style
);
1654 case GEOGRAPHICAL_SCOPE
:
1655 section
= new GeographicalScopeDetailSection(this, conversation
, parentElement
, style
);
1657 case SCOPE_RESTRICTION
:
1658 section
= new ScopeRestrictionSection(this, conversation
, parentElement
, style
);
1661 parentElement
.addElement(section
);
1667 * <p>createEntityCollectionElement</p>
1669 * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
1670 * @param style a int.
1671 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object.
1672 * @param versionableEntity a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity} object.
1673 * @param backgroundColor a {@link org.eclipse.swt.graphics.Color} object.
1674 * @return a {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement} object.
1676 public AbstractEntityCollectionElement
createEntityCollectionElement(AbstractFormSection parentElement
, IVersionableEntity versionableEntity
, SelectionListener removeListener
, Color backgroundColor
, int style
){
1677 AbstractEntityCollectionElement element
= null;
1679 VersionableEntity entity
= (VersionableEntity
) HibernateProxyHelper
.deproxy(versionableEntity
);
1681 if(entity
instanceof Annotation
){
1682 element
= new AnnotationElement(this, parentElement
, (Annotation
) entity
, removeListener
, style
);
1684 else if(entity
instanceof Person
){
1685 element
= new TeamMemberElement(this, parentElement
, (Person
) entity
, removeListener
, style
);
1687 else if(entity
instanceof Credit
){
1688 element
= new CreditElement(this, parentElement
, (Credit
) entity
, removeListener
, style
);
1690 else if(entity
instanceof Extension
){
1691 element
= new ExtensionElement(this, parentElement
, (Extension
) entity
, removeListener
, style
);
1693 else if(entity
instanceof Marker
){
1694 element
= new MarkerElement(this, parentElement
, (Marker
) entity
, removeListener
, style
);
1696 else if(entity
instanceof Media
){
1697 element
= new MediaElement(this, parentElement
, (Media
) entity
, removeListener
, style
);
1699 else if(entity
instanceof MediaRepresentation
){
1700 element
= new MediaRepresentationElement(this, parentElement
, (MediaRepresentation
) entity
, removeListener
, style
);
1702 else if(entity
instanceof ImageFile
){
1703 element
= new ImageFileElement(this, parentElement
, (ImageFile
) entity
, removeListener
, style
);
1705 else if(entity
instanceof NomenclaturalStatus
){
1706 element
= new NomenclaturalStatusElement(this, parentElement
, (NomenclaturalStatus
) entity
, removeListener
, style
);
1708 else if(entity
instanceof Rights
){
1709 element
= new RightsElement(this, parentElement
, (Rights
) entity
, removeListener
, style
);
1711 else if(entity
instanceof DescriptionElementSource
){
1712 element
= new DescriptionElementSourceElement(this, parentElement
, (DescriptionElementSource
) entity
, removeListener
, style
);
1714 else if(entity
instanceof IdentifiableSource
){
1715 element
= new IdentifiableSourceElement(this, parentElement
, (IdentifiableSource
) entity
, removeListener
, style
);
1717 else if(entity
instanceof Scope
){
1718 element
= new ScopeElement(this, parentElement
, (Scope
) entity
, removeListener
, style
);
1720 else if(entity
instanceof Modifier
){
1721 element
= new ModifierElement(this, parentElement
, (Modifier
) entity
, removeListener
, style
);
1723 else if(entity
instanceof Reference
){
1724 element
= new DescriptionSourceElement(this, parentElement
, (Reference
) entity
, removeListener
, style
);
1726 else if(entity
instanceof NameTypeDesignation
){
1727 element
= new NameTypeDesignationElement(this, parentElement
, (NameTypeDesignation
) entity
, removeListener
, style
);
1729 else if(entity
instanceof NameRelationship
){
1730 element
= new NameRelationshipDetailElement(this, parentElement
, (NameRelationship
) entity
, removeListener
, style
);
1732 else if(entity
instanceof SpecimenTypeDesignation
){
1733 element
= new SpecimenTypeDesignationElement(this, parentElement
, (SpecimenTypeDesignation
) entity
, removeListener
, style
);
1735 else if(entity
instanceof StateData
){
1736 element
= new StateDataElement(this, parentElement
, (StateData
) entity
, removeListener
, style
);
1738 else if(entity
instanceof StatisticalMeasurementValue
){
1739 element
= new StatisticalMeasurementValueElement(this, parentElement
, (StatisticalMeasurementValue
) entity
, removeListener
, style
);
1741 else if(entity
instanceof DerivedUnit
){
1742 element
= new DerivedUnitElement(this, parentElement
, (DerivedUnit
) entity
, removeListener
, style
);
1744 else if(entity
instanceof NamedArea
){
1745 element
= new NamedAreaDetailElement(this, parentElement
, (NamedArea
) entity
, removeListener
, style
);
1747 else if(entity
instanceof DeterminationEvent
){
1748 element
= new DeterminationEventDetailElement(this, parentElement
, (DeterminationEvent
) entity
, removeListener
, style
);
1750 else if(entity
instanceof Specimen
){
1751 element
= new SpecimenCollectionDetailElement(this, parentElement
, (Specimen
) entity
, removeListener
, style
);
1754 else if(entity
instanceof DescriptionElementBase
){
1755 // this is the special case for protologs, maybe we can do this differently when API improves
1756 DescriptionElementBase descriptionElement
= (DescriptionElementBase
) entity
;
1757 if(descriptionElement
.getFeature().equals(Feature
.PROTOLOGUE())){
1758 element
= new ProtologueElement(this, parentElement
, descriptionElement
, removeListener
, style
);
1762 if(element
== null){
1763 StoreUtil
.errorDialog("No element for entity", this, "Could not generate element for entity. " +
1764 "Looks like the case is not handled already. Check implementation. Entity: " + entity
, null);
1767 if(backgroundColor
!= null && !backgroundColor
.isDisposed()){
1768 element
.setBackgroundColor(backgroundColor
);
1772 parentElement
.addElement(element
);
1777 * <p>createSelectionElement</p>
1779 * @param selectionType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType} object.
1780 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1781 * @param labelString a {@link java.lang.String} object.
1782 * @param selectionType
1783 * @param selection a {@link eu.etaxonomy.cdm.model.common.IAnnotatableEntity} object.
1784 * @param style a int.
1785 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1786 * @return a {@link eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement} object.
1788 public AbstractSelectionElement
createSelectionElement(SelectionType selectionType
, ConversationHolder conversation
, ICdmFormElement parentElement
, String labelString
, ICdmBase selection
, int style
){
1789 AbstractSelectionElement element
= null;
1791 IAnnotatableEntity entity
= (IAnnotatableEntity
) HibernateProxyHelper
.deproxy(selection
);
1793 switch (selectionType
) {
1795 element
= new AgentSelectionElement(this, conversation
, parentElement
, labelString
, (TeamOrPersonBase
) entity
, style
);
1798 element
= new PersonSelectionElement(this, conversation
, parentElement
, labelString
, (Person
) entity
, style
);
1801 element
= new TeamSelectionElement(this, conversation
, parentElement
, labelString
, (Team
) entity
, style
);
1804 element
= new NomenclaturalAuthorTeamSelectionElement(this, conversation
, parentElement
, labelString
, (Team
) entity
, style
);
1807 element
= new InstitutionSelectionElement(this, conversation
, parentElement
, labelString
, (Institution
) entity
, style
);
1810 element
= new NameSelectionElement(this, conversation
, parentElement
, labelString
, (TaxonNameBase
) entity
, style
);
1813 element
= new ReferenceSelectionElement(this, conversation
, parentElement
, labelString
, (Reference
) entity
, style
);
1816 element
= new TaxonBaseSelectionElement(this, conversation
, parentElement
, labelString
, (TaxonBase
) entity
, style
);
1819 element
= new TaxonSelectionElement(this, conversation
, parentElement
, labelString
, (Taxon
) entity
, style
);
1822 element
= new SynonymSelectionElement(this, conversation
, parentElement
, labelString
, (Synonym
) entity
, style
);
1825 element
= new DerivedUnitBaseSelectionElement(this, conversation
, parentElement
, labelString
, (DerivedUnitBase
) entity
, style
);
1827 case FIELD_OBSERVATION
:
1828 element
= new FieldObservationSelectionElement(this, conversation
, parentElement
, labelString
, (FieldObservation
) entity
, style
);
1831 element
= new FeatureTreeSelectionElement(this, conversation
, parentElement
, labelString
, (FeatureTree
) entity
, style
);
1833 case CLASSIFICATION
:
1834 element
= new ClassificationSelectionElement(this, conversation
, parentElement
, labelString
, (Classification
) entity
, style
);
1837 element
= new TaxonNodeSelectionElement(this, conversation
, parentElement
, labelString
, (TaxonNode
) entity
, style
);
1840 element
= new CollectionSelectionElement(this, conversation
, parentElement
, labelString
, (Collection
) entity
, style
);
1843 element
= new FeatureSelectionElement(this, conversation
, parentElement
, labelString
, (Feature
) entity
, style
);
1845 case POLYTOMOUS_KEY
:
1846 element
= new PolytomousKeySelectionElement(this, conversation
, parentElement
, labelString
, (PolytomousKey
) entity
, style
);
1848 case POLYTOMOUS_KEY_NODE
:
1849 element
= new PolytomousKeyNodeSelectionElement(this, conversation
, parentElement
, labelString
, (PolytomousKeyNode
) entity
, style
);
1852 new RuntimeException("There is no selection composite for the desired selection type.");
1857 parentElement
.addElement(element
);
1862 * <p>createNamedAreaSelectionElement</p>
1864 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1865 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1866 * @param labelString a {@link java.lang.String} object.
1867 * @param selection a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
1868 * @param style a int.
1869 * @return a {@link eu.etaxonomy.taxeditor.ui.selection.NamedAreaSelectionElement} object.
1871 public NamedAreaSelectionElement
createNamedAreaSelectionElement(ICdmFormElement parentElement
, ConversationHolder conversation
, String labelString
, NamedArea selection
, int style
){
1872 NamedAreaSelectionElement element
= new NamedAreaSelectionElement(this, conversation
, parentElement
, labelString
, selection
, style
);
1874 parentElement
.addElement(element
);
1878 /** {@inheritDoc} */
1879 public LabelElement
createLabel(ICdmFormElement parentElement
, String text
) {
1880 LabelElement labelElement
= new LabelElement(this, parentElement
, text
);
1881 adapt(labelElement
);
1882 parentElement
.addElement(labelElement
);
1883 return labelElement
;
1887 * <p>Getter for the field <code>selectionProvider</code>.</p>
1889 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1891 public ISelectionProvider
getSelectionProvider() {
1892 return selectionProvider
;
1896 * <p>createDetailedDescriptionDetailElement</p>
1898 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1899 * @param entity a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
1900 * @param style a int.
1901 * @return a {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement} object.
1903 public AbstractDetailedDescriptionDetailElement
createDetailedDescriptionDetailElement(
1904 ICdmFormElement parentElement
, DescriptionElementBase entity
, int style
) {
1905 AbstractDetailedDescriptionDetailElement detailedDescriptionElement
= null;
1908 if(entity
instanceof CategoricalData
){
1909 detailedDescriptionElement
= new CategoricalDataDetailElement(this, parentElement
, (CategoricalData
) entity
, style
);
1911 else if(entity
instanceof CommonTaxonName
){
1912 detailedDescriptionElement
= new CommonNameDetailElement(this, parentElement
, (CommonTaxonName
) entity
, style
);
1914 else if(entity
instanceof Distribution
){
1915 detailedDescriptionElement
= new DistributionDetailElement(this, parentElement
, (Distribution
) entity
, style
);
1917 else if(entity
instanceof IndividualsAssociation
){
1918 detailedDescriptionElement
= new IndividualsAssociationDetailElement(this, parentElement
, (IndividualsAssociation
) entity
, style
);
1920 else if(entity
instanceof QuantitativeData
){
1921 detailedDescriptionElement
= new QuantitativeDataDetailElement(this, parentElement
, (QuantitativeData
) entity
, style
);
1923 else if(entity
instanceof TaxonInteraction
){
1924 detailedDescriptionElement
= new TaxonInteractionDetailElement(this, parentElement
, (TaxonInteraction
) entity
, style
);
1926 else if(entity
instanceof TextData
){
1927 detailedDescriptionElement
= new TextDataDetailElement(this, parentElement
, (TextData
) entity
, style
);
1930 throw new IllegalStateException("There is no interface for the given description element");
1932 adapt(detailedDescriptionElement
);
1933 parentElement
.addElement(detailedDescriptionElement
);
1934 return detailedDescriptionElement
;
1940 * Creates a styled text as a part of the form.
1945 * the text initial value
1948 * @return the text widget
1950 public StyledText
createStyledText(Composite parent
, String value
, int style
) {
1951 StyledText text
= new StyledText(parent
, getBorderStyle() | style
| getOrientation());
1953 text
.setText(value
);
1954 text
.setForeground(getColors().getForeground());
1955 text
.setBackground(getColors().getBackground());
1956 // text.addFocusListener(visibilityHandler);