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
.name
.AuthorshipDetailElement
;
190 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailSection
;
191 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailElement
;
192 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailSection
;
193 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailElement
;
194 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailSection
;
195 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailElement
;
196 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailSection
;
197 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameTypeDesignationElement
;
198 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusElement
;
199 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusSection
;
200 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailElement
;
201 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailSection
;
202 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueElement
;
203 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueSection
;
204 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.SpecimenTypeDesignationElement
;
205 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.TypeDesignationSection
;
206 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectingAreasDetailSection
;
207 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectionDetailElement
;
208 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailElement
;
209 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailSection
;
210 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailElement
;
211 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailSection
;
212 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationEventDetailElement
;
213 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationEventDetailSection
;
214 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailElement
;
215 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailSection
;
216 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailElement
;
217 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailSection
;
218 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailElement
;
219 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailSection
;
220 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.NamedAreaDetailElement
;
221 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SourceCollectionDetailSection
;
222 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailElement
;
223 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailSection
;
224 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailElement
;
225 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailSection
;
226 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailElement
;
227 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailSection
;
228 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationElement
;
229 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationSection
;
230 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditElement
;
231 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditSection
;
232 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionElement
;
233 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionSection
;
234 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.HeadlineSection
;
235 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.IdentifiableSourceElement
;
236 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ImageFileElement
;
237 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerElement
;
238 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerSection
;
239 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MediaElement
;
240 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MediaRepresentationElement
;
241 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MediaRepresentationPartSection
;
242 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MediaRepresentationSection
;
243 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MediaSection
;
244 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsElement
;
245 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
246 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.SourceSection
;
247 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionElement
;
248 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionSection
;
249 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessageElement
;
250 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
251 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailElement
;
252 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
253 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonDetailElement
;
254 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailElement
;
255 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailSection
;
256 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailElement
;
257 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailSection
;
258 import eu
.etaxonomy
.taxeditor
.ui
.selection
.AbstractSelectionElement
;
259 import eu
.etaxonomy
.taxeditor
.ui
.selection
.AgentSelectionElement
;
260 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ClassificationSelectionElement
;
261 import eu
.etaxonomy
.taxeditor
.ui
.selection
.CollectionSelectionElement
;
262 import eu
.etaxonomy
.taxeditor
.ui
.selection
.DerivedUnitBaseSelectionElement
;
263 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FeatureSelectionElement
;
264 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FeatureTreeSelectionElement
;
265 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FieldObservationSelectionElement
;
266 import eu
.etaxonomy
.taxeditor
.ui
.selection
.GroupSelectionElement
;
267 import eu
.etaxonomy
.taxeditor
.ui
.selection
.InstitutionSelectionElement
;
268 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NameSelectionElement
;
269 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NamedAreaSelectionElement
;
270 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NomenclaturalAuthorTeamSelectionElement
;
271 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PersonSelectionElement
;
272 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PolytomousKeyNodeSelectionElement
;
273 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PolytomousKeySelectionElement
;
274 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ReferenceSelectionElement
;
275 import eu
.etaxonomy
.taxeditor
.ui
.selection
.SynonymSelectionElement
;
276 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonBaseSelectionElement
;
277 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonNodeSelectionElement
;
278 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonSelectionElement
;
279 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TeamSelectionElement
;
280 import eu
.etaxonomy
.taxeditor
.ui
.selection
.UserSelectionElement
;
281 import eu
.etaxonomy
.taxeditor
.ui
.term
.AbstractEnumComboElement
;
282 import eu
.etaxonomy
.taxeditor
.ui
.term
.AbstractTermComboElement
;
283 import eu
.etaxonomy
.taxeditor
.ui
.term
.AnnotationTypeComboElement
;
284 import eu
.etaxonomy
.taxeditor
.ui
.term
.DeterminationModifierComboElement
;
285 import eu
.etaxonomy
.taxeditor
.ui
.term
.EmptyComboElement
;
286 import eu
.etaxonomy
.taxeditor
.ui
.term
.ExtensionTypeComboElement
;
287 import eu
.etaxonomy
.taxeditor
.ui
.term
.LanguageComboElement
;
288 import eu
.etaxonomy
.taxeditor
.ui
.term
.MarkerTypeComboElement
;
289 import eu
.etaxonomy
.taxeditor
.ui
.term
.MeasurementUnitComboElement
;
290 import eu
.etaxonomy
.taxeditor
.ui
.term
.ModifierComboElement
;
291 import eu
.etaxonomy
.taxeditor
.ui
.term
.NameRelationshipTypeComboElement
;
292 import eu
.etaxonomy
.taxeditor
.ui
.term
.NameTypeDesignationStatusComboElement
;
293 import eu
.etaxonomy
.taxeditor
.ui
.term
.NamedAreaTypeComboElement
;
294 import eu
.etaxonomy
.taxeditor
.ui
.term
.NomenclaturalCodeComboElement
;
295 import eu
.etaxonomy
.taxeditor
.ui
.term
.NomenclaturalStatusTypeComboElement
;
296 import eu
.etaxonomy
.taxeditor
.ui
.term
.PresenceAbsenceTermComboElement
;
297 import eu
.etaxonomy
.taxeditor
.ui
.term
.PreservationMethodComboElement
;
298 import eu
.etaxonomy
.taxeditor
.ui
.term
.RankComboElement
;
299 import eu
.etaxonomy
.taxeditor
.ui
.term
.ReferenceSystemComboElement
;
300 import eu
.etaxonomy
.taxeditor
.ui
.term
.ReferenceTypeComboElement
;
301 import eu
.etaxonomy
.taxeditor
.ui
.term
.RightsTypeComboElement
;
302 import eu
.etaxonomy
.taxeditor
.ui
.term
.ScopeComboElement
;
303 import eu
.etaxonomy
.taxeditor
.ui
.term
.SexComboElement
;
304 import eu
.etaxonomy
.taxeditor
.ui
.term
.SpecimenTypeDesignationStatusComboElement
;
305 import eu
.etaxonomy
.taxeditor
.ui
.term
.StageComboElement
;
306 import eu
.etaxonomy
.taxeditor
.ui
.term
.StateComboElement
;
307 import eu
.etaxonomy
.taxeditor
.ui
.term
.StatisticalMeasureComboElement
;
311 * CdmFormFactory class.
315 * @created Feb 24, 2010
318 public class CdmFormFactory
extends FormToolkit
{
320 private BoldFontHolder2 boldFontHolder2
;
321 private MouseListener selectionMouseHandler
;
322 private FocusListener selectionFocusHandler
;
324 private final Set selectionListenerList
= new HashSet();
326 private final List
<IPropertyChangeListener
> propertyChangeListeners
= new ArrayList
<IPropertyChangeListener
>();
328 private final int orientation
= Window
.getDefaultOrientation();
329 private ISelectionProvider selectionProvider
;
336 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
338 public static final TableWrapLayout
LAYOUT() {
339 return LAYOUT(1, false);
351 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
353 public static final TableWrapLayout
LAYOUT(int columns
, boolean equalWidth
) {
354 TableWrapLayout layout
= new TableWrapLayout();
355 layout
.topMargin
= 0;
356 layout
.rightMargin
= 0;
357 layout
.bottomMargin
= 0;
358 layout
.leftMargin
= 0;
359 layout
.numColumns
= columns
;
360 layout
.makeColumnsEqualWidth
= equalWidth
;
361 layout
.verticalSpacing
= 0;
362 layout
.horizontalSpacing
= 0;
371 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
373 public static final TableWrapData
FILL() {
382 * @param horizontalSpan
384 * @param verticalSpan
386 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
388 public static final TableWrapData
FILL(int horizontalSpan
, int verticalSpan
) {
389 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
,
390 TableWrapData
.FILL_GRAB
);
391 layoutData
.colspan
= horizontalSpan
;
392 layoutData
.rowspan
= verticalSpan
;
401 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
403 public static final TableWrapData
LEFT() {
404 return new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
);
412 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
414 public static final TableWrapData
RIGHT() {
415 return new TableWrapData(TableWrapData
.RIGHT
, TableWrapData
.TOP
);
423 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
425 public static final TableWrapData
FILL_HORIZONTALLY() {
426 return FILL_HORIZONTALLY(1, 1);
434 * @param horizontalSpan
436 * @param verticalSpan
438 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
440 public static final TableWrapData
FILL_HORIZONTALLY(int horizontalSpan
,
442 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
,
444 layoutData
.colspan
= horizontalSpan
;
445 layoutData
.rowspan
= verticalSpan
;
449 /** Constant <code>EMPTY_SELECTION</code> */
450 public static ISelection EMPTY_SELECTION
= new ISelection() {
452 public boolean isEmpty() {
457 private class SelectionMouseHandler
extends MouseAdapter
{
459 public void mouseDown(MouseEvent e
) {
460 notifySelectionListeners(e
);
464 private class SelectionFocusHandler
extends FocusAdapter
{
466 public void focusGained(FocusEvent e
) {
467 notifySelectionListeners(e
);
471 private void notifySelectionListeners(TypedEvent e
) {
472 Event event
= new Event();
473 event
.widget
= e
.widget
;
474 SelectionEvent selectionEvent
= new SelectionEvent(event
);
476 for (Object listener
: selectionListenerList
) {
477 ((SelectionListener
) listener
).widgetSelected(selectionEvent
);
483 * Constructor for CdmFormFactory.
487 * a {@link org.eclipse.swt.widgets.Display} object.
488 * @param selectionProvider
489 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
491 public CdmFormFactory(Display display
, ISelectionProvider selectionProvider
) {
493 this.selectionProvider
= selectionProvider
;
499 * Constructor for CdmFormFactory.
503 * a {@link org.eclipse.swt.widgets.Display} object.
505 public CdmFormFactory(Display display
) {
513 private void init() {
514 boldFontHolder2
= new BoldFontHolder2();
515 selectionMouseHandler
= new SelectionMouseHandler();
516 selectionFocusHandler
= new SelectionFocusHandler();
520 * Creates an instance initialized with the correct selectionProvider
522 * Make sure to remove the instance when the entityComposite disposes via
523 * destroySelectionArbitrator(..)
525 * @param entityElement
526 * a {@link eu.etaxonomy.taxeditor.ui.forms.IEntityElement}
528 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator}
531 public SelectionArbitrator
createSelectionArbitrator(
532 IEntityElement entityElement
) {
533 SelectionArbitrator selectionArbitrator
= new SelectionArbitrator(
535 selectionArbitrator
.addSelectionProvider(selectionProvider
);
536 selectionProvider
.addSelectionChangedListener(selectionArbitrator
);
537 addSelectionListener(selectionArbitrator
);
538 return selectionArbitrator
;
543 * destroySelectionArbitrator
546 * @param selectionArbitrator
547 * a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator}
550 public void destroySelectionArbitrator(
551 SelectionArbitrator selectionArbitrator
) {
552 removeSelectionListener(selectionArbitrator
);
553 if (selectionProvider
!= null) {
555 .removeSelectionChangedListener(selectionArbitrator
);
558 .error(this.getClass(),
559 "Tried to destroy a selection listener from this factories listeners but was null",
566 public void adapt(Composite composite
) {
567 composite
.addMouseListener(selectionMouseHandler
);
568 super.adapt(composite
);
578 * {@link eu.etaxonomy.taxeditor.ui.forms.AbstractCdmFormElement}
581 public void adapt(AbstractCdmFormElement formElement
) {
582 formElement
.setPropertyChangeListeners(propertyChangeListeners
);
587 public void adapt(Control control
, boolean trackFocus
, boolean trackKeyboard
) {
589 control
.addFocusListener(selectionFocusHandler
);
591 super.adapt(control
, trackFocus
, trackKeyboard
);
600 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
603 public void destroyElement(ICdmFormElement formElement
) {
604 // return if element was not initialized
605 if (formElement
== null) {
608 // destroy selection arbitrator, if any
609 if (formElement
instanceof ISelectableElement
) {
610 destroySelectionArbitrator(((ISelectableElement
) formElement
)
611 .getSelectionArbitrator());
613 // remove this element form its parents list of elements
614 // ICdmFormElement parentElement = formElement.getParentElement();
615 // if(parentElement != null){
616 // parentElement.removeElement(formElement);
618 // call destroy on child elements recursively
619 for (ICdmFormElement childElement
: formElement
.getElements()) {
620 destroyElement(childElement
);
622 // dispose of the controls
623 for (Control control
: formElement
.getControls()) {
624 // we added the layoutComposite of the parental element as the
625 // layout composite to this formElement
626 // but we do not want to destroy it.
627 if (control
.equals(formElement
.getLayoutComposite())) {
642 * a {@link org.eclipse.swt.widgets.Composite} object.
643 * @return a {@link org.eclipse.swt.widgets.Label} object.
645 public Label
createEmptyCell(Composite parent
) {
646 return this.createLabel(parent
, null);
651 * createMultilineTextWithLabel
655 * a {@link java.lang.String} object.
660 * @param parentElement
661 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
663 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement}
666 public TextWithLabelElement
createMultilineTextWithLabel(
667 ICdmFormElement parentElement
, String labelString
, int textHeight
,
669 TextWithLabelElement element
= new TextWithLabelElement(this,
670 parentElement
, labelString
, "", textHeight
, style
);
672 parentElement
.addElement(element
);
678 * createMultiLanguageTextElement
681 * @param parentElement
682 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
685 * a {@link java.lang.String} object.
686 * @param multilanguageText
687 * a {@link java.util.Map} object.
693 * {@link eu.etaxonomy.taxeditor.ui.forms.MultilanguageTextElement}
696 public MultilanguageTextElement
createMultiLanguageTextElement(
697 ICdmFormElement parentElement
, String labelString
,
698 Map
<Language
, LanguageString
> multilanguageText
, int textHeight
,
700 MultilanguageTextElement element
= new MultilanguageTextElement(this,
701 parentElement
, labelString
, multilanguageText
, textHeight
,
704 parentElement
.addElement(element
);
708 public KeyStatementElement
createKeyStatementElement(
709 ICdmFormElement parentElement
, String labelString
,
710 KeyStatement keyStatement
, int textHeight
, int style
) {
711 KeyStatementElement element
= new KeyStatementElement(this,
712 parentElement
, labelString
, keyStatement
, textHeight
, style
);
714 parentElement
.addElement(element
);
720 * createTextWithLabelElement
724 * a {@link java.lang.String} object.
726 * a {@link java.lang.String} object.
729 * @param parentElement
730 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
732 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement}
735 public TextWithLabelElement
createTextWithLabelElement(
736 ICdmFormElement parentElement
, String labelString
,
737 String initialText
, int style
) {
738 TextWithLabelElement element
= new TextWithLabelElement(this,
739 parentElement
, labelString
, initialText
, null, style
);
741 parentElement
.addElement(element
);
745 public UriWithLabelElement
createUriWithLabelElement(
746 ICdmFormElement parentElement
, String labelString
, URI initialUri
,
748 UriWithLabelElement element
= new UriWithLabelElement(this,
749 parentElement
, labelString
, initialUri
, null, style
);
751 parentElement
.addElement(element
);
762 public OpenUrlSelectorElement
createOpenUrlSelectorElement(
763 ICdmFormElement parentElement
, String labelString
,
764 IOpenUrlEnabled openUrlEnabled
, int style
) {
765 OpenUrlSelectorElement element
= new OpenUrlSelectorElement(this,
766 parentElement
, labelString
, openUrlEnabled
, style
);
768 parentElement
.addElement(element
);
774 * @param parentElement
776 * @param conversationEnabled
781 public EditPasswordElement
createEditPasswordElement(
782 ICdmFormElement parentElement
, String labelString
,
783 ConversationHolder conversation
, User user
, int style
) {
784 EditPasswordElement element
= new EditPasswordElement(this,
785 parentElement
, labelString
, user
, conversation
);
787 parentElement
.addElement(element
);
793 * createIntegerTextWithLabelElement
796 * @param parentElement
797 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
800 * a {@link java.lang.String} object.
801 * @param initialInteger
802 * a {@link java.lang.Integer} object.
805 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement}
808 public NumberWithLabelElement
createIntegerTextWithLabelElement(
809 ICdmFormElement parentElement
, String labelString
,
810 Integer initialInteger
, int style
) {
811 NumberWithLabelElement element
= new NumberWithLabelElement(this,
812 parentElement
, labelString
, initialInteger
, style
);
814 parentElement
.addElement(element
);
820 * createFloatTextWithLabelElement
823 * @param parentElement
824 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
827 * a {@link java.lang.String} object.
828 * @param initialFloat
832 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement}
835 public NumberWithLabelElement
createFloatTextWithLabelElement(
836 ICdmFormElement parentElement
, String labelString
,
837 float initialFloat
, int style
) {
838 NumberWithLabelElement element
= new NumberWithLabelElement(this,
839 parentElement
, labelString
, initialFloat
, style
);
841 parentElement
.addElement(element
);
847 * createLanguageStringWithLabelElement
850 * @param parentElement
851 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
854 * a {@link java.lang.String} object.
855 * @param languageString
856 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
860 * {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement}
863 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
864 ICdmFormElement parentElement
, String labelString
,
865 LanguageString languageString
, int style
) {
866 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
867 this, parentElement
, labelString
, languageString
, style
);
869 parentElement
.addElement(element
);
875 * createLanguageStringWithLabelElement
878 * @param parentElement
879 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
882 * a {@link java.lang.String} object.
883 * @param languageString
884 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
890 * {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement}
893 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
894 ICdmFormElement parentElement
, String labelString
,
895 LanguageString languageString
, int height
, int style
) {
896 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
897 this, parentElement
, labelString
, languageString
, height
, style
);
899 parentElement
.addElement(element
);
908 * @param parentElement
909 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
912 * a {@link java.lang.String} object.
915 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement}
918 public TextWithLabelElement
createTextElement(
919 ICdmFormElement parentElement
, String initialText
, int style
) {
920 TextWithLabelElement element
= new TextWithLabelElement(this,
921 parentElement
, null, initialText
, null, style
);
923 parentElement
.addElement(element
);
929 * createKeyValueViewerElement
932 * @param parentElement
933 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
936 * a {@link java.lang.String} object.
937 * @param valueHeading
938 * a {@link java.lang.String} object.
940 * a {@link java.util.Map} object.
941 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.KeyValueViewerElement}
944 public KeyValueViewerElement
createKeyValueViewerElement(
945 ICdmFormElement parentElement
, String keyHeading
,
946 String valueHeading
, Map
<Object
, Object
> map
) {
947 KeyValueViewerElement element
= new KeyValueViewerElement(this,
948 parentElement
, keyHeading
, valueHeading
, map
);
950 parentElement
.addElement(element
);
954 public static enum TermComboType
{
955 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
960 * createTermComboElement
963 * @param termComboType
965 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.TermComboType}
967 * @param parentElement
968 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
971 * a {@link java.lang.String} object.
973 * a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase}
977 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractTermComboElement}
980 public AbstractTermComboElement
createTermComboElement(
981 TermComboType termComboType
, ICdmFormElement parentElement
,
982 String labelString
, DefinedTermBase selection
, int style
) {
983 AbstractTermComboElement element
= null;
985 switch (termComboType
) {
987 element
= new EmptyComboElement
<DefinedTermBase
>(this,
988 parentElement
, labelString
, style
);
991 element
= new ExtensionTypeComboElement(this, parentElement
,
992 labelString
, (ExtensionType
) selection
, style
);
995 element
= new LanguageComboElement(this, parentElement
,
996 labelString
, (Language
) selection
, style
);
999 element
= new MarkerTypeComboElement(this, parentElement
,
1000 labelString
, (MarkerType
) selection
, style
);
1002 case NOMENCLATURALSTATUSTYPE
:
1003 element
= new NomenclaturalStatusTypeComboElement(this,
1004 parentElement
, labelString
,
1005 (NomenclaturalStatusType
) selection
, style
);
1008 element
= new RankComboElement(this, parentElement
, labelString
,
1009 (Rank
) selection
, style
);
1012 element
= new RightsTypeComboElement(this, parentElement
,
1013 labelString
, (RightsTerm
) selection
, style
);
1015 case NAMERELATIONSHIP
:
1016 element
= new NameRelationshipTypeComboElement(this, parentElement
,
1017 labelString
, (NameRelationshipType
) selection
, style
);
1020 element
= new NamedAreaTypeComboElement(this, parentElement
,
1021 labelString
, (NamedAreaType
) selection
, style
);
1023 case ANNOTATIONTYPE
:
1024 element
= new AnnotationTypeComboElement(this, parentElement
,
1025 labelString
, (AnnotationType
) selection
, style
);
1027 case PRESENCEABSENCESTATUS
:
1028 element
= new PresenceAbsenceTermComboElement(this, parentElement
,
1029 labelString
, (PresenceAbsenceTermBase
) selection
, style
);
1031 case NAMETYPEDESIGNATIONSTATUS
:
1032 element
= new NameTypeDesignationStatusComboElement(this,
1033 parentElement
, labelString
,
1034 (NameTypeDesignationStatus
) selection
, style
);
1036 case SPECIMENTYPEDESIGNATIONSTATUS
:
1037 element
= new SpecimenTypeDesignationStatusComboElement(this,
1038 parentElement
, labelString
,
1039 (SpecimenTypeDesignationStatus
) selection
, style
);
1042 element
= new SexComboElement(this, parentElement
, labelString
,
1043 (Sex
) selection
, style
);
1046 element
= new StageComboElement(this, parentElement
, labelString
,
1047 (Stage
) selection
, style
);
1049 case PRESERVATION_METHOD
:
1050 element
= new PreservationMethodComboElement(this, parentElement
,
1051 labelString
, (PreservationMethod
) selection
, style
);
1053 case MEASUREMENT_UNIT
:
1054 element
= new MeasurementUnitComboElement(this, parentElement
,
1055 labelString
, (MeasurementUnit
) selection
, style
);
1058 element
= new StateComboElement(this, parentElement
, labelString
,
1059 (State
) selection
, style
);
1062 element
= new ScopeComboElement(this, parentElement
, labelString
,
1063 (Scope
) selection
, style
);
1066 element
= new ModifierComboElement(this, parentElement
,
1067 labelString
, (Modifier
) selection
, style
);
1069 case STATISTICAL_MEASURE
:
1070 element
= new StatisticalMeasureComboElement(this, parentElement
,
1071 labelString
, (StatisticalMeasure
) selection
, style
);
1073 case DETERMINATION_MODIFIER
:
1074 element
= new DeterminationModifierComboElement(this,
1075 parentElement
, labelString
,
1076 (DeterminationModifier
) selection
, style
);
1078 case REFERENCE_SYSTEM
:
1079 element
= new ReferenceSystemComboElement(this, parentElement
,
1080 labelString
, (ReferenceSystem
) selection
, style
);
1085 parentElement
.addElement(element
);
1089 public static enum EnumComboType
{
1090 REFERENCETYPE
, NOMENCLATURALCODE
1095 * createEnumComboElement
1098 * @param enumComboType
1100 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EnumComboType}
1102 * @param parentElement
1103 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1107 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
1110 public AbstractEnumComboElement
createEnumComboElement(
1111 EnumComboType enumComboType
, ICdmFormElement parentElement
,
1113 AbstractEnumComboElement element
= null;
1115 switch (enumComboType
) {
1117 element
= new ReferenceTypeComboElement(this, parentElement
,
1118 "Reference Type", null, style
);
1120 case NOMENCLATURALCODE
:
1121 element
= new NomenclaturalCodeComboElement(this, parentElement
,
1122 "Nomenclatural Code", null, style
);
1126 parentElement
.addElement(element
);
1132 * createBrowserElement
1136 * a {@link java.net.URI} object.
1139 * @param parentElement
1140 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1142 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.BrowserElement} object.
1144 public BrowserElement
createBrowserElement(ICdmFormElement parentElement
,
1145 URI imageUri
, int style
) {
1146 BrowserElement element
= new BrowserElement(this, parentElement
,
1149 parentElement
.addElement(element
);
1155 * createImageElement
1158 * @param parentElement
1159 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1162 * a {@link java.net.URI} object.
1165 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.ImageElement} object.
1167 public ImageElement
createImageElement(ICdmFormElement parentElement
,
1168 URI imageUri
, int style
) {
1169 ImageElement element
= new ImageElement(this, parentElement
, imageUri
,
1172 parentElement
.addElement(element
);
1178 * createTextActionElement
1181 * @param labelString
1182 * a {@link java.lang.String} object.
1183 * @param initialText
1184 * a {@link java.lang.String} object.
1187 * @param parentElement
1188 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1190 * @param buttonLabel
1191 * a {@link java.lang.String} object.
1192 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextActionElement}
1195 public TextActionElement
createTextActionElement(
1196 ICdmFormElement parentElement
, String labelString
,
1197 String buttonLabel
, String initialText
, int style
) {
1198 TextActionElement element
= new TextActionElement(this, parentElement
,
1199 labelString
, buttonLabel
, initialText
, style
);
1201 parentElement
.addElement(element
);
1207 * @author n.hoffmann
1208 * @created Mar 5, 2010
1211 public static enum SelectionType
{
1212 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
1220 * @param parentElement
1221 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1224 * a {@link java.lang.String} object.
1225 * @param initialState
1229 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.CheckboxElement} object.
1231 public CheckboxElement
createCheckbox(ICdmFormElement parentElement
,
1232 String label
, boolean initialState
, int style
) {
1233 CheckboxElement element
= new CheckboxElement(this, parentElement
,
1234 label
, initialState
, style
| orientation
);
1236 parentElement
.addElement(element
);
1241 * Creates a section as a part of the form.
1243 * @return the section widget
1245 * a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
1248 public Section
adapt(AbstractFormSection section
) {
1249 section
.setMenu(section
.getLayoutComposite().getMenu());
1250 adapt(section
, true, true);
1252 // handle focus and property change events for cdm use
1253 section
.addFocusListener(selectionFocusHandler
);
1254 section
.setPropertyChangeListeners(propertyChangeListeners
);
1256 if (section
.getToggle() != null) {
1257 section
.getToggle().setHoverDecorationColor(
1258 getColors().getColor(IFormColors
.TB_TOGGLE_HOVER
));
1259 section
.getToggle().setDecorationColor(
1260 getColors().getColor(IFormColors
.TB_TOGGLE
));
1263 section
.setFont(boldFontHolder2
.getBoldFont(section
1264 .getLayoutComposite().getFont()));
1266 if ((section
.getStyle() & Section
.TITLE_BAR
) != 0
1267 || (section
.getStyle() & Section
.SHORT_TITLE_BAR
) != 0) {
1268 getColors().initializeSectionToolBarColors();
1269 section
.setTitleBarBackground(getColors().getColor(
1270 IFormColors
.TB_BG
));
1271 section
.setTitleBarBorderColor(getColors().getColor(
1272 IFormColors
.TB_BORDER
));
1274 // call setTitleBarForeground regardless as it also sets the label color
1275 section
.setTitleBarForeground(getColors().getColor(
1276 IFormColors
.TB_TOGGLE
));
1280 private class BoldFontHolder2
{
1281 private Font normalFont
;
1283 private Font boldFont
;
1285 public BoldFontHolder2() {
1288 public Font
getBoldFont(Font font
) {
1289 createBoldFont(font
);
1293 private void createBoldFont(Font font
) {
1294 if (normalFont
== null || !normalFont
.equals(font
)) {
1298 if (boldFont
== null) {
1299 boldFont
= FormFonts
.getInstance().getBoldFont(
1300 getColors().getDisplay(), normalFont
);
1304 public void dispose() {
1305 if (boldFont
!= null) {
1306 FormFonts
.getInstance().markFinished(boldFont
,
1307 getColors().getDisplay());
1315 * createToggleableTextField
1318 * @param parentElement
1319 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1321 * @param labelString
1322 * a {@link java.lang.String} object.
1323 * @param initialText
1324 * a {@link java.lang.String} object.
1325 * @param initialState
1329 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.ToggleableTextElement}
1332 public ToggleableTextElement
createToggleableTextField(
1333 ICdmFormElement parentElement
, String labelString
,
1334 String initialText
, boolean initialState
, int style
) {
1335 ToggleableTextElement element
= new ToggleableTextElement(this,
1336 parentElement
, labelString
, initialText
, initialState
, style
1339 parentElement
.addElement(element
);
1345 * createTimePeriodElement
1348 * @param parentElement
1349 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1351 * @param labelString
1352 * a {@link java.lang.String} object.
1354 * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1357 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TimePeriodElement}
1360 public TimePeriodElement
createTimePeriodElement(
1361 ICdmFormElement parentElement
, String labelString
,
1362 TimePeriod timePeriod
, int style
) {
1363 TimePeriodElement element
= new TimePeriodElement(this, parentElement
,
1364 labelString
, timePeriod
, style
);
1366 parentElement
.addElement(element
);
1372 * createPointElement
1377 * @param parentElement
1378 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1381 * a {@link eu.etaxonomy.cdm.model.location.Point} object.
1382 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.PointElement} object.
1384 public PointElement
createPointElement(ICdmFormElement parentElement
,
1385 Point point
, int style
) {
1386 PointElement element
= new PointElement(this, parentElement
, point
,
1389 parentElement
.addElement(element
);
1395 * createDateDetailSection
1398 * @param parentElement
1399 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1403 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.DateDetailSection}
1406 public DateDetailSection
createDateDetailSection(
1407 ICdmFormElement parentElement
, int style
) {
1408 DateDetailSection section
= new DateDetailSection(this, parentElement
,
1410 parentElement
.addElement(section
);
1417 * createPartialElement
1420 * @param parentElement
1421 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1423 * @param labelString
1424 * a {@link java.lang.String} object.
1426 * a {@link org.joda.time.Partial} object.
1429 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.PartialElement} object.
1431 public PartialElement
createPartialElement(ICdmFormElement parentElement
,
1432 String labelString
, Partial partial
, int style
) {
1433 PartialElement element
= new PartialElement(this, parentElement
,
1434 labelString
, style
);
1436 parentElement
.addElement(element
);
1442 * addSelectionListener
1446 * a {@link org.eclipse.swt.events.SelectionListener} object.
1448 public void addSelectionListener(SelectionListener listener
) {
1449 selectionListenerList
.add(listener
);
1454 * removeSelectionListener
1458 * a {@link org.eclipse.swt.events.SelectionListener} object.
1460 public void removeSelectionListener(SelectionListener listener
) {
1461 if (listener
== null) {
1463 .error(this.getClass(),
1464 "Tried to remove a selection listener from this factories listeners but was null",
1467 selectionListenerList
.remove(listener
);
1473 * addPropertyChangeListener
1477 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1480 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
1481 propertyChangeListeners
.add(0, listener
);
1486 * removePropertyChangeListener
1490 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1493 public void removePropertyChangeListener(IPropertyChangeListener listener
) {
1494 propertyChangeListeners
.remove(listener
);
1499 * createHorizontalSeparator
1502 * @param parentElement
1503 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1507 * @return a {@link org.eclipse.swt.widgets.Label} object.
1509 public Label
createHorizontalSeparator(ICdmFormElement parentElement
,
1511 Label separator
= this.createSeparator(
1512 parentElement
.getLayoutComposite(), SWT
.HORIZONTAL
| style
);
1513 separator
.setLayoutData(FILL_HORIZONTALLY());
1519 * createVersionElement
1522 * @param parentElement
1523 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1526 * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
1531 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
1534 public VersionElement
createVersionElement(ICdmFormElement parentElement
,
1535 VersionableEntity entity
, int style
) {
1536 VersionElement element
= new VersionElement(this, parentElement
,
1539 parentElement
.addElement(element
);
1545 * createVersionSection
1548 * @param parentElement
1549 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1554 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
1557 public VersionSection
createVersionSection(ICdmFormElement parentElement
,
1559 VersionSection section
= new VersionSection(this, parentElement
, style
);
1560 parentElement
.addElement(section
);
1567 * createEmptyElement
1570 * @param parentElement
1571 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1573 * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1575 public EmptyElement
createEmptyElement(ICdmFormElement parentElement
) {
1576 EmptyElement element
= new EmptyElement(this, parentElement
, null,
1579 parentElement
.addElement(element
);
1585 * createHeadlineSection
1588 * @param parentElement
1589 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1592 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
1595 public HeadlineSection
createHeadlineSection(ICdmFormElement parentElement
) {
1596 HeadlineSection section
= new HeadlineSection(this, parentElement
,
1598 parentElement
.addElement(section
);
1605 * createParsingMessageElement
1608 * @param parentElement
1609 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1611 * @param parserProblem
1612 * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
1617 * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
1620 public ParsingMessageElement
createParsingMessageElement(
1621 ICdmFormElement parentElement
, ParserProblem parserProblem
,
1623 ParsingMessageElement element
= new ParsingMessageElement(this,
1624 parentElement
, parserProblem
, style
);
1626 parentElement
.addElement(element
);
1635 public static enum DetailType
{
1636 NONVIRALNAME
, SCIENTIFICNAME
, REFERENCEBASE
, NOMENCLATURALREFERENCE
, TAXONBASE
, AUTHORSHIP
, TEAM
, PERSON
, DESCRIPTION
, DESCRIPTIONELEMENT
, PARSINGMESSAGE
, NAMERELATIONSHIP
, TEAMORPERSONBASE
, MEDIA
, FIELD_OBSERVATION
, DERIVED_UNIT_FACADE
, GATHERING_EVENT
, DERIVED_UNIT
, NATURAL_LANGUAGE
, FEATURE_DISTRIBUTION
, CLASSIFICATION
, TAXON_NODE
, COLLECTION
, POLYTOMOUS_KEY
, POLYTOMOUS_KEY_NODE
, INSTITUTION
, DERIVED_UNIT_GENERAL
, HYBRID
, USER
, GROUP
1641 * createCdmDetailSection
1646 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType}
1648 * @param parentElement
1649 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1651 * @param selectionProvider
1652 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1655 * @param conversation
1656 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1658 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
1661 public AbstractFormSection
createCdmDetailSection(DetailType detailType
,
1662 ConversationHolder conversation
, ICdmFormElement parentElement
,
1663 ISelectionProvider selectionProvider
, int style
) {
1664 AbstractFormSection section
= null;
1666 switch (detailType
) {
1667 case SCIENTIFICNAME
:
1668 section
= new NameDetailSection(this, conversation
, parentElement
,
1669 selectionProvider
, style
);
1672 section
= new ReferenceDetailSection(this, conversation
,
1673 parentElement
, selectionProvider
, style
);
1675 case NOMENCLATURALREFERENCE
:
1676 section
= new NomenclaturalReferenceDetailSection(this,
1677 conversation
, parentElement
, selectionProvider
, style
);
1680 section
= new TaxonBaseDetailSection(this, conversation
,
1681 parentElement
, selectionProvider
, style
);
1684 section
= new AuthorshipDetailSection(this, conversation
,
1685 parentElement
, selectionProvider
, style
);
1687 case TEAMORPERSONBASE
:
1688 section
= new TeamOrPersonBaseDetailSection(this, conversation
,
1689 parentElement
, selectionProvider
, style
);
1692 section
= new TeamDetailSection(this, conversation
, parentElement
,
1696 section
= new PersonDetailSection(this, conversation
,
1697 parentElement
, null, style
);
1700 section
= new DescriptionDetailSection(this, conversation
,
1701 parentElement
, selectionProvider
, style
);
1703 case DESCRIPTIONELEMENT
:
1704 section
= new DescriptionElementDetailSection(this, conversation
,
1705 parentElement
, selectionProvider
, style
);
1707 case PARSINGMESSAGE
:
1708 section
= new ParsingMessagesSection(this, conversation
,
1709 parentElement
, selectionProvider
, style
);
1712 section
= new NonViralNameDetailSection(this, conversation
,
1713 parentElement
, selectionProvider
, style
);
1716 section
= new eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection(
1717 this, conversation
, parentElement
, selectionProvider
, style
);
1719 case DERIVED_UNIT_FACADE
:
1720 section
= new DerivedUnitFacadeDetailSection(this, conversation
,
1721 parentElement
, selectionProvider
, style
);
1723 case FIELD_OBSERVATION
:
1724 section
= new FieldObservationDetailSection(this, conversation
,
1725 parentElement
, selectionProvider
, style
);
1727 case GATHERING_EVENT
:
1728 section
= new GatheringEventDetailSection(this, conversation
,
1729 parentElement
, selectionProvider
, style
);
1732 section
= new DerivedUnitBaseDetailSection(this, conversation
,
1733 parentElement
, selectionProvider
, style
);
1735 case NATURAL_LANGUAGE
:
1736 section
= new NaturalLanguageSection(this, conversation
,
1737 parentElement
, selectionProvider
, style
);
1739 case FEATURE_DISTRIBUTION
:
1740 section
= new FeatureDistributionDetailSection(this, conversation
,
1741 parentElement
, selectionProvider
, style
);
1743 case CLASSIFICATION
:
1744 section
= new ClassificationDetailSection(this, conversation
,
1745 parentElement
, selectionProvider
, style
);
1748 section
= new TaxonNodeDetailSection(this, conversation
,
1749 parentElement
, selectionProvider
, style
);
1751 case POLYTOMOUS_KEY
:
1752 section
= new PolytomousKeyDetailSection(this, conversation
,
1753 parentElement
, selectionProvider
, style
);
1755 case POLYTOMOUS_KEY_NODE
:
1756 section
= new PolytomousKeyNodeDetailSection(this, conversation
,
1757 parentElement
, selectionProvider
, style
);
1760 section
= new InstitutionDetailSection(this, conversation
,
1761 parentElement
, selectionProvider
, style
);
1763 case DERIVED_UNIT_GENERAL
:
1764 section
= new GeneralDetailSection(this, conversation
,
1765 parentElement
, selectionProvider
, style
);
1768 section
= new HybridDetailSection(this, conversation
,
1769 parentElement
, selectionProvider
, style
);
1772 section
= new UserDetailSection(this, conversation
, parentElement
,
1773 selectionProvider
, style
);
1776 section
= new GroupDetailSection(this, conversation
, parentElement
,
1777 selectionProvider
, style
);
1781 if (section
== null) {
1782 throw new RuntimeException(
1783 "You tried to create a cdm detail section that is not implemented yet.");
1786 parentElement
.addElement(section
);
1793 * createCdmDetailElement
1798 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType}
1802 * @param parentElement
1803 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1806 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
1809 public AbstractCdmDetailElement
createCdmDetailElement(
1810 DetailType detailType
, ICdmFormElement parentElement
, int style
) {
1811 AbstractCdmDetailElement element
= null;
1813 switch (detailType
) {
1814 case SCIENTIFICNAME
:
1815 element
= new NameDetailElement(this, parentElement
, style
);
1818 element
= new ReferenceDetailElement(this, parentElement
, style
);
1820 case NOMENCLATURALREFERENCE
:
1821 element
= new NomenclaturalReferenceDetailElement(this,
1822 parentElement
, style
);
1825 element
= new TaxonBaseDetailElement(this, parentElement
, style
);
1828 element
= new AuthorshipDetailElement(this, parentElement
, style
);
1831 element
= new TeamDetailElement(this, parentElement
, style
);
1834 element
= new PersonDetailElement(this, parentElement
, style
);
1837 element
= new DescriptionDetailElement(this, parentElement
, style
);
1839 case DESCRIPTIONELEMENT
:
1840 element
= new DescriptionElementDetailElement(this, parentElement
,
1844 element
= new NonViralNameDetailElement(this, parentElement
);
1846 case DERIVED_UNIT_FACADE
:
1847 element
= new DerivedUnitFacadeDetailElement(this, parentElement
);
1849 case FIELD_OBSERVATION
:
1850 element
= new FieldObservationDetailElement(this, parentElement
);
1852 case GATHERING_EVENT
:
1853 element
= new GatheringEventDetailElement(this, parentElement
);
1856 element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1858 case NATURAL_LANGUAGE
:
1859 element
= new NaturalLanguageDetailElement(this, parentElement
);
1861 case FEATURE_DISTRIBUTION
:
1862 element
= new FeatureDistributionDetailElement(this, parentElement
);
1864 case CLASSIFICATION
:
1865 element
= new ClassificationDetailElement(this, parentElement
);
1868 element
= new TaxonNodeDetailElement(this, parentElement
);
1871 element
= new CollectionDetailElement(this, parentElement
);
1873 case POLYTOMOUS_KEY
:
1874 element
= new PolytomousKeyDetailElement(this, parentElement
);
1876 case POLYTOMOUS_KEY_NODE
:
1877 element
= new PolytomousKeyNodeDetailElement(this, parentElement
);
1880 element
= new InstitutionDetailElement(this, parentElement
);
1882 case DERIVED_UNIT_GENERAL
:
1883 element
= new GeneralDetailElement(this, parentElement
);
1886 element
= new HybridDetailElement(this, parentElement
);
1889 element
= new UserDetailElement(this, parentElement
);
1892 element
= new GroupDetailElement(this, parentElement
);
1896 if (element
== null) {
1898 .error(this.getClass(),
1899 "Detail element was not created. Seems like the case was not implemented for the requested detail type: "
1900 + detailType
, null);
1904 parentElement
.addElement(element
);
1910 * @author n.hoffmann
1911 * @created Mar 5, 2010
1914 public static enum EntityDetailType
{
1915 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
1920 * createEntityDetailSection
1923 * @param entityDetailType
1925 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EntityDetailType}
1929 * @param conversation
1930 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1932 * @param parentElement
1933 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1935 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
1938 public AbstractFormSection
createEntityDetailSection(
1939 EntityDetailType entityDetailType
, ConversationHolder conversation
,
1940 ICdmFormElement parentElement
, int style
) {
1941 AbstractFormSection section
= null;
1943 switch (entityDetailType
) {
1945 section
= new TeamDetailSection(this, conversation
, parentElement
,
1949 section
= new TeamMemberSection(this, conversation
, parentElement
,
1953 section
= new AnnotationSection(this, conversation
, parentElement
,
1957 section
= new CreditSection(this, conversation
, parentElement
,
1960 case DESCRIPTIONELEMENTSOURCE
:
1961 section
= new DescriptionElementSourceSection(this, conversation
,
1962 parentElement
, style
);
1965 section
= new ExtensionSection(this, conversation
, parentElement
,
1969 section
= new MarkerSection(this, conversation
, parentElement
,
1973 section
= new MediaSection(this, conversation
, parentElement
, style
);
1975 case DESCRIPTIONELEMENTMEDIA
:
1976 section
= new DescriptionElementMediaSection(this, conversation
,
1977 parentElement
, style
);
1979 case MEDIAREPRESENTATION
:
1980 section
= new MediaRepresentationSection(this, conversation
,
1981 parentElement
, style
);
1983 case MEDIAREPRESENTATIONPART
:
1984 section
= new MediaRepresentationPartSection(this, conversation
,
1985 parentElement
, style
);
1988 section
= new ModifierSection(this, conversation
, parentElement
,
1991 case NOMENCLATURALSTATUS
:
1992 section
= new NomenclaturalStatusSection(this, conversation
,
1993 parentElement
, style
);
1995 case NAME_RELATIONSHIP
:
1996 section
= new NameRelationshipDetailSection(this, conversation
,
1997 parentElement
, style
);
2000 section
= new ProtologueSection(this, conversation
, parentElement
,
2004 section
= new RightsSection(this, conversation
, parentElement
,
2008 section
= new SourceSection(this, conversation
, parentElement
,
2012 section
= new ScopeSection(this, conversation
, parentElement
, style
);
2014 case DESCRIPTIONSOURCE
:
2015 section
= new DescriptionSourceSection(this, conversation
,
2016 parentElement
, style
);
2018 case TYPEDESIGNATION
:
2019 section
= new TypeDesignationSection(this, conversation
,
2020 parentElement
, style
);
2023 section
= new StateDataSection(this, conversation
, parentElement
,
2026 case STATISTICAL_MEASUREMENT_VALUE
:
2027 section
= new StatisticalMeasurementValueSection(this,
2028 conversation
, parentElement
, style
);
2030 case DESCRIBED_SPECIMEN
:
2031 section
= new DescribedSpecimenSection(this, conversation
,
2032 parentElement
, style
);
2034 case COLLECTING_AREA
:
2035 section
= new CollectingAreasDetailSection(this, conversation
,
2036 parentElement
, style
);
2038 case DETERMINATION_EVENT
:
2039 section
= new DeterminationEventDetailSection(this, conversation
,
2040 parentElement
, style
);
2042 case SPECIMEN_COLLECTION
:
2043 section
= new SpecimenCollectionDetailSection(this, conversation
,
2044 parentElement
, style
);
2046 case IDENTIFIABLE_SOURCE_COLLECTION
:
2047 section
= new SourceCollectionDetailSection(this, conversation
,
2048 parentElement
, style
);
2050 case GEOGRAPHICAL_SCOPE
:
2051 section
= new GeographicalScopeDetailSection(this, conversation
,
2052 parentElement
, style
);
2054 case SCOPE_RESTRICTION
:
2055 section
= new ScopeRestrictionSection(this, conversation
,
2056 parentElement
, style
);
2059 section
= new MemberDetailSection(this, conversation
,
2060 parentElement
, style
);
2062 case GRANTED_AUTHORITY
:
2063 section
= new GrantedAuthorityDetailSection(this, conversation
,
2064 parentElement
, style
);
2066 case GROUPS_BY_USER
:
2067 section
= new GroupsByUserDetailSection(this, conversation
,
2068 parentElement
, style
);
2070 case TAXONOMIC_SCOPE
:
2071 section
= new TaxonomicScopeSection(this, conversation
,
2072 parentElement
, style
);
2075 parentElement
.addElement(section
);
2082 * createEntityCollectionElement
2085 * @param removeListener
2086 * a {@link org.eclipse.swt.events.SelectionListener} object.
2089 * @param parentElement
2090 * a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
2092 * @param versionableEntity
2093 * a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity}
2095 * @param backgroundColor
2096 * a {@link org.eclipse.swt.graphics.Color} object.
2098 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement}
2101 public AbstractEntityCollectionElement
createEntityCollectionElement(
2102 AbstractFormSection parentElement
, Object versionableEntity
,
2103 SelectionListener removeListener
, Color backgroundColor
, int style
) {
2104 AbstractEntityCollectionElement element
= null;
2106 Object entity
= HibernateProxyHelper
.deproxy(versionableEntity
);
2108 if (entity
instanceof Annotation
) {
2109 element
= new AnnotationElement(this, parentElement
,
2110 (Annotation
) entity
, removeListener
, style
);
2111 } else if (entity
instanceof Person
) {
2112 element
= new TeamMemberElement(this, parentElement
,
2113 (Person
) entity
, removeListener
, style
);
2114 } else if (entity
instanceof Credit
) {
2115 element
= new CreditElement(this, parentElement
, (Credit
) entity
,
2116 removeListener
, style
);
2117 } else if (entity
instanceof Extension
) {
2118 element
= new ExtensionElement(this, parentElement
,
2119 (Extension
) entity
, removeListener
, style
);
2120 } else if (entity
instanceof Marker
) {
2121 element
= new MarkerElement(this, parentElement
, (Marker
) entity
,
2122 removeListener
, style
);
2123 } else if (entity
instanceof Media
) {
2124 element
= new MediaElement(this, parentElement
, (Media
) entity
,
2125 removeListener
, style
);
2126 } else if (entity
instanceof MediaRepresentation
) {
2127 element
= new MediaRepresentationElement(this, parentElement
,
2128 (MediaRepresentation
) entity
, removeListener
, style
);
2129 } else if (entity
instanceof ImageFile
) {
2130 element
= new ImageFileElement(this, parentElement
,
2131 (ImageFile
) entity
, removeListener
, style
);
2132 } else if (entity
instanceof NomenclaturalStatus
) {
2133 element
= new NomenclaturalStatusElement(this, parentElement
,
2134 (NomenclaturalStatus
) entity
, removeListener
, style
);
2135 } else if (entity
instanceof Rights
) {
2136 element
= new RightsElement(this, parentElement
, (Rights
) entity
,
2137 removeListener
, style
);
2138 } else if (entity
instanceof DescriptionElementSource
) {
2139 element
= new DescriptionElementSourceElement(this, parentElement
,
2140 (DescriptionElementSource
) entity
, removeListener
, style
);
2141 } else if (entity
instanceof IdentifiableSource
) {
2142 element
= new IdentifiableSourceElement(this, parentElement
,
2143 (IdentifiableSource
) entity
, removeListener
, style
);
2144 } else if (entity
instanceof Scope
) {
2145 element
= new ScopeElement(this, parentElement
, (Scope
) entity
,
2146 removeListener
, style
);
2147 } else if (entity
instanceof Modifier
) {
2148 element
= new ModifierElement(this, parentElement
,
2149 (Modifier
) entity
, removeListener
, style
);
2150 } else if (entity
instanceof Reference
) {
2151 element
= new DescriptionSourceElement(this, parentElement
,
2152 (Reference
) entity
, removeListener
, style
);
2153 } else if (entity
instanceof NameTypeDesignation
) {
2154 element
= new NameTypeDesignationElement(this, parentElement
,
2155 (NameTypeDesignation
) entity
, removeListener
, style
);
2156 } else if (entity
instanceof NameRelationship
) {
2157 element
= new NameRelationshipDetailElement(this, parentElement
,
2158 (NameRelationship
) entity
, removeListener
, style
);
2159 } else if (entity
instanceof SpecimenTypeDesignation
) {
2160 element
= new SpecimenTypeDesignationElement(this, parentElement
,
2161 (SpecimenTypeDesignation
) entity
, removeListener
, style
);
2162 } else if (entity
instanceof StateData
) {
2163 element
= new StateDataElement(this, parentElement
,
2164 (StateData
) entity
, removeListener
, style
);
2165 } else if (entity
instanceof StatisticalMeasurementValue
) {
2166 element
= new StatisticalMeasurementValueElement(this,
2167 parentElement
, (StatisticalMeasurementValue
) entity
,
2168 removeListener
, style
);
2169 } else if (entity
instanceof DerivedUnit
) {
2170 element
= new DerivedUnitElement(this, parentElement
,
2171 (DerivedUnit
) entity
, removeListener
, style
);
2172 } else if (entity
instanceof NamedArea
) {
2173 element
= new NamedAreaDetailElement(this, parentElement
,
2174 (NamedArea
) entity
, removeListener
, style
);
2175 } else if (entity
instanceof DeterminationEvent
) {
2176 element
= new DeterminationEventDetailElement(this, parentElement
,
2177 (DeterminationEvent
) entity
, removeListener
, style
);
2178 } else if (entity
instanceof Specimen
) {
2179 element
= new SpecimenCollectionDetailElement(this, parentElement
,
2180 (Specimen
) entity
, removeListener
, style
);
2181 } else if (entity
instanceof User
) {
2182 element
= new MemberDetailElement(this, parentElement
,
2183 (User
) entity
, removeListener
, style
);
2184 } else if (entity
instanceof GrantedAuthority
) {
2185 element
= new GrantedAuthorityDetailElement(this, parentElement
,
2186 (GrantedAuthority
) entity
, removeListener
, style
);
2187 } else if (entity
instanceof Group
) {
2188 element
= new GroupsByUserDetailElement(this, parentElement
,
2189 (Group
) entity
, removeListener
, style
);
2190 } else if (entity
instanceof Taxon
) {
2191 element
= new TaxonDetailElement(this, parentElement
,
2192 (Taxon
) entity
, removeListener
, style
);
2193 } else if (entity
instanceof DescriptionElementBase
) {
2194 // this is the special case for protologs, maybe we can do this
2195 // differently when API improves
2196 DescriptionElementBase descriptionElement
= (DescriptionElementBase
) entity
;
2197 if (descriptionElement
.getFeature().equals(Feature
.PROTOLOGUE())) {
2198 element
= new ProtologueElement(this, parentElement
,
2199 descriptionElement
, removeListener
, style
);
2203 if (element
== null) {
2206 "No element for entity",
2208 "Could not generate element for entity. "
2209 + "Looks like the case is not handled already. Check implementation. Entity: "
2213 if (backgroundColor
!= null && !backgroundColor
.isDisposed()) {
2214 element
.setBackgroundColor(backgroundColor
);
2218 parentElement
.addElement(element
);
2224 * createSelectionElement
2227 * @param selectionType
2229 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType}
2231 * @param parentElement
2232 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
2234 * @param labelString
2235 * a {@link java.lang.String} object.
2236 * @param selectionType
2238 * a {@link eu.etaxonomy.cdm.model.common.IAnnotatableEntity}
2242 * @param conversation
2243 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
2246 * {@link eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement}
2249 public AbstractSelectionElement
createSelectionElement(
2250 SelectionType selectionType
, ConversationHolder conversation
,
2251 ICdmFormElement parentElement
, String labelString
,
2252 ICdmBase selection
, int style
) {
2253 AbstractSelectionElement element
= null;
2255 IAnnotatableEntity entity
= (IAnnotatableEntity
) HibernateProxyHelper
2256 .deproxy(selection
);
2258 switch (selectionType
) {
2260 element
= new AgentSelectionElement(this, conversation
,
2261 parentElement
, labelString
, (TeamOrPersonBase
) entity
,
2265 element
= new PersonSelectionElement(this, conversation
,
2266 parentElement
, labelString
, (Person
) entity
, style
);
2269 element
= new TeamSelectionElement(this, conversation
,
2270 parentElement
, labelString
, (Team
) entity
, style
);
2273 element
= new NomenclaturalAuthorTeamSelectionElement(this,
2274 conversation
, parentElement
, labelString
, (Team
) entity
,
2278 element
= new InstitutionSelectionElement(this, conversation
,
2279 parentElement
, labelString
, (Institution
) entity
, style
);
2282 element
= new NameSelectionElement(this, conversation
,
2283 parentElement
, labelString
, (TaxonNameBase
) entity
, style
);
2286 element
= new ReferenceSelectionElement(this, conversation
,
2287 parentElement
, labelString
, (Reference
) entity
, style
);
2290 element
= new TaxonBaseSelectionElement(this, conversation
,
2291 parentElement
, labelString
, (TaxonBase
) entity
, style
);
2294 element
= new TaxonSelectionElement(this, conversation
,
2295 parentElement
, labelString
, (Taxon
) entity
, style
);
2298 element
= new SynonymSelectionElement(this, conversation
,
2299 parentElement
, labelString
, (Synonym
) entity
, style
);
2302 element
= new DerivedUnitBaseSelectionElement(this, conversation
,
2303 parentElement
, labelString
, (DerivedUnitBase
) entity
, style
);
2305 case FIELD_OBSERVATION
:
2306 element
= new FieldObservationSelectionElement(this, conversation
,
2307 parentElement
, labelString
, (FieldObservation
) entity
,
2311 element
= new FeatureTreeSelectionElement(this, conversation
,
2312 parentElement
, labelString
, (FeatureTree
) entity
, style
);
2314 case CLASSIFICATION
:
2315 element
= new ClassificationSelectionElement(this, conversation
,
2316 parentElement
, labelString
, (Classification
) entity
, style
);
2319 element
= new TaxonNodeSelectionElement(this, conversation
,
2320 parentElement
, labelString
, (TaxonNode
) entity
, style
);
2323 element
= new CollectionSelectionElement(this, conversation
,
2324 parentElement
, labelString
, (Collection
) entity
, style
);
2327 element
= new FeatureSelectionElement(this, conversation
,
2328 parentElement
, labelString
, (Feature
) entity
, style
);
2330 case POLYTOMOUS_KEY
:
2331 element
= new PolytomousKeySelectionElement(this, conversation
,
2332 parentElement
, labelString
, (PolytomousKey
) entity
, style
);
2334 case POLYTOMOUS_KEY_NODE
:
2335 element
= new PolytomousKeyNodeSelectionElement(this, conversation
,
2336 parentElement
, labelString
, (PolytomousKeyNode
) entity
,
2340 element
= new UserSelectionElement(this, conversation
,
2341 parentElement
, labelString
, (User
) entity
, style
);
2344 element
= new GroupSelectionElement(this, conversation
,
2345 parentElement
, labelString
, (Group
) entity
, style
);
2348 new RuntimeException(
2349 "There is no selection composite for the desired selection type.");
2354 parentElement
.addElement(element
);
2360 * createNamedAreaSelectionElement
2363 * @param parentElement
2364 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
2366 * @param conversation
2367 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
2369 * @param labelString
2370 * a {@link java.lang.String} object.
2372 * a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
2376 * {@link eu.etaxonomy.taxeditor.ui.selection.NamedAreaSelectionElement}
2379 public NamedAreaSelectionElement
createNamedAreaSelectionElement(
2380 ICdmFormElement parentElement
, ConversationHolder conversation
,
2381 String labelString
, NamedArea selection
, int style
) {
2382 NamedAreaSelectionElement element
= new NamedAreaSelectionElement(this,
2383 conversation
, parentElement
, labelString
, selection
, style
);
2385 parentElement
.addElement(element
);
2389 /** {@inheritDoc} */
2390 public LabelElement
createLabel(ICdmFormElement parentElement
, String text
) {
2391 LabelElement labelElement
= new LabelElement(this, parentElement
, text
);
2392 adapt(labelElement
);
2393 parentElement
.addElement(labelElement
);
2394 return labelElement
;
2399 * Getter for the field <code>selectionProvider</code>.
2402 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
2404 public ISelectionProvider
getSelectionProvider() {
2405 return selectionProvider
;
2410 * createDetailedDescriptionDetailElement
2413 * @param parentElement
2414 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
2418 * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
2423 * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
2426 public AbstractDetailedDescriptionDetailElement
createDetailedDescriptionDetailElement(
2427 ICdmFormElement parentElement
, DescriptionElementBase entity
,
2429 AbstractDetailedDescriptionDetailElement detailedDescriptionElement
= null;
2431 if (entity
instanceof CategoricalData
) {
2432 detailedDescriptionElement
= new CategoricalDataDetailElement(this,
2433 parentElement
, (CategoricalData
) entity
, style
);
2434 } else if (entity
instanceof CommonTaxonName
) {
2435 detailedDescriptionElement
= new CommonNameDetailElement(this,
2436 parentElement
, (CommonTaxonName
) entity
, style
);
2437 } else if (entity
instanceof Distribution
) {
2438 detailedDescriptionElement
= new DistributionDetailElement(this,
2439 parentElement
, (Distribution
) entity
, style
);
2440 } else if (entity
instanceof IndividualsAssociation
) {
2441 detailedDescriptionElement
= new IndividualsAssociationDetailElement(
2442 this, parentElement
, (IndividualsAssociation
) entity
, style
);
2443 } else if (entity
instanceof QuantitativeData
) {
2444 detailedDescriptionElement
= new QuantitativeDataDetailElement(
2445 this, parentElement
, (QuantitativeData
) entity
, style
);
2446 } else if (entity
instanceof TaxonInteraction
) {
2447 detailedDescriptionElement
= new TaxonInteractionDetailElement(
2448 this, parentElement
, (TaxonInteraction
) entity
, style
);
2449 } else if (entity
instanceof TextData
) {
2450 detailedDescriptionElement
= new TextDataDetailElement(this,
2451 parentElement
, (TextData
) entity
, style
);
2453 throw new IllegalStateException(
2454 "There is no interface for the given description element");
2456 adapt(detailedDescriptionElement
);
2457 parentElement
.addElement(detailedDescriptionElement
);
2458 return detailedDescriptionElement
;
2463 * Creates a styled text as a part of the form.
2468 * the text initial value
2471 * @return the text widget
2473 public StyledText
createStyledText(Composite parent
, String value
, int style
) {
2474 StyledText text
= new StyledText(parent
, getBorderStyle() | style
2475 | getOrientation());
2477 text
.setText(value
);
2478 text
.setForeground(getColors().getForeground());
2479 text
.setBackground(getColors().getBackground());
2480 // text.addFocusListener(visibilityHandler);