4 package eu
.etaxonomy
.taxeditor
.ui
.forms
;
7 import java
.util
.ArrayList
;
8 import java
.util
.HashSet
;
13 import org
.eclipse
.jface
.util
.IPropertyChangeListener
;
14 import org
.eclipse
.jface
.viewers
.ISelection
;
15 import org
.eclipse
.jface
.viewers
.ISelectionProvider
;
16 import org
.eclipse
.jface
.window
.Window
;
17 import org
.eclipse
.swt
.SWT
;
18 import org
.eclipse
.swt
.custom
.StyledText
;
19 import org
.eclipse
.swt
.events
.FocusAdapter
;
20 import org
.eclipse
.swt
.events
.FocusEvent
;
21 import org
.eclipse
.swt
.events
.FocusListener
;
22 import org
.eclipse
.swt
.events
.MouseAdapter
;
23 import org
.eclipse
.swt
.events
.MouseEvent
;
24 import org
.eclipse
.swt
.events
.MouseListener
;
25 import org
.eclipse
.swt
.events
.SelectionEvent
;
26 import org
.eclipse
.swt
.events
.SelectionListener
;
27 import org
.eclipse
.swt
.events
.TypedEvent
;
28 import org
.eclipse
.swt
.graphics
.Color
;
29 import org
.eclipse
.swt
.graphics
.Font
;
30 import org
.eclipse
.swt
.widgets
.Composite
;
31 import org
.eclipse
.swt
.widgets
.Control
;
32 import org
.eclipse
.swt
.widgets
.Display
;
33 import org
.eclipse
.swt
.widgets
.Event
;
34 import org
.eclipse
.swt
.widgets
.Label
;
35 import org
.eclipse
.ui
.forms
.IFormColors
;
36 import org
.eclipse
.ui
.forms
.widgets
.FormToolkit
;
37 import org
.eclipse
.ui
.forms
.widgets
.Section
;
38 import org
.eclipse
.ui
.forms
.widgets
.TableWrapData
;
39 import org
.eclipse
.ui
.forms
.widgets
.TableWrapLayout
;
40 import org
.eclipse
.ui
.internal
.forms
.widgets
.FormFonts
;
41 import org
.joda
.time
.Partial
;
42 import org
.springframework
.security
.core
.GrantedAuthority
;
44 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
45 import eu
.etaxonomy
.cdm
.api
.conversation
.IConversationEnabled
;
46 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
47 import eu
.etaxonomy
.cdm
.model
.agent
.Institution
;
48 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
49 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
50 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
51 import eu
.etaxonomy
.cdm
.model
.common
.Annotation
;
52 import eu
.etaxonomy
.cdm
.model
.common
.AnnotationType
;
53 import eu
.etaxonomy
.cdm
.model
.common
.Credit
;
54 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
55 import eu
.etaxonomy
.cdm
.model
.common
.DescriptionElementSource
;
56 import eu
.etaxonomy
.cdm
.model
.common
.Extension
;
57 import eu
.etaxonomy
.cdm
.model
.common
.ExtensionType
;
58 import eu
.etaxonomy
.cdm
.model
.common
.Group
;
59 import eu
.etaxonomy
.cdm
.model
.common
.IAnnotatableEntity
;
60 import eu
.etaxonomy
.cdm
.model
.common
.ICdmBase
;
61 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableSource
;
62 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
63 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
64 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
65 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
66 import eu
.etaxonomy
.cdm
.model
.common
.TimePeriod
;
67 import eu
.etaxonomy
.cdm
.model
.common
.User
;
68 import eu
.etaxonomy
.cdm
.model
.common
.VersionableEntity
;
69 import eu
.etaxonomy
.cdm
.model
.description
.CategoricalData
;
70 import eu
.etaxonomy
.cdm
.model
.description
.CommonTaxonName
;
71 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
72 import eu
.etaxonomy
.cdm
.model
.description
.Distribution
;
73 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
74 import eu
.etaxonomy
.cdm
.model
.description
.FeatureTree
;
75 import eu
.etaxonomy
.cdm
.model
.description
.IndividualsAssociation
;
76 import eu
.etaxonomy
.cdm
.model
.description
.KeyStatement
;
77 import eu
.etaxonomy
.cdm
.model
.description
.MeasurementUnit
;
78 import eu
.etaxonomy
.cdm
.model
.description
.Modifier
;
79 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKey
;
80 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKeyNode
;
81 import eu
.etaxonomy
.cdm
.model
.description
.PresenceAbsenceTermBase
;
82 import eu
.etaxonomy
.cdm
.model
.description
.QuantitativeData
;
83 import eu
.etaxonomy
.cdm
.model
.description
.Scope
;
84 import eu
.etaxonomy
.cdm
.model
.description
.Sex
;
85 import eu
.etaxonomy
.cdm
.model
.description
.Stage
;
86 import eu
.etaxonomy
.cdm
.model
.description
.State
;
87 import eu
.etaxonomy
.cdm
.model
.description
.StateData
;
88 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasure
;
89 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasurementValue
;
90 import eu
.etaxonomy
.cdm
.model
.description
.TaxonInteraction
;
91 import eu
.etaxonomy
.cdm
.model
.description
.TextData
;
92 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
93 import eu
.etaxonomy
.cdm
.model
.location
.NamedAreaType
;
94 import eu
.etaxonomy
.cdm
.model
.location
.Point
;
95 import eu
.etaxonomy
.cdm
.model
.location
.ReferenceSystem
;
96 import eu
.etaxonomy
.cdm
.model
.media
.ImageFile
;
97 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
98 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
99 import eu
.etaxonomy
.cdm
.model
.media
.Rights
;
100 import eu
.etaxonomy
.cdm
.model
.media
.RightsTerm
;
101 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationship
;
102 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationshipType
;
103 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignation
;
104 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignationStatus
;
105 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
106 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatusType
;
107 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
108 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignation
;
109 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignationStatus
;
110 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
111 import eu
.etaxonomy
.cdm
.model
.occurrence
.Collection
;
112 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
113 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnitBase
;
114 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationEvent
;
115 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationModifier
;
116 import eu
.etaxonomy
.cdm
.model
.occurrence
.FieldObservation
;
117 import eu
.etaxonomy
.cdm
.model
.occurrence
.PreservationMethod
;
118 import eu
.etaxonomy
.cdm
.model
.occurrence
.Specimen
;
119 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
120 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
121 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
122 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
123 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
124 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
125 import eu
.etaxonomy
.cdm
.strategy
.parser
.ParserProblem
;
126 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
127 import eu
.etaxonomy
.taxeditor
.ui
.forms
.password
.EditPasswordElement
;
128 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.IOpenUrlEnabled
;
129 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.OpenUrlSelectorElement
;
130 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
131 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
132 import eu
.etaxonomy
.taxeditor
.ui
.section
.EmptyElement
;
133 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailElement
;
134 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailSection
;
135 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailElement
;
136 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailSection
;
137 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailElement
;
138 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailSection
;
139 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberElement
;
140 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberSection
;
141 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamOrPersonBaseDetailSection
;
142 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailElement
;
143 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailSection
;
144 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailElement
;
145 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailSection
;
146 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DerivedUnitElement
;
147 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescribedSpecimenSection
;
148 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailElement
;
149 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailSection
;
150 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailElement
;
151 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailSection
;
152 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementMediaSection
;
153 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceElement
;
154 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceSection
;
155 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceElement
;
156 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceSection
;
157 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierElement
;
158 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierSection
;
159 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageDetailElement
;
160 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageSection
;
161 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeElement
;
162 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeSection
;
163 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataElement
;
164 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataSection
;
165 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueElement
;
166 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueSection
;
167 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.AbstractDetailedDescriptionDetailElement
;
168 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CategoricalDataDetailElement
;
169 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CommonNameDetailElement
;
170 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.DistributionDetailElement
;
171 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.IndividualsAssociationDetailElement
;
172 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.QuantitativeDataDetailElement
;
173 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TaxonInteractionDetailElement
;
174 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TextDataDetailElement
;
175 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailElement
;
176 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailSection
;
177 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GrantedAuthorityDetailElement
;
178 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GrantedAuthorityDetailSection
;
179 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailElement
;
180 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailSection
;
181 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailElement
;
182 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailSection
;
183 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.GeographicalScopeDetailSection
;
184 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailElement
;
185 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailSection
;
186 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailElement
;
187 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailSection
;
188 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.ScopeRestrictionSection
;
189 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailElement
;
190 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailSection
;
191 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailElement
;
192 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailSection
;
193 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailElement
;
194 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailSection
;
195 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailElement
;
196 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailSection
;
197 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameTypeDesignationElement
;
198 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusElement
;
199 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusSection
;
200 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailElement
;
201 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailSection
;
202 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueElement
;
203 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueSection
;
204 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.SpecimenTypeDesignationElement
;
205 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.TypeDesignationSection
;
206 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectingAreasDetailSection
;
207 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectionDetailElement
;
208 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailElement
;
209 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailSection
;
210 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailElement
;
211 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailSection
;
212 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationEventDetailElement
;
213 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationEventDetailSection
;
214 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailElement
;
215 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailSection
;
216 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailElement
;
217 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailSection
;
218 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailElement
;
219 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailSection
;
220 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.NamedAreaDetailElement
;
221 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SourceCollectionDetailSection
;
222 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailElement
;
223 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailSection
;
224 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailElement
;
225 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailSection
;
226 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailElement
;
227 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailSection
;
228 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationElement
;
229 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationSection
;
230 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditElement
;
231 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditSection
;
232 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionElement
;
233 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionSection
;
234 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.HeadlineSection
;
235 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.IdentifiableSourceElement
;
236 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ImageFileElement
;
237 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerElement
;
238 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerSection
;
239 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MediaElement
;
240 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MediaRepresentationElement
;
241 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MediaRepresentationPartSection
;
242 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MediaRepresentationSection
;
243 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MediaSection
;
244 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsElement
;
245 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
246 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.SourceSection
;
247 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionElement
;
248 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionSection
;
249 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessageElement
;
250 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
251 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailElement
;
252 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
253 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailElement
;
254 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailSection
;
255 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailElement
;
256 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailSection
;
257 import eu
.etaxonomy
.taxeditor
.ui
.selection
.AbstractSelectionElement
;
258 import eu
.etaxonomy
.taxeditor
.ui
.selection
.AgentSelectionElement
;
259 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ClassificationSelectionElement
;
260 import eu
.etaxonomy
.taxeditor
.ui
.selection
.CollectionSelectionElement
;
261 import eu
.etaxonomy
.taxeditor
.ui
.selection
.DerivedUnitBaseSelectionElement
;
262 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FeatureSelectionElement
;
263 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FeatureTreeSelectionElement
;
264 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FieldObservationSelectionElement
;
265 import eu
.etaxonomy
.taxeditor
.ui
.selection
.GroupSelectionElement
;
266 import eu
.etaxonomy
.taxeditor
.ui
.selection
.InstitutionSelectionElement
;
267 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NameSelectionElement
;
268 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NamedAreaSelectionElement
;
269 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NomenclaturalAuthorTeamSelectionElement
;
270 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PersonSelectionElement
;
271 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PolytomousKeyNodeSelectionElement
;
272 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PolytomousKeySelectionElement
;
273 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ReferenceSelectionElement
;
274 import eu
.etaxonomy
.taxeditor
.ui
.selection
.SynonymSelectionElement
;
275 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonBaseSelectionElement
;
276 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonNodeSelectionElement
;
277 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonSelectionElement
;
278 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TeamSelectionElement
;
279 import eu
.etaxonomy
.taxeditor
.ui
.selection
.UserSelectionElement
;
280 import eu
.etaxonomy
.taxeditor
.ui
.term
.AbstractEnumComboElement
;
281 import eu
.etaxonomy
.taxeditor
.ui
.term
.AbstractTermComboElement
;
282 import eu
.etaxonomy
.taxeditor
.ui
.term
.AnnotationTypeComboElement
;
283 import eu
.etaxonomy
.taxeditor
.ui
.term
.DeterminationModifierComboElement
;
284 import eu
.etaxonomy
.taxeditor
.ui
.term
.EmptyComboElement
;
285 import eu
.etaxonomy
.taxeditor
.ui
.term
.ExtensionTypeComboElement
;
286 import eu
.etaxonomy
.taxeditor
.ui
.term
.LanguageComboElement
;
287 import eu
.etaxonomy
.taxeditor
.ui
.term
.MarkerTypeComboElement
;
288 import eu
.etaxonomy
.taxeditor
.ui
.term
.MeasurementUnitComboElement
;
289 import eu
.etaxonomy
.taxeditor
.ui
.term
.ModifierComboElement
;
290 import eu
.etaxonomy
.taxeditor
.ui
.term
.NameRelationshipTypeComboElement
;
291 import eu
.etaxonomy
.taxeditor
.ui
.term
.NameTypeDesignationStatusComboElement
;
292 import eu
.etaxonomy
.taxeditor
.ui
.term
.NamedAreaTypeComboElement
;
293 import eu
.etaxonomy
.taxeditor
.ui
.term
.NomenclaturalCodeComboElement
;
294 import eu
.etaxonomy
.taxeditor
.ui
.term
.NomenclaturalStatusTypeComboElement
;
295 import eu
.etaxonomy
.taxeditor
.ui
.term
.PresenceAbsenceTermComboElement
;
296 import eu
.etaxonomy
.taxeditor
.ui
.term
.PreservationMethodComboElement
;
297 import eu
.etaxonomy
.taxeditor
.ui
.term
.RankComboElement
;
298 import eu
.etaxonomy
.taxeditor
.ui
.term
.ReferenceSystemComboElement
;
299 import eu
.etaxonomy
.taxeditor
.ui
.term
.ReferenceTypeComboElement
;
300 import eu
.etaxonomy
.taxeditor
.ui
.term
.RightsTypeComboElement
;
301 import eu
.etaxonomy
.taxeditor
.ui
.term
.ScopeComboElement
;
302 import eu
.etaxonomy
.taxeditor
.ui
.term
.SexComboElement
;
303 import eu
.etaxonomy
.taxeditor
.ui
.term
.SpecimenTypeDesignationStatusComboElement
;
304 import eu
.etaxonomy
.taxeditor
.ui
.term
.StageComboElement
;
305 import eu
.etaxonomy
.taxeditor
.ui
.term
.StateComboElement
;
306 import eu
.etaxonomy
.taxeditor
.ui
.term
.StatisticalMeasureComboElement
;
309 * <p>CdmFormFactory class.</p>
312 * @created Feb 24, 2010
315 public class CdmFormFactory
extends FormToolkit
{
317 private BoldFontHolder2 boldFontHolder2
;
318 private MouseListener selectionMouseHandler
;
319 private FocusListener selectionFocusHandler
;
321 private Set selectionListenerList
= new HashSet();
323 private List
<IPropertyChangeListener
> propertyChangeListeners
= new ArrayList
<IPropertyChangeListener
>();
325 private int orientation
= Window
.getDefaultOrientation();
326 private ISelectionProvider selectionProvider
;
331 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
333 public static final TableWrapLayout
LAYOUT(){
334 return LAYOUT(1, false);
340 * @param columns a int.
341 * @param equalWidth a boolean.
342 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
344 public static final TableWrapLayout
LAYOUT(int columns
, boolean equalWidth
){
345 TableWrapLayout layout
= new TableWrapLayout();
346 layout
.topMargin
= 0;
347 layout
.rightMargin
= 0;
348 layout
.bottomMargin
= 0;
349 layout
.leftMargin
= 0;
350 layout
.numColumns
= columns
;
351 layout
.makeColumnsEqualWidth
= equalWidth
;
352 layout
.verticalSpacing
= 0;
353 layout
.horizontalSpacing
= 0;
360 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
362 public static final TableWrapData
FILL(){
369 * @param horizontalSpan a int.
370 * @param verticalSpan a int.
371 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
373 public static final TableWrapData
FILL(int horizontalSpan
, int verticalSpan
){
374 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.FILL_GRAB
);
375 layoutData
.colspan
= horizontalSpan
;
376 layoutData
.rowspan
= verticalSpan
;
383 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
385 public static final TableWrapData
LEFT(){
386 return new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
);
392 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
394 public static final TableWrapData
RIGHT(){
395 return new TableWrapData(TableWrapData
.RIGHT
, TableWrapData
.TOP
);
399 * <p>FILL_HORIZONTALLY</p>
401 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
403 public static final TableWrapData
FILL_HORIZONTALLY(){
404 return FILL_HORIZONTALLY(1, 1);
408 * <p>FILL_HORIZONTALLY</p>
410 * @param horizontalSpan a int.
411 * @param verticalSpan a int.
412 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
414 public static final TableWrapData
FILL_HORIZONTALLY(int horizontalSpan
, int verticalSpan
){
415 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
);
416 layoutData
.colspan
= horizontalSpan
;
417 layoutData
.rowspan
= verticalSpan
;
421 /** Constant <code>EMPTY_SELECTION</code> */
422 public static ISelection EMPTY_SELECTION
= new ISelection() {
423 public boolean isEmpty() {
428 private class SelectionMouseHandler
extends MouseAdapter
{
430 public void mouseDown(MouseEvent e
) {
431 notifySelectionListeners(e
);
435 private class SelectionFocusHandler
extends FocusAdapter
{
437 public void focusGained(FocusEvent e
) {
438 notifySelectionListeners(e
);
442 private void notifySelectionListeners(TypedEvent e
){
443 Event event
= new Event();
444 event
.widget
= e
.widget
;
445 SelectionEvent selectionEvent
= new SelectionEvent(event
);
447 for(Object listener
: selectionListenerList
){
448 ((SelectionListener
) listener
).widgetSelected(selectionEvent
);
453 * <p>Constructor for CdmFormFactory.</p>
455 * @param display a {@link org.eclipse.swt.widgets.Display} object.
456 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
458 public CdmFormFactory(Display display
, ISelectionProvider selectionProvider
) {
460 this.selectionProvider
= selectionProvider
;
465 * <p>Constructor for CdmFormFactory.</p>
467 * @param display a {@link org.eclipse.swt.widgets.Display} object.
469 public CdmFormFactory(Display display
){
477 private void init() {
478 boldFontHolder2
= new BoldFontHolder2();
479 selectionMouseHandler
= new SelectionMouseHandler();
480 selectionFocusHandler
= new SelectionFocusHandler();
484 * Creates an instance initialized with the correct selectionProvider
486 * Make sure to remove the instance when the entityComposite disposes via
487 * destroySelectionArbitrator(..)
489 * @param entityElement a {@link eu.etaxonomy.taxeditor.ui.forms.IEntityElement} object.
490 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator} object.
492 public SelectionArbitrator
createSelectionArbitrator(IEntityElement entityElement
){
493 SelectionArbitrator selectionArbitrator
= new SelectionArbitrator(entityElement
);
494 selectionArbitrator
.addSelectionProvider(selectionProvider
);
495 selectionProvider
.addSelectionChangedListener(selectionArbitrator
);
496 addSelectionListener(selectionArbitrator
);
497 return selectionArbitrator
;
501 * <p>destroySelectionArbitrator</p>
503 * @param selectionArbitrator a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator} object.
505 public void destroySelectionArbitrator(SelectionArbitrator selectionArbitrator
){
506 removeSelectionListener(selectionArbitrator
);
507 if(selectionProvider
!= null){
508 selectionProvider
.removeSelectionChangedListener(selectionArbitrator
);
510 StoreUtil
.error(this.getClass(), "Tried to destroy a selection listener from this factories listeners but was null", null);
516 public void adapt(Composite composite
) {
517 composite
.addMouseListener(selectionMouseHandler
);
518 super.adapt(composite
);
524 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractCdmFormElement} object.
526 public void adapt(AbstractCdmFormElement formElement
){
527 formElement
.setPropertyChangeListeners(propertyChangeListeners
);
532 public void adapt(Control control
, boolean trackFocus
, boolean trackKeyboard
) {
534 control
.addFocusListener(selectionFocusHandler
);
536 super.adapt(control
, trackFocus
, trackKeyboard
);
540 * <p>destroyElement</p>
542 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
544 public void destroyElement(ICdmFormElement formElement
){
545 // return if element was not initialized
546 if(formElement
== null){
549 // destroy selection arbitrator, if any
550 if(formElement
instanceof ISelectableElement
){
551 destroySelectionArbitrator(((ISelectableElement
) formElement
).getSelectionArbitrator());
553 // remove this element form its parents list of elements
554 // ICdmFormElement parentElement = formElement.getParentElement();
555 // if(parentElement != null){
556 // parentElement.removeElement(formElement);
558 // call destroy on child elements recursively
559 for(ICdmFormElement childElement
: formElement
.getElements()){
560 destroyElement(childElement
);
562 // dispose of the controls
563 for(Control control
: formElement
.getControls()){
564 // we added the layoutComposite of the parental element as the layout composite to this formElement
565 // but we do not want to destroy it.
566 if(control
.equals(formElement
.getLayoutComposite())){
577 * <p>createEmptyCell</p>
579 * @param parent a {@link org.eclipse.swt.widgets.Composite} object.
580 * @return a {@link org.eclipse.swt.widgets.Label} object.
582 public Label
createEmptyCell(Composite parent
){
583 return this.createLabel(parent
, null);
587 * <p>createMultilineTextWithLabel</p>
589 * @param labelString a {@link java.lang.String} object.
590 * @param textHeight a int.
591 * @param style a int.
592 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
593 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement} object.
595 public TextWithLabelElement
createMultilineTextWithLabel(ICdmFormElement parentElement
, String labelString
, int textHeight
, int style
){
596 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, labelString
, "", textHeight
, style
);
598 parentElement
.addElement(element
);
604 * <p>createMultiLanguageTextElement</p>
606 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
607 * @param labelString a {@link java.lang.String} object.
608 * @param multilanguageText a {@link java.util.Map} object.
609 * @param textHeight a int.
610 * @param style a int.
611 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.MultilanguageTextElement} object.
613 public MultilanguageTextElement
createMultiLanguageTextElement(
614 ICdmFormElement parentElement
, String labelString
, Map
<Language
, LanguageString
> multilanguageText
, int textHeight
,
616 MultilanguageTextElement element
= new MultilanguageTextElement(this, parentElement
, labelString
, multilanguageText
, textHeight
, style
);
618 parentElement
.addElement(element
);
622 public KeyStatementElement
createKeyStatementElement(ICdmFormElement parentElement
, String labelString
,
623 KeyStatement keyStatement
, int textHeight
, int style
){
624 KeyStatementElement element
= new KeyStatementElement(this, parentElement
, labelString
, keyStatement
, textHeight
, style
);
626 parentElement
.addElement(element
);
632 * <p>createTextWithLabelElement</p>
634 * @param labelString a {@link java.lang.String} object.
635 * @param initialText a {@link java.lang.String} object.
636 * @param style a int.
637 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
638 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement} object.
640 public TextWithLabelElement
createTextWithLabelElement(ICdmFormElement parentElement
, String labelString
, String initialText
, int style
){
641 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, labelString
, initialText
, null, style
);
643 parentElement
.addElement(element
);
647 public UriWithLabelElement
createUriWithLabelElement(ICdmFormElement parentElement
, String labelString
, URI initialUri
, int style
){
648 UriWithLabelElement element
= new UriWithLabelElement(this, parentElement
, labelString
, initialUri
, null, style
);
650 parentElement
.addElement(element
);
661 public OpenUrlSelectorElement
createOpenUrlSelectorElement(
662 ICdmFormElement parentElement
, String labelString
, IOpenUrlEnabled openUrlEnabled
, int style
) {
663 OpenUrlSelectorElement element
= new OpenUrlSelectorElement(this, parentElement
, labelString
, openUrlEnabled
, style
);
665 parentElement
.addElement(element
);
671 * @param parentElement
673 * @param conversationEnabled
678 public EditPasswordElement
createEditPasswordElement(ICdmFormElement parentElement
, String labelString
,
679 ConversationHolder conversation
, User user
, int style
){
680 EditPasswordElement element
= new EditPasswordElement(this, parentElement
, labelString
, user
, conversation
);
682 parentElement
.addElement(element
);
687 * <p>createIntegerTextWithLabelElement</p>
689 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
690 * @param labelString a {@link java.lang.String} object.
691 * @param initialInteger a {@link java.lang.Integer} object.
692 * @param style a int.
693 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement} object.
695 public NumberWithLabelElement
createIntegerTextWithLabelElement(ICdmFormElement parentElement
, String labelString
, Integer initialInteger
, int style
){
696 NumberWithLabelElement element
= new NumberWithLabelElement(this, parentElement
, labelString
, initialInteger
, style
);
698 parentElement
.addElement(element
);
704 * <p>createFloatTextWithLabelElement</p>
706 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
707 * @param labelString a {@link java.lang.String} object.
708 * @param initialFloat a float.
709 * @param style a int.
710 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement} object.
712 public NumberWithLabelElement
createFloatTextWithLabelElement(
713 ICdmFormElement parentElement
, String labelString
, float initialFloat
,
715 NumberWithLabelElement element
= new NumberWithLabelElement(this, parentElement
, labelString
, initialFloat
, style
);
717 parentElement
.addElement(element
);
722 * <p>createLanguageStringWithLabelElement</p>
724 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
725 * @param labelString a {@link java.lang.String} object.
726 * @param languageString a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
727 * @param style a int.
728 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement} object.
730 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(ICdmFormElement parentElement
, String labelString
, LanguageString languageString
, int style
){
731 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(this, parentElement
, labelString
, languageString
, style
);
733 parentElement
.addElement(element
);
738 * <p>createLanguageStringWithLabelElement</p>
740 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
741 * @param labelString a {@link java.lang.String} object.
742 * @param languageString a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
743 * @param height a int.
744 * @param style a int.
745 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement} object.
747 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(ICdmFormElement parentElement
, String labelString
, LanguageString languageString
, int height
, int style
){
748 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(this, parentElement
, labelString
, languageString
, height
, style
);
750 parentElement
.addElement(element
);
755 * <p>createTextElement</p>
757 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
758 * @param initialText a {@link java.lang.String} object.
759 * @param style a int.
760 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement} object.
762 public TextWithLabelElement
createTextElement(ICdmFormElement parentElement
, String initialText
, int style
){
763 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, null, initialText
, null, style
);
765 parentElement
.addElement(element
);
770 * <p>createKeyValueViewerElement</p>
772 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
773 * @param keyHeading a {@link java.lang.String} object.
774 * @param valueHeading a {@link java.lang.String} object.
775 * @param map a {@link java.util.Map} object.
776 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.KeyValueViewerElement} object.
778 public KeyValueViewerElement
createKeyValueViewerElement(ICdmFormElement parentElement
, String keyHeading
, String valueHeading
, Map
<Object
, Object
> map
){
779 KeyValueViewerElement element
= new KeyValueViewerElement(this, parentElement
, keyHeading
, valueHeading
, map
);
781 parentElement
.addElement(element
);
786 public static enum TermComboType
{
790 NOMENCLATURALSTATUSTYPE
,
795 PRESENCEABSENCESTATUS
,
797 NAMETYPEDESIGNATIONSTATUS
,
798 SPECIMENTYPEDESIGNATIONSTATUS
,
808 DETERMINATION_MODIFIER
,
813 * <p>createTermComboElement</p>
815 * @param termComboType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.TermComboType} object.
816 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
817 * @param labelString a {@link java.lang.String} object.
818 * @param selection a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase} object.
819 * @param style a int.
820 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractTermComboElement} object.
822 public AbstractTermComboElement
createTermComboElement(TermComboType termComboType
, ICdmFormElement parentElement
, String labelString
, DefinedTermBase selection
, int style
){
823 AbstractTermComboElement element
= null;
825 switch(termComboType
){
827 element
= new EmptyComboElement
<DefinedTermBase
>(this, parentElement
, labelString
, style
);
830 element
= new ExtensionTypeComboElement(this, parentElement
, labelString
, (ExtensionType
) selection
, style
);
833 element
= new LanguageComboElement(this, parentElement
, labelString
, (Language
) selection
, style
);
836 element
= new MarkerTypeComboElement(this, parentElement
, labelString
, (MarkerType
) selection
, style
);
838 case NOMENCLATURALSTATUSTYPE
:
839 element
= new NomenclaturalStatusTypeComboElement(this, parentElement
, labelString
, (NomenclaturalStatusType
) selection
, style
);
842 element
= new RankComboElement(this, parentElement
, labelString
, (Rank
) selection
, style
);
845 element
= new RightsTypeComboElement(this, parentElement
, labelString
, (RightsTerm
) selection
, style
);
847 case NAMERELATIONSHIP
:
848 element
= new NameRelationshipTypeComboElement(this, parentElement
, labelString
, (NameRelationshipType
) selection
, style
);
851 element
= new NamedAreaTypeComboElement(this, parentElement
, labelString
, (NamedAreaType
) selection
, style
);
854 element
= new AnnotationTypeComboElement(this, parentElement
, labelString
, (AnnotationType
) selection
, style
);
856 case PRESENCEABSENCESTATUS
:
857 element
= new PresenceAbsenceTermComboElement(this, parentElement
, labelString
, (PresenceAbsenceTermBase
) selection
, style
);
859 case NAMETYPEDESIGNATIONSTATUS
:
860 element
= new NameTypeDesignationStatusComboElement(this, parentElement
, labelString
, (NameTypeDesignationStatus
) selection
, style
);
862 case SPECIMENTYPEDESIGNATIONSTATUS
:
863 element
= new SpecimenTypeDesignationStatusComboElement(this, parentElement
, labelString
, (SpecimenTypeDesignationStatus
) selection
, style
);
866 element
= new SexComboElement(this, parentElement
, labelString
, (Sex
) selection
, style
);
869 element
= new StageComboElement(this, parentElement
, labelString
, (Stage
) selection
, style
);
871 case PRESERVATION_METHOD
:
872 element
= new PreservationMethodComboElement(this, parentElement
, labelString
, (PreservationMethod
) selection
, style
);
874 case MEASUREMENT_UNIT
:
875 element
= new MeasurementUnitComboElement(this, parentElement
, labelString
, (MeasurementUnit
) selection
, style
);
878 element
= new StateComboElement(this, parentElement
, labelString
, (State
) selection
, style
);
881 element
= new ScopeComboElement(this, parentElement
, labelString
, (Scope
) selection
, style
);
884 element
= new ModifierComboElement(this, parentElement
, labelString
, (Modifier
) selection
, style
);
886 case STATISTICAL_MEASURE
:
887 element
= new StatisticalMeasureComboElement(this, parentElement
, labelString
, (StatisticalMeasure
) selection
, style
);
889 case DETERMINATION_MODIFIER
:
890 element
= new DeterminationModifierComboElement(this, parentElement
, labelString
, (DeterminationModifier
) selection
, style
);
892 case REFERENCE_SYSTEM
:
893 element
= new ReferenceSystemComboElement(this, parentElement
, labelString
, (ReferenceSystem
) selection
, style
);
898 parentElement
.addElement(element
);
902 public static enum EnumComboType
{
908 * <p>createEnumComboElement</p>
910 * @param enumComboType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EnumComboType} object.
911 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
912 * @param style a int.
913 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement} object.
915 public AbstractEnumComboElement
createEnumComboElement(EnumComboType enumComboType
, ICdmFormElement parentElement
, int style
){
916 AbstractEnumComboElement element
= null;
918 switch(enumComboType
){
920 element
= new ReferenceTypeComboElement(this, parentElement
, "Reference Type", null, style
);
922 case NOMENCLATURALCODE
:
923 element
= new NomenclaturalCodeComboElement(this, parentElement
, "Nomenclatural Code", null, style
);
927 parentElement
.addElement(element
);
932 * <p>createBrowserElement</p>
934 * @param imageUri a {@link java.net.URI} object.
935 * @param style a int.
936 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
937 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.BrowserElement} object.
939 public BrowserElement
createBrowserElement(ICdmFormElement parentElement
, URI imageUri
, int style
){
940 BrowserElement element
= new BrowserElement(this, parentElement
, imageUri
, style
);
942 parentElement
.addElement(element
);
947 * <p>createImageElement</p>
949 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
950 * @param imageUri a {@link java.net.URI} object.
951 * @param style a int.
952 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.ImageElement} object.
954 public ImageElement
createImageElement(ICdmFormElement parentElement
, URI imageUri
, int style
) {
955 ImageElement element
= new ImageElement(this, parentElement
, imageUri
, style
);
957 parentElement
.addElement(element
);
962 * <p>createTextActionElement</p>
964 * @param labelString a {@link java.lang.String} object.
965 * @param initialText a {@link java.lang.String} object.
966 * @param style a int.
967 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
968 * @param buttonLabel a {@link java.lang.String} object.
969 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextActionElement} object.
971 public TextActionElement
createTextActionElement(ICdmFormElement parentElement
, String labelString
, String buttonLabel
, String initialText
, int style
){
972 TextActionElement element
= new TextActionElement(this, parentElement
, labelString
, buttonLabel
, initialText
, style
);
974 parentElement
.addElement(element
);
981 * @created Mar 5, 2010
984 public static enum SelectionType
{
1003 POLYTOMOUS_KEY_NODE
,
1009 * <p>createCheckbox</p>
1011 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1012 * @param label a {@link java.lang.String} object.
1013 * @param initialState a boolean.
1014 * @param style a int.
1015 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.CheckboxElement} object.
1017 public CheckboxElement
createCheckbox(ICdmFormElement parentElement
, String label
, boolean initialState
, int style
) {
1018 CheckboxElement element
= new CheckboxElement(this, parentElement
, label
, initialState
, style
| orientation
);
1020 parentElement
.addElement(element
);
1027 * Creates a section as a part of the form.
1029 * @return the section widget
1030 * @param section a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object.
1032 public Section
adapt(AbstractFormSection section
) {
1033 section
.setMenu(section
.getLayoutComposite().getMenu());
1034 adapt(section
, true, true);
1036 // handle focus and property change events for cdm use
1037 section
.addFocusListener(selectionFocusHandler
);
1038 section
.setPropertyChangeListeners(propertyChangeListeners
);
1040 if (section
.getToggle() != null) {
1041 section
.getToggle().setHoverDecorationColor(getColors()
1042 .getColor(IFormColors
.TB_TOGGLE_HOVER
));
1043 section
.getToggle().setDecorationColor(getColors()
1044 .getColor(IFormColors
.TB_TOGGLE
));
1047 section
.setFont(boldFontHolder2
.getBoldFont(section
.getLayoutComposite().getFont()));
1049 if ((section
.getStyle() & Section
.TITLE_BAR
) != 0
1050 || (section
.getStyle() & Section
.SHORT_TITLE_BAR
) != 0) {
1051 getColors().initializeSectionToolBarColors();
1052 section
.setTitleBarBackground(getColors().getColor(IFormColors
.TB_BG
));
1053 section
.setTitleBarBorderColor(getColors()
1054 .getColor(IFormColors
.TB_BORDER
));
1056 // call setTitleBarForeground regardless as it also sets the label color
1057 section
.setTitleBarForeground(getColors()
1058 .getColor(IFormColors
.TB_TOGGLE
));
1062 private class BoldFontHolder2
{
1063 private Font normalFont
;
1065 private Font boldFont
;
1067 public BoldFontHolder2() {
1070 public Font
getBoldFont(Font font
) {
1071 createBoldFont(font
);
1075 private void createBoldFont(Font font
) {
1076 if (normalFont
== null || !normalFont
.equals(font
)) {
1080 if (boldFont
== null) {
1081 boldFont
= FormFonts
.getInstance().getBoldFont(getColors().getDisplay(),
1086 public void dispose() {
1087 if (boldFont
!= null) {
1088 FormFonts
.getInstance().markFinished(boldFont
, getColors().getDisplay());
1095 * <p>createToggleableTextField</p>
1097 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1098 * @param labelString a {@link java.lang.String} object.
1099 * @param initialText a {@link java.lang.String} object.
1100 * @param initialState a boolean.
1101 * @param style a int.
1102 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.ToggleableTextElement} object.
1104 public ToggleableTextElement
createToggleableTextField(ICdmFormElement parentElement
,
1105 String labelString
, String initialText
, boolean initialState
, int style
) {
1106 ToggleableTextElement element
= new ToggleableTextElement(this, parentElement
,
1107 labelString
, initialText
, initialState
, style
| orientation
);
1109 parentElement
.addElement(element
);
1114 * <p>createTimePeriodElement</p>
1116 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1117 * @param labelString a {@link java.lang.String} object.
1118 * @param timePeriod a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1119 * @param style a int.
1120 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TimePeriodElement} object.
1122 public TimePeriodElement
createTimePeriodElement(
1123 ICdmFormElement parentElement
, String labelString
, TimePeriod timePeriod
, int style
) {
1124 TimePeriodElement element
= new TimePeriodElement(this, parentElement
, labelString
, timePeriod
, style
);
1126 parentElement
.addElement(element
);
1132 * <p>createPointElement</p>
1134 * @param style a int.
1135 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1136 * @param point a {@link eu.etaxonomy.cdm.model.location.Point} object.
1137 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.PointElement} object.
1139 public PointElement
createPointElement(ICdmFormElement parentElement
,
1140 Point point
, int style
) {
1141 PointElement element
= new PointElement(this, parentElement
, point
, style
);
1143 parentElement
.addElement(element
);
1148 * <p>createDateDetailSection</p>
1150 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1151 * @param style a int.
1152 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.DateDetailSection} object.
1154 public DateDetailSection
createDateDetailSection(ICdmFormElement parentElement
, int style
){
1155 DateDetailSection section
= new DateDetailSection(this, parentElement
, style
);
1156 parentElement
.addElement(section
);
1162 * <p>createPartialElement</p>
1164 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1165 * @param labelString a {@link java.lang.String} object.
1166 * @param partial a {@link org.joda.time.Partial} object.
1167 * @param style a int.
1168 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.PartialElement} object.
1170 public PartialElement
createPartialElement(ICdmFormElement parentElement
, String labelString
, Partial partial
, int style
){
1171 PartialElement element
= new PartialElement(this, parentElement
, labelString
, style
);
1173 parentElement
.addElement(element
);
1178 * <p>addSelectionListener</p>
1180 * @param listener a {@link org.eclipse.swt.events.SelectionListener} object.
1182 public void addSelectionListener(SelectionListener listener
){
1183 selectionListenerList
.add(listener
);
1187 * <p>removeSelectionListener</p>
1189 * @param listener a {@link org.eclipse.swt.events.SelectionListener} object.
1191 public void removeSelectionListener(SelectionListener listener
){
1192 if(listener
== null){
1193 StoreUtil
.error(this.getClass(), "Tried to remove a selection listener from this factories listeners but was null", null);
1195 selectionListenerList
.remove(listener
);
1200 * <p>addPropertyChangeListener</p>
1202 * @param listener a {@link org.eclipse.jface.util.IPropertyChangeListener} object.
1204 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
1205 propertyChangeListeners
.add(0, listener
);
1209 * <p>removePropertyChangeListener</p>
1211 * @param listener a {@link org.eclipse.jface.util.IPropertyChangeListener} object.
1213 public void removePropertyChangeListener(IPropertyChangeListener listener
){
1214 propertyChangeListeners
.remove(listener
);
1220 * <p>createHorizontalSeparator</p>
1222 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1223 * @param style a int.
1224 * @return a {@link org.eclipse.swt.widgets.Label} object.
1226 public Label
createHorizontalSeparator(ICdmFormElement parentElement
, int style
) {
1227 Label separator
= this.createSeparator(parentElement
.getLayoutComposite(), SWT
.HORIZONTAL
| style
);
1228 separator
.setLayoutData(FILL_HORIZONTALLY());
1233 * <p>createVersionElement</p>
1235 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1236 * @param entity a {@link eu.etaxonomy.cdm.model.common.VersionableEntity} object.
1237 * @param style a int.
1238 * @return a {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement} object.
1240 public VersionElement
createVersionElement(ICdmFormElement parentElement
, VersionableEntity entity
,
1242 VersionElement element
= new VersionElement(this, parentElement
, entity
, style
);
1244 parentElement
.addElement(element
);
1249 * <p>createVersionSection</p>
1251 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1252 * @param style a int.
1253 * @return a {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection} object.
1255 public VersionSection
createVersionSection(ICdmFormElement parentElement
, int style
) {
1256 VersionSection section
= new VersionSection(this, parentElement
, style
);
1257 parentElement
.addElement(section
);
1263 * <p>createEmptyElement</p>
1265 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1266 * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1268 public EmptyElement
createEmptyElement(ICdmFormElement parentElement
) {
1269 EmptyElement element
= new EmptyElement(this, parentElement
, null, SWT
.NULL
);
1271 parentElement
.addElement(element
);
1276 * <p>createHeadlineSection</p>
1278 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1279 * @return a {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection} object.
1281 public HeadlineSection
createHeadlineSection(ICdmFormElement parentElement
) {
1282 HeadlineSection section
= new HeadlineSection(this, parentElement
, SWT
.NULL
);
1283 parentElement
.addElement(section
);
1290 * <p>createParsingMessageElement</p>
1292 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1293 * @param parserProblem a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem} object.
1294 * @param style a int.
1295 * @return a {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement} object.
1297 public ParsingMessageElement
createParsingMessageElement(
1298 ICdmFormElement parentElement
, ParserProblem parserProblem
, int style
) {
1299 ParsingMessageElement element
= new ParsingMessageElement(this, parentElement
, parserProblem
, style
);
1301 parentElement
.addElement(element
);
1311 public static enum DetailType
{
1315 NOMENCLATURALREFERENCE
,
1327 DERIVED_UNIT_FACADE
,
1329 DERIVED_UNIT
, NATURAL_LANGUAGE
,
1330 FEATURE_DISTRIBUTION
,
1335 POLYTOMOUS_KEY_NODE
,
1337 DERIVED_UNIT_GENERAL
,
1344 * <p>createCdmDetailSection</p>
1346 * @param detailType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType} object.
1347 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1348 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1349 * @param style a int.
1350 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1351 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object.
1353 public AbstractFormSection
createCdmDetailSection(DetailType detailType
, ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1354 AbstractFormSection section
= null;
1357 case SCIENTIFICNAME
:
1358 section
= new NameDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1361 section
= new ReferenceDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1363 case NOMENCLATURALREFERENCE
:
1364 section
= new NomenclaturalReferenceDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1367 section
= new TaxonBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1370 section
= new AuthorshipDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1372 case TEAMORPERSONBASE
:
1373 section
= new TeamOrPersonBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1376 section
= new TeamDetailSection(this, conversation
, parentElement
, null, style
);
1379 section
= new PersonDetailSection(this, conversation
, parentElement
, null, style
);
1382 section
= new DescriptionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1384 case DESCRIPTIONELEMENT
:
1385 section
= new DescriptionElementDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1387 case PARSINGMESSAGE
:
1388 section
= new ParsingMessagesSection(this, conversation
, parentElement
, selectionProvider
, style
);
1391 section
= new NonViralNameDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1394 section
= new eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection(this, conversation
, parentElement
, selectionProvider
, style
);
1396 case DERIVED_UNIT_FACADE
:
1397 section
= new DerivedUnitFacadeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1399 case FIELD_OBSERVATION
:
1400 section
= new FieldObservationDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1402 case GATHERING_EVENT
:
1403 section
= new GatheringEventDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1406 section
= new DerivedUnitBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1408 case NATURAL_LANGUAGE
:
1409 section
= new NaturalLanguageSection(this, conversation
, parentElement
, selectionProvider
, style
);
1411 case FEATURE_DISTRIBUTION
:
1412 section
= new FeatureDistributionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1414 case CLASSIFICATION
:
1415 section
= new ClassificationDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1418 section
= new TaxonNodeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1420 case POLYTOMOUS_KEY
:
1421 section
= new PolytomousKeyDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1423 case POLYTOMOUS_KEY_NODE
:
1424 section
= new PolytomousKeyNodeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1427 section
= new InstitutionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1429 case DERIVED_UNIT_GENERAL
:
1430 section
= new GeneralDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1433 section
= new HybridDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1436 section
= new UserDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1439 section
= new GroupDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1443 if(section
== null){
1444 throw new RuntimeException("You tried to create a cdm detail section that is not implemented yet.");
1447 parentElement
.addElement(section
);
1453 * <p>createCdmDetailElement</p>
1455 * @param detailType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType} object.
1456 * @param style a int.
1457 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1458 * @return a {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement} object.
1460 public AbstractCdmDetailElement
createCdmDetailElement(DetailType detailType
, ICdmFormElement parentElement
, int style
){
1461 AbstractCdmDetailElement element
= null;
1464 case SCIENTIFICNAME
:
1465 element
= new NameDetailElement(this, parentElement
, style
);
1468 element
= new ReferenceDetailElement(this, parentElement
, style
);
1470 case NOMENCLATURALREFERENCE
:
1471 element
= new NomenclaturalReferenceDetailElement(this, parentElement
, style
);
1474 element
= new TaxonBaseDetailElement(this, parentElement
, style
);
1477 element
= new AuthorshipDetailElement(this, parentElement
, style
);
1480 element
= new TeamDetailElement(this, parentElement
, style
);
1483 element
= new PersonDetailElement(this, parentElement
, style
);
1486 element
= new DescriptionDetailElement(this, parentElement
, style
);
1488 case DESCRIPTIONELEMENT
:
1489 element
= new DescriptionElementDetailElement(this, parentElement
, style
);
1492 element
= new NonViralNameDetailElement(this, parentElement
);
1494 case DERIVED_UNIT_FACADE
:
1495 element
= new DerivedUnitFacadeDetailElement(this, parentElement
);
1497 case FIELD_OBSERVATION
:
1498 element
= new FieldObservationDetailElement(this, parentElement
);
1500 case GATHERING_EVENT
:
1501 element
= new GatheringEventDetailElement(this, parentElement
);
1504 element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1506 case NATURAL_LANGUAGE
:
1507 element
= new NaturalLanguageDetailElement(this, parentElement
);
1509 case FEATURE_DISTRIBUTION
:
1510 element
= new FeatureDistributionDetailElement(this, parentElement
);
1512 case CLASSIFICATION
:
1513 element
= new ClassificationDetailElement(this, parentElement
);
1516 element
= new TaxonNodeDetailElement(this, parentElement
);
1519 element
= new CollectionDetailElement(this, parentElement
);
1521 case POLYTOMOUS_KEY
:
1522 element
= new PolytomousKeyDetailElement(this, parentElement
);
1524 case POLYTOMOUS_KEY_NODE
:
1525 element
= new PolytomousKeyNodeDetailElement(this, parentElement
);
1528 element
= new InstitutionDetailElement(this, parentElement
);
1530 case DERIVED_UNIT_GENERAL
:
1531 element
= new GeneralDetailElement(this, parentElement
);
1534 element
= new HybridDetailElement(this, parentElement
);
1537 element
= new UserDetailElement(this, parentElement
);
1540 element
= new GroupDetailElement(this, parentElement
);
1544 if(element
== null){
1545 StoreUtil
.error(this.getClass(), "Detail element was not created. Seems like the case was not implemented for the requested detail type: " + detailType
, null);
1549 parentElement
.addElement(element
);
1555 * @author n.hoffmann
1556 * @created Mar 5, 2010
1559 public static enum EntityDetailType
{
1564 DESCRIPTIONELEMENTSOURCE
,
1568 DESCRIPTIONELEMENTMEDIA
,
1569 MEDIAREPRESENTATION
,
1570 MEDIAREPRESENTATIONPART
,
1572 NOMENCLATURALSTATUS
,
1581 STATISTICAL_MEASUREMENT_VALUE
,
1584 DETERMINATION_EVENT
,
1585 SPECIMEN_COLLECTION
,
1586 IDENTIFIABLE_SOURCE_COLLECTION
,
1595 * <p>createEntityDetailSection</p>
1597 * @param entityDetailType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EntityDetailType} object.
1598 * @param style a int.
1599 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1600 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1601 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object.
1603 public AbstractFormSection
createEntityDetailSection(EntityDetailType entityDetailType
, ConversationHolder conversation
, ICdmFormElement parentElement
, int style
){
1604 AbstractFormSection section
= null;
1606 switch(entityDetailType
){
1608 section
= new TeamDetailSection(this, conversation
, parentElement
, null, style
);
1611 section
= new TeamMemberSection(this, conversation
, parentElement
, style
);
1614 section
= new AnnotationSection(this, conversation
, parentElement
, style
);
1617 section
= new CreditSection(this, conversation
, parentElement
, style
);
1619 case DESCRIPTIONELEMENTSOURCE
:
1620 section
= new DescriptionElementSourceSection(this, conversation
, parentElement
, style
);
1623 section
= new ExtensionSection(this, conversation
, parentElement
, style
);
1626 section
= new MarkerSection(this, conversation
, parentElement
, style
);
1629 section
= new MediaSection(this, conversation
, parentElement
, style
);
1631 case DESCRIPTIONELEMENTMEDIA
:
1632 section
= new DescriptionElementMediaSection(this, conversation
, parentElement
, style
);
1634 case MEDIAREPRESENTATION
:
1635 section
= new MediaRepresentationSection(this, conversation
, parentElement
, style
);
1637 case MEDIAREPRESENTATIONPART
:
1638 section
= new MediaRepresentationPartSection(this, conversation
, parentElement
, style
);
1641 section
= new ModifierSection(this, conversation
, parentElement
, style
);
1643 case NOMENCLATURALSTATUS
:
1644 section
= new NomenclaturalStatusSection(this, conversation
, parentElement
, style
);
1646 case NAME_RELATIONSHIP
:
1647 section
= new NameRelationshipDetailSection(this, conversation
, parentElement
, style
);
1650 section
= new ProtologueSection(this, conversation
, parentElement
, style
);
1653 section
= new RightsSection(this, conversation
, parentElement
, style
);
1656 section
= new SourceSection(this, conversation
, parentElement
, style
);
1659 section
= new ScopeSection(this, conversation
, parentElement
, style
);
1661 case DESCRIPTIONSOURCE
:
1662 section
= new DescriptionSourceSection(this, conversation
, parentElement
, style
);
1664 case TYPEDESIGNATION
:
1665 section
= new TypeDesignationSection(this, conversation
, parentElement
, style
);
1668 section
= new StateDataSection(this, conversation
, parentElement
, style
);
1670 case STATISTICAL_MEASUREMENT_VALUE
:
1671 section
= new StatisticalMeasurementValueSection(this, conversation
, parentElement
, style
);
1673 case DESCRIBED_SPECIMEN
:
1674 section
= new DescribedSpecimenSection(this, conversation
, parentElement
, style
);
1676 case COLLECTING_AREA
:
1677 section
= new CollectingAreasDetailSection(this, conversation
, parentElement
, style
);
1679 case DETERMINATION_EVENT
:
1680 section
= new DeterminationEventDetailSection(this, conversation
, parentElement
, style
);
1682 case SPECIMEN_COLLECTION
:
1683 section
= new SpecimenCollectionDetailSection(this, conversation
, parentElement
, style
);
1685 case IDENTIFIABLE_SOURCE_COLLECTION
:
1686 section
= new SourceCollectionDetailSection(this, conversation
, parentElement
, style
);
1688 case GEOGRAPHICAL_SCOPE
:
1689 section
= new GeographicalScopeDetailSection(this, conversation
, parentElement
, style
);
1691 case SCOPE_RESTRICTION
:
1692 section
= new ScopeRestrictionSection(this, conversation
, parentElement
, style
);
1695 section
= new MemberDetailSection(this, conversation
, parentElement
, style
);
1697 case GRANTED_AUTHORITY
:
1698 section
= new GrantedAuthorityDetailSection(this, conversation
, parentElement
, style
);
1700 case GROUPS_BY_USER
:
1701 section
= new GroupsByUserDetailSection(this, conversation
, parentElement
, style
);
1704 parentElement
.addElement(section
);
1710 * <p>createEntityCollectionElement</p>
1712 * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
1713 * @param style a int.
1714 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object.
1715 * @param versionableEntity a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity} object.
1716 * @param backgroundColor a {@link org.eclipse.swt.graphics.Color} object.
1717 * @return a {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement} object.
1719 public AbstractEntityCollectionElement
createEntityCollectionElement(AbstractFormSection parentElement
, Object versionableEntity
, SelectionListener removeListener
, Color backgroundColor
, int style
){
1720 AbstractEntityCollectionElement element
= null;
1722 Object entity
= HibernateProxyHelper
.deproxy(versionableEntity
);
1724 if(entity
instanceof Annotation
){
1725 element
= new AnnotationElement(this, parentElement
, (Annotation
) entity
, removeListener
, style
);
1727 else if(entity
instanceof Person
){
1728 element
= new TeamMemberElement(this, parentElement
, (Person
) entity
, removeListener
, style
);
1730 else if(entity
instanceof Credit
){
1731 element
= new CreditElement(this, parentElement
, (Credit
) entity
, removeListener
, style
);
1733 else if(entity
instanceof Extension
){
1734 element
= new ExtensionElement(this, parentElement
, (Extension
) entity
, removeListener
, style
);
1736 else if(entity
instanceof Marker
){
1737 element
= new MarkerElement(this, parentElement
, (Marker
) entity
, removeListener
, style
);
1739 else if(entity
instanceof Media
){
1740 element
= new MediaElement(this, parentElement
, (Media
) entity
, removeListener
, style
);
1742 else if(entity
instanceof MediaRepresentation
){
1743 element
= new MediaRepresentationElement(this, parentElement
, (MediaRepresentation
) entity
, removeListener
, style
);
1745 else if(entity
instanceof ImageFile
){
1746 element
= new ImageFileElement(this, parentElement
, (ImageFile
) entity
, removeListener
, style
);
1748 else if(entity
instanceof NomenclaturalStatus
){
1749 element
= new NomenclaturalStatusElement(this, parentElement
, (NomenclaturalStatus
) entity
, removeListener
, style
);
1751 else if(entity
instanceof Rights
){
1752 element
= new RightsElement(this, parentElement
, (Rights
) entity
, removeListener
, style
);
1754 else if(entity
instanceof DescriptionElementSource
){
1755 element
= new DescriptionElementSourceElement(this, parentElement
, (DescriptionElementSource
) entity
, removeListener
, style
);
1757 else if(entity
instanceof IdentifiableSource
){
1758 element
= new IdentifiableSourceElement(this, parentElement
, (IdentifiableSource
) entity
, removeListener
, style
);
1760 else if(entity
instanceof Scope
){
1761 element
= new ScopeElement(this, parentElement
, (Scope
) entity
, removeListener
, style
);
1763 else if(entity
instanceof Modifier
){
1764 element
= new ModifierElement(this, parentElement
, (Modifier
) entity
, removeListener
, style
);
1766 else if(entity
instanceof Reference
){
1767 element
= new DescriptionSourceElement(this, parentElement
, (Reference
) entity
, removeListener
, style
);
1769 else if(entity
instanceof NameTypeDesignation
){
1770 element
= new NameTypeDesignationElement(this, parentElement
, (NameTypeDesignation
) entity
, removeListener
, style
);
1772 else if(entity
instanceof NameRelationship
){
1773 element
= new NameRelationshipDetailElement(this, parentElement
, (NameRelationship
) entity
, removeListener
, style
);
1775 else if(entity
instanceof SpecimenTypeDesignation
){
1776 element
= new SpecimenTypeDesignationElement(this, parentElement
, (SpecimenTypeDesignation
) entity
, removeListener
, style
);
1778 else if(entity
instanceof StateData
){
1779 element
= new StateDataElement(this, parentElement
, (StateData
) entity
, removeListener
, style
);
1781 else if(entity
instanceof StatisticalMeasurementValue
){
1782 element
= new StatisticalMeasurementValueElement(this, parentElement
, (StatisticalMeasurementValue
) entity
, removeListener
, style
);
1784 else if(entity
instanceof DerivedUnit
){
1785 element
= new DerivedUnitElement(this, parentElement
, (DerivedUnit
) entity
, removeListener
, style
);
1787 else if(entity
instanceof NamedArea
){
1788 element
= new NamedAreaDetailElement(this, parentElement
, (NamedArea
) entity
, removeListener
, style
);
1790 else if(entity
instanceof DeterminationEvent
){
1791 element
= new DeterminationEventDetailElement(this, parentElement
, (DeterminationEvent
) entity
, removeListener
, style
);
1793 else if(entity
instanceof Specimen
){
1794 element
= new SpecimenCollectionDetailElement(this, parentElement
, (Specimen
) entity
, removeListener
, style
);
1796 else if(entity
instanceof User
){
1797 element
= new MemberDetailElement(this, parentElement
, (User
) entity
, removeListener
, style
);
1799 else if(entity
instanceof GrantedAuthority
){
1800 element
= new GrantedAuthorityDetailElement(this, parentElement
, (GrantedAuthority
) entity
, removeListener
, style
);
1802 else if(entity
instanceof Group
){
1803 element
= new GroupsByUserDetailElement(this, parentElement
, (Group
) entity
, removeListener
, style
);
1805 else if(entity
instanceof DescriptionElementBase
){
1806 // this is the special case for protologs, maybe we can do this differently when API improves
1807 DescriptionElementBase descriptionElement
= (DescriptionElementBase
) entity
;
1808 if(descriptionElement
.getFeature().equals(Feature
.PROTOLOGUE())){
1809 element
= new ProtologueElement(this, parentElement
, descriptionElement
, removeListener
, style
);
1813 if(element
== null){
1814 StoreUtil
.errorDialog("No element for entity", this, "Could not generate element for entity. " +
1815 "Looks like the case is not handled already. Check implementation. Entity: " + entity
, null);
1818 if(backgroundColor
!= null && !backgroundColor
.isDisposed()){
1819 element
.setBackgroundColor(backgroundColor
);
1823 parentElement
.addElement(element
);
1828 * <p>createSelectionElement</p>
1830 * @param selectionType a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType} object.
1831 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1832 * @param labelString a {@link java.lang.String} object.
1833 * @param selectionType
1834 * @param selection a {@link eu.etaxonomy.cdm.model.common.IAnnotatableEntity} object.
1835 * @param style a int.
1836 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1837 * @return a {@link eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement} object.
1839 public AbstractSelectionElement
createSelectionElement(SelectionType selectionType
, ConversationHolder conversation
, ICdmFormElement parentElement
, String labelString
, ICdmBase selection
, int style
){
1840 AbstractSelectionElement element
= null;
1842 IAnnotatableEntity entity
= (IAnnotatableEntity
) HibernateProxyHelper
.deproxy(selection
);
1844 switch (selectionType
) {
1846 element
= new AgentSelectionElement(this, conversation
, parentElement
, labelString
, (TeamOrPersonBase
) entity
, style
);
1849 element
= new PersonSelectionElement(this, conversation
, parentElement
, labelString
, (Person
) entity
, style
);
1852 element
= new TeamSelectionElement(this, conversation
, parentElement
, labelString
, (Team
) entity
, style
);
1855 element
= new NomenclaturalAuthorTeamSelectionElement(this, conversation
, parentElement
, labelString
, (Team
) entity
, style
);
1858 element
= new InstitutionSelectionElement(this, conversation
, parentElement
, labelString
, (Institution
) entity
, style
);
1861 element
= new NameSelectionElement(this, conversation
, parentElement
, labelString
, (TaxonNameBase
) entity
, style
);
1864 element
= new ReferenceSelectionElement(this, conversation
, parentElement
, labelString
, (Reference
) entity
, style
);
1867 element
= new TaxonBaseSelectionElement(this, conversation
, parentElement
, labelString
, (TaxonBase
) entity
, style
);
1870 element
= new TaxonSelectionElement(this, conversation
, parentElement
, labelString
, (Taxon
) entity
, style
);
1873 element
= new SynonymSelectionElement(this, conversation
, parentElement
, labelString
, (Synonym
) entity
, style
);
1876 element
= new DerivedUnitBaseSelectionElement(this, conversation
, parentElement
, labelString
, (DerivedUnitBase
) entity
, style
);
1878 case FIELD_OBSERVATION
:
1879 element
= new FieldObservationSelectionElement(this, conversation
, parentElement
, labelString
, (FieldObservation
) entity
, style
);
1882 element
= new FeatureTreeSelectionElement(this, conversation
, parentElement
, labelString
, (FeatureTree
) entity
, style
);
1884 case CLASSIFICATION
:
1885 element
= new ClassificationSelectionElement(this, conversation
, parentElement
, labelString
, (Classification
) entity
, style
);
1888 element
= new TaxonNodeSelectionElement(this, conversation
, parentElement
, labelString
, (TaxonNode
) entity
, style
);
1891 element
= new CollectionSelectionElement(this, conversation
, parentElement
, labelString
, (Collection
) entity
, style
);
1894 element
= new FeatureSelectionElement(this, conversation
, parentElement
, labelString
, (Feature
) entity
, style
);
1896 case POLYTOMOUS_KEY
:
1897 element
= new PolytomousKeySelectionElement(this, conversation
, parentElement
, labelString
, (PolytomousKey
) entity
, style
);
1899 case POLYTOMOUS_KEY_NODE
:
1900 element
= new PolytomousKeyNodeSelectionElement(this, conversation
, parentElement
, labelString
, (PolytomousKeyNode
) entity
, style
);
1903 element
= new UserSelectionElement(this, conversation
, parentElement
, labelString
, (User
) entity
, style
);
1906 element
= new GroupSelectionElement(this, conversation
, parentElement
, labelString
, (Group
) entity
, style
);
1909 new RuntimeException("There is no selection composite for the desired selection type.");
1914 parentElement
.addElement(element
);
1919 * <p>createNamedAreaSelectionElement</p>
1921 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1922 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1923 * @param labelString a {@link java.lang.String} object.
1924 * @param selection a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
1925 * @param style a int.
1926 * @return a {@link eu.etaxonomy.taxeditor.ui.selection.NamedAreaSelectionElement} object.
1928 public NamedAreaSelectionElement
createNamedAreaSelectionElement(ICdmFormElement parentElement
, ConversationHolder conversation
, String labelString
, NamedArea selection
, int style
){
1929 NamedAreaSelectionElement element
= new NamedAreaSelectionElement(this, conversation
, parentElement
, labelString
, selection
, style
);
1931 parentElement
.addElement(element
);
1935 /** {@inheritDoc} */
1936 public LabelElement
createLabel(ICdmFormElement parentElement
, String text
) {
1937 LabelElement labelElement
= new LabelElement(this, parentElement
, text
);
1938 adapt(labelElement
);
1939 parentElement
.addElement(labelElement
);
1940 return labelElement
;
1944 * <p>Getter for the field <code>selectionProvider</code>.</p>
1946 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1948 public ISelectionProvider
getSelectionProvider() {
1949 return selectionProvider
;
1953 * <p>createDetailedDescriptionDetailElement</p>
1955 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
1956 * @param entity a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
1957 * @param style a int.
1958 * @return a {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement} object.
1960 public AbstractDetailedDescriptionDetailElement
createDetailedDescriptionDetailElement(
1961 ICdmFormElement parentElement
, DescriptionElementBase entity
, int style
) {
1962 AbstractDetailedDescriptionDetailElement detailedDescriptionElement
= null;
1965 if(entity
instanceof CategoricalData
){
1966 detailedDescriptionElement
= new CategoricalDataDetailElement(this, parentElement
, (CategoricalData
) entity
, style
);
1968 else if(entity
instanceof CommonTaxonName
){
1969 detailedDescriptionElement
= new CommonNameDetailElement(this, parentElement
, (CommonTaxonName
) entity
, style
);
1971 else if(entity
instanceof Distribution
){
1972 detailedDescriptionElement
= new DistributionDetailElement(this, parentElement
, (Distribution
) entity
, style
);
1974 else if(entity
instanceof IndividualsAssociation
){
1975 detailedDescriptionElement
= new IndividualsAssociationDetailElement(this, parentElement
, (IndividualsAssociation
) entity
, style
);
1977 else if(entity
instanceof QuantitativeData
){
1978 detailedDescriptionElement
= new QuantitativeDataDetailElement(this, parentElement
, (QuantitativeData
) entity
, style
);
1980 else if(entity
instanceof TaxonInteraction
){
1981 detailedDescriptionElement
= new TaxonInteractionDetailElement(this, parentElement
, (TaxonInteraction
) entity
, style
);
1983 else if(entity
instanceof TextData
){
1984 detailedDescriptionElement
= new TextDataDetailElement(this, parentElement
, (TextData
) entity
, style
);
1987 throw new IllegalStateException("There is no interface for the given description element");
1989 adapt(detailedDescriptionElement
);
1990 parentElement
.addElement(detailedDescriptionElement
);
1991 return detailedDescriptionElement
;
1997 * Creates a styled text as a part of the form.
2002 * the text initial value
2005 * @return the text widget
2007 public StyledText
createStyledText(Composite parent
, String value
, int style
) {
2008 StyledText text
= new StyledText(parent
, getBorderStyle() | style
| getOrientation());
2010 text
.setText(value
);
2011 text
.setForeground(getColors().getForeground());
2012 text
.setBackground(getColors().getBackground());
2013 // text.addFocusListener(visibilityHandler);