4 package eu
.etaxonomy
.taxeditor
.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
.editor
.EditorUtil
;
124 import eu
.etaxonomy
.taxeditor
.forms
.selection
.AbstractSelectionElement
;
125 import eu
.etaxonomy
.taxeditor
.forms
.selection
.AgentSelectionElement
;
126 import eu
.etaxonomy
.taxeditor
.forms
.selection
.ClassificationSelectionElement
;
127 import eu
.etaxonomy
.taxeditor
.forms
.selection
.CollectionSelectionElement
;
128 import eu
.etaxonomy
.taxeditor
.forms
.selection
.DerivedUnitBaseSelectionElement
;
129 import eu
.etaxonomy
.taxeditor
.forms
.selection
.FeatureSelectionElement
;
130 import eu
.etaxonomy
.taxeditor
.forms
.selection
.FeatureTreeSelectionElement
;
131 import eu
.etaxonomy
.taxeditor
.forms
.selection
.FieldObservationSelectionElement
;
132 import eu
.etaxonomy
.taxeditor
.forms
.selection
.InstitutionSelectionElement
;
133 import eu
.etaxonomy
.taxeditor
.forms
.selection
.NameSelectionElement
;
134 import eu
.etaxonomy
.taxeditor
.forms
.selection
.NamedAreaSelectionElement
;
135 import eu
.etaxonomy
.taxeditor
.forms
.selection
.NomenclaturalAuthorTeamSelectionElement
;
136 import eu
.etaxonomy
.taxeditor
.forms
.selection
.PersonSelectionElement
;
137 import eu
.etaxonomy
.taxeditor
.forms
.selection
.PolytomousKeyNodeSelectionElement
;
138 import eu
.etaxonomy
.taxeditor
.forms
.selection
.PolytomousKeySelectionElement
;
139 import eu
.etaxonomy
.taxeditor
.forms
.selection
.ReferenceSelectionElement
;
140 import eu
.etaxonomy
.taxeditor
.forms
.selection
.SynonymSelectionElement
;
141 import eu
.etaxonomy
.taxeditor
.forms
.selection
.TaxonBaseSelectionElement
;
142 import eu
.etaxonomy
.taxeditor
.forms
.selection
.TaxonNodeSelectionElement
;
143 import eu
.etaxonomy
.taxeditor
.forms
.selection
.TaxonSelectionElement
;
144 import eu
.etaxonomy
.taxeditor
.forms
.selection
.TeamSelectionElement
;
145 import eu
.etaxonomy
.taxeditor
.forms
.term
.AbstractEnumComboElement
;
146 import eu
.etaxonomy
.taxeditor
.forms
.term
.AbstractTermComboElement
;
147 import eu
.etaxonomy
.taxeditor
.forms
.term
.AnnotationTypeComboElement
;
148 import eu
.etaxonomy
.taxeditor
.forms
.term
.DeterminationModifierComboElement
;
149 import eu
.etaxonomy
.taxeditor
.forms
.term
.EmptyComboElement
;
150 import eu
.etaxonomy
.taxeditor
.forms
.term
.ExtensionTypeComboElement
;
151 import eu
.etaxonomy
.taxeditor
.forms
.term
.LanguageComboElement
;
152 import eu
.etaxonomy
.taxeditor
.forms
.term
.MarkerTypeComboElement
;
153 import eu
.etaxonomy
.taxeditor
.forms
.term
.MeasurementUnitComboElement
;
154 import eu
.etaxonomy
.taxeditor
.forms
.term
.ModifierComboElement
;
155 import eu
.etaxonomy
.taxeditor
.forms
.term
.NameRelationshipTypeComboElement
;
156 import eu
.etaxonomy
.taxeditor
.forms
.term
.NameTypeDesignationStatusComboElement
;
157 import eu
.etaxonomy
.taxeditor
.forms
.term
.NamedAreaTypeComboElement
;
158 import eu
.etaxonomy
.taxeditor
.forms
.term
.NomenclaturalCodeComboElement
;
159 import eu
.etaxonomy
.taxeditor
.forms
.term
.NomenclaturalStatusTypeComboElement
;
160 import eu
.etaxonomy
.taxeditor
.forms
.term
.PresenceAbsenceTermComboElement
;
161 import eu
.etaxonomy
.taxeditor
.forms
.term
.PreservationMethodComboElement
;
162 import eu
.etaxonomy
.taxeditor
.forms
.term
.RankComboElement
;
163 import eu
.etaxonomy
.taxeditor
.forms
.term
.ReferenceSystemComboElement
;
164 import eu
.etaxonomy
.taxeditor
.forms
.term
.ReferenceTypeComboElement
;
165 import eu
.etaxonomy
.taxeditor
.forms
.term
.RightsTypeComboElement
;
166 import eu
.etaxonomy
.taxeditor
.forms
.term
.ScopeComboElement
;
167 import eu
.etaxonomy
.taxeditor
.forms
.term
.SexComboElement
;
168 import eu
.etaxonomy
.taxeditor
.forms
.term
.SpecimenTypeDesignationStatusComboElement
;
169 import eu
.etaxonomy
.taxeditor
.forms
.term
.StageComboElement
;
170 import eu
.etaxonomy
.taxeditor
.forms
.term
.StateComboElement
;
171 import eu
.etaxonomy
.taxeditor
.forms
.term
.StatisticalMeasureComboElement
;
172 import eu
.etaxonomy
.taxeditor
.section
.AbstractCdmDetailElement
;
173 import eu
.etaxonomy
.taxeditor
.section
.AbstractEntityCollectionElement
;
174 import eu
.etaxonomy
.taxeditor
.section
.EmptyElement
;
175 import eu
.etaxonomy
.taxeditor
.section
.agent
.InstitutionDetailElement
;
176 import eu
.etaxonomy
.taxeditor
.section
.agent
.InstitutionDetailSection
;
177 import eu
.etaxonomy
.taxeditor
.section
.agent
.PersonDetailElement
;
178 import eu
.etaxonomy
.taxeditor
.section
.agent
.PersonDetailSection
;
179 import eu
.etaxonomy
.taxeditor
.section
.agent
.TeamDetailElement
;
180 import eu
.etaxonomy
.taxeditor
.section
.agent
.TeamDetailSection
;
181 import eu
.etaxonomy
.taxeditor
.section
.agent
.TeamMemberElement
;
182 import eu
.etaxonomy
.taxeditor
.section
.agent
.TeamMemberSection
;
183 import eu
.etaxonomy
.taxeditor
.section
.agent
.TeamOrPersonBaseDetailSection
;
184 import eu
.etaxonomy
.taxeditor
.section
.classification
.ClassificationDetailElement
;
185 import eu
.etaxonomy
.taxeditor
.section
.classification
.ClassificationDetailSection
;
186 import eu
.etaxonomy
.taxeditor
.section
.classification
.TaxonNodeDetailElement
;
187 import eu
.etaxonomy
.taxeditor
.section
.classification
.TaxonNodeDetailSection
;
188 import eu
.etaxonomy
.taxeditor
.section
.description
.DerivedUnitElement
;
189 import eu
.etaxonomy
.taxeditor
.section
.description
.DescribedSpecimenSection
;
190 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionDetailElement
;
191 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionDetailSection
;
192 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionElementDetailElement
;
193 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionElementDetailSection
;
194 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionElementMediaSection
;
195 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionElementSourceElement
;
196 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionElementSourceSection
;
197 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionSourceElement
;
198 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionSourceSection
;
199 import eu
.etaxonomy
.taxeditor
.section
.description
.ModifierElement
;
200 import eu
.etaxonomy
.taxeditor
.section
.description
.ModifierSection
;
201 import eu
.etaxonomy
.taxeditor
.section
.description
.NaturalLanguageDetailElement
;
202 import eu
.etaxonomy
.taxeditor
.section
.description
.NaturalLanguageSection
;
203 import eu
.etaxonomy
.taxeditor
.section
.description
.ScopeElement
;
204 import eu
.etaxonomy
.taxeditor
.section
.description
.ScopeSection
;
205 import eu
.etaxonomy
.taxeditor
.section
.description
.StateDataElement
;
206 import eu
.etaxonomy
.taxeditor
.section
.description
.StateDataSection
;
207 import eu
.etaxonomy
.taxeditor
.section
.description
.StatisticalMeasurementValueElement
;
208 import eu
.etaxonomy
.taxeditor
.section
.description
.StatisticalMeasurementValueSection
;
209 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.AbstractDetailedDescriptionDetailElement
;
210 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.CategoricalDataDetailElement
;
211 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.CommonNameDetailElement
;
212 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.DistributionDetailElement
;
213 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.IndividualsAssociationDetailElement
;
214 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.QuantitativeDataDetailElement
;
215 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.TaxonInteractionDetailElement
;
216 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.TextDataDetailElement
;
217 import eu
.etaxonomy
.taxeditor
.section
.feature
.FeatureDistributionDetailElement
;
218 import eu
.etaxonomy
.taxeditor
.section
.feature
.FeatureDistributionDetailSection
;
219 import eu
.etaxonomy
.taxeditor
.section
.key
.GeographicalScopeDetailSection
;
220 import eu
.etaxonomy
.taxeditor
.section
.key
.PolytomousKeyDetailElement
;
221 import eu
.etaxonomy
.taxeditor
.section
.key
.PolytomousKeyDetailSection
;
222 import eu
.etaxonomy
.taxeditor
.section
.key
.PolytomousKeyNodeDetailElement
;
223 import eu
.etaxonomy
.taxeditor
.section
.key
.PolytomousKeyNodeDetailSection
;
224 import eu
.etaxonomy
.taxeditor
.section
.key
.ScopeRestrictionSection
;
225 import eu
.etaxonomy
.taxeditor
.section
.name
.AuthorshipDetailElement
;
226 import eu
.etaxonomy
.taxeditor
.section
.name
.AuthorshipDetailSection
;
227 import eu
.etaxonomy
.taxeditor
.section
.name
.HybridDetailElement
;
228 import eu
.etaxonomy
.taxeditor
.section
.name
.HybridDetailSection
;
229 import eu
.etaxonomy
.taxeditor
.section
.name
.NameDetailElement
;
230 import eu
.etaxonomy
.taxeditor
.section
.name
.NameDetailSection
;
231 import eu
.etaxonomy
.taxeditor
.section
.name
.NameRelationshipDetailElement
;
232 import eu
.etaxonomy
.taxeditor
.section
.name
.NameRelationshipDetailSection
;
233 import eu
.etaxonomy
.taxeditor
.section
.name
.NameTypeDesignationElement
;
234 import eu
.etaxonomy
.taxeditor
.section
.name
.NomenclaturalStatusElement
;
235 import eu
.etaxonomy
.taxeditor
.section
.name
.NomenclaturalStatusSection
;
236 import eu
.etaxonomy
.taxeditor
.section
.name
.NonViralNameDetailElement
;
237 import eu
.etaxonomy
.taxeditor
.section
.name
.NonViralNameDetailSection
;
238 import eu
.etaxonomy
.taxeditor
.section
.name
.ProtologueElement
;
239 import eu
.etaxonomy
.taxeditor
.section
.name
.ProtologueSection
;
240 import eu
.etaxonomy
.taxeditor
.section
.name
.SpecimenTypeDesignationElement
;
241 import eu
.etaxonomy
.taxeditor
.section
.name
.TypeDesignationSection
;
242 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.CollectingAreasDetailSection
;
243 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.CollectionDetailElement
;
244 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DerivedUnitBaseDetailElement
;
245 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DerivedUnitBaseDetailSection
;
246 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DerivedUnitFacadeDetailElement
;
247 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DerivedUnitFacadeDetailSection
;
248 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DeterminationEventDetailElement
;
249 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DeterminationEventDetailSection
;
250 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.FieldObservationDetailElement
;
251 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.FieldObservationDetailSection
;
252 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.GatheringEventDetailElement
;
253 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.GatheringEventDetailSection
;
254 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.GeneralDetailElement
;
255 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.GeneralDetailSection
;
256 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.NamedAreaDetailElement
;
257 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.SourceCollectionDetailSection
;
258 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.SpecimenCollectionDetailElement
;
259 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.SpecimenCollectionDetailSection
;
260 import eu
.etaxonomy
.taxeditor
.section
.reference
.NomenclaturalReferenceDetailElement
;
261 import eu
.etaxonomy
.taxeditor
.section
.reference
.NomenclaturalReferenceDetailSection
;
262 import eu
.etaxonomy
.taxeditor
.section
.reference
.ReferenceDetailElement
;
263 import eu
.etaxonomy
.taxeditor
.section
.reference
.ReferenceDetailSection
;
264 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.AnnotationElement
;
265 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.AnnotationSection
;
266 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.CreditElement
;
267 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.CreditSection
;
268 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.ExtensionElement
;
269 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.ExtensionSection
;
270 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.HeadlineSection
;
271 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.IdentifiableSourceElement
;
272 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.ImageFileElement
;
273 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MarkerElement
;
274 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MarkerSection
;
275 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MediaElement
;
276 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MediaRepresentationElement
;
277 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MediaRepresentationPartSection
;
278 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MediaRepresentationSection
;
279 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MediaSection
;
280 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.RightsElement
;
281 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.RightsSection
;
282 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.SourceSection
;
283 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.VersionElement
;
284 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.VersionSection
;
285 import eu
.etaxonomy
.taxeditor
.section
.taxon
.ParsingMessageElement
;
286 import eu
.etaxonomy
.taxeditor
.section
.taxon
.ParsingMessagesSection
;
287 import eu
.etaxonomy
.taxeditor
.section
.taxon
.TaxonBaseDetailElement
;
288 import eu
.etaxonomy
.taxeditor
.section
.taxon
.TaxonBaseDetailSection
;
291 * <p>CdmFormFactory class.</p>
294 * @created Feb 24, 2010
297 public class CdmFormFactory
extends FormToolkit
{
299 private BoldFontHolder2 boldFontHolder2
;
300 private MouseListener selectionMouseHandler
;
301 private FocusListener selectionFocusHandler
;
303 private Set selectionListenerList
= new HashSet();
305 private List
<IPropertyChangeListener
> propertyChangeListeners
= new ArrayList
<IPropertyChangeListener
>();
307 private int orientation
= Window
.getDefaultOrientation();
308 private ISelectionProvider selectionProvider
;
313 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
315 public static final TableWrapLayout
LAYOUT(){
316 return LAYOUT(1, false);
322 * @param columns a int.
323 * @param equalWidth a boolean.
324 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
326 public static final TableWrapLayout
LAYOUT(int columns
, boolean equalWidth
){
327 TableWrapLayout layout
= new TableWrapLayout();
328 layout
.topMargin
= 0;
329 layout
.rightMargin
= 0;
330 layout
.bottomMargin
= 0;
331 layout
.leftMargin
= 0;
332 layout
.numColumns
= columns
;
333 layout
.makeColumnsEqualWidth
= equalWidth
;
334 layout
.verticalSpacing
= 0;
335 layout
.horizontalSpacing
= 0;
342 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
344 public static final TableWrapData
FILL(){
351 * @param horizontalSpan a int.
352 * @param verticalSpan a int.
353 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
355 public static final TableWrapData
FILL(int horizontalSpan
, int verticalSpan
){
356 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.FILL_GRAB
);
357 layoutData
.colspan
= horizontalSpan
;
358 layoutData
.rowspan
= verticalSpan
;
365 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
367 public static final TableWrapData
LEFT(){
368 return new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
);
374 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
376 public static final TableWrapData
RIGHT(){
377 return new TableWrapData(TableWrapData
.RIGHT
, TableWrapData
.TOP
);
381 * <p>FILL_HORIZONTALLY</p>
383 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
385 public static final TableWrapData
FILL_HORIZONTALLY(){
386 return FILL_HORIZONTALLY(1, 1);
390 * <p>FILL_HORIZONTALLY</p>
392 * @param horizontalSpan a int.
393 * @param verticalSpan a int.
394 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
396 public static final TableWrapData
FILL_HORIZONTALLY(int horizontalSpan
, int verticalSpan
){
397 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
);
398 layoutData
.colspan
= horizontalSpan
;
399 layoutData
.rowspan
= verticalSpan
;
403 /** Constant <code>EMPTY_SELECTION</code> */
404 public static ISelection EMPTY_SELECTION
= new ISelection() {
405 public boolean isEmpty() {
410 private class SelectionMouseHandler
extends MouseAdapter
{
412 public void mouseDown(MouseEvent e
) {
413 notifySelectionListeners(e
);
417 private class SelectionFocusHandler
extends FocusAdapter
{
419 public void focusGained(FocusEvent e
) {
420 notifySelectionListeners(e
);
424 private void notifySelectionListeners(TypedEvent e
){
425 Event event
= new Event();
426 event
.widget
= e
.widget
;
427 SelectionEvent selectionEvent
= new SelectionEvent(event
);
429 for(Object listener
: selectionListenerList
){
430 ((SelectionListener
) listener
).widgetSelected(selectionEvent
);
435 * <p>Constructor for CdmFormFactory.</p>
437 * @param display a {@link org.eclipse.swt.widgets.Display} object.
438 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
440 public CdmFormFactory(Display display
, ISelectionProvider selectionProvider
) {
442 this.selectionProvider
= selectionProvider
;
447 * <p>Constructor for CdmFormFactory.</p>
449 * @param display a {@link org.eclipse.swt.widgets.Display} object.
451 public CdmFormFactory(Display display
){
459 private void init() {
460 boldFontHolder2
= new BoldFontHolder2();
461 selectionMouseHandler
= new SelectionMouseHandler();
462 selectionFocusHandler
= new SelectionFocusHandler();
466 * Creates an instance initialized with the correct selectionProvider
468 * Make sure to remove the instance when the entityComposite disposes via
469 * destroySelectionArbitrator(..)
471 * @param entityElement a {@link eu.etaxonomy.taxeditor.forms.IEntityElement} object.
472 * @return a {@link eu.etaxonomy.taxeditor.forms.SelectionArbitrator} object.
474 public SelectionArbitrator
createSelectionArbitrator(IEntityElement entityElement
){
475 SelectionArbitrator selectionArbitrator
= new SelectionArbitrator(entityElement
);
476 selectionArbitrator
.addSelectionProvider(selectionProvider
);
477 selectionProvider
.addSelectionChangedListener(selectionArbitrator
);
478 addSelectionListener(selectionArbitrator
);
479 return selectionArbitrator
;
483 * <p>destroySelectionArbitrator</p>
485 * @param selectionArbitrator a {@link eu.etaxonomy.taxeditor.forms.SelectionArbitrator} object.
487 public void destroySelectionArbitrator(SelectionArbitrator selectionArbitrator
){
488 removeSelectionListener(selectionArbitrator
);
489 if(selectionProvider
!= null){
490 selectionProvider
.removeSelectionChangedListener(selectionArbitrator
);
492 EditorUtil
.error(this.getClass(), "Tried to destroy a selection listener from this factories listeners but was null", null);
498 public void adapt(Composite composite
) {
499 composite
.addMouseListener(selectionMouseHandler
);
500 super.adapt(composite
);
506 * @param formElement a {@link eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement} object.
508 public void adapt(AbstractCdmFormElement formElement
){
509 formElement
.setPropertyChangeListeners(propertyChangeListeners
);
514 public void adapt(Control control
, boolean trackFocus
, boolean trackKeyboard
) {
516 control
.addFocusListener(selectionFocusHandler
);
518 super.adapt(control
, trackFocus
, trackKeyboard
);
522 * <p>destroyElement</p>
524 * @param formElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
526 public void destroyElement(ICdmFormElement formElement
){
527 // return if element was not initialized
528 if(formElement
== null){
531 // destroy selection arbitrator, if any
532 if(formElement
instanceof ISelectableElement
){
533 destroySelectionArbitrator(((ISelectableElement
) formElement
).getSelectionArbitrator());
535 // remove this element form its parents list of elements
536 // ICdmFormElement parentElement = formElement.getParentElement();
537 // if(parentElement != null){
538 // parentElement.removeElement(formElement);
540 // call destroy on child elements recursively
541 for(ICdmFormElement childElement
: formElement
.getElements()){
542 destroyElement(childElement
);
544 // dispose of the controls
545 for(Control control
: formElement
.getControls()){
546 // we added the layoutComposite of the parental element as the layout composite to this formElement
547 // but we do not want to destroy it.
548 if(control
.equals(formElement
.getLayoutComposite())){
559 * <p>createEmptyCell</p>
561 * @param parent a {@link org.eclipse.swt.widgets.Composite} object.
562 * @return a {@link org.eclipse.swt.widgets.Label} object.
564 public Label
createEmptyCell(Composite parent
){
565 return this.createLabel(parent
, null);
569 * <p>createMultilineTextWithLabel</p>
571 * @param labelString a {@link java.lang.String} object.
572 * @param textHeight a int.
573 * @param style a int.
574 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
575 * @return a {@link eu.etaxonomy.taxeditor.forms.TextWithLabelElement} object.
577 public TextWithLabelElement
createMultilineTextWithLabel(ICdmFormElement parentElement
, String labelString
, int textHeight
, int style
){
578 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, labelString
, "", textHeight
, style
);
580 parentElement
.addElement(element
);
586 * <p>createMultiLanguageTextElement</p>
588 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
589 * @param labelString a {@link java.lang.String} object.
590 * @param multilanguageText a {@link java.util.Map} object.
591 * @param textHeight a int.
592 * @param style a int.
593 * @return a {@link eu.etaxonomy.taxeditor.forms.MultilanguageTextElement} object.
595 public MultilanguageTextElement
createMultiLanguageTextElement(
596 ICdmFormElement parentElement
, String labelString
, Map
<Language
, LanguageString
> multilanguageText
, int textHeight
,
598 MultilanguageTextElement element
= new MultilanguageTextElement(this, parentElement
, labelString
, multilanguageText
, textHeight
, style
);
600 parentElement
.addElement(element
);
604 public KeyStatementElement
createKeyStatementElement(ICdmFormElement parentElement
, String labelString
,
605 KeyStatement keyStatement
, int textHeight
, int style
){
606 KeyStatementElement element
= new KeyStatementElement(this, parentElement
, labelString
, keyStatement
, textHeight
, style
);
608 parentElement
.addElement(element
);
614 * <p>createTextWithLabelElement</p>
616 * @param labelString a {@link java.lang.String} object.
617 * @param initialText a {@link java.lang.String} object.
618 * @param style a int.
619 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
620 * @return a {@link eu.etaxonomy.taxeditor.forms.TextWithLabelElement} object.
622 public TextWithLabelElement
createTextWithLabelElement(ICdmFormElement parentElement
, String labelString
, String initialText
, int style
){
623 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, labelString
, initialText
, null, style
);
625 parentElement
.addElement(element
);
629 public UriWithLabelElement
createUriWithLabelElement(ICdmFormElement parentElement
, String labelString
, URI initialUri
, int style
){
630 UriWithLabelElement element
= new UriWithLabelElement(this, parentElement
, labelString
, initialUri
, null, style
);
632 parentElement
.addElement(element
);
637 * <p>createIntegerTextWithLabelElement</p>
639 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
640 * @param labelString a {@link java.lang.String} object.
641 * @param initialInteger a {@link java.lang.Integer} object.
642 * @param style a int.
643 * @return a {@link eu.etaxonomy.taxeditor.forms.NumberWithLabelElement} object.
645 public NumberWithLabelElement
createIntegerTextWithLabelElement(ICdmFormElement parentElement
, String labelString
, Integer initialInteger
, int style
){
646 NumberWithLabelElement element
= new NumberWithLabelElement(this, parentElement
, labelString
, initialInteger
, style
);
648 parentElement
.addElement(element
);
654 * <p>createFloatTextWithLabelElement</p>
656 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
657 * @param labelString a {@link java.lang.String} object.
658 * @param initialFloat a float.
659 * @param style a int.
660 * @return a {@link eu.etaxonomy.taxeditor.forms.NumberWithLabelElement} object.
662 public NumberWithLabelElement
createFloatTextWithLabelElement(
663 ICdmFormElement parentElement
, String labelString
, float initialFloat
,
665 NumberWithLabelElement element
= new NumberWithLabelElement(this, parentElement
, labelString
, initialFloat
, style
);
667 parentElement
.addElement(element
);
672 * <p>createLanguageStringWithLabelElement</p>
674 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
675 * @param labelString a {@link java.lang.String} object.
676 * @param languageString a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
677 * @param style a int.
678 * @return a {@link eu.etaxonomy.taxeditor.forms.LanguageStringWithLabelElement} object.
680 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(ICdmFormElement parentElement
, String labelString
, LanguageString languageString
, int style
){
681 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(this, parentElement
, labelString
, languageString
, style
);
683 parentElement
.addElement(element
);
688 * <p>createLanguageStringWithLabelElement</p>
690 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
691 * @param labelString a {@link java.lang.String} object.
692 * @param languageString a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
693 * @param height a int.
694 * @param style a int.
695 * @return a {@link eu.etaxonomy.taxeditor.forms.LanguageStringWithLabelElement} object.
697 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(ICdmFormElement parentElement
, String labelString
, LanguageString languageString
, int height
, int style
){
698 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(this, parentElement
, labelString
, languageString
, height
, style
);
700 parentElement
.addElement(element
);
705 * <p>createTextElement</p>
707 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
708 * @param initialText a {@link java.lang.String} object.
709 * @param style a int.
710 * @return a {@link eu.etaxonomy.taxeditor.forms.TextWithLabelElement} object.
712 public TextWithLabelElement
createTextElement(ICdmFormElement parentElement
, String initialText
, int style
){
713 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, null, initialText
, null, style
);
715 parentElement
.addElement(element
);
720 * <p>createKeyValueViewerElement</p>
722 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
723 * @param keyHeading a {@link java.lang.String} object.
724 * @param valueHeading a {@link java.lang.String} object.
725 * @param map a {@link java.util.Map} object.
726 * @return a {@link eu.etaxonomy.taxeditor.forms.KeyValueViewerElement} object.
728 public KeyValueViewerElement
createKeyValueViewerElement(ICdmFormElement parentElement
, String keyHeading
, String valueHeading
, Map
<Object
, Object
> map
){
729 KeyValueViewerElement element
= new KeyValueViewerElement(this, parentElement
, keyHeading
, valueHeading
, map
);
731 parentElement
.addElement(element
);
736 public static enum TermComboType
{
740 NOMENCLATURALSTATUSTYPE
,
745 PRESENCEABSENCESTATUS
,
747 NAMETYPEDESIGNATIONSTATUS
,
748 SPECIMENTYPEDESIGNATIONSTATUS
,
758 DETERMINATION_MODIFIER
,
763 * <p>createTermComboElement</p>
765 * @param termComboType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.TermComboType} object.
766 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
767 * @param labelString a {@link java.lang.String} object.
768 * @param selection a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase} object.
769 * @param style a int.
770 * @return a {@link eu.etaxonomy.taxeditor.forms.term.AbstractTermComboElement} object.
772 public AbstractTermComboElement
createTermComboElement(TermComboType termComboType
, ICdmFormElement parentElement
, String labelString
, DefinedTermBase selection
, int style
){
773 AbstractTermComboElement element
= null;
775 switch(termComboType
){
777 element
= new EmptyComboElement
<DefinedTermBase
>(this, parentElement
, labelString
, style
);
780 element
= new ExtensionTypeComboElement(this, parentElement
, labelString
, (ExtensionType
) selection
, style
);
783 element
= new LanguageComboElement(this, parentElement
, labelString
, (Language
) selection
, style
);
786 element
= new MarkerTypeComboElement(this, parentElement
, labelString
, (MarkerType
) selection
, style
);
788 case NOMENCLATURALSTATUSTYPE
:
789 element
= new NomenclaturalStatusTypeComboElement(this, parentElement
, labelString
, (NomenclaturalStatusType
) selection
, style
);
792 element
= new RankComboElement(this, parentElement
, labelString
, (Rank
) selection
, style
);
795 element
= new RightsTypeComboElement(this, parentElement
, labelString
, (RightsTerm
) selection
, style
);
797 case NAMERELATIONSHIP
:
798 element
= new NameRelationshipTypeComboElement(this, parentElement
, labelString
, (NameRelationshipType
) selection
, style
);
801 element
= new NamedAreaTypeComboElement(this, parentElement
, labelString
, (NamedAreaType
) selection
, style
);
804 element
= new AnnotationTypeComboElement(this, parentElement
, labelString
, (AnnotationType
) selection
, style
);
806 case PRESENCEABSENCESTATUS
:
807 element
= new PresenceAbsenceTermComboElement(this, parentElement
, labelString
, (PresenceAbsenceTermBase
) selection
, style
);
809 case NAMETYPEDESIGNATIONSTATUS
:
810 element
= new NameTypeDesignationStatusComboElement(this, parentElement
, labelString
, (NameTypeDesignationStatus
) selection
, style
);
812 case SPECIMENTYPEDESIGNATIONSTATUS
:
813 element
= new SpecimenTypeDesignationStatusComboElement(this, parentElement
, labelString
, (SpecimenTypeDesignationStatus
) selection
, style
);
816 element
= new SexComboElement(this, parentElement
, labelString
, (Sex
) selection
, style
);
819 element
= new StageComboElement(this, parentElement
, labelString
, (Stage
) selection
, style
);
821 case PRESERVATION_METHOD
:
822 element
= new PreservationMethodComboElement(this, parentElement
, labelString
, (PreservationMethod
) selection
, style
);
824 case MEASUREMENT_UNIT
:
825 element
= new MeasurementUnitComboElement(this, parentElement
, labelString
, (MeasurementUnit
) selection
, style
);
828 element
= new StateComboElement(this, parentElement
, labelString
, (State
) selection
, style
);
831 element
= new ScopeComboElement(this, parentElement
, labelString
, (Scope
) selection
, style
);
834 element
= new ModifierComboElement(this, parentElement
, labelString
, (Modifier
) selection
, style
);
836 case STATISTICAL_MEASURE
:
837 element
= new StatisticalMeasureComboElement(this, parentElement
, labelString
, (StatisticalMeasure
) selection
, style
);
839 case DETERMINATION_MODIFIER
:
840 element
= new DeterminationModifierComboElement(this, parentElement
, labelString
, (DeterminationModifier
) selection
, style
);
842 case REFERENCE_SYSTEM
:
843 element
= new ReferenceSystemComboElement(this, parentElement
, labelString
, (ReferenceSystem
) selection
, style
);
848 parentElement
.addElement(element
);
852 public static enum EnumComboType
{
858 * <p>createEnumComboElement</p>
860 * @param enumComboType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.EnumComboType} object.
861 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
862 * @param style a int.
863 * @return a {@link eu.etaxonomy.taxeditor.forms.term.AbstractEnumComboElement} object.
865 public AbstractEnumComboElement
createEnumComboElement(EnumComboType enumComboType
, ICdmFormElement parentElement
, int style
){
866 AbstractEnumComboElement element
= null;
868 switch(enumComboType
){
870 element
= new ReferenceTypeComboElement(this, parentElement
, "Reference Type", null, style
);
872 case NOMENCLATURALCODE
:
873 element
= new NomenclaturalCodeComboElement(this, parentElement
, "Nomenclatural Code", null, style
);
877 parentElement
.addElement(element
);
882 * <p>createBrowserElement</p>
884 * @param imageUri a {@link java.net.URI} object.
885 * @param style a int.
886 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
887 * @return a {@link eu.etaxonomy.taxeditor.forms.BrowserElement} object.
889 public BrowserElement
createBrowserElement(ICdmFormElement parentElement
, URI imageUri
, int style
){
890 BrowserElement element
= new BrowserElement(this, parentElement
, imageUri
, style
);
892 parentElement
.addElement(element
);
897 * <p>createImageElement</p>
899 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
900 * @param imageUri a {@link java.net.URI} object.
901 * @param style a int.
902 * @return a {@link eu.etaxonomy.taxeditor.forms.ImageElement} object.
904 public ImageElement
createImageElement(ICdmFormElement parentElement
, URI imageUri
, int style
) {
905 ImageElement element
= new ImageElement(this, parentElement
, imageUri
, style
);
907 parentElement
.addElement(element
);
912 * <p>createTextActionElement</p>
914 * @param labelString a {@link java.lang.String} object.
915 * @param initialText a {@link java.lang.String} object.
916 * @param style a int.
917 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
918 * @param buttonLabel a {@link java.lang.String} object.
919 * @return a {@link eu.etaxonomy.taxeditor.forms.TextActionElement} object.
921 public TextActionElement
createTextActionElement(ICdmFormElement parentElement
, String labelString
, String buttonLabel
, String initialText
, int style
){
922 TextActionElement element
= new TextActionElement(this, parentElement
, labelString
, buttonLabel
, initialText
, style
);
924 parentElement
.addElement(element
);
931 * @created Mar 5, 2010
934 public static enum SelectionType
{
957 * <p>createCheckbox</p>
959 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
960 * @param label a {@link java.lang.String} object.
961 * @param initialState a boolean.
962 * @param style a int.
963 * @return a {@link eu.etaxonomy.taxeditor.forms.CheckboxElement} object.
965 public CheckboxElement
createCheckbox(ICdmFormElement parentElement
, String label
, boolean initialState
, int style
) {
966 CheckboxElement element
= new CheckboxElement(this, parentElement
, label
, initialState
, style
| orientation
);
968 parentElement
.addElement(element
);
975 * Creates a section as a part of the form.
977 * @return the section widget
978 * @param section a {@link eu.etaxonomy.taxeditor.forms.AbstractFormSection} object.
980 public Section
adapt(AbstractFormSection section
) {
981 section
.setMenu(section
.getLayoutComposite().getMenu());
982 adapt(section
, true, true);
984 // handle focus and property change events for cdm use
985 section
.addFocusListener(selectionFocusHandler
);
986 section
.setPropertyChangeListeners(propertyChangeListeners
);
988 if (section
.getToggle() != null) {
989 section
.getToggle().setHoverDecorationColor(getColors()
990 .getColor(IFormColors
.TB_TOGGLE_HOVER
));
991 section
.getToggle().setDecorationColor(getColors()
992 .getColor(IFormColors
.TB_TOGGLE
));
995 section
.setFont(boldFontHolder2
.getBoldFont(section
.getLayoutComposite().getFont()));
997 if ((section
.getStyle() & Section
.TITLE_BAR
) != 0
998 || (section
.getStyle() & Section
.SHORT_TITLE_BAR
) != 0) {
999 getColors().initializeSectionToolBarColors();
1000 section
.setTitleBarBackground(getColors().getColor(IFormColors
.TB_BG
));
1001 section
.setTitleBarBorderColor(getColors()
1002 .getColor(IFormColors
.TB_BORDER
));
1004 // call setTitleBarForeground regardless as it also sets the label color
1005 section
.setTitleBarForeground(getColors()
1006 .getColor(IFormColors
.TB_TOGGLE
));
1010 private class BoldFontHolder2
{
1011 private Font normalFont
;
1013 private Font boldFont
;
1015 public BoldFontHolder2() {
1018 public Font
getBoldFont(Font font
) {
1019 createBoldFont(font
);
1023 private void createBoldFont(Font font
) {
1024 if (normalFont
== null || !normalFont
.equals(font
)) {
1028 if (boldFont
== null) {
1029 boldFont
= FormFonts
.getInstance().getBoldFont(getColors().getDisplay(),
1034 public void dispose() {
1035 if (boldFont
!= null) {
1036 FormFonts
.getInstance().markFinished(boldFont
, getColors().getDisplay());
1043 * <p>createToggleableTextField</p>
1045 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1046 * @param labelString a {@link java.lang.String} object.
1047 * @param initialText a {@link java.lang.String} object.
1048 * @param initialState a boolean.
1049 * @param style a int.
1050 * @return a {@link eu.etaxonomy.taxeditor.forms.ToggleableTextElement} object.
1052 public ToggleableTextElement
createToggleableTextField(ICdmFormElement parentElement
,
1053 String labelString
, String initialText
, boolean initialState
, int style
) {
1054 ToggleableTextElement element
= new ToggleableTextElement(this, parentElement
,
1055 labelString
, initialText
, initialState
, style
| orientation
);
1057 parentElement
.addElement(element
);
1062 * <p>createTimePeriodElement</p>
1064 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1065 * @param labelString a {@link java.lang.String} object.
1066 * @param timePeriod a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1067 * @param style a int.
1068 * @return a {@link eu.etaxonomy.taxeditor.forms.TimePeriodElement} object.
1070 public TimePeriodElement
createTimePeriodElement(
1071 ICdmFormElement parentElement
, String labelString
, TimePeriod timePeriod
, int style
) {
1072 TimePeriodElement element
= new TimePeriodElement(this, parentElement
, labelString
, timePeriod
, style
);
1074 parentElement
.addElement(element
);
1080 * <p>createPointElement</p>
1082 * @param style a int.
1083 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1084 * @param point a {@link eu.etaxonomy.cdm.model.location.Point} object.
1085 * @return a {@link eu.etaxonomy.taxeditor.forms.PointElement} object.
1087 public PointElement
createPointElement(ICdmFormElement parentElement
,
1088 Point point
, int style
) {
1089 PointElement element
= new PointElement(this, parentElement
, point
, style
);
1091 parentElement
.addElement(element
);
1096 * <p>createDateDetailSection</p>
1098 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1099 * @param style a int.
1100 * @return a {@link eu.etaxonomy.taxeditor.forms.DateDetailSection} object.
1102 public DateDetailSection
createDateDetailSection(ICdmFormElement parentElement
, int style
){
1103 DateDetailSection section
= new DateDetailSection(this, parentElement
, style
);
1104 parentElement
.addElement(section
);
1110 * <p>createPartialElement</p>
1112 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1113 * @param labelString a {@link java.lang.String} object.
1114 * @param partial a {@link org.joda.time.Partial} object.
1115 * @param style a int.
1116 * @return a {@link eu.etaxonomy.taxeditor.forms.PartialElement} object.
1118 public PartialElement
createPartialElement(ICdmFormElement parentElement
, String labelString
, Partial partial
, int style
){
1119 PartialElement element
= new PartialElement(this, parentElement
, labelString
, style
);
1121 parentElement
.addElement(element
);
1126 * <p>addSelectionListener</p>
1128 * @param listener a {@link org.eclipse.swt.events.SelectionListener} object.
1130 public void addSelectionListener(SelectionListener listener
){
1131 selectionListenerList
.add(listener
);
1135 * <p>removeSelectionListener</p>
1137 * @param listener a {@link org.eclipse.swt.events.SelectionListener} object.
1139 public void removeSelectionListener(SelectionListener listener
){
1140 if(listener
== null){
1141 EditorUtil
.error(this.getClass(), "Tried to remove a selection listener from this factories listeners but was null", null);
1143 selectionListenerList
.remove(listener
);
1148 * <p>addPropertyChangeListener</p>
1150 * @param listener a {@link org.eclipse.jface.util.IPropertyChangeListener} object.
1152 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
1153 propertyChangeListeners
.add(0, listener
);
1157 * <p>removePropertyChangeListener</p>
1159 * @param listener a {@link org.eclipse.jface.util.IPropertyChangeListener} object.
1161 public void removePropertyChangeListener(IPropertyChangeListener listener
){
1162 propertyChangeListeners
.remove(listener
);
1168 * <p>createHorizontalSeparator</p>
1170 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1171 * @param style a int.
1172 * @return a {@link org.eclipse.swt.widgets.Label} object.
1174 public Label
createHorizontalSeparator(ICdmFormElement parentElement
, int style
) {
1175 Label separator
= this.createSeparator(parentElement
.getLayoutComposite(), SWT
.HORIZONTAL
| style
);
1176 separator
.setLayoutData(FILL_HORIZONTALLY());
1181 * <p>createVersionElement</p>
1183 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1184 * @param entity a {@link eu.etaxonomy.cdm.model.common.VersionableEntity} object.
1185 * @param style a int.
1186 * @return a {@link eu.etaxonomy.taxeditor.section.supplemental.VersionElement} object.
1188 public VersionElement
createVersionElement(ICdmFormElement parentElement
, VersionableEntity entity
,
1190 VersionElement element
= new VersionElement(this, parentElement
, entity
, style
);
1192 parentElement
.addElement(element
);
1197 * <p>createVersionSection</p>
1199 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1200 * @param style a int.
1201 * @return a {@link eu.etaxonomy.taxeditor.section.supplemental.VersionSection} object.
1203 public VersionSection
createVersionSection(ICdmFormElement parentElement
, int style
) {
1204 VersionSection section
= new VersionSection(this, parentElement
, style
);
1205 parentElement
.addElement(section
);
1211 * <p>createEmptyElement</p>
1213 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1214 * @return a {@link eu.etaxonomy.taxeditor.section.EmptyElement} object.
1216 public EmptyElement
createEmptyElement(ICdmFormElement parentElement
) {
1217 EmptyElement element
= new EmptyElement(this, parentElement
, null, SWT
.NULL
);
1219 parentElement
.addElement(element
);
1224 * <p>createHeadlineSection</p>
1226 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1227 * @return a {@link eu.etaxonomy.taxeditor.section.supplemental.HeadlineSection} object.
1229 public HeadlineSection
createHeadlineSection(ICdmFormElement parentElement
) {
1230 HeadlineSection section
= new HeadlineSection(this, parentElement
, SWT
.NULL
);
1231 parentElement
.addElement(section
);
1238 * <p>createParsingMessageElement</p>
1240 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1241 * @param parserProblem a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem} object.
1242 * @param style a int.
1243 * @return a {@link eu.etaxonomy.taxeditor.section.taxon.ParsingMessageElement} object.
1245 public ParsingMessageElement
createParsingMessageElement(
1246 ICdmFormElement parentElement
, ParserProblem parserProblem
, int style
) {
1247 ParsingMessageElement element
= new ParsingMessageElement(this, parentElement
, parserProblem
, style
);
1249 parentElement
.addElement(element
);
1259 public static enum DetailType
{
1263 NOMENCLATURALREFERENCE
,
1275 DERIVED_UNIT_FACADE
,
1277 DERIVED_UNIT
, NATURAL_LANGUAGE
,
1278 FEATURE_DISTRIBUTION
,
1283 POLYTOMOUS_KEY_NODE
,
1285 DERIVED_UNIT_GENERAL
,
1290 * <p>createCdmDetailSection</p>
1292 * @param detailType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.DetailType} object.
1293 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1294 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1295 * @param style a int.
1296 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1297 * @return a {@link eu.etaxonomy.taxeditor.forms.AbstractFormSection} object.
1299 public AbstractFormSection
createCdmDetailSection(DetailType detailType
, ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1300 AbstractFormSection section
= null;
1303 case SCIENTIFICNAME
:
1304 section
= new NameDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1307 section
= new ReferenceDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1309 case NOMENCLATURALREFERENCE
:
1310 section
= new NomenclaturalReferenceDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1313 section
= new TaxonBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1316 section
= new AuthorshipDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1318 case TEAMORPERSONBASE
:
1319 section
= new TeamOrPersonBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1322 section
= new TeamDetailSection(this, conversation
, parentElement
, null, style
);
1325 section
= new PersonDetailSection(this, conversation
, parentElement
, null, style
);
1328 section
= new DescriptionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1330 case DESCRIPTIONELEMENT
:
1331 section
= new DescriptionElementDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1333 case PARSINGMESSAGE
:
1334 section
= new ParsingMessagesSection(this, conversation
, parentElement
, selectionProvider
, style
);
1337 section
= new NonViralNameDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1340 section
= new eu
.etaxonomy
.taxeditor
.section
.description
.MediaDetailsSection(this, conversation
, parentElement
, selectionProvider
, style
);
1342 case DERIVED_UNIT_FACADE
:
1343 section
= new DerivedUnitFacadeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1345 case FIELD_OBSERVATION
:
1346 section
= new FieldObservationDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1348 case GATHERING_EVENT
:
1349 section
= new GatheringEventDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1352 section
= new DerivedUnitBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1354 case NATURAL_LANGUAGE
:
1355 section
= new NaturalLanguageSection(this, conversation
, parentElement
, selectionProvider
, style
);
1357 case FEATURE_DISTRIBUTION
:
1358 section
= new FeatureDistributionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1360 case CLASSIFICATION
:
1361 section
= new ClassificationDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1364 section
= new TaxonNodeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1366 case POLYTOMOUS_KEY
:
1367 section
= new PolytomousKeyDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1369 case POLYTOMOUS_KEY_NODE
:
1370 section
= new PolytomousKeyNodeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1373 section
= new InstitutionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1375 case DERIVED_UNIT_GENERAL
:
1376 section
= new GeneralDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1379 section
= new HybridDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1383 if(section
== null){
1384 throw new RuntimeException("You tried to create a cdm detail section that is not implemented yet.");
1387 parentElement
.addElement(section
);
1393 * <p>createCdmDetailElement</p>
1395 * @param detailType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.DetailType} object.
1396 * @param style a int.
1397 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1398 * @return a {@link eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement} object.
1400 public AbstractCdmDetailElement
createCdmDetailElement(DetailType detailType
, ICdmFormElement parentElement
, int style
){
1401 AbstractCdmDetailElement element
= null;
1404 case SCIENTIFICNAME
:
1405 element
= new NameDetailElement(this, parentElement
, style
);
1408 element
= new ReferenceDetailElement(this, parentElement
, style
);
1410 case NOMENCLATURALREFERENCE
:
1411 element
= new NomenclaturalReferenceDetailElement(this, parentElement
, style
);
1414 element
= new TaxonBaseDetailElement(this, parentElement
, style
);
1417 element
= new AuthorshipDetailElement(this, parentElement
, style
);
1420 element
= new TeamDetailElement(this, parentElement
, style
);
1423 element
= new PersonDetailElement(this, parentElement
, style
);
1426 element
= new DescriptionDetailElement(this, parentElement
, style
);
1428 case DESCRIPTIONELEMENT
:
1429 element
= new DescriptionElementDetailElement(this, parentElement
, style
);
1432 element
= new NonViralNameDetailElement(this, parentElement
);
1434 case DERIVED_UNIT_FACADE
:
1435 element
= new DerivedUnitFacadeDetailElement(this, parentElement
);
1437 case FIELD_OBSERVATION
:
1438 element
= new FieldObservationDetailElement(this, parentElement
);
1440 case GATHERING_EVENT
:
1441 element
= new GatheringEventDetailElement(this, parentElement
);
1444 element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1446 case NATURAL_LANGUAGE
:
1447 element
= new NaturalLanguageDetailElement(this, parentElement
);
1449 case FEATURE_DISTRIBUTION
:
1450 element
= new FeatureDistributionDetailElement(this, parentElement
);
1452 case CLASSIFICATION
:
1453 element
= new ClassificationDetailElement(this, parentElement
);
1456 element
= new TaxonNodeDetailElement(this, parentElement
);
1459 element
= new CollectionDetailElement(this, parentElement
);
1461 case POLYTOMOUS_KEY
:
1462 element
= new PolytomousKeyDetailElement(this, parentElement
);
1464 case POLYTOMOUS_KEY_NODE
:
1465 element
= new PolytomousKeyNodeDetailElement(this, parentElement
);
1468 element
= new InstitutionDetailElement(this, parentElement
);
1470 case DERIVED_UNIT_GENERAL
:
1471 element
= new GeneralDetailElement(this, parentElement
);
1474 element
= new HybridDetailElement(this, parentElement
);
1478 if(element
== null){
1479 EditorUtil
.error(this.getClass(), "Detail element was not created. Seems like the case was not implemented for the requested detail type: " + detailType
, null);
1483 parentElement
.addElement(element
);
1489 * @author n.hoffmann
1490 * @created Mar 5, 2010
1493 public static enum EntityDetailType
{
1498 DESCRIPTIONELEMENTSOURCE
,
1502 DESCRIPTIONELEMENTMEDIA
,
1503 MEDIAREPRESENTATION
,
1504 MEDIAREPRESENTATIONPART
,
1506 NOMENCLATURALSTATUS
,
1515 STATISTICAL_MEASUREMENT_VALUE
,
1518 DETERMINATION_EVENT
,
1519 SPECIMEN_COLLECTION
,
1520 IDENTIFIABLE_SOURCE_COLLECTION
,
1526 * <p>createEntityDetailSection</p>
1528 * @param entityDetailType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.EntityDetailType} object.
1529 * @param style a int.
1530 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1531 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1532 * @return a {@link eu.etaxonomy.taxeditor.forms.AbstractFormSection} object.
1534 public AbstractFormSection
createEntityDetailSection(EntityDetailType entityDetailType
, ConversationHolder conversation
, ICdmFormElement parentElement
, int style
){
1535 AbstractFormSection section
= null;
1537 switch(entityDetailType
){
1539 section
= new TeamDetailSection(this, conversation
, parentElement
, null, style
);
1542 section
= new TeamMemberSection(this, conversation
, parentElement
, style
);
1545 section
= new AnnotationSection(this, conversation
, parentElement
, style
);
1548 section
= new CreditSection(this, conversation
, parentElement
, style
);
1550 case DESCRIPTIONELEMENTSOURCE
:
1551 section
= new DescriptionElementSourceSection(this, conversation
, parentElement
, style
);
1554 section
= new ExtensionSection(this, conversation
, parentElement
, style
);
1557 section
= new MarkerSection(this, conversation
, parentElement
, style
);
1560 section
= new MediaSection(this, conversation
, parentElement
, style
);
1562 case DESCRIPTIONELEMENTMEDIA
:
1563 section
= new DescriptionElementMediaSection(this, conversation
, parentElement
, style
);
1565 case MEDIAREPRESENTATION
:
1566 section
= new MediaRepresentationSection(this, conversation
, parentElement
, style
);
1568 case MEDIAREPRESENTATIONPART
:
1569 section
= new MediaRepresentationPartSection(this, conversation
, parentElement
, style
);
1572 section
= new ModifierSection(this, conversation
, parentElement
, style
);
1574 case NOMENCLATURALSTATUS
:
1575 section
= new NomenclaturalStatusSection(this, conversation
, parentElement
, style
);
1577 case NAME_RELATIONSHIP
:
1578 section
= new NameRelationshipDetailSection(this, conversation
, parentElement
, style
);
1581 section
= new ProtologueSection(this, conversation
, parentElement
, style
);
1584 section
= new RightsSection(this, conversation
, parentElement
, style
);
1587 section
= new SourceSection(this, conversation
, parentElement
, style
);
1590 section
= new ScopeSection(this, conversation
, parentElement
, style
);
1592 case DESCRIPTIONSOURCE
:
1593 section
= new DescriptionSourceSection(this, conversation
, parentElement
, style
);
1595 case TYPEDESIGNATION
:
1596 section
= new TypeDesignationSection(this, conversation
, parentElement
, style
);
1599 section
= new StateDataSection(this, conversation
, parentElement
, style
);
1601 case STATISTICAL_MEASUREMENT_VALUE
:
1602 section
= new StatisticalMeasurementValueSection(this, conversation
, parentElement
, style
);
1604 case DESCRIBED_SPECIMEN
:
1605 section
= new DescribedSpecimenSection(this, conversation
, parentElement
, style
);
1607 case COLLECTING_AREA
:
1608 section
= new CollectingAreasDetailSection(this, conversation
, parentElement
, style
);
1610 case DETERMINATION_EVENT
:
1611 section
= new DeterminationEventDetailSection(this, conversation
, parentElement
, style
);
1613 case SPECIMEN_COLLECTION
:
1614 section
= new SpecimenCollectionDetailSection(this, conversation
, parentElement
, style
);
1616 case IDENTIFIABLE_SOURCE_COLLECTION
:
1617 section
= new SourceCollectionDetailSection(this, conversation
, parentElement
, style
);
1619 case GEOGRAPHICAL_SCOPE
:
1620 section
= new GeographicalScopeDetailSection(this, conversation
, parentElement
, style
);
1622 case SCOPE_RESTRICTION
:
1623 section
= new ScopeRestrictionSection(this, conversation
, parentElement
, style
);
1626 parentElement
.addElement(section
);
1632 * <p>createEntityCollectionElement</p>
1634 * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
1635 * @param style a int.
1636 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.AbstractFormSection} object.
1637 * @param versionableEntity a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity} object.
1638 * @param backgroundColor a {@link org.eclipse.swt.graphics.Color} object.
1639 * @return a {@link eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement} object.
1641 public AbstractEntityCollectionElement
createEntityCollectionElement(AbstractFormSection parentElement
, IVersionableEntity versionableEntity
, SelectionListener removeListener
, Color backgroundColor
, int style
){
1642 AbstractEntityCollectionElement element
= null;
1644 VersionableEntity entity
= (VersionableEntity
) HibernateProxyHelper
.deproxy(versionableEntity
);
1646 if(entity
instanceof Annotation
){
1647 element
= new AnnotationElement(this, parentElement
, (Annotation
) entity
, removeListener
, style
);
1649 else if(entity
instanceof Person
){
1650 element
= new TeamMemberElement(this, parentElement
, (Person
) entity
, removeListener
, style
);
1652 else if(entity
instanceof Credit
){
1653 element
= new CreditElement(this, parentElement
, (Credit
) entity
, removeListener
, style
);
1655 else if(entity
instanceof Extension
){
1656 element
= new ExtensionElement(this, parentElement
, (Extension
) entity
, removeListener
, style
);
1658 else if(entity
instanceof Marker
){
1659 element
= new MarkerElement(this, parentElement
, (Marker
) entity
, removeListener
, style
);
1661 else if(entity
instanceof Media
){
1662 element
= new MediaElement(this, parentElement
, (Media
) entity
, removeListener
, style
);
1664 else if(entity
instanceof MediaRepresentation
){
1665 element
= new MediaRepresentationElement(this, parentElement
, (MediaRepresentation
) entity
, removeListener
, style
);
1667 else if(entity
instanceof ImageFile
){
1668 element
= new ImageFileElement(this, parentElement
, (ImageFile
) entity
, removeListener
, style
);
1670 else if(entity
instanceof NomenclaturalStatus
){
1671 element
= new NomenclaturalStatusElement(this, parentElement
, (NomenclaturalStatus
) entity
, removeListener
, style
);
1673 else if(entity
instanceof Rights
){
1674 element
= new RightsElement(this, parentElement
, (Rights
) entity
, removeListener
, style
);
1676 else if(entity
instanceof DescriptionElementSource
){
1677 element
= new DescriptionElementSourceElement(this, parentElement
, (DescriptionElementSource
) entity
, removeListener
, style
);
1679 else if(entity
instanceof IdentifiableSource
){
1680 element
= new IdentifiableSourceElement(this, parentElement
, (IdentifiableSource
) entity
, removeListener
, style
);
1682 else if(entity
instanceof Scope
){
1683 element
= new ScopeElement(this, parentElement
, (Scope
) entity
, removeListener
, style
);
1685 else if(entity
instanceof Modifier
){
1686 element
= new ModifierElement(this, parentElement
, (Modifier
) entity
, removeListener
, style
);
1688 else if(entity
instanceof Reference
){
1689 element
= new DescriptionSourceElement(this, parentElement
, (Reference
) entity
, removeListener
, style
);
1691 else if(entity
instanceof NameTypeDesignation
){
1692 element
= new NameTypeDesignationElement(this, parentElement
, (NameTypeDesignation
) entity
, removeListener
, style
);
1694 else if(entity
instanceof NameRelationship
){
1695 element
= new NameRelationshipDetailElement(this, parentElement
, (NameRelationship
) entity
, removeListener
, style
);
1697 else if(entity
instanceof SpecimenTypeDesignation
){
1698 element
= new SpecimenTypeDesignationElement(this, parentElement
, (SpecimenTypeDesignation
) entity
, removeListener
, style
);
1700 else if(entity
instanceof StateData
){
1701 element
= new StateDataElement(this, parentElement
, (StateData
) entity
, removeListener
, style
);
1703 else if(entity
instanceof StatisticalMeasurementValue
){
1704 element
= new StatisticalMeasurementValueElement(this, parentElement
, (StatisticalMeasurementValue
) entity
, removeListener
, style
);
1706 else if(entity
instanceof DerivedUnit
){
1707 element
= new DerivedUnitElement(this, parentElement
, (DerivedUnit
) entity
, removeListener
, style
);
1709 else if(entity
instanceof NamedArea
){
1710 element
= new NamedAreaDetailElement(this, parentElement
, (NamedArea
) entity
, removeListener
, style
);
1712 else if(entity
instanceof DeterminationEvent
){
1713 element
= new DeterminationEventDetailElement(this, parentElement
, (DeterminationEvent
) entity
, removeListener
, style
);
1715 else if(entity
instanceof Specimen
){
1716 element
= new SpecimenCollectionDetailElement(this, parentElement
, (Specimen
) entity
, removeListener
, style
);
1719 else if(entity
instanceof DescriptionElementBase
){
1720 // this is the special case for protologs, maybe we can do this differently when API improves
1721 DescriptionElementBase descriptionElement
= (DescriptionElementBase
) entity
;
1722 if(descriptionElement
.getFeature().equals(Feature
.PROTOLOGUE())){
1723 element
= new ProtologueElement(this, parentElement
, descriptionElement
, removeListener
, style
);
1727 if(element
== null){
1728 EditorUtil
.errorDialog("No element for entity", this, "Could not generate element for entity. " +
1729 "Looks like the case is not handled already. Check implementation. Entity: " + entity
, null);
1732 if(backgroundColor
!= null && !backgroundColor
.isDisposed()){
1733 element
.setBackgroundColor(backgroundColor
);
1737 parentElement
.addElement(element
);
1742 * <p>createSelectionElement</p>
1744 * @param selectionType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.SelectionType} object.
1745 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1746 * @param labelString a {@link java.lang.String} object.
1747 * @param selectionType
1748 * @param selection a {@link eu.etaxonomy.cdm.model.common.IAnnotatableEntity} object.
1749 * @param style a int.
1750 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1751 * @return a {@link eu.etaxonomy.taxeditor.forms.selection.AbstractSelectionElement} object.
1753 public AbstractSelectionElement
createSelectionElement(SelectionType selectionType
, ConversationHolder conversation
, ICdmFormElement parentElement
, String labelString
, ICdmBase selection
, int style
){
1754 AbstractSelectionElement element
= null;
1756 IAnnotatableEntity entity
= (IAnnotatableEntity
) HibernateProxyHelper
.deproxy(selection
);
1758 switch (selectionType
) {
1760 element
= new AgentSelectionElement(this, conversation
, parentElement
, labelString
, (TeamOrPersonBase
) entity
, style
);
1763 element
= new PersonSelectionElement(this, conversation
, parentElement
, labelString
, (Person
) entity
, style
);
1766 element
= new TeamSelectionElement(this, conversation
, parentElement
, labelString
, (Team
) entity
, style
);
1769 element
= new NomenclaturalAuthorTeamSelectionElement(this, conversation
, parentElement
, labelString
, (Team
) entity
, style
);
1772 element
= new InstitutionSelectionElement(this, conversation
, parentElement
, labelString
, (Institution
) entity
, style
);
1775 element
= new NameSelectionElement(this, conversation
, parentElement
, labelString
, (TaxonNameBase
) entity
, style
);
1778 element
= new ReferenceSelectionElement(this, conversation
, parentElement
, labelString
, (Reference
) entity
, style
);
1781 element
= new TaxonBaseSelectionElement(this, conversation
, parentElement
, labelString
, (TaxonBase
) entity
, style
);
1784 element
= new TaxonSelectionElement(this, conversation
, parentElement
, labelString
, (Taxon
) entity
, style
);
1787 element
= new SynonymSelectionElement(this, conversation
, parentElement
, labelString
, (Synonym
) entity
, style
);
1790 element
= new DerivedUnitBaseSelectionElement(this, conversation
, parentElement
, labelString
, (DerivedUnitBase
) entity
, style
);
1792 case FIELD_OBSERVATION
:
1793 element
= new FieldObservationSelectionElement(this, conversation
, parentElement
, labelString
, (FieldObservation
) entity
, style
);
1796 element
= new FeatureTreeSelectionElement(this, conversation
, parentElement
, labelString
, (FeatureTree
) entity
, style
);
1798 case CLASSIFICATION
:
1799 element
= new ClassificationSelectionElement(this, conversation
, parentElement
, labelString
, (Classification
) entity
, style
);
1802 element
= new TaxonNodeSelectionElement(this, conversation
, parentElement
, labelString
, (TaxonNode
) entity
, style
);
1805 element
= new CollectionSelectionElement(this, conversation
, parentElement
, labelString
, (Collection
) entity
, style
);
1808 element
= new FeatureSelectionElement(this, conversation
, parentElement
, labelString
, (Feature
) entity
, style
);
1810 case POLYTOMOUS_KEY
:
1811 element
= new PolytomousKeySelectionElement(this, conversation
, parentElement
, labelString
, (PolytomousKey
) entity
, style
);
1813 case POLYTOMOUS_KEY_NODE
:
1814 element
= new PolytomousKeyNodeSelectionElement(this, conversation
, parentElement
, labelString
, (PolytomousKeyNode
) entity
, style
);
1817 new RuntimeException("There is no selection composite for the desired selection type.");
1822 parentElement
.addElement(element
);
1827 * <p>createNamedAreaSelectionElement</p>
1829 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1830 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1831 * @param labelString a {@link java.lang.String} object.
1832 * @param selection a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
1833 * @param style a int.
1834 * @return a {@link eu.etaxonomy.taxeditor.forms.selection.NamedAreaSelectionElement} object.
1836 public NamedAreaSelectionElement
createNamedAreaSelectionElement(ICdmFormElement parentElement
, ConversationHolder conversation
, String labelString
, NamedArea selection
, int style
){
1837 NamedAreaSelectionElement element
= new NamedAreaSelectionElement(this, conversation
, parentElement
, labelString
, selection
, style
);
1839 parentElement
.addElement(element
);
1843 /** {@inheritDoc} */
1844 public LabelElement
createLabel(ICdmFormElement parentElement
, String text
) {
1845 LabelElement labelElement
= new LabelElement(this, parentElement
, text
);
1846 adapt(labelElement
);
1847 parentElement
.addElement(labelElement
);
1848 return labelElement
;
1852 * <p>Getter for the field <code>selectionProvider</code>.</p>
1854 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1856 public ISelectionProvider
getSelectionProvider() {
1857 return selectionProvider
;
1861 * <p>createDetailedDescriptionDetailElement</p>
1863 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1864 * @param entity a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
1865 * @param style a int.
1866 * @return a {@link eu.etaxonomy.taxeditor.section.description.detail.AbstractDetailedDescriptionDetailElement} object.
1868 public AbstractDetailedDescriptionDetailElement
createDetailedDescriptionDetailElement(
1869 ICdmFormElement parentElement
, DescriptionElementBase entity
, int style
) {
1870 AbstractDetailedDescriptionDetailElement detailedDescriptionElement
= null;
1873 if(entity
instanceof CategoricalData
){
1874 detailedDescriptionElement
= new CategoricalDataDetailElement(this, parentElement
, (CategoricalData
) entity
, style
);
1876 else if(entity
instanceof CommonTaxonName
){
1877 detailedDescriptionElement
= new CommonNameDetailElement(this, parentElement
, (CommonTaxonName
) entity
, style
);
1879 else if(entity
instanceof Distribution
){
1880 detailedDescriptionElement
= new DistributionDetailElement(this, parentElement
, (Distribution
) entity
, style
);
1882 else if(entity
instanceof IndividualsAssociation
){
1883 detailedDescriptionElement
= new IndividualsAssociationDetailElement(this, parentElement
, (IndividualsAssociation
) entity
, style
);
1885 else if(entity
instanceof QuantitativeData
){
1886 detailedDescriptionElement
= new QuantitativeDataDetailElement(this, parentElement
, (QuantitativeData
) entity
, style
);
1888 else if(entity
instanceof TaxonInteraction
){
1889 detailedDescriptionElement
= new TaxonInteractionDetailElement(this, parentElement
, (TaxonInteraction
) entity
, style
);
1891 else if(entity
instanceof TextData
){
1892 detailedDescriptionElement
= new TextDataDetailElement(this, parentElement
, (TextData
) entity
, style
);
1895 throw new IllegalStateException("There is no interface for the given description element");
1897 adapt(detailedDescriptionElement
);
1898 parentElement
.addElement(detailedDescriptionElement
);
1899 return detailedDescriptionElement
;
1905 * Creates a styled text as a part of the form.
1910 * the text initial value
1913 * @return the text widget
1915 public StyledText
createStyledText(Composite parent
, String value
, int style
) {
1916 StyledText text
= new StyledText(parent
, getBorderStyle() | style
| getOrientation());
1918 text
.setText(value
);
1919 text
.setForeground(getColors().getForeground());
1920 text
.setBackground(getColors().getBackground());
1921 // text.addFocusListener(visibilityHandler);