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
.hibernate
.HibernateProxyHelper
;
46 import eu
.etaxonomy
.cdm
.model
.agent
.Institution
;
47 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
48 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
49 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
50 import eu
.etaxonomy
.cdm
.model
.common
.Annotation
;
51 import eu
.etaxonomy
.cdm
.model
.common
.AnnotationType
;
52 import eu
.etaxonomy
.cdm
.model
.common
.Credit
;
53 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
54 import eu
.etaxonomy
.cdm
.model
.common
.DescriptionElementSource
;
55 import eu
.etaxonomy
.cdm
.model
.common
.Extension
;
56 import eu
.etaxonomy
.cdm
.model
.common
.ExtensionType
;
57 import eu
.etaxonomy
.cdm
.model
.common
.Group
;
58 import eu
.etaxonomy
.cdm
.model
.common
.IAnnotatableEntity
;
59 import eu
.etaxonomy
.cdm
.model
.common
.ICdmBase
;
60 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableSource
;
61 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
62 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
63 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
64 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
65 import eu
.etaxonomy
.cdm
.model
.common
.TimePeriod
;
66 import eu
.etaxonomy
.cdm
.model
.common
.User
;
67 import eu
.etaxonomy
.cdm
.model
.common
.VersionableEntity
;
68 import eu
.etaxonomy
.cdm
.model
.description
.CategoricalData
;
69 import eu
.etaxonomy
.cdm
.model
.description
.CommonTaxonName
;
70 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
71 import eu
.etaxonomy
.cdm
.model
.description
.Distribution
;
72 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
73 import eu
.etaxonomy
.cdm
.model
.description
.FeatureTree
;
74 import eu
.etaxonomy
.cdm
.model
.description
.IndividualsAssociation
;
75 import eu
.etaxonomy
.cdm
.model
.description
.KeyStatement
;
76 import eu
.etaxonomy
.cdm
.model
.description
.MeasurementUnit
;
77 import eu
.etaxonomy
.cdm
.model
.description
.Modifier
;
78 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKey
;
79 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKeyNode
;
80 import eu
.etaxonomy
.cdm
.model
.description
.PresenceAbsenceTermBase
;
81 import eu
.etaxonomy
.cdm
.model
.description
.QuantitativeData
;
82 import eu
.etaxonomy
.cdm
.model
.description
.Scope
;
83 import eu
.etaxonomy
.cdm
.model
.description
.Sex
;
84 import eu
.etaxonomy
.cdm
.model
.description
.Stage
;
85 import eu
.etaxonomy
.cdm
.model
.description
.State
;
86 import eu
.etaxonomy
.cdm
.model
.description
.StateData
;
87 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasure
;
88 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasurementValue
;
89 import eu
.etaxonomy
.cdm
.model
.description
.TaxonInteraction
;
90 import eu
.etaxonomy
.cdm
.model
.description
.TextData
;
91 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
92 import eu
.etaxonomy
.cdm
.model
.location
.NamedAreaType
;
93 import eu
.etaxonomy
.cdm
.model
.location
.Point
;
94 import eu
.etaxonomy
.cdm
.model
.location
.ReferenceSystem
;
95 import eu
.etaxonomy
.cdm
.model
.media
.ImageFile
;
96 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
97 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
98 import eu
.etaxonomy
.cdm
.model
.media
.Rights
;
99 import eu
.etaxonomy
.cdm
.model
.media
.RightsTerm
;
100 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationship
;
101 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationshipType
;
102 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignation
;
103 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignationStatus
;
104 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
105 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatusType
;
106 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
107 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignation
;
108 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignationStatus
;
109 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
110 import eu
.etaxonomy
.cdm
.model
.occurrence
.Collection
;
111 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
112 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnitBase
;
113 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationEvent
;
114 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationModifier
;
115 import eu
.etaxonomy
.cdm
.model
.occurrence
.FieldObservation
;
116 import eu
.etaxonomy
.cdm
.model
.occurrence
.PreservationMethod
;
117 import eu
.etaxonomy
.cdm
.model
.occurrence
.Specimen
;
118 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
119 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
120 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
121 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
122 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
123 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
124 import eu
.etaxonomy
.cdm
.strategy
.parser
.ParserProblem
;
125 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
126 import eu
.etaxonomy
.taxeditor
.ui
.forms
.password
.EditPasswordElement
;
127 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.IOpenUrlEnabled
;
128 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.OpenUrlSelectorElement
;
129 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
130 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
131 import eu
.etaxonomy
.taxeditor
.ui
.section
.EmptyElement
;
132 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailElement
;
133 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailSection
;
134 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailElement
;
135 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailSection
;
136 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailElement
;
137 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailSection
;
138 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberElement
;
139 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberSection
;
140 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamOrPersonBaseDetailSection
;
141 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailElement
;
142 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailSection
;
143 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailElement
;
144 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailSection
;
145 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DerivedUnitElement
;
146 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescribedSpecimenSection
;
147 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailElement
;
148 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailSection
;
149 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailElement
;
150 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailSection
;
151 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementMediaSection
;
152 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceElement
;
153 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceSection
;
154 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceElement
;
155 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceSection
;
156 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierElement
;
157 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierSection
;
158 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageDetailElement
;
159 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageSection
;
160 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeElement
;
161 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeSection
;
162 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataElement
;
163 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataSection
;
164 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueElement
;
165 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueSection
;
166 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.AbstractDetailedDescriptionDetailElement
;
167 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CategoricalDataDetailElement
;
168 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CommonNameDetailElement
;
169 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.DistributionDetailElement
;
170 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.IndividualsAssociationDetailElement
;
171 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.QuantitativeDataDetailElement
;
172 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TaxonInteractionDetailElement
;
173 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TextDataDetailElement
;
174 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailElement
;
175 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailSection
;
176 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GrantedAuthorityDetailElement
;
177 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GrantedAuthorityDetailSection
;
178 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailElement
;
179 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailSection
;
180 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailElement
;
181 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailSection
;
182 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.GeographicalScopeDetailSection
;
183 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailElement
;
184 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailSection
;
185 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailElement
;
186 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailSection
;
187 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.ScopeRestrictionSection
;
188 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.TaxonomicScopeSection
;
189 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.ImageFileElement
;
190 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaElement
;
191 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationElement
;
192 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationPartSection
;
193 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationSection
;
194 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaSection
;
195 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailElement
;
196 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailSection
;
197 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailElement
;
198 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailSection
;
199 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailElement
;
200 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailSection
;
201 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailElement
;
202 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailSection
;
203 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameTypeDesignationElement
;
204 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusElement
;
205 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusSection
;
206 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailElement
;
207 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailSection
;
208 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueElement
;
209 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueSection
;
210 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.SpecimenTypeDesignationElement
;
211 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.TypeDesignationSection
;
212 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectingAreasDetailSection
;
213 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectionDetailElement
;
214 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CurrentDeterminationDetailSection
;
215 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailElement
;
216 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailSection
;
217 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailElement
;
218 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailSection
;
219 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailElement
;
220 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailSection
;
221 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationEventDetailElement
;
222 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationHistoryDetailSection
;
223 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailElement
;
224 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailSection
;
225 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailElement
;
226 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailSection
;
227 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailElement
;
228 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailSection
;
229 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.NamedAreaDetailElement
;
230 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SourceCollectionDetailSection
;
231 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailElement
;
232 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailSection
;
233 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailElement
;
234 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailSection
;
235 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailElement
;
236 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailSection
;
237 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationElement
;
238 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationSection
;
239 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditElement
;
240 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditSection
;
241 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionElement
;
242 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionSection
;
243 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.HeadlineSection
;
244 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.IdentifiableSourceElement
;
245 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerElement
;
246 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerSection
;
247 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsElement
;
248 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
249 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.SourceSection
;
250 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionElement
;
251 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionSection
;
252 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessageElement
;
253 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
254 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailElement
;
255 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
256 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonDetailElement
;
257 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailElement
;
258 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailSection
;
259 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailElement
;
260 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailSection
;
261 import eu
.etaxonomy
.taxeditor
.ui
.selection
.AbstractSelectionElement
;
262 import eu
.etaxonomy
.taxeditor
.ui
.selection
.AgentSelectionElement
;
263 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ClassificationSelectionElement
;
264 import eu
.etaxonomy
.taxeditor
.ui
.selection
.CollectionSelectionElement
;
265 import eu
.etaxonomy
.taxeditor
.ui
.selection
.DerivedUnitBaseSelectionElement
;
266 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FeatureSelectionElement
;
267 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FeatureTreeSelectionElement
;
268 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FieldObservationSelectionElement
;
269 import eu
.etaxonomy
.taxeditor
.ui
.selection
.GroupSelectionElement
;
270 import eu
.etaxonomy
.taxeditor
.ui
.selection
.InstitutionSelectionElement
;
271 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NameSelectionElement
;
272 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NamedAreaSelectionElement
;
273 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NomenclaturalAuthorTeamSelectionElement
;
274 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PersonSelectionElement
;
275 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PolytomousKeyNodeSelectionElement
;
276 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PolytomousKeySelectionElement
;
277 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ReferenceSelectionElement
;
278 import eu
.etaxonomy
.taxeditor
.ui
.selection
.SynonymSelectionElement
;
279 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonBaseSelectionElement
;
280 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonNodeSelectionElement
;
281 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonSelectionElement
;
282 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TeamSelectionElement
;
283 import eu
.etaxonomy
.taxeditor
.ui
.selection
.UserSelectionElement
;
284 import eu
.etaxonomy
.taxeditor
.ui
.term
.AbstractEnumComboElement
;
285 import eu
.etaxonomy
.taxeditor
.ui
.term
.AbstractTermComboElement
;
286 import eu
.etaxonomy
.taxeditor
.ui
.term
.AnnotationTypeComboElement
;
287 import eu
.etaxonomy
.taxeditor
.ui
.term
.DeterminationModifierComboElement
;
288 import eu
.etaxonomy
.taxeditor
.ui
.term
.EmptyComboElement
;
289 import eu
.etaxonomy
.taxeditor
.ui
.term
.ExtensionTypeComboElement
;
290 import eu
.etaxonomy
.taxeditor
.ui
.term
.LanguageComboElement
;
291 import eu
.etaxonomy
.taxeditor
.ui
.term
.MarkerTypeComboElement
;
292 import eu
.etaxonomy
.taxeditor
.ui
.term
.MeasurementUnitComboElement
;
293 import eu
.etaxonomy
.taxeditor
.ui
.term
.ModifierComboElement
;
294 import eu
.etaxonomy
.taxeditor
.ui
.term
.NameRelationshipTypeComboElement
;
295 import eu
.etaxonomy
.taxeditor
.ui
.term
.NameTypeDesignationStatusComboElement
;
296 import eu
.etaxonomy
.taxeditor
.ui
.term
.NamedAreaTypeComboElement
;
297 import eu
.etaxonomy
.taxeditor
.ui
.term
.NomenclaturalCodeComboElement
;
298 import eu
.etaxonomy
.taxeditor
.ui
.term
.NomenclaturalStatusTypeComboElement
;
299 import eu
.etaxonomy
.taxeditor
.ui
.term
.PresenceAbsenceTermComboElement
;
300 import eu
.etaxonomy
.taxeditor
.ui
.term
.PreservationMethodComboElement
;
301 import eu
.etaxonomy
.taxeditor
.ui
.term
.RankComboElement
;
302 import eu
.etaxonomy
.taxeditor
.ui
.term
.ReferenceSystemComboElement
;
303 import eu
.etaxonomy
.taxeditor
.ui
.term
.ReferenceTypeComboElement
;
304 import eu
.etaxonomy
.taxeditor
.ui
.term
.RightsTypeComboElement
;
305 import eu
.etaxonomy
.taxeditor
.ui
.term
.ScopeComboElement
;
306 import eu
.etaxonomy
.taxeditor
.ui
.term
.SexComboElement
;
307 import eu
.etaxonomy
.taxeditor
.ui
.term
.SpecimenTypeDesignationStatusComboElement
;
308 import eu
.etaxonomy
.taxeditor
.ui
.term
.StageComboElement
;
309 import eu
.etaxonomy
.taxeditor
.ui
.term
.StateComboElement
;
310 import eu
.etaxonomy
.taxeditor
.ui
.term
.StatisticalMeasureComboElement
;
314 * CdmFormFactory class.
318 * @created Feb 24, 2010
321 public class CdmFormFactory
extends FormToolkit
{
323 private BoldFontHolder2 boldFontHolder2
;
324 private MouseListener selectionMouseHandler
;
325 private FocusListener selectionFocusHandler
;
327 private final Set selectionListenerList
= new HashSet();
329 private final List
<IPropertyChangeListener
> propertyChangeListeners
= new ArrayList
<IPropertyChangeListener
>();
331 private final int orientation
= Window
.getDefaultOrientation();
332 private ISelectionProvider selectionProvider
;
339 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
341 public static final TableWrapLayout
LAYOUT() {
342 return LAYOUT(1, false);
354 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
356 public static final TableWrapLayout
LAYOUT(int columns
, boolean equalWidth
) {
357 TableWrapLayout layout
= new TableWrapLayout();
358 layout
.topMargin
= 0;
359 layout
.rightMargin
= 0;
360 layout
.bottomMargin
= 0;
361 layout
.leftMargin
= 0;
362 layout
.numColumns
= columns
;
363 layout
.makeColumnsEqualWidth
= equalWidth
;
364 layout
.verticalSpacing
= 0;
365 layout
.horizontalSpacing
= 0;
374 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
376 public static final TableWrapData
FILL() {
385 * @param horizontalSpan
387 * @param verticalSpan
389 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
391 public static final TableWrapData
FILL(int horizontalSpan
, int verticalSpan
) {
392 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
,
393 TableWrapData
.FILL_GRAB
);
394 layoutData
.colspan
= horizontalSpan
;
395 layoutData
.rowspan
= verticalSpan
;
404 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
406 public static final TableWrapData
LEFT() {
407 return new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
);
415 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
417 public static final TableWrapData
RIGHT() {
418 return new TableWrapData(TableWrapData
.RIGHT
, TableWrapData
.TOP
);
426 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
428 public static final TableWrapData
FILL_HORIZONTALLY() {
429 return FILL_HORIZONTALLY(1, 1);
437 * @param horizontalSpan
439 * @param verticalSpan
441 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
443 public static final TableWrapData
FILL_HORIZONTALLY(int horizontalSpan
,
445 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
,
447 layoutData
.colspan
= horizontalSpan
;
448 layoutData
.rowspan
= verticalSpan
;
452 /** Constant <code>EMPTY_SELECTION</code> */
453 public static ISelection EMPTY_SELECTION
= new ISelection() {
455 public boolean isEmpty() {
460 private class SelectionMouseHandler
extends MouseAdapter
{
462 public void mouseDown(MouseEvent e
) {
463 notifySelectionListeners(e
);
467 private class SelectionFocusHandler
extends FocusAdapter
{
469 public void focusGained(FocusEvent e
) {
470 notifySelectionListeners(e
);
474 private void notifySelectionListeners(TypedEvent e
) {
475 Event event
= new Event();
476 event
.widget
= e
.widget
;
477 SelectionEvent selectionEvent
= new SelectionEvent(event
);
479 for (Object listener
: selectionListenerList
) {
480 ((SelectionListener
) listener
).widgetSelected(selectionEvent
);
486 * Constructor for CdmFormFactory.
490 * a {@link org.eclipse.swt.widgets.Display} object.
491 * @param selectionProvider
492 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
494 public CdmFormFactory(Display display
, ISelectionProvider selectionProvider
) {
496 this.selectionProvider
= selectionProvider
;
502 * Constructor for CdmFormFactory.
506 * a {@link org.eclipse.swt.widgets.Display} object.
508 public CdmFormFactory(Display display
) {
516 private void init() {
517 boldFontHolder2
= new BoldFontHolder2();
518 selectionMouseHandler
= new SelectionMouseHandler();
519 selectionFocusHandler
= new SelectionFocusHandler();
523 * Creates an instance initialized with the correct selectionProvider
525 * Make sure to remove the instance when the entityComposite disposes via
526 * destroySelectionArbitrator(..)
528 * @param entityElement
529 * a {@link eu.etaxonomy.taxeditor.ui.forms.IEntityElement}
531 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator}
534 public SelectionArbitrator
createSelectionArbitrator(
535 IEntityElement entityElement
) {
536 SelectionArbitrator selectionArbitrator
= new SelectionArbitrator(
538 selectionArbitrator
.addSelectionProvider(selectionProvider
);
539 selectionProvider
.addSelectionChangedListener(selectionArbitrator
);
540 addSelectionListener(selectionArbitrator
);
541 return selectionArbitrator
;
546 * destroySelectionArbitrator
549 * @param selectionArbitrator
550 * a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator}
553 public void destroySelectionArbitrator(
554 SelectionArbitrator selectionArbitrator
) {
555 removeSelectionListener(selectionArbitrator
);
556 if (selectionProvider
!= null) {
558 .removeSelectionChangedListener(selectionArbitrator
);
561 .error(this.getClass(),
562 "Tried to destroy a selection listener from this factories listeners but was null",
569 public void adapt(Composite composite
) {
570 composite
.addMouseListener(selectionMouseHandler
);
571 super.adapt(composite
);
581 * {@link eu.etaxonomy.taxeditor.ui.forms.AbstractCdmFormElement}
584 public void adapt(AbstractCdmFormElement formElement
) {
585 formElement
.setPropertyChangeListeners(propertyChangeListeners
);
590 public void adapt(Control control
, boolean trackFocus
, boolean trackKeyboard
) {
592 control
.addFocusListener(selectionFocusHandler
);
594 super.adapt(control
, trackFocus
, trackKeyboard
);
603 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
606 public void destroyElement(ICdmFormElement formElement
) {
607 // return if element was not initialized
608 if (formElement
== null) {
611 // destroy selection arbitrator, if any
612 if (formElement
instanceof ISelectableElement
) {
613 destroySelectionArbitrator(((ISelectableElement
) formElement
)
614 .getSelectionArbitrator());
616 // remove this element form its parents list of elements
617 // ICdmFormElement parentElement = formElement.getParentElement();
618 // if(parentElement != null){
619 // parentElement.removeElement(formElement);
621 // call destroy on child elements recursively
622 for (ICdmFormElement childElement
: formElement
.getElements()) {
623 destroyElement(childElement
);
625 // dispose of the controls
626 for (Control control
: formElement
.getControls()) {
627 // we added the layoutComposite of the parental element as the
628 // layout composite to this formElement
629 // but we do not want to destroy it.
630 if (control
.equals(formElement
.getLayoutComposite())) {
645 * a {@link org.eclipse.swt.widgets.Composite} object.
646 * @return a {@link org.eclipse.swt.widgets.Label} object.
648 public Label
createEmptyCell(Composite parent
) {
649 return this.createLabel(parent
, null);
654 * createMultilineTextWithLabel
658 * a {@link java.lang.String} object.
663 * @param parentElement
664 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
666 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement}
669 public TextWithLabelElement
createMultilineTextWithLabel(
670 ICdmFormElement parentElement
, String labelString
, int textHeight
,
672 TextWithLabelElement element
= new TextWithLabelElement(this,
673 parentElement
, labelString
, "", textHeight
, style
);
675 parentElement
.addElement(element
);
681 * createMultiLanguageTextElement
684 * @param parentElement
685 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
688 * a {@link java.lang.String} object.
689 * @param multilanguageText
690 * a {@link java.util.Map} object.
696 * {@link eu.etaxonomy.taxeditor.ui.forms.MultilanguageTextElement}
699 public MultilanguageTextElement
createMultiLanguageTextElement(
700 ICdmFormElement parentElement
, String labelString
,
701 Map
<Language
, LanguageString
> multilanguageText
, int textHeight
,
703 MultilanguageTextElement element
= new MultilanguageTextElement(this,
704 parentElement
, labelString
, multilanguageText
, textHeight
,
707 parentElement
.addElement(element
);
711 public KeyStatementElement
createKeyStatementElement(
712 ICdmFormElement parentElement
, String labelString
,
713 KeyStatement keyStatement
, int textHeight
, int style
) {
714 KeyStatementElement element
= new KeyStatementElement(this,
715 parentElement
, labelString
, keyStatement
, textHeight
, style
);
717 parentElement
.addElement(element
);
723 * createTextWithLabelElement
727 * a {@link java.lang.String} object.
729 * a {@link java.lang.String} object.
732 * @param parentElement
733 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
735 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement}
738 public TextWithLabelElement
createTextWithLabelElement(
739 ICdmFormElement parentElement
, String labelString
,
740 String initialText
, int style
) {
741 TextWithLabelElement element
= new TextWithLabelElement(this,
742 parentElement
, labelString
, initialText
, null, style
);
744 parentElement
.addElement(element
);
748 public UriWithLabelElement
createUriWithLabelElement(
749 ICdmFormElement parentElement
, String labelString
, URI initialUri
,
751 UriWithLabelElement element
= new UriWithLabelElement(this,
752 parentElement
, labelString
, initialUri
, null, style
);
754 parentElement
.addElement(element
);
765 public OpenUrlSelectorElement
createOpenUrlSelectorElement(
766 ICdmFormElement parentElement
, String labelString
,
767 IOpenUrlEnabled openUrlEnabled
, int style
) {
768 OpenUrlSelectorElement element
= new OpenUrlSelectorElement(this,
769 parentElement
, labelString
, openUrlEnabled
, style
);
771 parentElement
.addElement(element
);
777 * @param parentElement
779 * @param conversationEnabled
784 public EditPasswordElement
createEditPasswordElement(
785 ICdmFormElement parentElement
, String labelString
,
786 ConversationHolder conversation
, User user
, int style
) {
787 EditPasswordElement element
= new EditPasswordElement(this,
788 parentElement
, labelString
, user
, conversation
);
790 parentElement
.addElement(element
);
796 * createIntegerTextWithLabelElement
799 * @param parentElement
800 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
803 * a {@link java.lang.String} object.
804 * @param initialInteger
805 * a {@link java.lang.Integer} object.
808 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement}
811 public NumberWithLabelElement
createIntegerTextWithLabelElement(
812 ICdmFormElement parentElement
, String labelString
,
813 Integer initialInteger
, int style
) {
814 NumberWithLabelElement element
= new NumberWithLabelElement(this,
815 parentElement
, labelString
, initialInteger
, style
);
817 parentElement
.addElement(element
);
823 * createFloatTextWithLabelElement
826 * @param parentElement
827 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
830 * a {@link java.lang.String} object.
831 * @param initialFloat
835 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement}
838 public NumberWithLabelElement
createFloatTextWithLabelElement(
839 ICdmFormElement parentElement
, String labelString
,
840 float initialFloat
, int style
) {
841 NumberWithLabelElement element
= new NumberWithLabelElement(this,
842 parentElement
, labelString
, initialFloat
, style
);
844 parentElement
.addElement(element
);
850 * createLanguageStringWithLabelElement
853 * @param parentElement
854 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
857 * a {@link java.lang.String} object.
858 * @param languageString
859 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
863 * {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement}
866 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
867 ICdmFormElement parentElement
, String labelString
,
868 LanguageString languageString
, int style
) {
869 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
870 this, parentElement
, labelString
, languageString
, style
);
872 parentElement
.addElement(element
);
878 * createLanguageStringWithLabelElement
881 * @param parentElement
882 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
885 * a {@link java.lang.String} object.
886 * @param languageString
887 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
893 * {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement}
896 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
897 ICdmFormElement parentElement
, String labelString
,
898 LanguageString languageString
, int height
, int style
) {
899 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
900 this, parentElement
, labelString
, languageString
, height
, style
);
902 parentElement
.addElement(element
);
911 * @param parentElement
912 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
915 * a {@link java.lang.String} object.
918 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement}
921 public TextWithLabelElement
createTextElement(
922 ICdmFormElement parentElement
, String initialText
, int style
) {
923 TextWithLabelElement element
= new TextWithLabelElement(this,
924 parentElement
, null, initialText
, null, style
);
926 parentElement
.addElement(element
);
932 * createKeyValueViewerElement
935 * @param parentElement
936 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
939 * a {@link java.lang.String} object.
940 * @param valueHeading
941 * a {@link java.lang.String} object.
943 * a {@link java.util.Map} object.
944 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.KeyValueViewerElement}
947 public KeyValueViewerElement
createKeyValueViewerElement(
948 ICdmFormElement parentElement
, String keyHeading
,
949 String valueHeading
, Map
<Object
, Object
> map
) {
950 KeyValueViewerElement element
= new KeyValueViewerElement(this,
951 parentElement
, keyHeading
, valueHeading
, map
);
953 parentElement
.addElement(element
);
957 public static enum TermComboType
{
958 EXTENSIONTYPE
, LANGUAGE
, MARKERTYPE
, NOMENCLATURALSTATUSTYPE
, RANK
, RIGHTSTYPE
, NAMERELATIONSHIP
, NAMEDAREATYPE
, PRESENCEABSENCESTATUS
, ANNOTATIONTYPE
, NAMETYPEDESIGNATIONSTATUS
, SPECIMENTYPEDESIGNATIONSTATUS
, SEX
, STAGE
, PRESERVATION_METHOD
, MEASUREMENT_UNIT
, STATE
, MODIFIER
, STATISTICAL_MEASURE
, SCOPE
, EMPTY
, DETERMINATION_MODIFIER
, REFERENCE_SYSTEM
963 * createTermComboElement
966 * @param termComboType
968 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.TermComboType}
970 * @param parentElement
971 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
974 * a {@link java.lang.String} object.
976 * a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase}
980 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractTermComboElement}
983 public AbstractTermComboElement
createTermComboElement(
984 TermComboType termComboType
, ICdmFormElement parentElement
,
985 String labelString
, DefinedTermBase selection
, int style
) {
986 AbstractTermComboElement element
= null;
988 switch (termComboType
) {
990 element
= new EmptyComboElement
<DefinedTermBase
>(this,
991 parentElement
, labelString
, style
);
994 element
= new ExtensionTypeComboElement(this, parentElement
,
995 labelString
, (ExtensionType
) selection
, style
);
998 element
= new LanguageComboElement(this, parentElement
,
999 labelString
, (Language
) selection
, style
);
1002 element
= new MarkerTypeComboElement(this, parentElement
,
1003 labelString
, (MarkerType
) selection
, style
);
1005 case NOMENCLATURALSTATUSTYPE
:
1006 element
= new NomenclaturalStatusTypeComboElement(this,
1007 parentElement
, labelString
,
1008 (NomenclaturalStatusType
) selection
, style
);
1011 element
= new RankComboElement(this, parentElement
, labelString
,
1012 (Rank
) selection
, style
);
1015 element
= new RightsTypeComboElement(this, parentElement
,
1016 labelString
, (RightsTerm
) selection
, style
);
1018 case NAMERELATIONSHIP
:
1019 element
= new NameRelationshipTypeComboElement(this, parentElement
,
1020 labelString
, (NameRelationshipType
) selection
, style
);
1023 element
= new NamedAreaTypeComboElement(this, parentElement
,
1024 labelString
, (NamedAreaType
) selection
, style
);
1026 case ANNOTATIONTYPE
:
1027 element
= new AnnotationTypeComboElement(this, parentElement
,
1028 labelString
, (AnnotationType
) selection
, style
);
1030 case PRESENCEABSENCESTATUS
:
1031 element
= new PresenceAbsenceTermComboElement(this, parentElement
,
1032 labelString
, (PresenceAbsenceTermBase
) selection
, style
);
1034 case NAMETYPEDESIGNATIONSTATUS
:
1035 element
= new NameTypeDesignationStatusComboElement(this,
1036 parentElement
, labelString
,
1037 (NameTypeDesignationStatus
) selection
, style
);
1039 case SPECIMENTYPEDESIGNATIONSTATUS
:
1040 element
= new SpecimenTypeDesignationStatusComboElement(this,
1041 parentElement
, labelString
,
1042 (SpecimenTypeDesignationStatus
) selection
, style
);
1045 element
= new SexComboElement(this, parentElement
, labelString
,
1046 (Sex
) selection
, style
);
1049 element
= new StageComboElement(this, parentElement
, labelString
,
1050 (Stage
) selection
, style
);
1052 case PRESERVATION_METHOD
:
1053 element
= new PreservationMethodComboElement(this, parentElement
,
1054 labelString
, (PreservationMethod
) selection
, style
);
1056 case MEASUREMENT_UNIT
:
1057 element
= new MeasurementUnitComboElement(this, parentElement
,
1058 labelString
, (MeasurementUnit
) selection
, style
);
1061 element
= new StateComboElement(this, parentElement
, labelString
,
1062 (State
) selection
, style
);
1065 element
= new ScopeComboElement(this, parentElement
, labelString
,
1066 (Scope
) selection
, style
);
1069 element
= new ModifierComboElement(this, parentElement
,
1070 labelString
, (Modifier
) selection
, style
);
1072 case STATISTICAL_MEASURE
:
1073 element
= new StatisticalMeasureComboElement(this, parentElement
,
1074 labelString
, (StatisticalMeasure
) selection
, style
);
1076 case DETERMINATION_MODIFIER
:
1077 element
= new DeterminationModifierComboElement(this,
1078 parentElement
, labelString
,
1079 (DeterminationModifier
) selection
, style
);
1081 case REFERENCE_SYSTEM
:
1082 element
= new ReferenceSystemComboElement(this, parentElement
,
1083 labelString
, (ReferenceSystem
) selection
, style
);
1088 parentElement
.addElement(element
);
1092 public static enum EnumComboType
{
1093 REFERENCETYPE
, NOMENCLATURALCODE
1098 * createEnumComboElement
1101 * @param enumComboType
1103 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EnumComboType}
1105 * @param parentElement
1106 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1110 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
1113 public AbstractEnumComboElement
createEnumComboElement(
1114 EnumComboType enumComboType
, ICdmFormElement parentElement
,
1116 AbstractEnumComboElement element
= null;
1118 switch (enumComboType
) {
1120 element
= new ReferenceTypeComboElement(this, parentElement
,
1121 "Reference Type", null, style
);
1123 case NOMENCLATURALCODE
:
1124 element
= new NomenclaturalCodeComboElement(this, parentElement
,
1125 "Nomenclatural Code", null, style
);
1129 parentElement
.addElement(element
);
1135 * createBrowserElement
1139 * a {@link java.net.URI} object.
1142 * @param parentElement
1143 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1145 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.BrowserElement} object.
1147 public BrowserElement
createBrowserElement(ICdmFormElement parentElement
,
1148 URI imageUri
, int style
) {
1149 BrowserElement element
= new BrowserElement(this, parentElement
,
1152 parentElement
.addElement(element
);
1158 * createImageElement
1161 * @param parentElement
1162 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1165 * a {@link java.net.URI} object.
1168 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.ImageElement} object.
1170 public ImageElement
createImageElement(ICdmFormElement parentElement
,
1171 URI imageUri
, int style
) {
1172 ImageElement element
= new ImageElement(this, parentElement
, imageUri
,
1175 parentElement
.addElement(element
);
1181 * createTextActionElement
1184 * @param labelString
1185 * a {@link java.lang.String} object.
1186 * @param initialText
1187 * a {@link java.lang.String} object.
1190 * @param parentElement
1191 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1193 * @param buttonLabel
1194 * a {@link java.lang.String} object.
1195 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextActionElement}
1198 public TextActionElement
createTextActionElement(
1199 ICdmFormElement parentElement
, String labelString
,
1200 String buttonLabel
, String initialText
, int style
) {
1201 TextActionElement element
= new TextActionElement(this, parentElement
,
1202 labelString
, buttonLabel
, initialText
, style
);
1204 parentElement
.addElement(element
);
1210 * @author n.hoffmann
1211 * @created Mar 5, 2010
1214 public static enum SelectionType
{
1215 AGENT
, INSTITUTION
, NAME
, REFERENCE
, TAXON_BASE
, TAXON
, SYNONYM
, TEAM
, AUTHOR_TEAM
, PERSON
, DERIVED_UNIT
, FIELD_OBSERVATION
, FEATURE_TREE
, CLASSIFICATION
, TAXON_NODE
, COLLECTION
, FEATURE
, POLYTOMOUS_KEY
, POLYTOMOUS_KEY_NODE
, USER
, GROUP
1223 * @param parentElement
1224 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1227 * a {@link java.lang.String} object.
1228 * @param initialState
1232 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.CheckboxElement} object.
1234 public CheckboxElement
createCheckbox(ICdmFormElement parentElement
,
1235 String label
, boolean initialState
, int style
) {
1236 CheckboxElement element
= new CheckboxElement(this, parentElement
,
1237 label
, initialState
, style
| orientation
);
1239 parentElement
.addElement(element
);
1244 * Creates a section as a part of the form.
1246 * @return the section widget
1248 * a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
1251 public Section
adapt(AbstractFormSection section
) {
1252 section
.setMenu(section
.getLayoutComposite().getMenu());
1253 adapt(section
, true, true);
1255 // handle focus and property change events for cdm use
1256 section
.addFocusListener(selectionFocusHandler
);
1257 section
.setPropertyChangeListeners(propertyChangeListeners
);
1259 if (section
.getToggle() != null) {
1260 section
.getToggle().setHoverDecorationColor(
1261 getColors().getColor(IFormColors
.TB_TOGGLE_HOVER
));
1262 section
.getToggle().setDecorationColor(
1263 getColors().getColor(IFormColors
.TB_TOGGLE
));
1266 section
.setFont(boldFontHolder2
.getBoldFont(section
1267 .getLayoutComposite().getFont()));
1269 if ((section
.getStyle() & Section
.TITLE_BAR
) != 0
1270 || (section
.getStyle() & Section
.SHORT_TITLE_BAR
) != 0) {
1271 getColors().initializeSectionToolBarColors();
1272 section
.setTitleBarBackground(getColors().getColor(
1273 IFormColors
.TB_BG
));
1274 section
.setTitleBarBorderColor(getColors().getColor(
1275 IFormColors
.TB_BORDER
));
1277 // call setTitleBarForeground regardless as it also sets the label color
1278 section
.setTitleBarForeground(getColors().getColor(
1279 IFormColors
.TB_TOGGLE
));
1283 private class BoldFontHolder2
{
1284 private Font normalFont
;
1286 private Font boldFont
;
1288 public BoldFontHolder2() {
1291 public Font
getBoldFont(Font font
) {
1292 createBoldFont(font
);
1296 private void createBoldFont(Font font
) {
1297 if (normalFont
== null || !normalFont
.equals(font
)) {
1301 if (boldFont
== null) {
1302 boldFont
= FormFonts
.getInstance().getBoldFont(
1303 getColors().getDisplay(), normalFont
);
1307 public void dispose() {
1308 if (boldFont
!= null) {
1309 FormFonts
.getInstance().markFinished(boldFont
,
1310 getColors().getDisplay());
1318 * createToggleableTextField
1321 * @param parentElement
1322 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1324 * @param labelString
1325 * a {@link java.lang.String} object.
1326 * @param initialText
1327 * a {@link java.lang.String} object.
1328 * @param initialState
1332 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.ToggleableTextElement}
1335 public ToggleableTextElement
createToggleableTextField(
1336 ICdmFormElement parentElement
, String labelString
,
1337 String initialText
, boolean initialState
, int style
) {
1338 ToggleableTextElement element
= new ToggleableTextElement(this,
1339 parentElement
, labelString
, initialText
, initialState
, style
1342 parentElement
.addElement(element
);
1348 * createTimePeriodElement
1351 * @param parentElement
1352 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1354 * @param labelString
1355 * a {@link java.lang.String} object.
1357 * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1360 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TimePeriodElement}
1363 public TimePeriodElement
createTimePeriodElement(
1364 ICdmFormElement parentElement
, String labelString
,
1365 TimePeriod timePeriod
, int style
) {
1366 TimePeriodElement element
= new TimePeriodElement(this, parentElement
,
1367 labelString
, timePeriod
, style
);
1369 parentElement
.addElement(element
);
1375 * createPointElement
1380 * @param parentElement
1381 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1384 * a {@link eu.etaxonomy.cdm.model.location.Point} object.
1385 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.PointElement} object.
1387 public PointElement
createPointElement(ICdmFormElement parentElement
,
1388 Point point
, int style
) {
1389 PointElement element
= new PointElement(this, parentElement
, point
,
1392 parentElement
.addElement(element
);
1398 * createDateDetailSection
1401 * @param parentElement
1402 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1406 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.DateDetailSection}
1409 public DateDetailSection
createDateDetailSection(
1410 ICdmFormElement parentElement
, int style
) {
1411 DateDetailSection section
= new DateDetailSection(this, parentElement
,
1413 parentElement
.addElement(section
);
1420 * createPartialElement
1423 * @param parentElement
1424 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1426 * @param labelString
1427 * a {@link java.lang.String} object.
1429 * a {@link org.joda.time.Partial} object.
1432 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.PartialElement} object.
1434 public PartialElement
createPartialElement(ICdmFormElement parentElement
,
1435 String labelString
, Partial partial
, int style
) {
1436 PartialElement element
= new PartialElement(this, parentElement
,
1437 labelString
, style
);
1439 parentElement
.addElement(element
);
1445 * addSelectionListener
1449 * a {@link org.eclipse.swt.events.SelectionListener} object.
1451 public void addSelectionListener(SelectionListener listener
) {
1452 selectionListenerList
.add(listener
);
1457 * removeSelectionListener
1461 * a {@link org.eclipse.swt.events.SelectionListener} object.
1463 public void removeSelectionListener(SelectionListener listener
) {
1464 if (listener
== null) {
1466 .error(this.getClass(),
1467 "Tried to remove a selection listener from this factories listeners but was null",
1470 selectionListenerList
.remove(listener
);
1476 * addPropertyChangeListener
1480 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1483 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
1484 if(propertyChangeListeners
.contains(listener
)){
1487 propertyChangeListeners
.add(0, listener
);
1492 * removePropertyChangeListener
1496 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1499 public void removePropertyChangeListener(IPropertyChangeListener listener
) {
1500 propertyChangeListeners
.remove(listener
);
1505 * createHorizontalSeparator
1508 * @param parentElement
1509 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1513 * @return a {@link org.eclipse.swt.widgets.Label} object.
1515 public Label
createHorizontalSeparator(ICdmFormElement parentElement
,
1517 Label separator
= this.createSeparator(
1518 parentElement
.getLayoutComposite(), SWT
.HORIZONTAL
| style
);
1519 separator
.setLayoutData(FILL_HORIZONTALLY());
1525 * createVersionElement
1528 * @param parentElement
1529 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1532 * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
1537 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
1540 public VersionElement
createVersionElement(ICdmFormElement parentElement
,
1541 VersionableEntity entity
, int style
) {
1542 VersionElement element
= new VersionElement(this, parentElement
,
1545 parentElement
.addElement(element
);
1551 * createVersionSection
1554 * @param parentElement
1555 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1560 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
1563 public VersionSection
createVersionSection(ICdmFormElement parentElement
,
1565 VersionSection section
= new VersionSection(this, parentElement
, style
);
1566 parentElement
.addElement(section
);
1573 * createEmptyElement
1576 * @param parentElement
1577 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1579 * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1581 public EmptyElement
createEmptyElement(ICdmFormElement parentElement
) {
1582 EmptyElement element
= new EmptyElement(this, parentElement
, null,
1585 parentElement
.addElement(element
);
1591 * createHeadlineSection
1594 * @param parentElement
1595 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1598 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
1601 public HeadlineSection
createHeadlineSection(ICdmFormElement parentElement
) {
1602 HeadlineSection section
= new HeadlineSection(this, parentElement
,
1604 parentElement
.addElement(section
);
1611 * createParsingMessageElement
1614 * @param parentElement
1615 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1617 * @param parserProblem
1618 * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
1623 * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
1626 public ParsingMessageElement
createParsingMessageElement(
1627 ICdmFormElement parentElement
, ParserProblem parserProblem
,
1629 ParsingMessageElement element
= new ParsingMessageElement(this,
1630 parentElement
, parserProblem
, style
);
1632 parentElement
.addElement(element
);
1641 public static enum DetailType
{
1645 NOMENCLATURALREFERENCE
,
1657 DERIVED_UNIT_FACADE
,
1661 FEATURE_DISTRIBUTION
,
1666 POLYTOMOUS_KEY_NODE
,
1668 DERIVED_UNIT_GENERAL
,
1677 * createCdmDetailSection
1682 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType}
1684 * @param parentElement
1685 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1687 * @param selectionProvider
1688 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1691 * @param conversation
1692 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1694 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
1697 public AbstractFormSection
createCdmDetailSection(DetailType detailType
,
1698 ConversationHolder conversation
, ICdmFormElement parentElement
,
1699 ISelectionProvider selectionProvider
, int style
) {
1700 AbstractFormSection section
= null;
1702 switch (detailType
) {
1703 case SCIENTIFICNAME
:
1704 section
= new NameDetailSection(this, conversation
, parentElement
,
1705 selectionProvider
, style
);
1708 section
= new ReferenceDetailSection(this, conversation
,
1709 parentElement
, selectionProvider
, style
);
1711 case NOMENCLATURALREFERENCE
:
1712 section
= new NomenclaturalReferenceDetailSection(this,
1713 conversation
, parentElement
, selectionProvider
, style
);
1716 section
= new TaxonBaseDetailSection(this, conversation
,
1717 parentElement
, selectionProvider
, style
);
1720 section
= new AuthorshipDetailSection(this, conversation
,
1721 parentElement
, selectionProvider
, style
);
1723 case TEAMORPERSONBASE
:
1724 section
= new TeamOrPersonBaseDetailSection(this, conversation
,
1725 parentElement
, selectionProvider
, style
);
1728 section
= new TeamDetailSection(this, conversation
, parentElement
,
1732 section
= new PersonDetailSection(this, conversation
,
1733 parentElement
, null, style
);
1736 section
= new DescriptionDetailSection(this, conversation
,
1737 parentElement
, selectionProvider
, style
);
1739 case DESCRIPTIONELEMENT
:
1740 section
= new DescriptionElementDetailSection(this, conversation
,
1741 parentElement
, selectionProvider
, style
);
1743 case PARSINGMESSAGE
:
1744 section
= new ParsingMessagesSection(this, conversation
,
1745 parentElement
, selectionProvider
, style
);
1748 section
= new NonViralNameDetailSection(this, conversation
,
1749 parentElement
, selectionProvider
, style
);
1752 section
= new eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection(
1753 this, conversation
, parentElement
, selectionProvider
, style
);
1755 case DERIVED_UNIT_FACADE
:
1756 section
= new DerivedUnitFacadeDetailSection(this, conversation
,
1757 parentElement
, selectionProvider
, style
);
1759 case FIELD_OBSERVATION
:
1760 section
= new FieldObservationDetailSection(this, conversation
,
1761 parentElement
, selectionProvider
, style
);
1763 case GATHERING_EVENT
:
1764 section
= new GatheringEventDetailSection(this, conversation
,
1765 parentElement
, selectionProvider
, style
);
1768 section
= new DerivedUnitBaseDetailSection(this, conversation
,
1769 parentElement
, selectionProvider
, style
);
1771 case NATURAL_LANGUAGE
:
1772 section
= new NaturalLanguageSection(this, conversation
,
1773 parentElement
, selectionProvider
, style
);
1775 case FEATURE_DISTRIBUTION
:
1776 section
= new FeatureDistributionDetailSection(this, conversation
,
1777 parentElement
, selectionProvider
, style
);
1779 case CLASSIFICATION
:
1780 section
= new ClassificationDetailSection(this, conversation
,
1781 parentElement
, selectionProvider
, style
);
1784 section
= new TaxonNodeDetailSection(this, conversation
,
1785 parentElement
, selectionProvider
, style
);
1787 case POLYTOMOUS_KEY
:
1788 section
= new PolytomousKeyDetailSection(this, conversation
,
1789 parentElement
, selectionProvider
, style
);
1791 case POLYTOMOUS_KEY_NODE
:
1792 section
= new PolytomousKeyNodeDetailSection(this, conversation
,
1793 parentElement
, selectionProvider
, style
);
1796 section
= new InstitutionDetailSection(this, conversation
,
1797 parentElement
, selectionProvider
, style
);
1799 case DERIVED_UNIT_GENERAL
:
1800 section
= new GeneralDetailSection(this, conversation
,
1801 parentElement
, selectionProvider
, style
);
1804 section
= new HybridDetailSection(this, conversation
,
1805 parentElement
, selectionProvider
, style
);
1808 section
= new UserDetailSection(this, conversation
, parentElement
,
1809 selectionProvider
, style
);
1812 section
= new GroupDetailSection(this, conversation
, parentElement
,
1813 selectionProvider
, style
);
1816 section
= new DeterminationDetailSection(this, conversation
, parentElement
,
1817 selectionProvider
, style
);
1820 if (section
== null) {
1821 throw new RuntimeException(
1822 "You tried to create a cdm detail section that is not implemented yet.");
1825 parentElement
.addElement(section
);
1832 * createCdmDetailElement
1837 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType}
1841 * @param parentElement
1842 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1845 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
1848 public AbstractCdmDetailElement
createCdmDetailElement(
1849 DetailType detailType
, ICdmFormElement parentElement
, int style
) {
1850 AbstractCdmDetailElement element
= null;
1852 switch (detailType
) {
1853 case SCIENTIFICNAME
:
1854 element
= new NameDetailElement(this, parentElement
, style
);
1857 element
= new ReferenceDetailElement(this, parentElement
, style
);
1859 case NOMENCLATURALREFERENCE
:
1860 element
= new NomenclaturalReferenceDetailElement(this,
1861 parentElement
, style
);
1864 element
= new TaxonBaseDetailElement(this, parentElement
, style
);
1867 element
= new AuthorshipDetailElement(this, parentElement
, style
);
1870 element
= new TeamDetailElement(this, parentElement
, style
);
1873 element
= new PersonDetailElement(this, parentElement
, style
);
1876 element
= new DescriptionDetailElement(this, parentElement
, style
);
1878 case DESCRIPTIONELEMENT
:
1879 element
= new DescriptionElementDetailElement(this, parentElement
,
1883 element
= new NonViralNameDetailElement(this, parentElement
);
1885 case DERIVED_UNIT_FACADE
:
1886 element
= new DerivedUnitFacadeDetailElement(this, parentElement
);
1888 case FIELD_OBSERVATION
:
1889 element
= new FieldObservationDetailElement(this, parentElement
);
1891 case GATHERING_EVENT
:
1892 element
= new GatheringEventDetailElement(this, parentElement
);
1895 element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1897 case NATURAL_LANGUAGE
:
1898 element
= new NaturalLanguageDetailElement(this, parentElement
);
1900 case FEATURE_DISTRIBUTION
:
1901 element
= new FeatureDistributionDetailElement(this, parentElement
);
1903 case CLASSIFICATION
:
1904 element
= new ClassificationDetailElement(this, parentElement
);
1907 element
= new TaxonNodeDetailElement(this, parentElement
);
1910 element
= new CollectionDetailElement(this, parentElement
);
1912 case POLYTOMOUS_KEY
:
1913 element
= new PolytomousKeyDetailElement(this, parentElement
);
1915 case POLYTOMOUS_KEY_NODE
:
1916 element
= new PolytomousKeyNodeDetailElement(this, parentElement
);
1919 element
= new InstitutionDetailElement(this, parentElement
);
1921 case DERIVED_UNIT_GENERAL
:
1922 element
= new GeneralDetailElement(this, parentElement
);
1925 element
= new HybridDetailElement(this, parentElement
);
1928 element
= new UserDetailElement(this, parentElement
);
1931 element
= new GroupDetailElement(this, parentElement
);
1934 element
= new DeterminationDetailElement(this, parentElement
);
1938 if (element
== null) {
1940 .error(this.getClass(),
1941 "Detail element was not created. Seems like the case was not implemented for the requested detail type: "
1942 + detailType
, null);
1946 parentElement
.addElement(element
);
1952 * @author n.hoffmann
1953 * @created Mar 5, 2010
1956 public static enum EntityDetailType
{
1957 TEAM
, TEAMMEMBER
, ANNOTATION
, CREDIT
, DESCRIPTIONELEMENTSOURCE
, EXTENSION
, MARKER
, MEDIA
, DESCRIPTIONELEMENTMEDIA
, MEDIAREPRESENTATION
, MEDIAREPRESENTATIONPART
, MODIFIER
, NOMENCLATURALSTATUS
, NAME_RELATIONSHIP
, PROTOLOG
, RIGHTS
, SOURCE
, SCOPE
, DESCRIPTIONSOURCE
, TYPEDESIGNATION
, STATE_DATA
, STATISTICAL_MEASUREMENT_VALUE
, DESCRIBED_SPECIMEN
, COLLECTING_AREA
, DETERMINATION_EVENT
, SPECIMEN_COLLECTION
, IDENTIFIABLE_SOURCE_COLLECTION
, GEOGRAPHICAL_SCOPE
, SCOPE_RESTRICTION
, MEMBER
, GRANTED_AUTHORITY
, GROUPS_BY_USER
, TAXONOMIC_SCOPE
, DETERMINATION_CURRENT
, DETERMINATION_HISTORY
1962 * createEntityDetailSection
1965 * @param entityDetailType
1967 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EntityDetailType}
1971 * @param conversation
1972 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1974 * @param parentElement
1975 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1977 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
1980 public AbstractFormSection
createEntityDetailSection(
1981 EntityDetailType entityDetailType
, ConversationHolder conversation
,
1982 ICdmFormElement parentElement
, int style
) {
1983 AbstractFormSection section
= null;
1985 switch (entityDetailType
) {
1987 section
= new TeamDetailSection(this, conversation
, parentElement
,
1991 section
= new TeamMemberSection(this, conversation
, parentElement
,
1995 section
= new AnnotationSection(this, conversation
, parentElement
,
1999 section
= new CreditSection(this, conversation
, parentElement
,
2002 case DESCRIPTIONELEMENTSOURCE
:
2003 section
= new DescriptionElementSourceSection(this, conversation
,
2004 parentElement
, style
);
2007 section
= new ExtensionSection(this, conversation
, parentElement
,
2011 section
= new MarkerSection(this, conversation
, parentElement
,
2015 section
= new MediaSection(this, conversation
, parentElement
, style
);
2017 case DESCRIPTIONELEMENTMEDIA
:
2018 section
= new DescriptionElementMediaSection(this, conversation
,
2019 parentElement
, style
);
2021 case MEDIAREPRESENTATION
:
2022 section
= new MediaRepresentationSection(this, conversation
,
2023 parentElement
, style
);
2025 case MEDIAREPRESENTATIONPART
:
2026 section
= new MediaRepresentationPartSection(this, conversation
,
2027 parentElement
, style
);
2030 section
= new ModifierSection(this, conversation
, parentElement
,
2033 case NOMENCLATURALSTATUS
:
2034 section
= new NomenclaturalStatusSection(this, conversation
,
2035 parentElement
, style
);
2037 case NAME_RELATIONSHIP
:
2038 section
= new NameRelationshipDetailSection(this, conversation
,
2039 parentElement
, style
);
2042 section
= new ProtologueSection(this, conversation
, parentElement
,
2046 section
= new RightsSection(this, conversation
, parentElement
,
2050 section
= new SourceSection(this, conversation
, parentElement
,
2054 section
= new ScopeSection(this, conversation
, parentElement
, style
);
2056 case DESCRIPTIONSOURCE
:
2057 section
= new DescriptionSourceSection(this, conversation
,
2058 parentElement
, style
);
2060 case TYPEDESIGNATION
:
2061 section
= new TypeDesignationSection(this, conversation
,
2062 parentElement
, style
);
2065 section
= new StateDataSection(this, conversation
, parentElement
,
2068 case STATISTICAL_MEASUREMENT_VALUE
:
2069 section
= new StatisticalMeasurementValueSection(this,
2070 conversation
, parentElement
, style
);
2072 case DESCRIBED_SPECIMEN
:
2073 section
= new DescribedSpecimenSection(this, conversation
,
2074 parentElement
, style
);
2076 case COLLECTING_AREA
:
2077 section
= new CollectingAreasDetailSection(this, conversation
,
2078 parentElement
, style
);
2080 case DETERMINATION_CURRENT
:
2081 section
= new CurrentDeterminationDetailSection(this, conversation
,
2082 parentElement
, style
);
2084 case DETERMINATION_HISTORY
:
2085 section
= new DeterminationHistoryDetailSection(this, conversation
,
2086 parentElement
, style
);
2088 case SPECIMEN_COLLECTION
:
2089 section
= new SpecimenCollectionDetailSection(this, conversation
,
2090 parentElement
, style
);
2092 case IDENTIFIABLE_SOURCE_COLLECTION
:
2093 section
= new SourceCollectionDetailSection(this, conversation
,
2094 parentElement
, style
);
2096 case GEOGRAPHICAL_SCOPE
:
2097 section
= new GeographicalScopeDetailSection(this, conversation
,
2098 parentElement
, style
);
2100 case SCOPE_RESTRICTION
:
2101 section
= new ScopeRestrictionSection(this, conversation
,
2102 parentElement
, style
);
2105 section
= new MemberDetailSection(this, conversation
,
2106 parentElement
, style
);
2108 case GRANTED_AUTHORITY
:
2109 section
= new GrantedAuthorityDetailSection(this, conversation
,
2110 parentElement
, style
);
2112 case GROUPS_BY_USER
:
2113 section
= new GroupsByUserDetailSection(this, conversation
,
2114 parentElement
, style
);
2116 case TAXONOMIC_SCOPE
:
2117 section
= new TaxonomicScopeSection(this, conversation
,
2118 parentElement
, style
);
2121 parentElement
.addElement(section
);
2128 * createEntityCollectionElement
2131 * @param removeListener
2132 * a {@link org.eclipse.swt.events.SelectionListener} object.
2135 * @param parentElement
2136 * a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
2138 * @param versionableEntity
2139 * a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity}
2141 * @param backgroundColor
2142 * a {@link org.eclipse.swt.graphics.Color} object.
2144 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement}
2147 public AbstractEntityCollectionElement
createEntityCollectionElement(
2148 AbstractFormSection parentElement
, Object versionableEntity
,
2149 SelectionListener removeListener
, Color backgroundColor
, int style
) {
2150 AbstractEntityCollectionElement element
= null;
2152 Object entity
= HibernateProxyHelper
.deproxy(versionableEntity
);
2154 if (entity
instanceof Annotation
) {
2155 element
= new AnnotationElement(this, parentElement
,
2156 (Annotation
) entity
, removeListener
, style
);
2157 } else if (entity
instanceof Person
) {
2158 element
= new TeamMemberElement(this, parentElement
,
2159 (Person
) entity
, removeListener
, style
);
2160 } else if (entity
instanceof Credit
) {
2161 element
= new CreditElement(this, parentElement
, (Credit
) entity
,
2162 removeListener
, style
);
2163 } else if (entity
instanceof Extension
) {
2164 element
= new ExtensionElement(this, parentElement
,
2165 (Extension
) entity
, removeListener
, style
);
2166 } else if (entity
instanceof Marker
) {
2167 element
= new MarkerElement(this, parentElement
, (Marker
) entity
,
2168 removeListener
, style
);
2169 } else if (entity
instanceof Media
) {
2170 element
= new MediaElement(this, parentElement
, (Media
) entity
,
2171 removeListener
, style
);
2172 } else if (entity
instanceof MediaRepresentation
) {
2173 element
= new MediaRepresentationElement(this, parentElement
,
2174 (MediaRepresentation
) entity
, removeListener
, style
);
2175 } else if (entity
instanceof ImageFile
) {
2176 element
= new ImageFileElement(this, parentElement
,
2177 (ImageFile
) entity
, removeListener
, style
);
2178 } else if (entity
instanceof NomenclaturalStatus
) {
2179 element
= new NomenclaturalStatusElement(this, parentElement
,
2180 (NomenclaturalStatus
) entity
, removeListener
, style
);
2181 } else if (entity
instanceof Rights
) {
2182 element
= new RightsElement(this, parentElement
, (Rights
) entity
,
2183 removeListener
, style
);
2184 } else if (entity
instanceof DescriptionElementSource
) {
2185 element
= new DescriptionElementSourceElement(this, parentElement
,
2186 (DescriptionElementSource
) entity
, removeListener
, style
);
2187 } else if (entity
instanceof IdentifiableSource
) {
2188 element
= new IdentifiableSourceElement(this, parentElement
,
2189 (IdentifiableSource
) entity
, removeListener
, style
);
2190 } else if (entity
instanceof Scope
) {
2191 element
= new ScopeElement(this, parentElement
, (Scope
) entity
,
2192 removeListener
, style
);
2193 } else if (entity
instanceof Modifier
) {
2194 element
= new ModifierElement(this, parentElement
,
2195 (Modifier
) entity
, removeListener
, style
);
2196 } else if (entity
instanceof Reference
) {
2197 element
= new DescriptionSourceElement(this, parentElement
,
2198 (Reference
) entity
, removeListener
, style
);
2199 } else if (entity
instanceof NameTypeDesignation
) {
2200 element
= new NameTypeDesignationElement(this, parentElement
,
2201 (NameTypeDesignation
) entity
, removeListener
, style
);
2202 } else if (entity
instanceof NameRelationship
) {
2203 element
= new NameRelationshipDetailElement(this, parentElement
,
2204 (NameRelationship
) entity
, removeListener
, style
);
2205 } else if (entity
instanceof SpecimenTypeDesignation
) {
2206 element
= new SpecimenTypeDesignationElement(this, parentElement
,
2207 (SpecimenTypeDesignation
) entity
, removeListener
, style
);
2208 } else if (entity
instanceof StateData
) {
2209 element
= new StateDataElement(this, parentElement
,
2210 (StateData
) entity
, removeListener
, style
);
2211 } else if (entity
instanceof StatisticalMeasurementValue
) {
2212 element
= new StatisticalMeasurementValueElement(this,
2213 parentElement
, (StatisticalMeasurementValue
) entity
,
2214 removeListener
, style
);
2215 } else if (entity
instanceof DerivedUnit
) {
2216 element
= new DerivedUnitElement(this, parentElement
,
2217 (DerivedUnit
) entity
, removeListener
, style
);
2218 } else if (entity
instanceof NamedArea
) {
2219 element
= new NamedAreaDetailElement(this, parentElement
,
2220 (NamedArea
) entity
, removeListener
, style
);
2221 } else if (entity
instanceof DeterminationEvent
) {
2222 element
= new DeterminationEventDetailElement(this, parentElement
,
2223 (DeterminationEvent
) entity
, removeListener
, style
);
2224 } else if (entity
instanceof Specimen
) {
2225 element
= new SpecimenCollectionDetailElement(this, parentElement
,
2226 (Specimen
) entity
, removeListener
, style
);
2227 } else if (entity
instanceof User
) {
2228 element
= new MemberDetailElement(this, parentElement
,
2229 (User
) entity
, removeListener
, style
);
2230 } else if (entity
instanceof GrantedAuthority
) {
2231 element
= new GrantedAuthorityDetailElement(this, parentElement
,
2232 (GrantedAuthority
) entity
, removeListener
, style
);
2233 } else if (entity
instanceof Group
) {
2234 element
= new GroupsByUserDetailElement(this, parentElement
,
2235 (Group
) entity
, removeListener
, style
);
2236 } else if (entity
instanceof Taxon
) {
2237 element
= new TaxonDetailElement(this, parentElement
,
2238 (Taxon
) entity
, removeListener
, style
);
2239 } else if (entity
instanceof DescriptionElementBase
) {
2240 // this is the special case for protologs, maybe we can do this
2241 // differently when API improves
2242 DescriptionElementBase descriptionElement
= (DescriptionElementBase
) entity
;
2243 if (descriptionElement
.getFeature().equals(Feature
.PROTOLOGUE())) {
2244 element
= new ProtologueElement(this, parentElement
,
2245 descriptionElement
, removeListener
, style
);
2249 if (element
== null) {
2252 "No element for entity",
2254 "Could not generate element for entity. "
2255 + "Looks like the case is not handled already. Check implementation. Entity: "
2259 if (backgroundColor
!= null && !backgroundColor
.isDisposed()) {
2260 element
.setBackgroundColor(backgroundColor
);
2264 parentElement
.addElement(element
);
2270 * createSelectionElement
2273 * @param selectionType
2275 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType}
2277 * @param parentElement
2278 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
2280 * @param labelString
2281 * a {@link java.lang.String} object.
2282 * @param selectionType
2284 * a {@link eu.etaxonomy.cdm.model.common.IAnnotatableEntity}
2288 * @param conversation
2289 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
2292 * {@link eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement}
2295 public AbstractSelectionElement
createSelectionElement(
2296 SelectionType selectionType
, ConversationHolder conversation
,
2297 ICdmFormElement parentElement
, String labelString
,
2298 ICdmBase selection
, int mode
, int style
) {
2299 AbstractSelectionElement element
= null;
2301 IAnnotatableEntity entity
= (IAnnotatableEntity
) HibernateProxyHelper
2302 .deproxy(selection
);
2304 switch (selectionType
) {
2306 element
= new AgentSelectionElement(this, conversation
,
2307 parentElement
, labelString
, (TeamOrPersonBase
) entity
,
2311 element
= new PersonSelectionElement(this, conversation
,
2312 parentElement
, labelString
, (Person
) entity
, mode
, style
);
2315 element
= new TeamSelectionElement(this, conversation
,
2316 parentElement
, labelString
, (Team
) entity
, mode
, style
);
2319 element
= new NomenclaturalAuthorTeamSelectionElement(this,
2320 conversation
, parentElement
, labelString
, (Team
) entity
,
2324 element
= new InstitutionSelectionElement(this, conversation
,
2325 parentElement
, labelString
, (Institution
) entity
, mode
,
2329 element
= new NameSelectionElement(this, conversation
,
2330 parentElement
, labelString
, (TaxonNameBase
) entity
, mode
,
2334 element
= new ReferenceSelectionElement(this, conversation
,
2335 parentElement
, labelString
, (Reference
) entity
, mode
, style
);
2338 element
= new TaxonBaseSelectionElement(this, conversation
,
2339 parentElement
, labelString
, (TaxonBase
) entity
, mode
, style
);
2342 element
= new TaxonSelectionElement(this, conversation
,
2343 parentElement
, labelString
, (Taxon
) entity
, mode
, style
);
2346 element
= new SynonymSelectionElement(this, conversation
,
2347 parentElement
, labelString
, (Synonym
) entity
, mode
, style
);
2350 element
= new DerivedUnitBaseSelectionElement(this, conversation
,
2351 parentElement
, labelString
, (DerivedUnitBase
) entity
, mode
,
2354 case FIELD_OBSERVATION
:
2355 element
= new FieldObservationSelectionElement(this, conversation
,
2356 parentElement
, labelString
, (FieldObservation
) entity
,
2360 element
= new FeatureTreeSelectionElement(this, conversation
,
2361 parentElement
, labelString
, (FeatureTree
) entity
, mode
,
2364 case CLASSIFICATION
:
2365 element
= new ClassificationSelectionElement(this, conversation
,
2366 parentElement
, labelString
, (Classification
) entity
, mode
,
2370 element
= new TaxonNodeSelectionElement(this, conversation
,
2371 parentElement
, labelString
, (TaxonNode
) entity
, mode
, style
);
2374 element
= new CollectionSelectionElement(this, conversation
,
2375 parentElement
, labelString
, (Collection
) entity
, mode
,
2379 element
= new FeatureSelectionElement(this, conversation
,
2380 parentElement
, labelString
, (Feature
) entity
, mode
, style
);
2382 case POLYTOMOUS_KEY
:
2383 element
= new PolytomousKeySelectionElement(this, conversation
,
2384 parentElement
, labelString
, (PolytomousKey
) entity
, mode
,
2387 case POLYTOMOUS_KEY_NODE
:
2388 element
= new PolytomousKeyNodeSelectionElement(this, conversation
,
2389 parentElement
, labelString
, (PolytomousKeyNode
) entity
,
2393 element
= new UserSelectionElement(this, conversation
,
2394 parentElement
, labelString
, (User
) entity
, mode
, style
);
2397 element
= new GroupSelectionElement(this, conversation
,
2398 parentElement
, labelString
, (Group
) entity
, mode
, style
);
2401 new RuntimeException(
2402 "There is no selection composite for the desired selection type.");
2407 parentElement
.addElement(element
);
2413 * createNamedAreaSelectionElement
2416 * @param parentElement
2417 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
2419 * @param conversation
2420 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
2422 * @param labelString
2423 * a {@link java.lang.String} object.
2425 * a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
2429 * {@link eu.etaxonomy.taxeditor.ui.selection.NamedAreaSelectionElement}
2432 public NamedAreaSelectionElement
createNamedAreaSelectionElement(
2433 ICdmFormElement parentElement
, ConversationHolder conversation
,
2434 String labelString
, NamedArea selection
, int style
) {
2435 NamedAreaSelectionElement element
= new NamedAreaSelectionElement(this,
2436 conversation
, parentElement
, labelString
, selection
,
2437 AbstractSelectionElement
.NOTHING
, style
);
2439 parentElement
.addElement(element
);
2443 /** {@inheritDoc} */
2444 public LabelElement
createLabel(ICdmFormElement parentElement
, String text
) {
2445 LabelElement labelElement
= new LabelElement(this, parentElement
, text
);
2446 adapt(labelElement
);
2447 parentElement
.addElement(labelElement
);
2448 return labelElement
;
2453 * Getter for the field <code>selectionProvider</code>.
2456 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
2458 public ISelectionProvider
getSelectionProvider() {
2459 return selectionProvider
;
2464 * createDetailedDescriptionDetailElement
2467 * @param parentElement
2468 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
2472 * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
2477 * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
2480 public AbstractDetailedDescriptionDetailElement
createDetailedDescriptionDetailElement(
2481 ICdmFormElement parentElement
, DescriptionElementBase entity
,
2483 AbstractDetailedDescriptionDetailElement detailedDescriptionElement
= null;
2485 if (entity
instanceof CategoricalData
) {
2486 detailedDescriptionElement
= new CategoricalDataDetailElement(this,
2487 parentElement
, (CategoricalData
) entity
, style
);
2488 } else if (entity
instanceof CommonTaxonName
) {
2489 detailedDescriptionElement
= new CommonNameDetailElement(this,
2490 parentElement
, (CommonTaxonName
) entity
, style
);
2491 } else if (entity
instanceof Distribution
) {
2492 detailedDescriptionElement
= new DistributionDetailElement(this,
2493 parentElement
, (Distribution
) entity
, style
);
2494 } else if (entity
instanceof IndividualsAssociation
) {
2495 detailedDescriptionElement
= new IndividualsAssociationDetailElement(
2496 this, parentElement
, (IndividualsAssociation
) entity
, style
);
2497 } else if (entity
instanceof QuantitativeData
) {
2498 detailedDescriptionElement
= new QuantitativeDataDetailElement(
2499 this, parentElement
, (QuantitativeData
) entity
, style
);
2500 } else if (entity
instanceof TaxonInteraction
) {
2501 detailedDescriptionElement
= new TaxonInteractionDetailElement(
2502 this, parentElement
, (TaxonInteraction
) entity
, style
);
2503 } else if (entity
instanceof TextData
) {
2504 detailedDescriptionElement
= new TextDataDetailElement(this,
2505 parentElement
, (TextData
) entity
, style
);
2507 throw new IllegalStateException(
2508 "There is no interface for the given description element");
2510 adapt(detailedDescriptionElement
);
2511 parentElement
.addElement(detailedDescriptionElement
);
2512 return detailedDescriptionElement
;
2517 * Creates a styled text as a part of the form.
2522 * the text initial value
2525 * @return the text widget
2527 public StyledText
createStyledText(Composite parent
, String value
, int style
) {
2528 StyledText text
= new StyledText(parent
, getBorderStyle() | style
2529 | getOrientation());
2531 text
.setText(value
);
2532 text
.setForeground(getColors().getForeground());
2533 text
.setBackground(getColors().getBackground());
2534 // text.addFocusListener(visibilityHandler);