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
.MediaRepresentationPart
;
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
.key
.TaxonomicScopeSection
;
190 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.ImageFileElement
;
191 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaElement
;
192 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationElement
;
193 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationPartElement
;
194 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationPartSection
;
195 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationSection
;
196 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaSection
;
197 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailElement
;
198 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailSection
;
199 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailElement
;
200 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailSection
;
201 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailElement
;
202 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailSection
;
203 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailElement
;
204 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailSection
;
205 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameTypeDesignationElement
;
206 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusElement
;
207 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusSection
;
208 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailElement
;
209 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailSection
;
210 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueElement
;
211 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueSection
;
212 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.SpecimenTypeDesignationElement
;
213 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.TypeDesignationSection
;
214 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectingAreasDetailSection
;
215 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectionDetailElement
;
216 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CurrentDeterminationDetailSection
;
217 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailElement
;
218 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailSection
;
219 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailElement
;
220 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailSection
;
221 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailElement
;
222 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailSection
;
223 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationEventDetailElement
;
224 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationHistoryDetailSection
;
225 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailElement
;
226 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailSection
;
227 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailElement
;
228 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailSection
;
229 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailElement
;
230 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailSection
;
231 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.NamedAreaDetailElement
;
232 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SourceCollectionDetailSection
;
233 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailElement
;
234 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailSection
;
235 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailElement
;
236 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailSection
;
237 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailElement
;
238 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailSection
;
239 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationElement
;
240 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationSection
;
241 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditElement
;
242 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditSection
;
243 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionElement
;
244 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionSection
;
245 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.HeadlineSection
;
246 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.IdentifiableSourceElement
;
247 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerElement
;
248 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerSection
;
249 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsElement
;
250 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
251 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.SourceSection
;
252 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionElement
;
253 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionSection
;
254 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessageElement
;
255 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
256 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailElement
;
257 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
258 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonDetailElement
;
259 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailElement
;
260 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailSection
;
261 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailElement
;
262 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailSection
;
263 import eu
.etaxonomy
.taxeditor
.ui
.selection
.AbstractSelectionElement
;
264 import eu
.etaxonomy
.taxeditor
.ui
.selection
.AgentSelectionElement
;
265 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ClassificationSelectionElement
;
266 import eu
.etaxonomy
.taxeditor
.ui
.selection
.CollectionSelectionElement
;
267 import eu
.etaxonomy
.taxeditor
.ui
.selection
.DerivedUnitBaseSelectionElement
;
268 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FeatureSelectionElement
;
269 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FeatureTreeSelectionElement
;
270 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FieldObservationSelectionElement
;
271 import eu
.etaxonomy
.taxeditor
.ui
.selection
.GroupSelectionElement
;
272 import eu
.etaxonomy
.taxeditor
.ui
.selection
.InstitutionSelectionElement
;
273 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NameSelectionElement
;
274 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NamedAreaSelectionElement
;
275 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NomenclaturalAuthorTeamSelectionElement
;
276 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PersonSelectionElement
;
277 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PolytomousKeyNodeSelectionElement
;
278 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PolytomousKeySelectionElement
;
279 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ReferenceSelectionElement
;
280 import eu
.etaxonomy
.taxeditor
.ui
.selection
.SynonymSelectionElement
;
281 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonBaseSelectionElement
;
282 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonNodeSelectionElement
;
283 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonSelectionElement
;
284 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TeamSelectionElement
;
285 import eu
.etaxonomy
.taxeditor
.ui
.selection
.UserSelectionElement
;
286 import eu
.etaxonomy
.taxeditor
.ui
.term
.AbstractEnumComboElement
;
287 import eu
.etaxonomy
.taxeditor
.ui
.term
.AbstractTermComboElement
;
288 import eu
.etaxonomy
.taxeditor
.ui
.term
.AnnotationTypeComboElement
;
289 import eu
.etaxonomy
.taxeditor
.ui
.term
.DeterminationModifierComboElement
;
290 import eu
.etaxonomy
.taxeditor
.ui
.term
.EmptyComboElement
;
291 import eu
.etaxonomy
.taxeditor
.ui
.term
.ExtensionTypeComboElement
;
292 import eu
.etaxonomy
.taxeditor
.ui
.term
.LanguageComboElement
;
293 import eu
.etaxonomy
.taxeditor
.ui
.term
.MarkerTypeComboElement
;
294 import eu
.etaxonomy
.taxeditor
.ui
.term
.MeasurementUnitComboElement
;
295 import eu
.etaxonomy
.taxeditor
.ui
.term
.ModifierComboElement
;
296 import eu
.etaxonomy
.taxeditor
.ui
.term
.NameRelationshipTypeComboElement
;
297 import eu
.etaxonomy
.taxeditor
.ui
.term
.NameTypeDesignationStatusComboElement
;
298 import eu
.etaxonomy
.taxeditor
.ui
.term
.NamedAreaTypeComboElement
;
299 import eu
.etaxonomy
.taxeditor
.ui
.term
.NomenclaturalCodeComboElement
;
300 import eu
.etaxonomy
.taxeditor
.ui
.term
.NomenclaturalStatusTypeComboElement
;
301 import eu
.etaxonomy
.taxeditor
.ui
.term
.PresenceAbsenceTermComboElement
;
302 import eu
.etaxonomy
.taxeditor
.ui
.term
.PreservationMethodComboElement
;
303 import eu
.etaxonomy
.taxeditor
.ui
.term
.RankComboElement
;
304 import eu
.etaxonomy
.taxeditor
.ui
.term
.ReferenceSystemComboElement
;
305 import eu
.etaxonomy
.taxeditor
.ui
.term
.ReferenceTypeComboElement
;
306 import eu
.etaxonomy
.taxeditor
.ui
.term
.RightsTypeComboElement
;
307 import eu
.etaxonomy
.taxeditor
.ui
.term
.ScopeComboElement
;
308 import eu
.etaxonomy
.taxeditor
.ui
.term
.SexComboElement
;
309 import eu
.etaxonomy
.taxeditor
.ui
.term
.SpecimenTypeDesignationStatusComboElement
;
310 import eu
.etaxonomy
.taxeditor
.ui
.term
.StageComboElement
;
311 import eu
.etaxonomy
.taxeditor
.ui
.term
.StateComboElement
;
312 import eu
.etaxonomy
.taxeditor
.ui
.term
.StatisticalMeasureComboElement
;
316 * CdmFormFactory class.
320 * @created Feb 24, 2010
323 public class CdmFormFactory
extends FormToolkit
{
325 private BoldFontHolder2 boldFontHolder2
;
326 private MouseListener selectionMouseHandler
;
327 private FocusListener selectionFocusHandler
;
329 private final Set selectionListenerList
= new HashSet();
331 private final List
<IPropertyChangeListener
> propertyChangeListeners
= new ArrayList
<IPropertyChangeListener
>();
333 private final int orientation
= Window
.getDefaultOrientation();
334 private ISelectionProvider selectionProvider
;
341 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
343 public static final TableWrapLayout
LAYOUT() {
344 return LAYOUT(1, false);
356 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
358 public static final TableWrapLayout
LAYOUT(int columns
, boolean equalWidth
) {
359 TableWrapLayout layout
= new TableWrapLayout();
360 layout
.topMargin
= 0;
361 layout
.rightMargin
= 0;
362 layout
.bottomMargin
= 0;
363 layout
.leftMargin
= 0;
364 layout
.numColumns
= columns
;
365 layout
.makeColumnsEqualWidth
= equalWidth
;
366 layout
.verticalSpacing
= 0;
367 layout
.horizontalSpacing
= 0;
376 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
378 public static final TableWrapData
FILL() {
387 * @param horizontalSpan
389 * @param verticalSpan
391 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
393 public static final TableWrapData
FILL(int horizontalSpan
, int verticalSpan
) {
394 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
,
395 TableWrapData
.FILL_GRAB
);
396 layoutData
.colspan
= horizontalSpan
;
397 layoutData
.rowspan
= verticalSpan
;
406 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
408 public static final TableWrapData
LEFT() {
409 return new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
);
417 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
419 public static final TableWrapData
RIGHT() {
420 return new TableWrapData(TableWrapData
.RIGHT
, TableWrapData
.TOP
);
428 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
430 public static final TableWrapData
FILL_HORIZONTALLY() {
431 return FILL_HORIZONTALLY(1, 1);
439 * @param horizontalSpan
441 * @param verticalSpan
443 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
445 public static final TableWrapData
FILL_HORIZONTALLY(int horizontalSpan
,
447 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
,
449 layoutData
.colspan
= horizontalSpan
;
450 layoutData
.rowspan
= verticalSpan
;
454 /** Constant <code>EMPTY_SELECTION</code> */
455 public static ISelection EMPTY_SELECTION
= new ISelection() {
457 public boolean isEmpty() {
462 private class SelectionMouseHandler
extends MouseAdapter
{
464 public void mouseDown(MouseEvent e
) {
465 notifySelectionListeners(e
);
469 private class SelectionFocusHandler
extends FocusAdapter
{
471 public void focusGained(FocusEvent e
) {
472 notifySelectionListeners(e
);
476 private void notifySelectionListeners(TypedEvent e
) {
477 Event event
= new Event();
478 event
.widget
= e
.widget
;
479 SelectionEvent selectionEvent
= new SelectionEvent(event
);
481 for (Object listener
: selectionListenerList
) {
482 ((SelectionListener
) listener
).widgetSelected(selectionEvent
);
488 * Constructor for CdmFormFactory.
492 * a {@link org.eclipse.swt.widgets.Display} object.
493 * @param selectionProvider
494 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
496 public CdmFormFactory(Display display
, ISelectionProvider selectionProvider
) {
498 this.selectionProvider
= selectionProvider
;
504 * Constructor for CdmFormFactory.
508 * a {@link org.eclipse.swt.widgets.Display} object.
510 public CdmFormFactory(Display display
) {
518 private void init() {
519 boldFontHolder2
= new BoldFontHolder2();
520 selectionMouseHandler
= new SelectionMouseHandler();
521 selectionFocusHandler
= new SelectionFocusHandler();
525 * Creates an instance initialized with the correct selectionProvider
527 * Make sure to remove the instance when the entityComposite disposes via
528 * destroySelectionArbitrator(..)
530 * @param entityElement
531 * a {@link eu.etaxonomy.taxeditor.ui.forms.IEntityElement}
533 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator}
536 public SelectionArbitrator
createSelectionArbitrator(
537 IEntityElement entityElement
) {
538 SelectionArbitrator selectionArbitrator
= new SelectionArbitrator(
540 selectionArbitrator
.addSelectionProvider(selectionProvider
);
541 selectionProvider
.addSelectionChangedListener(selectionArbitrator
);
542 addSelectionListener(selectionArbitrator
);
543 return selectionArbitrator
;
548 * destroySelectionArbitrator
551 * @param selectionArbitrator
552 * a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator}
555 public void destroySelectionArbitrator(
556 SelectionArbitrator selectionArbitrator
) {
557 removeSelectionListener(selectionArbitrator
);
558 if (selectionProvider
!= null) {
560 .removeSelectionChangedListener(selectionArbitrator
);
563 .error(this.getClass(),
564 "Tried to destroy a selection listener from this factories listeners but was null",
571 public void adapt(Composite composite
) {
572 composite
.addMouseListener(selectionMouseHandler
);
573 super.adapt(composite
);
583 * {@link eu.etaxonomy.taxeditor.ui.forms.AbstractCdmFormElement}
586 public void adapt(AbstractCdmFormElement formElement
) {
587 formElement
.setPropertyChangeListeners(propertyChangeListeners
);
592 public void adapt(Control control
, boolean trackFocus
, boolean trackKeyboard
) {
594 control
.addFocusListener(selectionFocusHandler
);
596 super.adapt(control
, trackFocus
, trackKeyboard
);
605 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
608 public void destroyElement(ICdmFormElement formElement
) {
609 // return if element was not initialized
610 if (formElement
== null) {
613 // destroy selection arbitrator, if any
614 if (formElement
instanceof ISelectableElement
) {
615 destroySelectionArbitrator(((ISelectableElement
) formElement
)
616 .getSelectionArbitrator());
618 // remove this element form its parents list of elements
619 // ICdmFormElement parentElement = formElement.getParentElement();
620 // if(parentElement != null){
621 // parentElement.removeElement(formElement);
623 // call destroy on child elements recursively
624 for (ICdmFormElement childElement
: formElement
.getElements()) {
625 destroyElement(childElement
);
627 // dispose of the controls
628 for (Control control
: formElement
.getControls()) {
629 // we added the layoutComposite of the parental element as the
630 // layout composite to this formElement
631 // but we do not want to destroy it.
632 if (control
.equals(formElement
.getLayoutComposite())) {
647 * a {@link org.eclipse.swt.widgets.Composite} object.
648 * @return a {@link org.eclipse.swt.widgets.Label} object.
650 public Label
createEmptyCell(Composite parent
) {
651 return this.createLabel(parent
, null);
656 * createMultilineTextWithLabel
660 * a {@link java.lang.String} object.
665 * @param parentElement
666 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
668 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement}
671 public TextWithLabelElement
createMultilineTextWithLabel(
672 ICdmFormElement parentElement
, String labelString
, int textHeight
,
674 TextWithLabelElement element
= new TextWithLabelElement(this,
675 parentElement
, labelString
, "", textHeight
, style
);
677 parentElement
.addElement(element
);
683 * createMultiLanguageTextElement
686 * @param parentElement
687 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
690 * a {@link java.lang.String} object.
691 * @param multilanguageText
692 * a {@link java.util.Map} object.
698 * {@link eu.etaxonomy.taxeditor.ui.forms.MultilanguageTextElement}
701 public MultilanguageTextElement
createMultiLanguageTextElement(
702 ICdmFormElement parentElement
, String labelString
,
703 Map
<Language
, LanguageString
> multilanguageText
, int textHeight
,
705 MultilanguageTextElement element
= new MultilanguageTextElement(this,
706 parentElement
, labelString
, multilanguageText
, textHeight
,
709 parentElement
.addElement(element
);
713 public KeyStatementElement
createKeyStatementElement(
714 ICdmFormElement parentElement
, String labelString
,
715 KeyStatement keyStatement
, int textHeight
, int style
) {
716 KeyStatementElement element
= new KeyStatementElement(this,
717 parentElement
, labelString
, keyStatement
, textHeight
, style
);
719 parentElement
.addElement(element
);
725 * createTextWithLabelElement
729 * a {@link java.lang.String} object.
731 * a {@link java.lang.String} object.
734 * @param parentElement
735 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
737 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement}
740 public TextWithLabelElement
createTextWithLabelElement(
741 ICdmFormElement parentElement
, String labelString
,
742 String initialText
, int style
) {
743 TextWithLabelElement element
= new TextWithLabelElement(this,
744 parentElement
, labelString
, initialText
, null, style
);
746 parentElement
.addElement(element
);
750 public UriWithLabelElement
createUriWithLabelElement(
751 ICdmFormElement parentElement
, String labelString
, URI initialUri
,
753 UriWithLabelElement element
= new UriWithLabelElement(this,
754 parentElement
, labelString
, initialUri
, null, style
);
756 parentElement
.addElement(element
);
767 public OpenUrlSelectorElement
createOpenUrlSelectorElement(
768 ICdmFormElement parentElement
, String labelString
,
769 IOpenUrlEnabled openUrlEnabled
, int style
) {
770 OpenUrlSelectorElement element
= new OpenUrlSelectorElement(this,
771 parentElement
, labelString
, openUrlEnabled
, style
);
773 parentElement
.addElement(element
);
779 * @param parentElement
781 * @param conversationEnabled
786 public EditPasswordElement
createEditPasswordElement(
787 ICdmFormElement parentElement
, String labelString
,
788 ConversationHolder conversation
, User user
, int style
) {
789 EditPasswordElement element
= new EditPasswordElement(this,
790 parentElement
, labelString
, user
, conversation
);
792 parentElement
.addElement(element
);
798 * createIntegerTextWithLabelElement
801 * @param parentElement
802 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
805 * a {@link java.lang.String} object.
806 * @param initialInteger
807 * a {@link java.lang.Integer} object.
810 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement}
813 public NumberWithLabelElement
createIntegerTextWithLabelElement(
814 ICdmFormElement parentElement
, String labelString
,
815 Integer initialInteger
, int style
) {
816 NumberWithLabelElement element
= new NumberWithLabelElement(this,
817 parentElement
, labelString
, initialInteger
, style
);
819 parentElement
.addElement(element
);
825 * createFloatTextWithLabelElement
828 * @param parentElement
829 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
832 * a {@link java.lang.String} object.
833 * @param initialFloat
837 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement}
840 public NumberWithLabelElement
createFloatTextWithLabelElement(
841 ICdmFormElement parentElement
, String labelString
,
842 float initialFloat
, int style
) {
843 NumberWithLabelElement element
= new NumberWithLabelElement(this,
844 parentElement
, labelString
, initialFloat
, style
);
846 parentElement
.addElement(element
);
852 * createLanguageStringWithLabelElement
855 * @param parentElement
856 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
859 * a {@link java.lang.String} object.
860 * @param languageString
861 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
865 * {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement}
868 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
869 ICdmFormElement parentElement
, String labelString
,
870 LanguageString languageString
, int style
) {
871 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
872 this, parentElement
, labelString
, languageString
, style
);
874 parentElement
.addElement(element
);
880 * createLanguageStringWithLabelElement
883 * @param parentElement
884 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
887 * a {@link java.lang.String} object.
888 * @param languageString
889 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
895 * {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement}
898 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
899 ICdmFormElement parentElement
, String labelString
,
900 LanguageString languageString
, int height
, int style
) {
901 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
902 this, parentElement
, labelString
, languageString
, height
, style
);
904 parentElement
.addElement(element
);
913 * @param parentElement
914 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
917 * a {@link java.lang.String} object.
920 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement}
923 public TextWithLabelElement
createTextElement(
924 ICdmFormElement parentElement
, String initialText
, int style
) {
925 TextWithLabelElement element
= new TextWithLabelElement(this,
926 parentElement
, null, initialText
, null, style
);
928 parentElement
.addElement(element
);
934 * createKeyValueViewerElement
937 * @param parentElement
938 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
941 * a {@link java.lang.String} object.
942 * @param valueHeading
943 * a {@link java.lang.String} object.
945 * a {@link java.util.Map} object.
946 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.KeyValueViewerElement}
949 public KeyValueViewerElement
createKeyValueViewerElement(
950 ICdmFormElement parentElement
, String keyHeading
,
951 String valueHeading
, Map
<Object
, Object
> map
) {
952 KeyValueViewerElement element
= new KeyValueViewerElement(this,
953 parentElement
, keyHeading
, valueHeading
, map
);
955 parentElement
.addElement(element
);
959 public static enum TermComboType
{
960 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
965 * createTermComboElement
968 * @param termComboType
970 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.TermComboType}
972 * @param parentElement
973 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
976 * a {@link java.lang.String} object.
978 * a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase}
982 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractTermComboElement}
985 public AbstractTermComboElement
createTermComboElement(
986 TermComboType termComboType
, ICdmFormElement parentElement
,
987 String labelString
, DefinedTermBase selection
, int style
) {
988 AbstractTermComboElement element
= null;
990 switch (termComboType
) {
992 element
= new EmptyComboElement
<DefinedTermBase
>(this,
993 parentElement
, labelString
, style
);
996 element
= new ExtensionTypeComboElement(this, parentElement
,
997 labelString
, (ExtensionType
) selection
, style
);
1000 element
= new LanguageComboElement(this, parentElement
,
1001 labelString
, (Language
) selection
, style
);
1004 element
= new MarkerTypeComboElement(this, parentElement
,
1005 labelString
, (MarkerType
) selection
, style
);
1007 case NOMENCLATURALSTATUSTYPE
:
1008 element
= new NomenclaturalStatusTypeComboElement(this,
1009 parentElement
, labelString
,
1010 (NomenclaturalStatusType
) selection
, style
);
1013 element
= new RankComboElement(this, parentElement
, labelString
,
1014 (Rank
) selection
, style
);
1017 element
= new RightsTypeComboElement(this, parentElement
,
1018 labelString
, (RightsTerm
) selection
, style
);
1020 case NAMERELATIONSHIP
:
1021 element
= new NameRelationshipTypeComboElement(this, parentElement
,
1022 labelString
, (NameRelationshipType
) selection
, style
);
1025 element
= new NamedAreaTypeComboElement(this, parentElement
,
1026 labelString
, (NamedAreaType
) selection
, style
);
1028 case ANNOTATIONTYPE
:
1029 element
= new AnnotationTypeComboElement(this, parentElement
,
1030 labelString
, (AnnotationType
) selection
, style
);
1032 case PRESENCEABSENCESTATUS
:
1033 element
= new PresenceAbsenceTermComboElement(this, parentElement
,
1034 labelString
, (PresenceAbsenceTermBase
) selection
, style
);
1036 case NAMETYPEDESIGNATIONSTATUS
:
1037 element
= new NameTypeDesignationStatusComboElement(this,
1038 parentElement
, labelString
,
1039 (NameTypeDesignationStatus
) selection
, style
);
1041 case SPECIMENTYPEDESIGNATIONSTATUS
:
1042 element
= new SpecimenTypeDesignationStatusComboElement(this,
1043 parentElement
, labelString
,
1044 (SpecimenTypeDesignationStatus
) selection
, style
);
1047 element
= new SexComboElement(this, parentElement
, labelString
,
1048 (Sex
) selection
, style
);
1051 element
= new StageComboElement(this, parentElement
, labelString
,
1052 (Stage
) selection
, style
);
1054 case PRESERVATION_METHOD
:
1055 element
= new PreservationMethodComboElement(this, parentElement
,
1056 labelString
, (PreservationMethod
) selection
, style
);
1058 case MEASUREMENT_UNIT
:
1059 element
= new MeasurementUnitComboElement(this, parentElement
,
1060 labelString
, (MeasurementUnit
) selection
, style
);
1063 element
= new StateComboElement(this, parentElement
, labelString
,
1064 (State
) selection
, style
);
1067 element
= new ScopeComboElement(this, parentElement
, labelString
,
1068 (Scope
) selection
, style
);
1071 element
= new ModifierComboElement(this, parentElement
,
1072 labelString
, (Modifier
) selection
, style
);
1074 case STATISTICAL_MEASURE
:
1075 element
= new StatisticalMeasureComboElement(this, parentElement
,
1076 labelString
, (StatisticalMeasure
) selection
, style
);
1078 case DETERMINATION_MODIFIER
:
1079 element
= new DeterminationModifierComboElement(this,
1080 parentElement
, labelString
,
1081 (DeterminationModifier
) selection
, style
);
1083 case REFERENCE_SYSTEM
:
1084 element
= new ReferenceSystemComboElement(this, parentElement
,
1085 labelString
, (ReferenceSystem
) selection
, style
);
1090 parentElement
.addElement(element
);
1094 public static enum EnumComboType
{
1095 REFERENCETYPE
, NOMENCLATURALCODE
1100 * createEnumComboElement
1103 * @param enumComboType
1105 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EnumComboType}
1107 * @param parentElement
1108 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1112 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
1115 public AbstractEnumComboElement
createEnumComboElement(
1116 EnumComboType enumComboType
, ICdmFormElement parentElement
,
1118 AbstractEnumComboElement element
= null;
1120 switch (enumComboType
) {
1122 element
= new ReferenceTypeComboElement(this, parentElement
,
1123 "Reference Type", null, style
);
1125 case NOMENCLATURALCODE
:
1126 element
= new NomenclaturalCodeComboElement(this, parentElement
,
1127 "Nomenclatural Code", null, style
);
1131 parentElement
.addElement(element
);
1137 * createBrowserElement
1141 * a {@link java.net.URI} object.
1144 * @param parentElement
1145 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1147 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.BrowserElement} object.
1149 public BrowserElement
createBrowserElement(ICdmFormElement parentElement
,
1150 URI imageUri
, int style
) {
1151 BrowserElement element
= new BrowserElement(this, parentElement
,
1154 parentElement
.addElement(element
);
1160 * createImageElement
1163 * @param parentElement
1164 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1167 * a {@link java.net.URI} object.
1170 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.ImageElement} object.
1172 public ImageElement
createImageElement(ICdmFormElement parentElement
,
1173 URI imageUri
, int style
) {
1174 ImageElement element
= new ImageElement(this, parentElement
, imageUri
,
1177 parentElement
.addElement(element
);
1183 * createTextActionElement
1186 * @param labelString
1187 * a {@link java.lang.String} object.
1188 * @param initialText
1189 * a {@link java.lang.String} object.
1192 * @param parentElement
1193 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1195 * @param buttonLabel
1196 * a {@link java.lang.String} object.
1197 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextActionElement}
1200 public TextActionElement
createTextActionElement(
1201 ICdmFormElement parentElement
, String labelString
,
1202 String buttonLabel
, String initialText
, int style
) {
1203 TextActionElement element
= new TextActionElement(this, parentElement
,
1204 labelString
, buttonLabel
, initialText
, style
);
1206 parentElement
.addElement(element
);
1212 * @author n.hoffmann
1213 * @created Mar 5, 2010
1216 public static enum SelectionType
{
1217 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
1225 * @param parentElement
1226 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1229 * a {@link java.lang.String} object.
1230 * @param initialState
1234 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.CheckboxElement} object.
1236 public CheckboxElement
createCheckbox(ICdmFormElement parentElement
,
1237 String label
, boolean initialState
, int style
) {
1238 CheckboxElement element
= new CheckboxElement(this, parentElement
,
1239 label
, initialState
, style
| orientation
);
1241 parentElement
.addElement(element
);
1246 * Creates a section as a part of the form.
1248 * @return the section widget
1250 * a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
1253 public Section
adapt(AbstractFormSection section
) {
1254 section
.setMenu(section
.getLayoutComposite().getMenu());
1255 adapt(section
, true, true);
1257 // handle focus and property change events for cdm use
1258 section
.addFocusListener(selectionFocusHandler
);
1259 section
.setPropertyChangeListeners(propertyChangeListeners
);
1261 if (section
.getToggle() != null) {
1262 section
.getToggle().setHoverDecorationColor(
1263 getColors().getColor(IFormColors
.TB_TOGGLE_HOVER
));
1264 section
.getToggle().setDecorationColor(
1265 getColors().getColor(IFormColors
.TB_TOGGLE
));
1268 section
.setFont(boldFontHolder2
.getBoldFont(section
1269 .getLayoutComposite().getFont()));
1271 if ((section
.getStyle() & Section
.TITLE_BAR
) != 0
1272 || (section
.getStyle() & Section
.SHORT_TITLE_BAR
) != 0) {
1273 getColors().initializeSectionToolBarColors();
1274 section
.setTitleBarBackground(getColors().getColor(
1275 IFormColors
.TB_BG
));
1276 section
.setTitleBarBorderColor(getColors().getColor(
1277 IFormColors
.TB_BORDER
));
1279 // call setTitleBarForeground regardless as it also sets the label color
1280 section
.setTitleBarForeground(getColors().getColor(
1281 IFormColors
.TB_TOGGLE
));
1285 private class BoldFontHolder2
{
1286 private Font normalFont
;
1288 private Font boldFont
;
1290 public BoldFontHolder2() {
1293 public Font
getBoldFont(Font font
) {
1294 createBoldFont(font
);
1298 private void createBoldFont(Font font
) {
1299 if (normalFont
== null || !normalFont
.equals(font
)) {
1303 if (boldFont
== null) {
1304 boldFont
= FormFonts
.getInstance().getBoldFont(
1305 getColors().getDisplay(), normalFont
);
1309 public void dispose() {
1310 if (boldFont
!= null) {
1311 FormFonts
.getInstance().markFinished(boldFont
,
1312 getColors().getDisplay());
1320 * createToggleableTextField
1323 * @param parentElement
1324 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1326 * @param labelString
1327 * a {@link java.lang.String} object.
1328 * @param initialText
1329 * a {@link java.lang.String} object.
1330 * @param initialState
1334 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.ToggleableTextElement}
1337 public ToggleableTextElement
createToggleableTextField(
1338 ICdmFormElement parentElement
, String labelString
,
1339 String initialText
, boolean initialState
, int style
) {
1340 ToggleableTextElement element
= new ToggleableTextElement(this,
1341 parentElement
, labelString
, initialText
, initialState
, style
1344 parentElement
.addElement(element
);
1350 * createTimePeriodElement
1353 * @param parentElement
1354 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1356 * @param labelString
1357 * a {@link java.lang.String} object.
1359 * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1362 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TimePeriodElement}
1365 public TimePeriodElement
createTimePeriodElement(
1366 ICdmFormElement parentElement
, String labelString
,
1367 TimePeriod timePeriod
, int style
) {
1368 TimePeriodElement element
= new TimePeriodElement(this, parentElement
,
1369 labelString
, timePeriod
, style
);
1371 parentElement
.addElement(element
);
1377 * createPointElement
1382 * @param parentElement
1383 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1386 * a {@link eu.etaxonomy.cdm.model.location.Point} object.
1387 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.PointElement} object.
1389 public PointElement
createPointElement(ICdmFormElement parentElement
,
1390 Point point
, int style
) {
1391 PointElement element
= new PointElement(this, parentElement
, point
,
1394 parentElement
.addElement(element
);
1400 * createDateDetailSection
1403 * @param parentElement
1404 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1408 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.DateDetailSection}
1411 public DateDetailSection
createDateDetailSection(
1412 ICdmFormElement parentElement
, int style
) {
1413 DateDetailSection section
= new DateDetailSection(this, parentElement
,
1415 parentElement
.addElement(section
);
1422 * createPartialElement
1425 * @param parentElement
1426 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1428 * @param labelString
1429 * a {@link java.lang.String} object.
1431 * a {@link org.joda.time.Partial} object.
1434 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.PartialElement} object.
1436 public PartialElement
createPartialElement(ICdmFormElement parentElement
,
1437 String labelString
, Partial partial
, int style
) {
1438 PartialElement element
= new PartialElement(this, parentElement
,
1439 labelString
, style
);
1441 parentElement
.addElement(element
);
1447 * addSelectionListener
1451 * a {@link org.eclipse.swt.events.SelectionListener} object.
1453 public void addSelectionListener(SelectionListener listener
) {
1454 selectionListenerList
.add(listener
);
1459 * removeSelectionListener
1463 * a {@link org.eclipse.swt.events.SelectionListener} object.
1465 public void removeSelectionListener(SelectionListener listener
) {
1466 if (listener
== null) {
1468 .error(this.getClass(),
1469 "Tried to remove a selection listener from this factories listeners but was null",
1472 selectionListenerList
.remove(listener
);
1478 * addPropertyChangeListener
1482 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1485 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
1486 if(propertyChangeListeners
.contains(listener
)){
1489 propertyChangeListeners
.add(0, listener
);
1494 * removePropertyChangeListener
1498 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1501 public void removePropertyChangeListener(IPropertyChangeListener listener
) {
1502 propertyChangeListeners
.remove(listener
);
1507 * createHorizontalSeparator
1510 * @param parentElement
1511 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1515 * @return a {@link org.eclipse.swt.widgets.Label} object.
1517 public Label
createHorizontalSeparator(ICdmFormElement parentElement
,
1519 Label separator
= this.createSeparator(
1520 parentElement
.getLayoutComposite(), SWT
.HORIZONTAL
| style
);
1521 separator
.setLayoutData(FILL_HORIZONTALLY());
1527 * createVersionElement
1530 * @param parentElement
1531 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1534 * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
1539 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
1542 public VersionElement
createVersionElement(ICdmFormElement parentElement
,
1543 VersionableEntity entity
, int style
) {
1544 VersionElement element
= new VersionElement(this, parentElement
,
1547 parentElement
.addElement(element
);
1553 * createVersionSection
1556 * @param parentElement
1557 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1562 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
1565 public VersionSection
createVersionSection(ICdmFormElement parentElement
,
1567 VersionSection section
= new VersionSection(this, parentElement
, style
);
1568 parentElement
.addElement(section
);
1575 * createEmptyElement
1578 * @param parentElement
1579 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1581 * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1583 public EmptyElement
createEmptyElement(ICdmFormElement parentElement
) {
1584 EmptyElement element
= new EmptyElement(this, parentElement
, null,
1587 parentElement
.addElement(element
);
1593 * createHeadlineSection
1596 * @param parentElement
1597 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1600 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
1603 public HeadlineSection
createHeadlineSection(ICdmFormElement parentElement
) {
1604 HeadlineSection section
= new HeadlineSection(this, parentElement
,
1606 parentElement
.addElement(section
);
1613 * createParsingMessageElement
1616 * @param parentElement
1617 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1619 * @param parserProblem
1620 * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
1625 * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
1628 public ParsingMessageElement
createParsingMessageElement(
1629 ICdmFormElement parentElement
, ParserProblem parserProblem
,
1631 ParsingMessageElement element
= new ParsingMessageElement(this,
1632 parentElement
, parserProblem
, style
);
1634 parentElement
.addElement(element
);
1643 public static enum DetailType
{
1647 NOMENCLATURALREFERENCE
,
1659 DERIVED_UNIT_FACADE
,
1663 FEATURE_DISTRIBUTION
,
1668 POLYTOMOUS_KEY_NODE
,
1670 DERIVED_UNIT_GENERAL
,
1679 * createCdmDetailSection
1684 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType}
1686 * @param parentElement
1687 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1689 * @param selectionProvider
1690 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1693 * @param conversation
1694 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1696 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
1699 public AbstractFormSection
createCdmDetailSection(DetailType detailType
,
1700 ConversationHolder conversation
, ICdmFormElement parentElement
,
1701 ISelectionProvider selectionProvider
, int style
) {
1702 AbstractFormSection section
= null;
1704 switch (detailType
) {
1705 case SCIENTIFICNAME
:
1706 section
= new NameDetailSection(this, conversation
, parentElement
,
1707 selectionProvider
, style
);
1710 section
= new ReferenceDetailSection(this, conversation
,
1711 parentElement
, selectionProvider
, style
);
1713 case NOMENCLATURALREFERENCE
:
1714 section
= new NomenclaturalReferenceDetailSection(this,
1715 conversation
, parentElement
, selectionProvider
, style
);
1718 section
= new TaxonBaseDetailSection(this, conversation
,
1719 parentElement
, selectionProvider
, style
);
1722 section
= new AuthorshipDetailSection(this, conversation
,
1723 parentElement
, selectionProvider
, style
);
1725 case TEAMORPERSONBASE
:
1726 section
= new TeamOrPersonBaseDetailSection(this, conversation
,
1727 parentElement
, selectionProvider
, style
);
1730 section
= new TeamDetailSection(this, conversation
, parentElement
,
1734 section
= new PersonDetailSection(this, conversation
,
1735 parentElement
, null, style
);
1738 section
= new DescriptionDetailSection(this, conversation
,
1739 parentElement
, selectionProvider
, style
);
1741 case DESCRIPTIONELEMENT
:
1742 section
= new DescriptionElementDetailSection(this, conversation
,
1743 parentElement
, selectionProvider
, style
);
1745 case PARSINGMESSAGE
:
1746 section
= new ParsingMessagesSection(this, conversation
,
1747 parentElement
, selectionProvider
, style
);
1750 section
= new NonViralNameDetailSection(this, conversation
,
1751 parentElement
, selectionProvider
, style
);
1754 section
= new eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection(
1755 this, conversation
, parentElement
, selectionProvider
, style
);
1757 case DERIVED_UNIT_FACADE
:
1758 section
= new DerivedUnitFacadeDetailSection(this, conversation
,
1759 parentElement
, selectionProvider
, style
);
1761 case FIELD_OBSERVATION
:
1762 section
= new FieldObservationDetailSection(this, conversation
,
1763 parentElement
, selectionProvider
, style
);
1765 case GATHERING_EVENT
:
1766 section
= new GatheringEventDetailSection(this, conversation
,
1767 parentElement
, selectionProvider
, style
);
1770 section
= new DerivedUnitBaseDetailSection(this, conversation
,
1771 parentElement
, selectionProvider
, style
);
1773 case NATURAL_LANGUAGE
:
1774 section
= new NaturalLanguageSection(this, conversation
,
1775 parentElement
, selectionProvider
, style
);
1777 case FEATURE_DISTRIBUTION
:
1778 section
= new FeatureDistributionDetailSection(this, conversation
,
1779 parentElement
, selectionProvider
, style
);
1781 case CLASSIFICATION
:
1782 section
= new ClassificationDetailSection(this, conversation
,
1783 parentElement
, selectionProvider
, style
);
1786 section
= new TaxonNodeDetailSection(this, conversation
,
1787 parentElement
, selectionProvider
, style
);
1789 case POLYTOMOUS_KEY
:
1790 section
= new PolytomousKeyDetailSection(this, conversation
,
1791 parentElement
, selectionProvider
, style
);
1793 case POLYTOMOUS_KEY_NODE
:
1794 section
= new PolytomousKeyNodeDetailSection(this, conversation
,
1795 parentElement
, selectionProvider
, style
);
1798 section
= new InstitutionDetailSection(this, conversation
,
1799 parentElement
, selectionProvider
, style
);
1801 case DERIVED_UNIT_GENERAL
:
1802 section
= new GeneralDetailSection(this, conversation
,
1803 parentElement
, selectionProvider
, style
);
1806 section
= new HybridDetailSection(this, conversation
,
1807 parentElement
, selectionProvider
, style
);
1810 section
= new UserDetailSection(this, conversation
, parentElement
,
1811 selectionProvider
, style
);
1814 section
= new GroupDetailSection(this, conversation
, parentElement
,
1815 selectionProvider
, style
);
1818 section
= new DeterminationDetailSection(this, conversation
, parentElement
,
1819 selectionProvider
, style
);
1822 if (section
== null) {
1823 throw new RuntimeException(
1824 "You tried to create a cdm detail section that is not implemented yet.");
1827 parentElement
.addElement(section
);
1834 * createCdmDetailElement
1839 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType}
1843 * @param parentElement
1844 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1847 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
1850 public AbstractCdmDetailElement
createCdmDetailElement(
1851 DetailType detailType
, ICdmFormElement parentElement
, int style
) {
1852 AbstractCdmDetailElement element
= null;
1854 switch (detailType
) {
1855 case SCIENTIFICNAME
:
1856 element
= new NameDetailElement(this, parentElement
, style
);
1859 element
= new ReferenceDetailElement(this, parentElement
, style
);
1861 case NOMENCLATURALREFERENCE
:
1862 element
= new NomenclaturalReferenceDetailElement(this,
1863 parentElement
, style
);
1866 element
= new TaxonBaseDetailElement(this, parentElement
, style
);
1869 element
= new AuthorshipDetailElement(this, parentElement
, style
);
1872 element
= new TeamDetailElement(this, parentElement
, style
);
1875 element
= new PersonDetailElement(this, parentElement
, style
);
1878 element
= new DescriptionDetailElement(this, parentElement
, style
);
1880 case DESCRIPTIONELEMENT
:
1881 element
= new DescriptionElementDetailElement(this, parentElement
,
1885 element
= new NonViralNameDetailElement(this, parentElement
);
1887 case DERIVED_UNIT_FACADE
:
1888 element
= new DerivedUnitFacadeDetailElement(this, parentElement
);
1890 case FIELD_OBSERVATION
:
1891 element
= new FieldObservationDetailElement(this, parentElement
);
1893 case GATHERING_EVENT
:
1894 element
= new GatheringEventDetailElement(this, parentElement
);
1897 element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1899 case NATURAL_LANGUAGE
:
1900 element
= new NaturalLanguageDetailElement(this, parentElement
);
1902 case FEATURE_DISTRIBUTION
:
1903 element
= new FeatureDistributionDetailElement(this, parentElement
);
1905 case CLASSIFICATION
:
1906 element
= new ClassificationDetailElement(this, parentElement
);
1909 element
= new TaxonNodeDetailElement(this, parentElement
);
1912 element
= new CollectionDetailElement(this, parentElement
);
1914 case POLYTOMOUS_KEY
:
1915 element
= new PolytomousKeyDetailElement(this, parentElement
);
1917 case POLYTOMOUS_KEY_NODE
:
1918 element
= new PolytomousKeyNodeDetailElement(this, parentElement
);
1921 element
= new InstitutionDetailElement(this, parentElement
);
1923 case DERIVED_UNIT_GENERAL
:
1924 element
= new GeneralDetailElement(this, parentElement
);
1927 element
= new HybridDetailElement(this, parentElement
);
1930 element
= new UserDetailElement(this, parentElement
);
1933 element
= new GroupDetailElement(this, parentElement
);
1936 element
= new DeterminationDetailElement(this, parentElement
);
1940 if (element
== null) {
1942 .error(this.getClass(),
1943 "Detail element was not created. Seems like the case was not implemented for the requested detail type: "
1944 + detailType
, null);
1948 parentElement
.addElement(element
);
1954 * @author n.hoffmann
1955 * @created Mar 5, 2010
1958 public static enum EntityDetailType
{
1959 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
1964 * createEntityDetailSection
1967 * @param entityDetailType
1969 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EntityDetailType}
1973 * @param conversation
1974 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1976 * @param parentElement
1977 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1979 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
1982 public AbstractFormSection
createEntityDetailSection(
1983 EntityDetailType entityDetailType
, ConversationHolder conversation
,
1984 ICdmFormElement parentElement
, int style
) {
1985 AbstractFormSection section
= null;
1987 switch (entityDetailType
) {
1989 section
= new TeamDetailSection(this, conversation
, parentElement
,
1993 section
= new TeamMemberSection(this, conversation
, parentElement
,
1997 section
= new AnnotationSection(this, conversation
, parentElement
,
2001 section
= new CreditSection(this, conversation
, parentElement
,
2004 case DESCRIPTIONELEMENTSOURCE
:
2005 section
= new DescriptionElementSourceSection(this, conversation
,
2006 parentElement
, style
);
2009 section
= new ExtensionSection(this, conversation
, parentElement
,
2013 section
= new MarkerSection(this, conversation
, parentElement
,
2017 section
= new MediaSection(this, conversation
, parentElement
, style
);
2019 case DESCRIPTIONELEMENTMEDIA
:
2020 section
= new DescriptionElementMediaSection(this, conversation
,
2021 parentElement
, style
);
2023 case MEDIAREPRESENTATION
:
2024 section
= new MediaRepresentationSection(this, conversation
,
2025 parentElement
, style
);
2027 case MEDIAREPRESENTATIONPART
:
2028 section
= new MediaRepresentationPartSection(this, conversation
,
2029 parentElement
, style
);
2032 section
= new ModifierSection(this, conversation
, parentElement
,
2035 case NOMENCLATURALSTATUS
:
2036 section
= new NomenclaturalStatusSection(this, conversation
,
2037 parentElement
, style
);
2039 case NAME_RELATIONSHIP
:
2040 section
= new NameRelationshipDetailSection(this, conversation
,
2041 parentElement
, style
);
2044 section
= new ProtologueSection(this, conversation
, parentElement
,
2048 section
= new RightsSection(this, conversation
, parentElement
,
2052 section
= new SourceSection(this, conversation
, parentElement
,
2056 section
= new ScopeSection(this, conversation
, parentElement
, style
);
2058 case DESCRIPTIONSOURCE
:
2059 section
= new DescriptionSourceSection(this, conversation
,
2060 parentElement
, style
);
2062 case TYPEDESIGNATION
:
2063 section
= new TypeDesignationSection(this, conversation
,
2064 parentElement
, style
);
2067 section
= new StateDataSection(this, conversation
, parentElement
,
2070 case STATISTICAL_MEASUREMENT_VALUE
:
2071 section
= new StatisticalMeasurementValueSection(this,
2072 conversation
, parentElement
, style
);
2074 case DESCRIBED_SPECIMEN
:
2075 section
= new DescribedSpecimenSection(this, conversation
,
2076 parentElement
, style
);
2078 case COLLECTING_AREA
:
2079 section
= new CollectingAreasDetailSection(this, conversation
,
2080 parentElement
, style
);
2082 case DETERMINATION_CURRENT
:
2083 section
= new CurrentDeterminationDetailSection(this, conversation
,
2084 parentElement
, style
);
2086 case DETERMINATION_HISTORY
:
2087 section
= new DeterminationHistoryDetailSection(this, conversation
,
2088 parentElement
, style
);
2090 case SPECIMEN_COLLECTION
:
2091 section
= new SpecimenCollectionDetailSection(this, conversation
,
2092 parentElement
, style
);
2094 case IDENTIFIABLE_SOURCE_COLLECTION
:
2095 section
= new SourceCollectionDetailSection(this, conversation
,
2096 parentElement
, style
);
2098 case GEOGRAPHICAL_SCOPE
:
2099 section
= new GeographicalScopeDetailSection(this, conversation
,
2100 parentElement
, style
);
2102 case SCOPE_RESTRICTION
:
2103 section
= new ScopeRestrictionSection(this, conversation
,
2104 parentElement
, style
);
2107 section
= new MemberDetailSection(this, conversation
,
2108 parentElement
, style
);
2110 case GRANTED_AUTHORITY
:
2111 section
= new GrantedAuthorityDetailSection(this, conversation
,
2112 parentElement
, style
);
2114 case GROUPS_BY_USER
:
2115 section
= new GroupsByUserDetailSection(this, conversation
,
2116 parentElement
, style
);
2118 case TAXONOMIC_SCOPE
:
2119 section
= new TaxonomicScopeSection(this, conversation
,
2120 parentElement
, style
);
2123 parentElement
.addElement(section
);
2130 * createEntityCollectionElement
2133 * @param removeListener
2134 * a {@link org.eclipse.swt.events.SelectionListener} object.
2137 * @param parentElement
2138 * a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
2140 * @param versionableEntity
2141 * a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity}
2143 * @param backgroundColor
2144 * a {@link org.eclipse.swt.graphics.Color} object.
2146 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement}
2149 public AbstractEntityCollectionElement
createEntityCollectionElement(
2150 AbstractFormSection parentElement
, Object versionableEntity
,
2151 SelectionListener removeListener
, Color backgroundColor
, int style
) {
2152 AbstractEntityCollectionElement element
= null;
2154 Object entity
= HibernateProxyHelper
.deproxy(versionableEntity
);
2156 if (entity
instanceof Annotation
) {
2157 element
= new AnnotationElement(this, parentElement
,
2158 (Annotation
) entity
, removeListener
, style
);
2159 } else if (entity
instanceof Person
) {
2160 element
= new TeamMemberElement(this, parentElement
,
2161 (Person
) entity
, removeListener
, style
);
2162 } else if (entity
instanceof Credit
) {
2163 element
= new CreditElement(this, parentElement
, (Credit
) entity
,
2164 removeListener
, style
);
2165 } else if (entity
instanceof Extension
) {
2166 element
= new ExtensionElement(this, parentElement
,
2167 (Extension
) entity
, removeListener
, style
);
2168 } else if (entity
instanceof Marker
) {
2169 element
= new MarkerElement(this, parentElement
, (Marker
) entity
,
2170 removeListener
, style
);
2171 } else if (entity
instanceof Media
) {
2172 element
= new MediaElement(this, parentElement
, (Media
) entity
,
2173 removeListener
, style
);
2174 } else if (entity
instanceof MediaRepresentation
) {
2175 element
= new MediaRepresentationElement(this, parentElement
,
2176 (MediaRepresentation
) entity
, removeListener
, style
);
2177 } else if (entity
instanceof ImageFile
) {
2178 element
= new ImageFileElement(this, parentElement
,
2179 (ImageFile
) entity
, removeListener
, style
);
2180 } else if (entity
instanceof MediaRepresentationPart
){
2181 element
= new MediaRepresentationPartElement(this, parentElement
,
2182 (MediaRepresentationPart
) entity
, removeListener
, style
);
2183 } else if (entity
instanceof NomenclaturalStatus
) {
2184 element
= new NomenclaturalStatusElement(this, parentElement
,
2185 (NomenclaturalStatus
) entity
, removeListener
, style
);
2186 } else if (entity
instanceof Rights
) {
2187 element
= new RightsElement(this, parentElement
, (Rights
) entity
,
2188 removeListener
, style
);
2189 } else if (entity
instanceof DescriptionElementSource
) {
2190 element
= new DescriptionElementSourceElement(this, parentElement
,
2191 (DescriptionElementSource
) entity
, removeListener
, style
);
2192 } else if (entity
instanceof IdentifiableSource
) {
2193 element
= new IdentifiableSourceElement(this, parentElement
,
2194 (IdentifiableSource
) entity
, removeListener
, style
);
2195 } else if (entity
instanceof Scope
) {
2196 element
= new ScopeElement(this, parentElement
, (Scope
) entity
,
2197 removeListener
, style
);
2198 } else if (entity
instanceof Modifier
) {
2199 element
= new ModifierElement(this, parentElement
,
2200 (Modifier
) entity
, removeListener
, style
);
2201 } else if (entity
instanceof Reference
) {
2202 element
= new DescriptionSourceElement(this, parentElement
,
2203 (Reference
) entity
, removeListener
, style
);
2204 } else if (entity
instanceof NameTypeDesignation
) {
2205 element
= new NameTypeDesignationElement(this, parentElement
,
2206 (NameTypeDesignation
) entity
, removeListener
, style
);
2207 } else if (entity
instanceof NameRelationship
) {
2208 element
= new NameRelationshipDetailElement(this, parentElement
,
2209 (NameRelationship
) entity
, removeListener
, style
);
2210 } else if (entity
instanceof SpecimenTypeDesignation
) {
2211 element
= new SpecimenTypeDesignationElement(this, parentElement
,
2212 (SpecimenTypeDesignation
) entity
, removeListener
, style
);
2213 } else if (entity
instanceof StateData
) {
2214 element
= new StateDataElement(this, parentElement
,
2215 (StateData
) entity
, removeListener
, style
);
2216 } else if (entity
instanceof StatisticalMeasurementValue
) {
2217 element
= new StatisticalMeasurementValueElement(this,
2218 parentElement
, (StatisticalMeasurementValue
) entity
,
2219 removeListener
, style
);
2220 } else if (entity
instanceof DerivedUnit
) {
2221 element
= new DerivedUnitElement(this, parentElement
,
2222 (DerivedUnit
) entity
, removeListener
, style
);
2223 } else if (entity
instanceof NamedArea
) {
2224 element
= new NamedAreaDetailElement(this, parentElement
,
2225 (NamedArea
) entity
, removeListener
, style
);
2226 } else if (entity
instanceof DeterminationEvent
) {
2227 element
= new DeterminationEventDetailElement(this, parentElement
,
2228 (DeterminationEvent
) entity
, removeListener
, style
);
2229 } else if (entity
instanceof Specimen
) {
2230 element
= new SpecimenCollectionDetailElement(this, parentElement
,
2231 (Specimen
) entity
, removeListener
, style
);
2232 } else if (entity
instanceof User
) {
2233 element
= new MemberDetailElement(this, parentElement
,
2234 (User
) entity
, removeListener
, style
);
2235 } else if (entity
instanceof GrantedAuthority
) {
2236 element
= new GrantedAuthorityDetailElement(this, parentElement
,
2237 (GrantedAuthority
) entity
, removeListener
, style
);
2238 } else if (entity
instanceof Group
) {
2239 element
= new GroupsByUserDetailElement(this, parentElement
,
2240 (Group
) entity
, removeListener
, style
);
2241 } else if (entity
instanceof Taxon
) {
2242 element
= new TaxonDetailElement(this, parentElement
,
2243 (Taxon
) entity
, removeListener
, style
);
2244 } else if (entity
instanceof DescriptionElementBase
) {
2245 // this is the special case for protologs, maybe we can do this
2246 // differently when API improves
2247 DescriptionElementBase descriptionElement
= (DescriptionElementBase
) entity
;
2248 if (descriptionElement
.getFeature().equals(Feature
.PROTOLOGUE())) {
2249 element
= new ProtologueElement(this, parentElement
,
2250 descriptionElement
, removeListener
, style
);
2254 if (element
== null) {
2257 "No element for entity",
2259 "Could not generate element for entity. "
2260 + "Looks like the case is not handled already. Check implementation. Entity: "
2265 if (backgroundColor
!= null && !backgroundColor
.isDisposed()) {
2266 element
.setPersistentBackground(backgroundColor
);
2270 parentElement
.addElement(element
);
2276 * createSelectionElement
2279 * @param selectionType
2281 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType}
2283 * @param parentElement
2284 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
2286 * @param labelString
2287 * a {@link java.lang.String} object.
2288 * @param selectionType
2290 * a {@link eu.etaxonomy.cdm.model.common.IAnnotatableEntity}
2294 * @param conversation
2295 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
2298 * {@link eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement}
2301 public AbstractSelectionElement
createSelectionElement(
2302 SelectionType selectionType
, ConversationHolder conversation
,
2303 ICdmFormElement parentElement
, String labelString
,
2304 ICdmBase selection
, int mode
, int style
) {
2305 AbstractSelectionElement element
= null;
2307 IAnnotatableEntity entity
= (IAnnotatableEntity
) HibernateProxyHelper
2308 .deproxy(selection
);
2310 switch (selectionType
) {
2312 element
= new AgentSelectionElement(this, conversation
,
2313 parentElement
, labelString
, (TeamOrPersonBase
) entity
,
2317 element
= new PersonSelectionElement(this, conversation
,
2318 parentElement
, labelString
, (Person
) entity
, mode
, style
);
2321 element
= new TeamSelectionElement(this, conversation
,
2322 parentElement
, labelString
, (Team
) entity
, mode
, style
);
2325 element
= new NomenclaturalAuthorTeamSelectionElement(this,
2326 conversation
, parentElement
, labelString
, (Team
) entity
,
2330 element
= new InstitutionSelectionElement(this, conversation
,
2331 parentElement
, labelString
, (Institution
) entity
, mode
,
2335 element
= new NameSelectionElement(this, conversation
,
2336 parentElement
, labelString
, (TaxonNameBase
) entity
, mode
,
2340 element
= new ReferenceSelectionElement(this, conversation
,
2341 parentElement
, labelString
, (Reference
) entity
, mode
, style
);
2344 element
= new TaxonBaseSelectionElement(this, conversation
,
2345 parentElement
, labelString
, (TaxonBase
) entity
, mode
, style
);
2348 element
= new TaxonSelectionElement(this, conversation
,
2349 parentElement
, labelString
, (Taxon
) entity
, mode
, style
);
2352 element
= new SynonymSelectionElement(this, conversation
,
2353 parentElement
, labelString
, (Synonym
) entity
, mode
, style
);
2356 element
= new DerivedUnitBaseSelectionElement(this, conversation
,
2357 parentElement
, labelString
, (DerivedUnitBase
) entity
, mode
,
2360 case FIELD_OBSERVATION
:
2361 element
= new FieldObservationSelectionElement(this, conversation
,
2362 parentElement
, labelString
, (FieldObservation
) entity
,
2366 element
= new FeatureTreeSelectionElement(this, conversation
,
2367 parentElement
, labelString
, (FeatureTree
) entity
, mode
,
2370 case CLASSIFICATION
:
2371 element
= new ClassificationSelectionElement(this, conversation
,
2372 parentElement
, labelString
, (Classification
) entity
, mode
,
2376 element
= new TaxonNodeSelectionElement(this, conversation
,
2377 parentElement
, labelString
, (TaxonNode
) entity
, mode
, style
);
2380 element
= new CollectionSelectionElement(this, conversation
,
2381 parentElement
, labelString
, (Collection
) entity
, mode
,
2385 element
= new FeatureSelectionElement(this, conversation
,
2386 parentElement
, labelString
, (Feature
) entity
, mode
, style
);
2388 case POLYTOMOUS_KEY
:
2389 element
= new PolytomousKeySelectionElement(this, conversation
,
2390 parentElement
, labelString
, (PolytomousKey
) entity
, mode
,
2393 case POLYTOMOUS_KEY_NODE
:
2394 element
= new PolytomousKeyNodeSelectionElement(this, conversation
,
2395 parentElement
, labelString
, (PolytomousKeyNode
) entity
,
2399 element
= new UserSelectionElement(this, conversation
,
2400 parentElement
, labelString
, (User
) entity
, mode
, style
);
2403 element
= new GroupSelectionElement(this, conversation
,
2404 parentElement
, labelString
, (Group
) entity
, mode
, style
);
2407 new RuntimeException(
2408 "There is no selection composite for the desired selection type.");
2413 parentElement
.addElement(element
);
2419 * createNamedAreaSelectionElement
2422 * @param parentElement
2423 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
2425 * @param conversation
2426 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
2428 * @param labelString
2429 * a {@link java.lang.String} object.
2431 * a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
2435 * {@link eu.etaxonomy.taxeditor.ui.selection.NamedAreaSelectionElement}
2438 public NamedAreaSelectionElement
createNamedAreaSelectionElement(
2439 ICdmFormElement parentElement
, ConversationHolder conversation
,
2440 String labelString
, NamedArea selection
, int style
) {
2441 NamedAreaSelectionElement element
= new NamedAreaSelectionElement(this,
2442 conversation
, parentElement
, labelString
, selection
,
2443 AbstractSelectionElement
.NOTHING
, style
);
2445 parentElement
.addElement(element
);
2449 /** {@inheritDoc} */
2450 public LabelElement
createLabel(ICdmFormElement parentElement
, String text
) {
2451 LabelElement labelElement
= new LabelElement(this, parentElement
, text
);
2452 adapt(labelElement
);
2453 parentElement
.addElement(labelElement
);
2454 return labelElement
;
2459 * Getter for the field <code>selectionProvider</code>.
2462 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
2464 public ISelectionProvider
getSelectionProvider() {
2465 return selectionProvider
;
2470 * createDetailedDescriptionDetailElement
2473 * @param parentElement
2474 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
2478 * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
2483 * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
2486 public AbstractDetailedDescriptionDetailElement
createDetailedDescriptionDetailElement(
2487 ICdmFormElement parentElement
, DescriptionElementBase entity
,
2489 AbstractDetailedDescriptionDetailElement detailedDescriptionElement
= null;
2491 if (entity
instanceof CategoricalData
) {
2492 detailedDescriptionElement
= new CategoricalDataDetailElement(this,
2493 parentElement
, (CategoricalData
) entity
, style
);
2494 } else if (entity
instanceof CommonTaxonName
) {
2495 detailedDescriptionElement
= new CommonNameDetailElement(this,
2496 parentElement
, (CommonTaxonName
) entity
, style
);
2497 } else if (entity
instanceof Distribution
) {
2498 detailedDescriptionElement
= new DistributionDetailElement(this,
2499 parentElement
, (Distribution
) entity
, style
);
2500 } else if (entity
instanceof IndividualsAssociation
) {
2501 detailedDescriptionElement
= new IndividualsAssociationDetailElement(
2502 this, parentElement
, (IndividualsAssociation
) entity
, style
);
2503 } else if (entity
instanceof QuantitativeData
) {
2504 detailedDescriptionElement
= new QuantitativeDataDetailElement(
2505 this, parentElement
, (QuantitativeData
) entity
, style
);
2506 } else if (entity
instanceof TaxonInteraction
) {
2507 detailedDescriptionElement
= new TaxonInteractionDetailElement(
2508 this, parentElement
, (TaxonInteraction
) entity
, style
);
2509 } else if (entity
instanceof TextData
) {
2510 detailedDescriptionElement
= new TextDataDetailElement(this,
2511 parentElement
, (TextData
) entity
, style
);
2513 throw new IllegalStateException(
2514 "There is no interface for the given description element");
2516 adapt(detailedDescriptionElement
);
2517 parentElement
.addElement(detailedDescriptionElement
);
2518 return detailedDescriptionElement
;
2523 * Creates a styled text as a part of the form.
2528 * the text initial value
2531 * @return the text widget
2533 public StyledText
createStyledText(Composite parent
, String value
, int style
) {
2534 StyledText text
= new StyledText(parent
, getBorderStyle() | style
2535 | getOrientation());
2537 text
.setText(value
);
2538 text
.setForeground(getColors().getForeground());
2539 text
.setBackground(getColors().getBackground());
2540 // text.addFocusListener(visibilityHandler);