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
.openurl
.IOpenUrlEnabled
;
125 import eu
.etaxonomy
.taxeditor
.forms
.openurl
.OpenUrlSelectorElement
;
126 import eu
.etaxonomy
.taxeditor
.forms
.selection
.AbstractSelectionElement
;
127 import eu
.etaxonomy
.taxeditor
.forms
.selection
.AgentSelectionElement
;
128 import eu
.etaxonomy
.taxeditor
.forms
.selection
.ClassificationSelectionElement
;
129 import eu
.etaxonomy
.taxeditor
.forms
.selection
.CollectionSelectionElement
;
130 import eu
.etaxonomy
.taxeditor
.forms
.selection
.DerivedUnitBaseSelectionElement
;
131 import eu
.etaxonomy
.taxeditor
.forms
.selection
.FeatureSelectionElement
;
132 import eu
.etaxonomy
.taxeditor
.forms
.selection
.FeatureTreeSelectionElement
;
133 import eu
.etaxonomy
.taxeditor
.forms
.selection
.FieldObservationSelectionElement
;
134 import eu
.etaxonomy
.taxeditor
.forms
.selection
.InstitutionSelectionElement
;
135 import eu
.etaxonomy
.taxeditor
.forms
.selection
.NameSelectionElement
;
136 import eu
.etaxonomy
.taxeditor
.forms
.selection
.NamedAreaSelectionElement
;
137 import eu
.etaxonomy
.taxeditor
.forms
.selection
.NomenclaturalAuthorTeamSelectionElement
;
138 import eu
.etaxonomy
.taxeditor
.forms
.selection
.PersonSelectionElement
;
139 import eu
.etaxonomy
.taxeditor
.forms
.selection
.PolytomousKeyNodeSelectionElement
;
140 import eu
.etaxonomy
.taxeditor
.forms
.selection
.PolytomousKeySelectionElement
;
141 import eu
.etaxonomy
.taxeditor
.forms
.selection
.ReferenceSelectionElement
;
142 import eu
.etaxonomy
.taxeditor
.forms
.selection
.SynonymSelectionElement
;
143 import eu
.etaxonomy
.taxeditor
.forms
.selection
.TaxonBaseSelectionElement
;
144 import eu
.etaxonomy
.taxeditor
.forms
.selection
.TaxonNodeSelectionElement
;
145 import eu
.etaxonomy
.taxeditor
.forms
.selection
.TaxonSelectionElement
;
146 import eu
.etaxonomy
.taxeditor
.forms
.selection
.TeamSelectionElement
;
147 import eu
.etaxonomy
.taxeditor
.forms
.term
.AbstractEnumComboElement
;
148 import eu
.etaxonomy
.taxeditor
.forms
.term
.AbstractTermComboElement
;
149 import eu
.etaxonomy
.taxeditor
.forms
.term
.AnnotationTypeComboElement
;
150 import eu
.etaxonomy
.taxeditor
.forms
.term
.DeterminationModifierComboElement
;
151 import eu
.etaxonomy
.taxeditor
.forms
.term
.EmptyComboElement
;
152 import eu
.etaxonomy
.taxeditor
.forms
.term
.ExtensionTypeComboElement
;
153 import eu
.etaxonomy
.taxeditor
.forms
.term
.LanguageComboElement
;
154 import eu
.etaxonomy
.taxeditor
.forms
.term
.MarkerTypeComboElement
;
155 import eu
.etaxonomy
.taxeditor
.forms
.term
.MeasurementUnitComboElement
;
156 import eu
.etaxonomy
.taxeditor
.forms
.term
.ModifierComboElement
;
157 import eu
.etaxonomy
.taxeditor
.forms
.term
.NameRelationshipTypeComboElement
;
158 import eu
.etaxonomy
.taxeditor
.forms
.term
.NameTypeDesignationStatusComboElement
;
159 import eu
.etaxonomy
.taxeditor
.forms
.term
.NamedAreaTypeComboElement
;
160 import eu
.etaxonomy
.taxeditor
.forms
.term
.NomenclaturalCodeComboElement
;
161 import eu
.etaxonomy
.taxeditor
.forms
.term
.NomenclaturalStatusTypeComboElement
;
162 import eu
.etaxonomy
.taxeditor
.forms
.term
.PresenceAbsenceTermComboElement
;
163 import eu
.etaxonomy
.taxeditor
.forms
.term
.PreservationMethodComboElement
;
164 import eu
.etaxonomy
.taxeditor
.forms
.term
.RankComboElement
;
165 import eu
.etaxonomy
.taxeditor
.forms
.term
.ReferenceSystemComboElement
;
166 import eu
.etaxonomy
.taxeditor
.forms
.term
.ReferenceTypeComboElement
;
167 import eu
.etaxonomy
.taxeditor
.forms
.term
.RightsTypeComboElement
;
168 import eu
.etaxonomy
.taxeditor
.forms
.term
.ScopeComboElement
;
169 import eu
.etaxonomy
.taxeditor
.forms
.term
.SexComboElement
;
170 import eu
.etaxonomy
.taxeditor
.forms
.term
.SpecimenTypeDesignationStatusComboElement
;
171 import eu
.etaxonomy
.taxeditor
.forms
.term
.StageComboElement
;
172 import eu
.etaxonomy
.taxeditor
.forms
.term
.StateComboElement
;
173 import eu
.etaxonomy
.taxeditor
.forms
.term
.StatisticalMeasureComboElement
;
174 import eu
.etaxonomy
.taxeditor
.section
.AbstractCdmDetailElement
;
175 import eu
.etaxonomy
.taxeditor
.section
.AbstractEntityCollectionElement
;
176 import eu
.etaxonomy
.taxeditor
.section
.EmptyElement
;
177 import eu
.etaxonomy
.taxeditor
.section
.agent
.InstitutionDetailElement
;
178 import eu
.etaxonomy
.taxeditor
.section
.agent
.InstitutionDetailSection
;
179 import eu
.etaxonomy
.taxeditor
.section
.agent
.PersonDetailElement
;
180 import eu
.etaxonomy
.taxeditor
.section
.agent
.PersonDetailSection
;
181 import eu
.etaxonomy
.taxeditor
.section
.agent
.TeamDetailElement
;
182 import eu
.etaxonomy
.taxeditor
.section
.agent
.TeamDetailSection
;
183 import eu
.etaxonomy
.taxeditor
.section
.agent
.TeamMemberElement
;
184 import eu
.etaxonomy
.taxeditor
.section
.agent
.TeamMemberSection
;
185 import eu
.etaxonomy
.taxeditor
.section
.agent
.TeamOrPersonBaseDetailSection
;
186 import eu
.etaxonomy
.taxeditor
.section
.classification
.ClassificationDetailElement
;
187 import eu
.etaxonomy
.taxeditor
.section
.classification
.ClassificationDetailSection
;
188 import eu
.etaxonomy
.taxeditor
.section
.classification
.TaxonNodeDetailElement
;
189 import eu
.etaxonomy
.taxeditor
.section
.classification
.TaxonNodeDetailSection
;
190 import eu
.etaxonomy
.taxeditor
.section
.description
.DerivedUnitElement
;
191 import eu
.etaxonomy
.taxeditor
.section
.description
.DescribedSpecimenSection
;
192 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionDetailElement
;
193 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionDetailSection
;
194 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionElementDetailElement
;
195 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionElementDetailSection
;
196 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionElementMediaSection
;
197 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionElementSourceElement
;
198 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionElementSourceSection
;
199 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionSourceElement
;
200 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionSourceSection
;
201 import eu
.etaxonomy
.taxeditor
.section
.description
.ModifierElement
;
202 import eu
.etaxonomy
.taxeditor
.section
.description
.ModifierSection
;
203 import eu
.etaxonomy
.taxeditor
.section
.description
.NaturalLanguageDetailElement
;
204 import eu
.etaxonomy
.taxeditor
.section
.description
.NaturalLanguageSection
;
205 import eu
.etaxonomy
.taxeditor
.section
.description
.ScopeElement
;
206 import eu
.etaxonomy
.taxeditor
.section
.description
.ScopeSection
;
207 import eu
.etaxonomy
.taxeditor
.section
.description
.StateDataElement
;
208 import eu
.etaxonomy
.taxeditor
.section
.description
.StateDataSection
;
209 import eu
.etaxonomy
.taxeditor
.section
.description
.StatisticalMeasurementValueElement
;
210 import eu
.etaxonomy
.taxeditor
.section
.description
.StatisticalMeasurementValueSection
;
211 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.AbstractDetailedDescriptionDetailElement
;
212 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.CategoricalDataDetailElement
;
213 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.CommonNameDetailElement
;
214 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.DistributionDetailElement
;
215 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.IndividualsAssociationDetailElement
;
216 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.QuantitativeDataDetailElement
;
217 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.TaxonInteractionDetailElement
;
218 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.TextDataDetailElement
;
219 import eu
.etaxonomy
.taxeditor
.section
.feature
.FeatureDistributionDetailElement
;
220 import eu
.etaxonomy
.taxeditor
.section
.feature
.FeatureDistributionDetailSection
;
221 import eu
.etaxonomy
.taxeditor
.section
.key
.GeographicalScopeDetailSection
;
222 import eu
.etaxonomy
.taxeditor
.section
.key
.PolytomousKeyDetailElement
;
223 import eu
.etaxonomy
.taxeditor
.section
.key
.PolytomousKeyDetailSection
;
224 import eu
.etaxonomy
.taxeditor
.section
.key
.PolytomousKeyNodeDetailElement
;
225 import eu
.etaxonomy
.taxeditor
.section
.key
.PolytomousKeyNodeDetailSection
;
226 import eu
.etaxonomy
.taxeditor
.section
.key
.ScopeRestrictionSection
;
227 import eu
.etaxonomy
.taxeditor
.section
.name
.AuthorshipDetailElement
;
228 import eu
.etaxonomy
.taxeditor
.section
.name
.AuthorshipDetailSection
;
229 import eu
.etaxonomy
.taxeditor
.section
.name
.HybridDetailElement
;
230 import eu
.etaxonomy
.taxeditor
.section
.name
.HybridDetailSection
;
231 import eu
.etaxonomy
.taxeditor
.section
.name
.NameDetailElement
;
232 import eu
.etaxonomy
.taxeditor
.section
.name
.NameDetailSection
;
233 import eu
.etaxonomy
.taxeditor
.section
.name
.NameRelationshipDetailElement
;
234 import eu
.etaxonomy
.taxeditor
.section
.name
.NameRelationshipDetailSection
;
235 import eu
.etaxonomy
.taxeditor
.section
.name
.NameTypeDesignationElement
;
236 import eu
.etaxonomy
.taxeditor
.section
.name
.NomenclaturalStatusElement
;
237 import eu
.etaxonomy
.taxeditor
.section
.name
.NomenclaturalStatusSection
;
238 import eu
.etaxonomy
.taxeditor
.section
.name
.NonViralNameDetailElement
;
239 import eu
.etaxonomy
.taxeditor
.section
.name
.NonViralNameDetailSection
;
240 import eu
.etaxonomy
.taxeditor
.section
.name
.ProtologueElement
;
241 import eu
.etaxonomy
.taxeditor
.section
.name
.ProtologueSection
;
242 import eu
.etaxonomy
.taxeditor
.section
.name
.SpecimenTypeDesignationElement
;
243 import eu
.etaxonomy
.taxeditor
.section
.name
.TypeDesignationSection
;
244 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.CollectingAreasDetailSection
;
245 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.CollectionDetailElement
;
246 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DerivedUnitBaseDetailElement
;
247 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DerivedUnitBaseDetailSection
;
248 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DerivedUnitFacadeDetailElement
;
249 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DerivedUnitFacadeDetailSection
;
250 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DeterminationEventDetailElement
;
251 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DeterminationEventDetailSection
;
252 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.FieldObservationDetailElement
;
253 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.FieldObservationDetailSection
;
254 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.GatheringEventDetailElement
;
255 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.GatheringEventDetailSection
;
256 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.GeneralDetailElement
;
257 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.GeneralDetailSection
;
258 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.NamedAreaDetailElement
;
259 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.SourceCollectionDetailSection
;
260 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.SpecimenCollectionDetailElement
;
261 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.SpecimenCollectionDetailSection
;
262 import eu
.etaxonomy
.taxeditor
.section
.reference
.NomenclaturalReferenceDetailElement
;
263 import eu
.etaxonomy
.taxeditor
.section
.reference
.NomenclaturalReferenceDetailSection
;
264 import eu
.etaxonomy
.taxeditor
.section
.reference
.ReferenceDetailElement
;
265 import eu
.etaxonomy
.taxeditor
.section
.reference
.ReferenceDetailSection
;
266 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.AnnotationElement
;
267 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.AnnotationSection
;
268 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.CreditElement
;
269 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.CreditSection
;
270 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.ExtensionElement
;
271 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.ExtensionSection
;
272 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.HeadlineSection
;
273 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.IdentifiableSourceElement
;
274 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.ImageFileElement
;
275 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MarkerElement
;
276 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MarkerSection
;
277 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MediaElement
;
278 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MediaRepresentationElement
;
279 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MediaRepresentationPartSection
;
280 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MediaRepresentationSection
;
281 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MediaSection
;
282 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.RightsElement
;
283 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.RightsSection
;
284 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.SourceSection
;
285 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.VersionElement
;
286 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.VersionSection
;
287 import eu
.etaxonomy
.taxeditor
.section
.taxon
.ParsingMessageElement
;
288 import eu
.etaxonomy
.taxeditor
.section
.taxon
.ParsingMessagesSection
;
289 import eu
.etaxonomy
.taxeditor
.section
.taxon
.TaxonBaseDetailElement
;
290 import eu
.etaxonomy
.taxeditor
.section
.taxon
.TaxonBaseDetailSection
;
293 * <p>CdmFormFactory class.</p>
296 * @created Feb 24, 2010
299 public class CdmFormFactory
extends FormToolkit
{
301 private BoldFontHolder2 boldFontHolder2
;
302 private MouseListener selectionMouseHandler
;
303 private FocusListener selectionFocusHandler
;
305 private Set selectionListenerList
= new HashSet();
307 private List
<IPropertyChangeListener
> propertyChangeListeners
= new ArrayList
<IPropertyChangeListener
>();
309 private int orientation
= Window
.getDefaultOrientation();
310 private ISelectionProvider selectionProvider
;
315 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
317 public static final TableWrapLayout
LAYOUT(){
318 return LAYOUT(1, false);
324 * @param columns a int.
325 * @param equalWidth a boolean.
326 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
328 public static final TableWrapLayout
LAYOUT(int columns
, boolean equalWidth
){
329 TableWrapLayout layout
= new TableWrapLayout();
330 layout
.topMargin
= 0;
331 layout
.rightMargin
= 0;
332 layout
.bottomMargin
= 0;
333 layout
.leftMargin
= 0;
334 layout
.numColumns
= columns
;
335 layout
.makeColumnsEqualWidth
= equalWidth
;
336 layout
.verticalSpacing
= 0;
337 layout
.horizontalSpacing
= 0;
344 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
346 public static final TableWrapData
FILL(){
353 * @param horizontalSpan a int.
354 * @param verticalSpan a int.
355 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
357 public static final TableWrapData
FILL(int horizontalSpan
, int verticalSpan
){
358 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.FILL_GRAB
);
359 layoutData
.colspan
= horizontalSpan
;
360 layoutData
.rowspan
= verticalSpan
;
367 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
369 public static final TableWrapData
LEFT(){
370 return new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
);
376 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
378 public static final TableWrapData
RIGHT(){
379 return new TableWrapData(TableWrapData
.RIGHT
, TableWrapData
.TOP
);
383 * <p>FILL_HORIZONTALLY</p>
385 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
387 public static final TableWrapData
FILL_HORIZONTALLY(){
388 return FILL_HORIZONTALLY(1, 1);
392 * <p>FILL_HORIZONTALLY</p>
394 * @param horizontalSpan a int.
395 * @param verticalSpan a int.
396 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
398 public static final TableWrapData
FILL_HORIZONTALLY(int horizontalSpan
, int verticalSpan
){
399 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
);
400 layoutData
.colspan
= horizontalSpan
;
401 layoutData
.rowspan
= verticalSpan
;
405 /** Constant <code>EMPTY_SELECTION</code> */
406 public static ISelection EMPTY_SELECTION
= new ISelection() {
407 public boolean isEmpty() {
412 private class SelectionMouseHandler
extends MouseAdapter
{
414 public void mouseDown(MouseEvent e
) {
415 notifySelectionListeners(e
);
419 private class SelectionFocusHandler
extends FocusAdapter
{
421 public void focusGained(FocusEvent e
) {
422 notifySelectionListeners(e
);
426 private void notifySelectionListeners(TypedEvent e
){
427 Event event
= new Event();
428 event
.widget
= e
.widget
;
429 SelectionEvent selectionEvent
= new SelectionEvent(event
);
431 for(Object listener
: selectionListenerList
){
432 ((SelectionListener
) listener
).widgetSelected(selectionEvent
);
437 * <p>Constructor for CdmFormFactory.</p>
439 * @param display a {@link org.eclipse.swt.widgets.Display} object.
440 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
442 public CdmFormFactory(Display display
, ISelectionProvider selectionProvider
) {
444 this.selectionProvider
= selectionProvider
;
449 * <p>Constructor for CdmFormFactory.</p>
451 * @param display a {@link org.eclipse.swt.widgets.Display} object.
453 public CdmFormFactory(Display display
){
461 private void init() {
462 boldFontHolder2
= new BoldFontHolder2();
463 selectionMouseHandler
= new SelectionMouseHandler();
464 selectionFocusHandler
= new SelectionFocusHandler();
468 * Creates an instance initialized with the correct selectionProvider
470 * Make sure to remove the instance when the entityComposite disposes via
471 * destroySelectionArbitrator(..)
473 * @param entityElement a {@link eu.etaxonomy.taxeditor.forms.IEntityElement} object.
474 * @return a {@link eu.etaxonomy.taxeditor.forms.SelectionArbitrator} object.
476 public SelectionArbitrator
createSelectionArbitrator(IEntityElement entityElement
){
477 SelectionArbitrator selectionArbitrator
= new SelectionArbitrator(entityElement
);
478 selectionArbitrator
.addSelectionProvider(selectionProvider
);
479 selectionProvider
.addSelectionChangedListener(selectionArbitrator
);
480 addSelectionListener(selectionArbitrator
);
481 return selectionArbitrator
;
485 * <p>destroySelectionArbitrator</p>
487 * @param selectionArbitrator a {@link eu.etaxonomy.taxeditor.forms.SelectionArbitrator} object.
489 public void destroySelectionArbitrator(SelectionArbitrator selectionArbitrator
){
490 removeSelectionListener(selectionArbitrator
);
491 if(selectionProvider
!= null){
492 selectionProvider
.removeSelectionChangedListener(selectionArbitrator
);
494 EditorUtil
.error(this.getClass(), "Tried to destroy a selection listener from this factories listeners but was null", null);
500 public void adapt(Composite composite
) {
501 composite
.addMouseListener(selectionMouseHandler
);
502 super.adapt(composite
);
508 * @param formElement a {@link eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement} object.
510 public void adapt(AbstractCdmFormElement formElement
){
511 formElement
.setPropertyChangeListeners(propertyChangeListeners
);
516 public void adapt(Control control
, boolean trackFocus
, boolean trackKeyboard
) {
518 control
.addFocusListener(selectionFocusHandler
);
520 super.adapt(control
, trackFocus
, trackKeyboard
);
524 * <p>destroyElement</p>
526 * @param formElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
528 public void destroyElement(ICdmFormElement formElement
){
529 // return if element was not initialized
530 if(formElement
== null){
533 // destroy selection arbitrator, if any
534 if(formElement
instanceof ISelectableElement
){
535 destroySelectionArbitrator(((ISelectableElement
) formElement
).getSelectionArbitrator());
537 // remove this element form its parents list of elements
538 // ICdmFormElement parentElement = formElement.getParentElement();
539 // if(parentElement != null){
540 // parentElement.removeElement(formElement);
542 // call destroy on child elements recursively
543 for(ICdmFormElement childElement
: formElement
.getElements()){
544 destroyElement(childElement
);
546 // dispose of the controls
547 for(Control control
: formElement
.getControls()){
548 // we added the layoutComposite of the parental element as the layout composite to this formElement
549 // but we do not want to destroy it.
550 if(control
.equals(formElement
.getLayoutComposite())){
561 * <p>createEmptyCell</p>
563 * @param parent a {@link org.eclipse.swt.widgets.Composite} object.
564 * @return a {@link org.eclipse.swt.widgets.Label} object.
566 public Label
createEmptyCell(Composite parent
){
567 return this.createLabel(parent
, null);
571 * <p>createMultilineTextWithLabel</p>
573 * @param labelString a {@link java.lang.String} object.
574 * @param textHeight a int.
575 * @param style a int.
576 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
577 * @return a {@link eu.etaxonomy.taxeditor.forms.TextWithLabelElement} object.
579 public TextWithLabelElement
createMultilineTextWithLabel(ICdmFormElement parentElement
, String labelString
, int textHeight
, int style
){
580 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, labelString
, "", textHeight
, style
);
582 parentElement
.addElement(element
);
588 * <p>createMultiLanguageTextElement</p>
590 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
591 * @param labelString a {@link java.lang.String} object.
592 * @param multilanguageText a {@link java.util.Map} object.
593 * @param textHeight a int.
594 * @param style a int.
595 * @return a {@link eu.etaxonomy.taxeditor.forms.MultilanguageTextElement} object.
597 public MultilanguageTextElement
createMultiLanguageTextElement(
598 ICdmFormElement parentElement
, String labelString
, Map
<Language
, LanguageString
> multilanguageText
, int textHeight
,
600 MultilanguageTextElement element
= new MultilanguageTextElement(this, parentElement
, labelString
, multilanguageText
, textHeight
, style
);
602 parentElement
.addElement(element
);
606 public KeyStatementElement
createKeyStatementElement(ICdmFormElement parentElement
, String labelString
,
607 KeyStatement keyStatement
, int textHeight
, int style
){
608 KeyStatementElement element
= new KeyStatementElement(this, parentElement
, labelString
, keyStatement
, textHeight
, style
);
610 parentElement
.addElement(element
);
616 * <p>createTextWithLabelElement</p>
618 * @param labelString a {@link java.lang.String} object.
619 * @param initialText a {@link java.lang.String} object.
620 * @param style a int.
621 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
622 * @return a {@link eu.etaxonomy.taxeditor.forms.TextWithLabelElement} object.
624 public TextWithLabelElement
createTextWithLabelElement(ICdmFormElement parentElement
, String labelString
, String initialText
, int style
){
625 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, labelString
, initialText
, null, style
);
627 parentElement
.addElement(element
);
631 public UriWithLabelElement
createUriWithLabelElement(ICdmFormElement parentElement
, String labelString
, URI initialUri
, int style
){
632 UriWithLabelElement element
= new UriWithLabelElement(this, parentElement
, labelString
, initialUri
, null, style
);
634 parentElement
.addElement(element
);
645 public OpenUrlSelectorElement
createOpenUrlSelectorElement(
646 ICdmFormElement parentElement
, String labelString
, IOpenUrlEnabled openUrlEnabled
, int style
) {
647 OpenUrlSelectorElement element
= new OpenUrlSelectorElement(this, parentElement
, labelString
, openUrlEnabled
, style
);
649 parentElement
.addElement(element
);
654 * <p>createIntegerTextWithLabelElement</p>
656 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
657 * @param labelString a {@link java.lang.String} object.
658 * @param initialInteger a {@link java.lang.Integer} object.
659 * @param style a int.
660 * @return a {@link eu.etaxonomy.taxeditor.forms.NumberWithLabelElement} object.
662 public NumberWithLabelElement
createIntegerTextWithLabelElement(ICdmFormElement parentElement
, String labelString
, Integer initialInteger
, int style
){
663 NumberWithLabelElement element
= new NumberWithLabelElement(this, parentElement
, labelString
, initialInteger
, style
);
665 parentElement
.addElement(element
);
671 * <p>createFloatTextWithLabelElement</p>
673 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
674 * @param labelString a {@link java.lang.String} object.
675 * @param initialFloat a float.
676 * @param style a int.
677 * @return a {@link eu.etaxonomy.taxeditor.forms.NumberWithLabelElement} object.
679 public NumberWithLabelElement
createFloatTextWithLabelElement(
680 ICdmFormElement parentElement
, String labelString
, float initialFloat
,
682 NumberWithLabelElement element
= new NumberWithLabelElement(this, parentElement
, labelString
, initialFloat
, style
);
684 parentElement
.addElement(element
);
689 * <p>createLanguageStringWithLabelElement</p>
691 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
692 * @param labelString a {@link java.lang.String} object.
693 * @param languageString a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
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 style
){
698 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(this, parentElement
, labelString
, languageString
, style
);
700 parentElement
.addElement(element
);
705 * <p>createLanguageStringWithLabelElement</p>
707 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
708 * @param labelString a {@link java.lang.String} object.
709 * @param languageString a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
710 * @param height a int.
711 * @param style a int.
712 * @return a {@link eu.etaxonomy.taxeditor.forms.LanguageStringWithLabelElement} object.
714 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(ICdmFormElement parentElement
, String labelString
, LanguageString languageString
, int height
, int style
){
715 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(this, parentElement
, labelString
, languageString
, height
, style
);
717 parentElement
.addElement(element
);
722 * <p>createTextElement</p>
724 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
725 * @param initialText a {@link java.lang.String} object.
726 * @param style a int.
727 * @return a {@link eu.etaxonomy.taxeditor.forms.TextWithLabelElement} object.
729 public TextWithLabelElement
createTextElement(ICdmFormElement parentElement
, String initialText
, int style
){
730 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, null, initialText
, null, style
);
732 parentElement
.addElement(element
);
737 * <p>createKeyValueViewerElement</p>
739 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
740 * @param keyHeading a {@link java.lang.String} object.
741 * @param valueHeading a {@link java.lang.String} object.
742 * @param map a {@link java.util.Map} object.
743 * @return a {@link eu.etaxonomy.taxeditor.forms.KeyValueViewerElement} object.
745 public KeyValueViewerElement
createKeyValueViewerElement(ICdmFormElement parentElement
, String keyHeading
, String valueHeading
, Map
<Object
, Object
> map
){
746 KeyValueViewerElement element
= new KeyValueViewerElement(this, parentElement
, keyHeading
, valueHeading
, map
);
748 parentElement
.addElement(element
);
753 public static enum TermComboType
{
757 NOMENCLATURALSTATUSTYPE
,
762 PRESENCEABSENCESTATUS
,
764 NAMETYPEDESIGNATIONSTATUS
,
765 SPECIMENTYPEDESIGNATIONSTATUS
,
775 DETERMINATION_MODIFIER
,
780 * <p>createTermComboElement</p>
782 * @param termComboType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.TermComboType} object.
783 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
784 * @param labelString a {@link java.lang.String} object.
785 * @param selection a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase} object.
786 * @param style a int.
787 * @return a {@link eu.etaxonomy.taxeditor.forms.term.AbstractTermComboElement} object.
789 public AbstractTermComboElement
createTermComboElement(TermComboType termComboType
, ICdmFormElement parentElement
, String labelString
, DefinedTermBase selection
, int style
){
790 AbstractTermComboElement element
= null;
792 switch(termComboType
){
794 element
= new EmptyComboElement
<DefinedTermBase
>(this, parentElement
, labelString
, style
);
797 element
= new ExtensionTypeComboElement(this, parentElement
, labelString
, (ExtensionType
) selection
, style
);
800 element
= new LanguageComboElement(this, parentElement
, labelString
, (Language
) selection
, style
);
803 element
= new MarkerTypeComboElement(this, parentElement
, labelString
, (MarkerType
) selection
, style
);
805 case NOMENCLATURALSTATUSTYPE
:
806 element
= new NomenclaturalStatusTypeComboElement(this, parentElement
, labelString
, (NomenclaturalStatusType
) selection
, style
);
809 element
= new RankComboElement(this, parentElement
, labelString
, (Rank
) selection
, style
);
812 element
= new RightsTypeComboElement(this, parentElement
, labelString
, (RightsTerm
) selection
, style
);
814 case NAMERELATIONSHIP
:
815 element
= new NameRelationshipTypeComboElement(this, parentElement
, labelString
, (NameRelationshipType
) selection
, style
);
818 element
= new NamedAreaTypeComboElement(this, parentElement
, labelString
, (NamedAreaType
) selection
, style
);
821 element
= new AnnotationTypeComboElement(this, parentElement
, labelString
, (AnnotationType
) selection
, style
);
823 case PRESENCEABSENCESTATUS
:
824 element
= new PresenceAbsenceTermComboElement(this, parentElement
, labelString
, (PresenceAbsenceTermBase
) selection
, style
);
826 case NAMETYPEDESIGNATIONSTATUS
:
827 element
= new NameTypeDesignationStatusComboElement(this, parentElement
, labelString
, (NameTypeDesignationStatus
) selection
, style
);
829 case SPECIMENTYPEDESIGNATIONSTATUS
:
830 element
= new SpecimenTypeDesignationStatusComboElement(this, parentElement
, labelString
, (SpecimenTypeDesignationStatus
) selection
, style
);
833 element
= new SexComboElement(this, parentElement
, labelString
, (Sex
) selection
, style
);
836 element
= new StageComboElement(this, parentElement
, labelString
, (Stage
) selection
, style
);
838 case PRESERVATION_METHOD
:
839 element
= new PreservationMethodComboElement(this, parentElement
, labelString
, (PreservationMethod
) selection
, style
);
841 case MEASUREMENT_UNIT
:
842 element
= new MeasurementUnitComboElement(this, parentElement
, labelString
, (MeasurementUnit
) selection
, style
);
845 element
= new StateComboElement(this, parentElement
, labelString
, (State
) selection
, style
);
848 element
= new ScopeComboElement(this, parentElement
, labelString
, (Scope
) selection
, style
);
851 element
= new ModifierComboElement(this, parentElement
, labelString
, (Modifier
) selection
, style
);
853 case STATISTICAL_MEASURE
:
854 element
= new StatisticalMeasureComboElement(this, parentElement
, labelString
, (StatisticalMeasure
) selection
, style
);
856 case DETERMINATION_MODIFIER
:
857 element
= new DeterminationModifierComboElement(this, parentElement
, labelString
, (DeterminationModifier
) selection
, style
);
859 case REFERENCE_SYSTEM
:
860 element
= new ReferenceSystemComboElement(this, parentElement
, labelString
, (ReferenceSystem
) selection
, style
);
865 parentElement
.addElement(element
);
869 public static enum EnumComboType
{
875 * <p>createEnumComboElement</p>
877 * @param enumComboType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.EnumComboType} object.
878 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
879 * @param style a int.
880 * @return a {@link eu.etaxonomy.taxeditor.forms.term.AbstractEnumComboElement} object.
882 public AbstractEnumComboElement
createEnumComboElement(EnumComboType enumComboType
, ICdmFormElement parentElement
, int style
){
883 AbstractEnumComboElement element
= null;
885 switch(enumComboType
){
887 element
= new ReferenceTypeComboElement(this, parentElement
, "Reference Type", null, style
);
889 case NOMENCLATURALCODE
:
890 element
= new NomenclaturalCodeComboElement(this, parentElement
, "Nomenclatural Code", null, style
);
894 parentElement
.addElement(element
);
899 * <p>createBrowserElement</p>
901 * @param imageUri a {@link java.net.URI} object.
902 * @param style a int.
903 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
904 * @return a {@link eu.etaxonomy.taxeditor.forms.BrowserElement} object.
906 public BrowserElement
createBrowserElement(ICdmFormElement parentElement
, URI imageUri
, int style
){
907 BrowserElement element
= new BrowserElement(this, parentElement
, imageUri
, style
);
909 parentElement
.addElement(element
);
914 * <p>createImageElement</p>
916 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
917 * @param imageUri a {@link java.net.URI} object.
918 * @param style a int.
919 * @return a {@link eu.etaxonomy.taxeditor.forms.ImageElement} object.
921 public ImageElement
createImageElement(ICdmFormElement parentElement
, URI imageUri
, int style
) {
922 ImageElement element
= new ImageElement(this, parentElement
, imageUri
, style
);
924 parentElement
.addElement(element
);
929 * <p>createTextActionElement</p>
931 * @param labelString a {@link java.lang.String} object.
932 * @param initialText a {@link java.lang.String} object.
933 * @param style a int.
934 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
935 * @param buttonLabel a {@link java.lang.String} object.
936 * @return a {@link eu.etaxonomy.taxeditor.forms.TextActionElement} object.
938 public TextActionElement
createTextActionElement(ICdmFormElement parentElement
, String labelString
, String buttonLabel
, String initialText
, int style
){
939 TextActionElement element
= new TextActionElement(this, parentElement
, labelString
, buttonLabel
, initialText
, style
);
941 parentElement
.addElement(element
);
948 * @created Mar 5, 2010
951 public static enum SelectionType
{
974 * <p>createCheckbox</p>
976 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
977 * @param label a {@link java.lang.String} object.
978 * @param initialState a boolean.
979 * @param style a int.
980 * @return a {@link eu.etaxonomy.taxeditor.forms.CheckboxElement} object.
982 public CheckboxElement
createCheckbox(ICdmFormElement parentElement
, String label
, boolean initialState
, int style
) {
983 CheckboxElement element
= new CheckboxElement(this, parentElement
, label
, initialState
, style
| orientation
);
985 parentElement
.addElement(element
);
992 * Creates a section as a part of the form.
994 * @return the section widget
995 * @param section a {@link eu.etaxonomy.taxeditor.forms.AbstractFormSection} object.
997 public Section
adapt(AbstractFormSection section
) {
998 section
.setMenu(section
.getLayoutComposite().getMenu());
999 adapt(section
, true, true);
1001 // handle focus and property change events for cdm use
1002 section
.addFocusListener(selectionFocusHandler
);
1003 section
.setPropertyChangeListeners(propertyChangeListeners
);
1005 if (section
.getToggle() != null) {
1006 section
.getToggle().setHoverDecorationColor(getColors()
1007 .getColor(IFormColors
.TB_TOGGLE_HOVER
));
1008 section
.getToggle().setDecorationColor(getColors()
1009 .getColor(IFormColors
.TB_TOGGLE
));
1012 section
.setFont(boldFontHolder2
.getBoldFont(section
.getLayoutComposite().getFont()));
1014 if ((section
.getStyle() & Section
.TITLE_BAR
) != 0
1015 || (section
.getStyle() & Section
.SHORT_TITLE_BAR
) != 0) {
1016 getColors().initializeSectionToolBarColors();
1017 section
.setTitleBarBackground(getColors().getColor(IFormColors
.TB_BG
));
1018 section
.setTitleBarBorderColor(getColors()
1019 .getColor(IFormColors
.TB_BORDER
));
1021 // call setTitleBarForeground regardless as it also sets the label color
1022 section
.setTitleBarForeground(getColors()
1023 .getColor(IFormColors
.TB_TOGGLE
));
1027 private class BoldFontHolder2
{
1028 private Font normalFont
;
1030 private Font boldFont
;
1032 public BoldFontHolder2() {
1035 public Font
getBoldFont(Font font
) {
1036 createBoldFont(font
);
1040 private void createBoldFont(Font font
) {
1041 if (normalFont
== null || !normalFont
.equals(font
)) {
1045 if (boldFont
== null) {
1046 boldFont
= FormFonts
.getInstance().getBoldFont(getColors().getDisplay(),
1051 public void dispose() {
1052 if (boldFont
!= null) {
1053 FormFonts
.getInstance().markFinished(boldFont
, getColors().getDisplay());
1060 * <p>createToggleableTextField</p>
1062 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1063 * @param labelString a {@link java.lang.String} object.
1064 * @param initialText a {@link java.lang.String} object.
1065 * @param initialState a boolean.
1066 * @param style a int.
1067 * @return a {@link eu.etaxonomy.taxeditor.forms.ToggleableTextElement} object.
1069 public ToggleableTextElement
createToggleableTextField(ICdmFormElement parentElement
,
1070 String labelString
, String initialText
, boolean initialState
, int style
) {
1071 ToggleableTextElement element
= new ToggleableTextElement(this, parentElement
,
1072 labelString
, initialText
, initialState
, style
| orientation
);
1074 parentElement
.addElement(element
);
1079 * <p>createTimePeriodElement</p>
1081 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1082 * @param labelString a {@link java.lang.String} object.
1083 * @param timePeriod a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1084 * @param style a int.
1085 * @return a {@link eu.etaxonomy.taxeditor.forms.TimePeriodElement} object.
1087 public TimePeriodElement
createTimePeriodElement(
1088 ICdmFormElement parentElement
, String labelString
, TimePeriod timePeriod
, int style
) {
1089 TimePeriodElement element
= new TimePeriodElement(this, parentElement
, labelString
, timePeriod
, style
);
1091 parentElement
.addElement(element
);
1097 * <p>createPointElement</p>
1099 * @param style a int.
1100 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1101 * @param point a {@link eu.etaxonomy.cdm.model.location.Point} object.
1102 * @return a {@link eu.etaxonomy.taxeditor.forms.PointElement} object.
1104 public PointElement
createPointElement(ICdmFormElement parentElement
,
1105 Point point
, int style
) {
1106 PointElement element
= new PointElement(this, parentElement
, point
, style
);
1108 parentElement
.addElement(element
);
1113 * <p>createDateDetailSection</p>
1115 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1116 * @param style a int.
1117 * @return a {@link eu.etaxonomy.taxeditor.forms.DateDetailSection} object.
1119 public DateDetailSection
createDateDetailSection(ICdmFormElement parentElement
, int style
){
1120 DateDetailSection section
= new DateDetailSection(this, parentElement
, style
);
1121 parentElement
.addElement(section
);
1127 * <p>createPartialElement</p>
1129 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1130 * @param labelString a {@link java.lang.String} object.
1131 * @param partial a {@link org.joda.time.Partial} object.
1132 * @param style a int.
1133 * @return a {@link eu.etaxonomy.taxeditor.forms.PartialElement} object.
1135 public PartialElement
createPartialElement(ICdmFormElement parentElement
, String labelString
, Partial partial
, int style
){
1136 PartialElement element
= new PartialElement(this, parentElement
, labelString
, style
);
1138 parentElement
.addElement(element
);
1143 * <p>addSelectionListener</p>
1145 * @param listener a {@link org.eclipse.swt.events.SelectionListener} object.
1147 public void addSelectionListener(SelectionListener listener
){
1148 selectionListenerList
.add(listener
);
1152 * <p>removeSelectionListener</p>
1154 * @param listener a {@link org.eclipse.swt.events.SelectionListener} object.
1156 public void removeSelectionListener(SelectionListener listener
){
1157 if(listener
== null){
1158 EditorUtil
.error(this.getClass(), "Tried to remove a selection listener from this factories listeners but was null", null);
1160 selectionListenerList
.remove(listener
);
1165 * <p>addPropertyChangeListener</p>
1167 * @param listener a {@link org.eclipse.jface.util.IPropertyChangeListener} object.
1169 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
1170 propertyChangeListeners
.add(0, listener
);
1174 * <p>removePropertyChangeListener</p>
1176 * @param listener a {@link org.eclipse.jface.util.IPropertyChangeListener} object.
1178 public void removePropertyChangeListener(IPropertyChangeListener listener
){
1179 propertyChangeListeners
.remove(listener
);
1185 * <p>createHorizontalSeparator</p>
1187 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1188 * @param style a int.
1189 * @return a {@link org.eclipse.swt.widgets.Label} object.
1191 public Label
createHorizontalSeparator(ICdmFormElement parentElement
, int style
) {
1192 Label separator
= this.createSeparator(parentElement
.getLayoutComposite(), SWT
.HORIZONTAL
| style
);
1193 separator
.setLayoutData(FILL_HORIZONTALLY());
1198 * <p>createVersionElement</p>
1200 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1201 * @param entity a {@link eu.etaxonomy.cdm.model.common.VersionableEntity} object.
1202 * @param style a int.
1203 * @return a {@link eu.etaxonomy.taxeditor.section.supplemental.VersionElement} object.
1205 public VersionElement
createVersionElement(ICdmFormElement parentElement
, VersionableEntity entity
,
1207 VersionElement element
= new VersionElement(this, parentElement
, entity
, style
);
1209 parentElement
.addElement(element
);
1214 * <p>createVersionSection</p>
1216 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1217 * @param style a int.
1218 * @return a {@link eu.etaxonomy.taxeditor.section.supplemental.VersionSection} object.
1220 public VersionSection
createVersionSection(ICdmFormElement parentElement
, int style
) {
1221 VersionSection section
= new VersionSection(this, parentElement
, style
);
1222 parentElement
.addElement(section
);
1228 * <p>createEmptyElement</p>
1230 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1231 * @return a {@link eu.etaxonomy.taxeditor.section.EmptyElement} object.
1233 public EmptyElement
createEmptyElement(ICdmFormElement parentElement
) {
1234 EmptyElement element
= new EmptyElement(this, parentElement
, null, SWT
.NULL
);
1236 parentElement
.addElement(element
);
1241 * <p>createHeadlineSection</p>
1243 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1244 * @return a {@link eu.etaxonomy.taxeditor.section.supplemental.HeadlineSection} object.
1246 public HeadlineSection
createHeadlineSection(ICdmFormElement parentElement
) {
1247 HeadlineSection section
= new HeadlineSection(this, parentElement
, SWT
.NULL
);
1248 parentElement
.addElement(section
);
1255 * <p>createParsingMessageElement</p>
1257 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1258 * @param parserProblem a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem} object.
1259 * @param style a int.
1260 * @return a {@link eu.etaxonomy.taxeditor.section.taxon.ParsingMessageElement} object.
1262 public ParsingMessageElement
createParsingMessageElement(
1263 ICdmFormElement parentElement
, ParserProblem parserProblem
, int style
) {
1264 ParsingMessageElement element
= new ParsingMessageElement(this, parentElement
, parserProblem
, style
);
1266 parentElement
.addElement(element
);
1276 public static enum DetailType
{
1280 NOMENCLATURALREFERENCE
,
1292 DERIVED_UNIT_FACADE
,
1294 DERIVED_UNIT
, NATURAL_LANGUAGE
,
1295 FEATURE_DISTRIBUTION
,
1300 POLYTOMOUS_KEY_NODE
,
1302 DERIVED_UNIT_GENERAL
,
1307 * <p>createCdmDetailSection</p>
1309 * @param detailType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.DetailType} object.
1310 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1311 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1312 * @param style a int.
1313 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1314 * @return a {@link eu.etaxonomy.taxeditor.forms.AbstractFormSection} object.
1316 public AbstractFormSection
createCdmDetailSection(DetailType detailType
, ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1317 AbstractFormSection section
= null;
1320 case SCIENTIFICNAME
:
1321 section
= new NameDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1324 section
= new ReferenceDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1326 case NOMENCLATURALREFERENCE
:
1327 section
= new NomenclaturalReferenceDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1330 section
= new TaxonBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1333 section
= new AuthorshipDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1335 case TEAMORPERSONBASE
:
1336 section
= new TeamOrPersonBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1339 section
= new TeamDetailSection(this, conversation
, parentElement
, null, style
);
1342 section
= new PersonDetailSection(this, conversation
, parentElement
, null, style
);
1345 section
= new DescriptionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1347 case DESCRIPTIONELEMENT
:
1348 section
= new DescriptionElementDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1350 case PARSINGMESSAGE
:
1351 section
= new ParsingMessagesSection(this, conversation
, parentElement
, selectionProvider
, style
);
1354 section
= new NonViralNameDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1357 section
= new eu
.etaxonomy
.taxeditor
.section
.description
.MediaDetailsSection(this, conversation
, parentElement
, selectionProvider
, style
);
1359 case DERIVED_UNIT_FACADE
:
1360 section
= new DerivedUnitFacadeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1362 case FIELD_OBSERVATION
:
1363 section
= new FieldObservationDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1365 case GATHERING_EVENT
:
1366 section
= new GatheringEventDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1369 section
= new DerivedUnitBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1371 case NATURAL_LANGUAGE
:
1372 section
= new NaturalLanguageSection(this, conversation
, parentElement
, selectionProvider
, style
);
1374 case FEATURE_DISTRIBUTION
:
1375 section
= new FeatureDistributionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1377 case CLASSIFICATION
:
1378 section
= new ClassificationDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1381 section
= new TaxonNodeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1383 case POLYTOMOUS_KEY
:
1384 section
= new PolytomousKeyDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1386 case POLYTOMOUS_KEY_NODE
:
1387 section
= new PolytomousKeyNodeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1390 section
= new InstitutionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1392 case DERIVED_UNIT_GENERAL
:
1393 section
= new GeneralDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1396 section
= new HybridDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1400 if(section
== null){
1401 throw new RuntimeException("You tried to create a cdm detail section that is not implemented yet.");
1404 parentElement
.addElement(section
);
1410 * <p>createCdmDetailElement</p>
1412 * @param detailType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.DetailType} object.
1413 * @param style a int.
1414 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1415 * @return a {@link eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement} object.
1417 public AbstractCdmDetailElement
createCdmDetailElement(DetailType detailType
, ICdmFormElement parentElement
, int style
){
1418 AbstractCdmDetailElement element
= null;
1421 case SCIENTIFICNAME
:
1422 element
= new NameDetailElement(this, parentElement
, style
);
1425 element
= new ReferenceDetailElement(this, parentElement
, style
);
1427 case NOMENCLATURALREFERENCE
:
1428 element
= new NomenclaturalReferenceDetailElement(this, parentElement
, style
);
1431 element
= new TaxonBaseDetailElement(this, parentElement
, style
);
1434 element
= new AuthorshipDetailElement(this, parentElement
, style
);
1437 element
= new TeamDetailElement(this, parentElement
, style
);
1440 element
= new PersonDetailElement(this, parentElement
, style
);
1443 element
= new DescriptionDetailElement(this, parentElement
, style
);
1445 case DESCRIPTIONELEMENT
:
1446 element
= new DescriptionElementDetailElement(this, parentElement
, style
);
1449 element
= new NonViralNameDetailElement(this, parentElement
);
1451 case DERIVED_UNIT_FACADE
:
1452 element
= new DerivedUnitFacadeDetailElement(this, parentElement
);
1454 case FIELD_OBSERVATION
:
1455 element
= new FieldObservationDetailElement(this, parentElement
);
1457 case GATHERING_EVENT
:
1458 element
= new GatheringEventDetailElement(this, parentElement
);
1461 element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1463 case NATURAL_LANGUAGE
:
1464 element
= new NaturalLanguageDetailElement(this, parentElement
);
1466 case FEATURE_DISTRIBUTION
:
1467 element
= new FeatureDistributionDetailElement(this, parentElement
);
1469 case CLASSIFICATION
:
1470 element
= new ClassificationDetailElement(this, parentElement
);
1473 element
= new TaxonNodeDetailElement(this, parentElement
);
1476 element
= new CollectionDetailElement(this, parentElement
);
1478 case POLYTOMOUS_KEY
:
1479 element
= new PolytomousKeyDetailElement(this, parentElement
);
1481 case POLYTOMOUS_KEY_NODE
:
1482 element
= new PolytomousKeyNodeDetailElement(this, parentElement
);
1485 element
= new InstitutionDetailElement(this, parentElement
);
1487 case DERIVED_UNIT_GENERAL
:
1488 element
= new GeneralDetailElement(this, parentElement
);
1491 element
= new HybridDetailElement(this, parentElement
);
1495 if(element
== null){
1496 EditorUtil
.error(this.getClass(), "Detail element was not created. Seems like the case was not implemented for the requested detail type: " + detailType
, null);
1500 parentElement
.addElement(element
);
1506 * @author n.hoffmann
1507 * @created Mar 5, 2010
1510 public static enum EntityDetailType
{
1515 DESCRIPTIONELEMENTSOURCE
,
1519 DESCRIPTIONELEMENTMEDIA
,
1520 MEDIAREPRESENTATION
,
1521 MEDIAREPRESENTATIONPART
,
1523 NOMENCLATURALSTATUS
,
1532 STATISTICAL_MEASUREMENT_VALUE
,
1535 DETERMINATION_EVENT
,
1536 SPECIMEN_COLLECTION
,
1537 IDENTIFIABLE_SOURCE_COLLECTION
,
1543 * <p>createEntityDetailSection</p>
1545 * @param entityDetailType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.EntityDetailType} object.
1546 * @param style a int.
1547 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1548 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1549 * @return a {@link eu.etaxonomy.taxeditor.forms.AbstractFormSection} object.
1551 public AbstractFormSection
createEntityDetailSection(EntityDetailType entityDetailType
, ConversationHolder conversation
, ICdmFormElement parentElement
, int style
){
1552 AbstractFormSection section
= null;
1554 switch(entityDetailType
){
1556 section
= new TeamDetailSection(this, conversation
, parentElement
, null, style
);
1559 section
= new TeamMemberSection(this, conversation
, parentElement
, style
);
1562 section
= new AnnotationSection(this, conversation
, parentElement
, style
);
1565 section
= new CreditSection(this, conversation
, parentElement
, style
);
1567 case DESCRIPTIONELEMENTSOURCE
:
1568 section
= new DescriptionElementSourceSection(this, conversation
, parentElement
, style
);
1571 section
= new ExtensionSection(this, conversation
, parentElement
, style
);
1574 section
= new MarkerSection(this, conversation
, parentElement
, style
);
1577 section
= new MediaSection(this, conversation
, parentElement
, style
);
1579 case DESCRIPTIONELEMENTMEDIA
:
1580 section
= new DescriptionElementMediaSection(this, conversation
, parentElement
, style
);
1582 case MEDIAREPRESENTATION
:
1583 section
= new MediaRepresentationSection(this, conversation
, parentElement
, style
);
1585 case MEDIAREPRESENTATIONPART
:
1586 section
= new MediaRepresentationPartSection(this, conversation
, parentElement
, style
);
1589 section
= new ModifierSection(this, conversation
, parentElement
, style
);
1591 case NOMENCLATURALSTATUS
:
1592 section
= new NomenclaturalStatusSection(this, conversation
, parentElement
, style
);
1594 case NAME_RELATIONSHIP
:
1595 section
= new NameRelationshipDetailSection(this, conversation
, parentElement
, style
);
1598 section
= new ProtologueSection(this, conversation
, parentElement
, style
);
1601 section
= new RightsSection(this, conversation
, parentElement
, style
);
1604 section
= new SourceSection(this, conversation
, parentElement
, style
);
1607 section
= new ScopeSection(this, conversation
, parentElement
, style
);
1609 case DESCRIPTIONSOURCE
:
1610 section
= new DescriptionSourceSection(this, conversation
, parentElement
, style
);
1612 case TYPEDESIGNATION
:
1613 section
= new TypeDesignationSection(this, conversation
, parentElement
, style
);
1616 section
= new StateDataSection(this, conversation
, parentElement
, style
);
1618 case STATISTICAL_MEASUREMENT_VALUE
:
1619 section
= new StatisticalMeasurementValueSection(this, conversation
, parentElement
, style
);
1621 case DESCRIBED_SPECIMEN
:
1622 section
= new DescribedSpecimenSection(this, conversation
, parentElement
, style
);
1624 case COLLECTING_AREA
:
1625 section
= new CollectingAreasDetailSection(this, conversation
, parentElement
, style
);
1627 case DETERMINATION_EVENT
:
1628 section
= new DeterminationEventDetailSection(this, conversation
, parentElement
, style
);
1630 case SPECIMEN_COLLECTION
:
1631 section
= new SpecimenCollectionDetailSection(this, conversation
, parentElement
, style
);
1633 case IDENTIFIABLE_SOURCE_COLLECTION
:
1634 section
= new SourceCollectionDetailSection(this, conversation
, parentElement
, style
);
1636 case GEOGRAPHICAL_SCOPE
:
1637 section
= new GeographicalScopeDetailSection(this, conversation
, parentElement
, style
);
1639 case SCOPE_RESTRICTION
:
1640 section
= new ScopeRestrictionSection(this, conversation
, parentElement
, style
);
1643 parentElement
.addElement(section
);
1649 * <p>createEntityCollectionElement</p>
1651 * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
1652 * @param style a int.
1653 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.AbstractFormSection} object.
1654 * @param versionableEntity a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity} object.
1655 * @param backgroundColor a {@link org.eclipse.swt.graphics.Color} object.
1656 * @return a {@link eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement} object.
1658 public AbstractEntityCollectionElement
createEntityCollectionElement(AbstractFormSection parentElement
, IVersionableEntity versionableEntity
, SelectionListener removeListener
, Color backgroundColor
, int style
){
1659 AbstractEntityCollectionElement element
= null;
1661 VersionableEntity entity
= (VersionableEntity
) HibernateProxyHelper
.deproxy(versionableEntity
);
1663 if(entity
instanceof Annotation
){
1664 element
= new AnnotationElement(this, parentElement
, (Annotation
) entity
, removeListener
, style
);
1666 else if(entity
instanceof Person
){
1667 element
= new TeamMemberElement(this, parentElement
, (Person
) entity
, removeListener
, style
);
1669 else if(entity
instanceof Credit
){
1670 element
= new CreditElement(this, parentElement
, (Credit
) entity
, removeListener
, style
);
1672 else if(entity
instanceof Extension
){
1673 element
= new ExtensionElement(this, parentElement
, (Extension
) entity
, removeListener
, style
);
1675 else if(entity
instanceof Marker
){
1676 element
= new MarkerElement(this, parentElement
, (Marker
) entity
, removeListener
, style
);
1678 else if(entity
instanceof Media
){
1679 element
= new MediaElement(this, parentElement
, (Media
) entity
, removeListener
, style
);
1681 else if(entity
instanceof MediaRepresentation
){
1682 element
= new MediaRepresentationElement(this, parentElement
, (MediaRepresentation
) entity
, removeListener
, style
);
1684 else if(entity
instanceof ImageFile
){
1685 element
= new ImageFileElement(this, parentElement
, (ImageFile
) entity
, removeListener
, style
);
1687 else if(entity
instanceof NomenclaturalStatus
){
1688 element
= new NomenclaturalStatusElement(this, parentElement
, (NomenclaturalStatus
) entity
, removeListener
, style
);
1690 else if(entity
instanceof Rights
){
1691 element
= new RightsElement(this, parentElement
, (Rights
) entity
, removeListener
, style
);
1693 else if(entity
instanceof DescriptionElementSource
){
1694 element
= new DescriptionElementSourceElement(this, parentElement
, (DescriptionElementSource
) entity
, removeListener
, style
);
1696 else if(entity
instanceof IdentifiableSource
){
1697 element
= new IdentifiableSourceElement(this, parentElement
, (IdentifiableSource
) entity
, removeListener
, style
);
1699 else if(entity
instanceof Scope
){
1700 element
= new ScopeElement(this, parentElement
, (Scope
) entity
, removeListener
, style
);
1702 else if(entity
instanceof Modifier
){
1703 element
= new ModifierElement(this, parentElement
, (Modifier
) entity
, removeListener
, style
);
1705 else if(entity
instanceof Reference
){
1706 element
= new DescriptionSourceElement(this, parentElement
, (Reference
) entity
, removeListener
, style
);
1708 else if(entity
instanceof NameTypeDesignation
){
1709 element
= new NameTypeDesignationElement(this, parentElement
, (NameTypeDesignation
) entity
, removeListener
, style
);
1711 else if(entity
instanceof NameRelationship
){
1712 element
= new NameRelationshipDetailElement(this, parentElement
, (NameRelationship
) entity
, removeListener
, style
);
1714 else if(entity
instanceof SpecimenTypeDesignation
){
1715 element
= new SpecimenTypeDesignationElement(this, parentElement
, (SpecimenTypeDesignation
) entity
, removeListener
, style
);
1717 else if(entity
instanceof StateData
){
1718 element
= new StateDataElement(this, parentElement
, (StateData
) entity
, removeListener
, style
);
1720 else if(entity
instanceof StatisticalMeasurementValue
){
1721 element
= new StatisticalMeasurementValueElement(this, parentElement
, (StatisticalMeasurementValue
) entity
, removeListener
, style
);
1723 else if(entity
instanceof DerivedUnit
){
1724 element
= new DerivedUnitElement(this, parentElement
, (DerivedUnit
) entity
, removeListener
, style
);
1726 else if(entity
instanceof NamedArea
){
1727 element
= new NamedAreaDetailElement(this, parentElement
, (NamedArea
) entity
, removeListener
, style
);
1729 else if(entity
instanceof DeterminationEvent
){
1730 element
= new DeterminationEventDetailElement(this, parentElement
, (DeterminationEvent
) entity
, removeListener
, style
);
1732 else if(entity
instanceof Specimen
){
1733 element
= new SpecimenCollectionDetailElement(this, parentElement
, (Specimen
) entity
, removeListener
, style
);
1736 else if(entity
instanceof DescriptionElementBase
){
1737 // this is the special case for protologs, maybe we can do this differently when API improves
1738 DescriptionElementBase descriptionElement
= (DescriptionElementBase
) entity
;
1739 if(descriptionElement
.getFeature().equals(Feature
.PROTOLOGUE())){
1740 element
= new ProtologueElement(this, parentElement
, descriptionElement
, removeListener
, style
);
1744 if(element
== null){
1745 EditorUtil
.errorDialog("No element for entity", this, "Could not generate element for entity. " +
1746 "Looks like the case is not handled already. Check implementation. Entity: " + entity
, null);
1749 if(backgroundColor
!= null && !backgroundColor
.isDisposed()){
1750 element
.setBackgroundColor(backgroundColor
);
1754 parentElement
.addElement(element
);
1759 * <p>createSelectionElement</p>
1761 * @param selectionType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.SelectionType} object.
1762 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1763 * @param labelString a {@link java.lang.String} object.
1764 * @param selectionType
1765 * @param selection a {@link eu.etaxonomy.cdm.model.common.IAnnotatableEntity} object.
1766 * @param style a int.
1767 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1768 * @return a {@link eu.etaxonomy.taxeditor.forms.selection.AbstractSelectionElement} object.
1770 public AbstractSelectionElement
createSelectionElement(SelectionType selectionType
, ConversationHolder conversation
, ICdmFormElement parentElement
, String labelString
, ICdmBase selection
, int style
){
1771 AbstractSelectionElement element
= null;
1773 IAnnotatableEntity entity
= (IAnnotatableEntity
) HibernateProxyHelper
.deproxy(selection
);
1775 switch (selectionType
) {
1777 element
= new AgentSelectionElement(this, conversation
, parentElement
, labelString
, (TeamOrPersonBase
) entity
, style
);
1780 element
= new PersonSelectionElement(this, conversation
, parentElement
, labelString
, (Person
) entity
, style
);
1783 element
= new TeamSelectionElement(this, conversation
, parentElement
, labelString
, (Team
) entity
, style
);
1786 element
= new NomenclaturalAuthorTeamSelectionElement(this, conversation
, parentElement
, labelString
, (Team
) entity
, style
);
1789 element
= new InstitutionSelectionElement(this, conversation
, parentElement
, labelString
, (Institution
) entity
, style
);
1792 element
= new NameSelectionElement(this, conversation
, parentElement
, labelString
, (TaxonNameBase
) entity
, style
);
1795 element
= new ReferenceSelectionElement(this, conversation
, parentElement
, labelString
, (Reference
) entity
, style
);
1798 element
= new TaxonBaseSelectionElement(this, conversation
, parentElement
, labelString
, (TaxonBase
) entity
, style
);
1801 element
= new TaxonSelectionElement(this, conversation
, parentElement
, labelString
, (Taxon
) entity
, style
);
1804 element
= new SynonymSelectionElement(this, conversation
, parentElement
, labelString
, (Synonym
) entity
, style
);
1807 element
= new DerivedUnitBaseSelectionElement(this, conversation
, parentElement
, labelString
, (DerivedUnitBase
) entity
, style
);
1809 case FIELD_OBSERVATION
:
1810 element
= new FieldObservationSelectionElement(this, conversation
, parentElement
, labelString
, (FieldObservation
) entity
, style
);
1813 element
= new FeatureTreeSelectionElement(this, conversation
, parentElement
, labelString
, (FeatureTree
) entity
, style
);
1815 case CLASSIFICATION
:
1816 element
= new ClassificationSelectionElement(this, conversation
, parentElement
, labelString
, (Classification
) entity
, style
);
1819 element
= new TaxonNodeSelectionElement(this, conversation
, parentElement
, labelString
, (TaxonNode
) entity
, style
);
1822 element
= new CollectionSelectionElement(this, conversation
, parentElement
, labelString
, (Collection
) entity
, style
);
1825 element
= new FeatureSelectionElement(this, conversation
, parentElement
, labelString
, (Feature
) entity
, style
);
1827 case POLYTOMOUS_KEY
:
1828 element
= new PolytomousKeySelectionElement(this, conversation
, parentElement
, labelString
, (PolytomousKey
) entity
, style
);
1830 case POLYTOMOUS_KEY_NODE
:
1831 element
= new PolytomousKeyNodeSelectionElement(this, conversation
, parentElement
, labelString
, (PolytomousKeyNode
) entity
, style
);
1834 new RuntimeException("There is no selection composite for the desired selection type.");
1839 parentElement
.addElement(element
);
1844 * <p>createNamedAreaSelectionElement</p>
1846 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1847 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1848 * @param labelString a {@link java.lang.String} object.
1849 * @param selection a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
1850 * @param style a int.
1851 * @return a {@link eu.etaxonomy.taxeditor.forms.selection.NamedAreaSelectionElement} object.
1853 public NamedAreaSelectionElement
createNamedAreaSelectionElement(ICdmFormElement parentElement
, ConversationHolder conversation
, String labelString
, NamedArea selection
, int style
){
1854 NamedAreaSelectionElement element
= new NamedAreaSelectionElement(this, conversation
, parentElement
, labelString
, selection
, style
);
1856 parentElement
.addElement(element
);
1860 /** {@inheritDoc} */
1861 public LabelElement
createLabel(ICdmFormElement parentElement
, String text
) {
1862 LabelElement labelElement
= new LabelElement(this, parentElement
, text
);
1863 adapt(labelElement
);
1864 parentElement
.addElement(labelElement
);
1865 return labelElement
;
1869 * <p>Getter for the field <code>selectionProvider</code>.</p>
1871 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1873 public ISelectionProvider
getSelectionProvider() {
1874 return selectionProvider
;
1878 * <p>createDetailedDescriptionDetailElement</p>
1880 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1881 * @param entity a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
1882 * @param style a int.
1883 * @return a {@link eu.etaxonomy.taxeditor.section.description.detail.AbstractDetailedDescriptionDetailElement} object.
1885 public AbstractDetailedDescriptionDetailElement
createDetailedDescriptionDetailElement(
1886 ICdmFormElement parentElement
, DescriptionElementBase entity
, int style
) {
1887 AbstractDetailedDescriptionDetailElement detailedDescriptionElement
= null;
1890 if(entity
instanceof CategoricalData
){
1891 detailedDescriptionElement
= new CategoricalDataDetailElement(this, parentElement
, (CategoricalData
) entity
, style
);
1893 else if(entity
instanceof CommonTaxonName
){
1894 detailedDescriptionElement
= new CommonNameDetailElement(this, parentElement
, (CommonTaxonName
) entity
, style
);
1896 else if(entity
instanceof Distribution
){
1897 detailedDescriptionElement
= new DistributionDetailElement(this, parentElement
, (Distribution
) entity
, style
);
1899 else if(entity
instanceof IndividualsAssociation
){
1900 detailedDescriptionElement
= new IndividualsAssociationDetailElement(this, parentElement
, (IndividualsAssociation
) entity
, style
);
1902 else if(entity
instanceof QuantitativeData
){
1903 detailedDescriptionElement
= new QuantitativeDataDetailElement(this, parentElement
, (QuantitativeData
) entity
, style
);
1905 else if(entity
instanceof TaxonInteraction
){
1906 detailedDescriptionElement
= new TaxonInteractionDetailElement(this, parentElement
, (TaxonInteraction
) entity
, style
);
1908 else if(entity
instanceof TextData
){
1909 detailedDescriptionElement
= new TextDataDetailElement(this, parentElement
, (TextData
) entity
, style
);
1912 throw new IllegalStateException("There is no interface for the given description element");
1914 adapt(detailedDescriptionElement
);
1915 parentElement
.addElement(detailedDescriptionElement
);
1916 return detailedDescriptionElement
;
1922 * Creates a styled text as a part of the form.
1927 * the text initial value
1930 * @return the text widget
1932 public StyledText
createStyledText(Composite parent
, String value
, int style
) {
1933 StyledText text
= new StyledText(parent
, getBorderStyle() | style
| getOrientation());
1935 text
.setText(value
);
1936 text
.setForeground(getColors().getForeground());
1937 text
.setBackground(getColors().getBackground());
1938 // text.addFocusListener(visibilityHandler);