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
.Credit
;
52 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
53 import eu
.etaxonomy
.cdm
.model
.common
.DescriptionElementSource
;
54 import eu
.etaxonomy
.cdm
.model
.common
.Extension
;
55 import eu
.etaxonomy
.cdm
.model
.common
.Group
;
56 import eu
.etaxonomy
.cdm
.model
.common
.IAnnotatableEntity
;
57 import eu
.etaxonomy
.cdm
.model
.common
.ICdmBase
;
58 import eu
.etaxonomy
.cdm
.model
.common
.IDefinedTerm
;
59 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableSource
;
60 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
61 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
62 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
63 import eu
.etaxonomy
.cdm
.model
.common
.TimePeriod
;
64 import eu
.etaxonomy
.cdm
.model
.common
.User
;
65 import eu
.etaxonomy
.cdm
.model
.common
.VersionableEntity
;
66 import eu
.etaxonomy
.cdm
.model
.description
.CategoricalData
;
67 import eu
.etaxonomy
.cdm
.model
.description
.CommonTaxonName
;
68 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
69 import eu
.etaxonomy
.cdm
.model
.description
.Distribution
;
70 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
71 import eu
.etaxonomy
.cdm
.model
.description
.FeatureTree
;
72 import eu
.etaxonomy
.cdm
.model
.description
.IndividualsAssociation
;
73 import eu
.etaxonomy
.cdm
.model
.description
.KeyStatement
;
74 import eu
.etaxonomy
.cdm
.model
.description
.Modifier
;
75 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKey
;
76 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKeyNode
;
77 import eu
.etaxonomy
.cdm
.model
.description
.QuantitativeData
;
78 import eu
.etaxonomy
.cdm
.model
.description
.Scope
;
79 import eu
.etaxonomy
.cdm
.model
.description
.StateData
;
80 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasurementValue
;
81 import eu
.etaxonomy
.cdm
.model
.description
.TaxonInteraction
;
82 import eu
.etaxonomy
.cdm
.model
.description
.TextData
;
83 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
84 import eu
.etaxonomy
.cdm
.model
.location
.NamedAreaLevel
;
85 import eu
.etaxonomy
.cdm
.model
.location
.Point
;
86 import eu
.etaxonomy
.cdm
.model
.media
.ImageFile
;
87 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
88 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
89 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentationPart
;
90 import eu
.etaxonomy
.cdm
.model
.media
.Rights
;
91 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationship
;
92 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignation
;
93 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
94 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignation
;
95 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
96 import eu
.etaxonomy
.cdm
.model
.occurrence
.Collection
;
97 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
98 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnitBase
;
99 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationEvent
;
100 import eu
.etaxonomy
.cdm
.model
.occurrence
.FieldObservation
;
101 import eu
.etaxonomy
.cdm
.model
.occurrence
.Specimen
;
102 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
103 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
104 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
105 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
106 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
107 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
108 import eu
.etaxonomy
.cdm
.strategy
.parser
.ParserProblem
;
109 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
110 import eu
.etaxonomy
.taxeditor
.ui
.combo
.EmptyComboElement
;
111 import eu
.etaxonomy
.taxeditor
.ui
.combo
.EnumComboElement
;
112 import eu
.etaxonomy
.taxeditor
.ui
.combo
.TermComboElement
;
113 import eu
.etaxonomy
.taxeditor
.ui
.forms
.password
.EditPasswordElement
;
114 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.IOpenUrlEnabled
;
115 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.OpenUrlSelectorElement
;
116 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
117 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailSection
;
118 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
119 import eu
.etaxonomy
.taxeditor
.ui
.section
.EmptyElement
;
120 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailElement
;
121 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailSection
;
122 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailElement
;
123 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailSection
;
124 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailElement
;
125 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailSection
;
126 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberElement
;
127 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberSection
;
128 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamOrPersonBaseDetailSection
;
129 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailElement
;
130 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailSection
;
131 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailElement
;
132 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailSection
;
133 import eu
.etaxonomy
.taxeditor
.ui
.section
.common
.ReferencedEntityDetailSection
;
134 import eu
.etaxonomy
.taxeditor
.ui
.section
.common
.RefereneEntityDetailElement
;
135 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DerivedUnitElement
;
136 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescribedSpecimenSection
;
137 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailElement
;
138 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailSection
;
139 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailElement
;
140 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailSection
;
141 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementMediaSection
;
142 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceElement
;
143 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceSection
;
144 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceElement
;
145 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceSection
;
146 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierElement
;
147 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierSection
;
148 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageDetailElement
;
149 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageSection
;
150 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeElement
;
151 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeSection
;
152 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataElement
;
153 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataSection
;
154 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueElement
;
155 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueSection
;
156 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.AbstractDetailedDescriptionDetailElement
;
157 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CategoricalDataDetailElement
;
158 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CommonNameDetailElement
;
159 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.DistributionDetailElement
;
160 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.IndividualsAssociationDetailElement
;
161 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.QuantitativeDataDetailElement
;
162 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TaxonInteractionDetailElement
;
163 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TextDataDetailElement
;
164 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailElement
;
165 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailSection
;
166 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GrantedAuthorityDetailElement
;
167 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GrantedAuthorityDetailSection
;
168 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailElement
;
169 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailSection
;
170 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailElement
;
171 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailSection
;
172 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.GeographicalScopeDetailSection
;
173 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailElement
;
174 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailSection
;
175 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailElement
;
176 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailSection
;
177 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.ScopeRestrictionSection
;
178 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.TaxonomicScopeSection
;
179 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.ImageFileElement
;
180 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaElement
;
181 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationElement
;
182 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationPartElement
;
183 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationPartSection
;
184 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationSection
;
185 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaSection
;
186 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailElement
;
187 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailSection
;
188 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailElement
;
189 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailSection
;
190 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailElement
;
191 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailSection
;
192 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailElement
;
193 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailSection
;
194 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameTypeDesignationElement
;
195 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusElement
;
196 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusSection
;
197 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailElement
;
198 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailSection
;
199 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueElement
;
200 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueSection
;
201 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.SpecimenTypeDesignationElement
;
202 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.TypeDesignationSection
;
203 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectingAreasDetailSection
;
204 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectionDetailElement
;
205 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CurrentDeterminationDetailSection
;
206 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailElement
;
207 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailSection
;
208 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailElement
;
209 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailSection
;
210 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailElement
;
211 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailSection
;
212 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationEventDetailElement
;
213 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationHistoryDetailSection
;
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
.MarkerElement
;
237 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerSection
;
238 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsElement
;
239 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
240 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.SourceSection
;
241 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionElement
;
242 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionSection
;
243 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessageElement
;
244 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
245 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailElement
;
246 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
247 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonDetailElement
;
248 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailElement
;
249 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailSection
;
250 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailElement
;
251 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailSection
;
252 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailElement
;
253 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailSection
;
254 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.DefinedTermDetailElement
;
255 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.DefinedTermDetailSection
;
256 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailSection
;
257 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailElement
;
258 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailSection
;
259 import eu
.etaxonomy
.taxeditor
.ui
.selection
.AbstractSelectionElement
;
260 import eu
.etaxonomy
.taxeditor
.ui
.selection
.AgentSelectionElement
;
261 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ClassificationSelectionElement
;
262 import eu
.etaxonomy
.taxeditor
.ui
.selection
.CollectionSelectionElement
;
263 import eu
.etaxonomy
.taxeditor
.ui
.selection
.DerivedUnitBaseSelectionElement
;
264 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FeatureSelectionElement
;
265 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FeatureTreeSelectionElement
;
266 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FieldObservationSelectionElement
;
267 import eu
.etaxonomy
.taxeditor
.ui
.selection
.GroupSelectionElement
;
268 import eu
.etaxonomy
.taxeditor
.ui
.selection
.InstitutionSelectionElement
;
269 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NameSelectionElement
;
270 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NamedAreaSelectionElement
;
271 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NomenclaturalAuthorTeamSelectionElement
;
272 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PersonSelectionElement
;
273 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PolytomousKeyNodeSelectionElement
;
274 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PolytomousKeySelectionElement
;
275 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ReferenceSelectionElement
;
276 import eu
.etaxonomy
.taxeditor
.ui
.selection
.SynonymSelectionElement
;
277 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonBaseSelectionElement
;
278 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonNodeSelectionElement
;
279 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonSelectionElement
;
280 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TeamSelectionElement
;
281 import eu
.etaxonomy
.taxeditor
.ui
.selection
.UserSelectionElement
;
285 * CdmFormFactory class.
289 * @created Feb 24, 2010
292 public class CdmFormFactory
extends FormToolkit
{
294 private BoldFontHolder2 boldFontHolder2
;
295 private MouseListener selectionMouseHandler
;
296 private FocusListener selectionFocusHandler
;
298 private final Set selectionListenerList
= new HashSet();
300 private final List
<IPropertyChangeListener
> propertyChangeListeners
= new ArrayList
<IPropertyChangeListener
>();
302 private final int orientation
= Window
.getDefaultOrientation();
303 private ISelectionProvider selectionProvider
;
310 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
312 public static final TableWrapLayout
LAYOUT() {
313 return LAYOUT(1, false);
325 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
327 public static final TableWrapLayout
LAYOUT(int columns
, boolean equalWidth
) {
328 TableWrapLayout layout
= new TableWrapLayout();
329 layout
.topMargin
= 0;
330 layout
.rightMargin
= 0;
331 layout
.bottomMargin
= 0;
332 layout
.leftMargin
= 0;
333 layout
.numColumns
= columns
;
334 layout
.makeColumnsEqualWidth
= equalWidth
;
335 layout
.verticalSpacing
= 0;
336 layout
.horizontalSpacing
= 0;
345 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
347 public static final TableWrapData
FILL() {
356 * @param horizontalSpan
358 * @param verticalSpan
360 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
362 public static final TableWrapData
FILL(int horizontalSpan
, int verticalSpan
) {
363 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
,
364 TableWrapData
.FILL_GRAB
);
365 layoutData
.colspan
= horizontalSpan
;
366 layoutData
.rowspan
= verticalSpan
;
375 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
377 public static final TableWrapData
LEFT() {
378 return new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
);
386 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
388 public static final TableWrapData
RIGHT() {
389 return new TableWrapData(TableWrapData
.RIGHT
, TableWrapData
.TOP
);
397 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
399 public static final TableWrapData
FILL_HORIZONTALLY() {
400 return FILL_HORIZONTALLY(1, 1);
408 * @param horizontalSpan
410 * @param verticalSpan
412 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
414 public static final TableWrapData
FILL_HORIZONTALLY(int horizontalSpan
,
416 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
,
418 layoutData
.colspan
= horizontalSpan
;
419 layoutData
.rowspan
= verticalSpan
;
423 /** Constant <code>EMPTY_SELECTION</code> */
424 public static ISelection EMPTY_SELECTION
= new ISelection() {
426 public boolean isEmpty() {
431 private class SelectionMouseHandler
extends MouseAdapter
{
433 public void mouseDown(MouseEvent e
) {
434 notifySelectionListeners(e
);
438 private class SelectionFocusHandler
extends FocusAdapter
{
440 public void focusGained(FocusEvent e
) {
441 notifySelectionListeners(e
);
445 private void notifySelectionListeners(TypedEvent e
) {
446 Event event
= new Event();
447 event
.widget
= e
.widget
;
448 SelectionEvent selectionEvent
= new SelectionEvent(event
);
450 for (Object listener
: selectionListenerList
) {
451 ((SelectionListener
) listener
).widgetSelected(selectionEvent
);
457 * Constructor for CdmFormFactory.
461 * a {@link org.eclipse.swt.widgets.Display} object.
462 * @param selectionProvider
463 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
465 public CdmFormFactory(Display display
, ISelectionProvider selectionProvider
) {
467 this.selectionProvider
= selectionProvider
;
473 * Constructor for CdmFormFactory.
477 * a {@link org.eclipse.swt.widgets.Display} object.
479 public CdmFormFactory(Display display
) {
487 private void init() {
488 boldFontHolder2
= new BoldFontHolder2();
489 selectionMouseHandler
= new SelectionMouseHandler();
490 selectionFocusHandler
= new SelectionFocusHandler();
494 * Creates an instance initialized with the correct selectionProvider
496 * Make sure to remove the instance when the entityComposite disposes via
497 * destroySelectionArbitrator(..)
499 * @param entityElement
500 * a {@link eu.etaxonomy.taxeditor.ui.forms.IEntityElement}
502 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator}
505 public SelectionArbitrator
createSelectionArbitrator(
506 IEntityElement entityElement
) {
507 SelectionArbitrator selectionArbitrator
= new SelectionArbitrator(
509 selectionArbitrator
.addSelectionProvider(selectionProvider
);
510 selectionProvider
.addSelectionChangedListener(selectionArbitrator
);
511 addSelectionListener(selectionArbitrator
);
512 return selectionArbitrator
;
517 * destroySelectionArbitrator
520 * @param selectionArbitrator
521 * a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator}
524 public void destroySelectionArbitrator(
525 SelectionArbitrator selectionArbitrator
) {
526 removeSelectionListener(selectionArbitrator
);
527 if (selectionProvider
!= null) {
529 .removeSelectionChangedListener(selectionArbitrator
);
532 .error(this.getClass(),
533 "Tried to destroy a selection listener from this factories listeners but was null",
540 public void adapt(Composite composite
) {
541 composite
.addMouseListener(selectionMouseHandler
);
542 super.adapt(composite
);
552 * {@link eu.etaxonomy.taxeditor.ui.forms.AbstractCdmFormElement}
555 public void adapt(AbstractCdmFormElement formElement
) {
556 formElement
.setPropertyChangeListeners(propertyChangeListeners
);
561 public void adapt(Control control
, boolean trackFocus
, boolean trackKeyboard
) {
563 control
.addFocusListener(selectionFocusHandler
);
565 super.adapt(control
, trackFocus
, trackKeyboard
);
574 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
577 public void destroyElement(ICdmFormElement formElement
) {
578 // return if element was not initialized
579 if (formElement
== null) {
582 // destroy selection arbitrator, if any
583 if (formElement
instanceof ISelectableElement
) {
584 destroySelectionArbitrator(((ISelectableElement
) formElement
)
585 .getSelectionArbitrator());
587 // remove this element form its parents list of elements
588 // ICdmFormElement parentElement = formElement.getParentElement();
589 // if(parentElement != null){
590 // parentElement.removeElement(formElement);
592 // call destroy on child elements recursively
593 for (ICdmFormElement childElement
: formElement
.getElements()) {
594 destroyElement(childElement
);
596 // dispose of the controls
597 for (Control control
: formElement
.getControls()) {
598 // we added the layoutComposite of the parental element as the
599 // layout composite to this formElement
600 // but we do not want to destroy it.
601 if (control
.equals(formElement
.getLayoutComposite())) {
616 * a {@link org.eclipse.swt.widgets.Composite} object.
617 * @return a {@link org.eclipse.swt.widgets.Label} object.
619 public Label
createEmptyCell(Composite parent
) {
620 return this.createLabel(parent
, null);
625 * createMultilineTextWithLabel
629 * a {@link java.lang.String} object.
634 * @param parentElement
635 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
637 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement}
640 public TextWithLabelElement
createMultilineTextWithLabel(
641 ICdmFormElement parentElement
, String labelString
, int textHeight
,
643 TextWithLabelElement element
= new TextWithLabelElement(this,
644 parentElement
, labelString
, "", textHeight
, style
);
646 parentElement
.addElement(element
);
652 * createMultiLanguageTextElement
655 * @param parentElement
656 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
659 * a {@link java.lang.String} object.
660 * @param multilanguageText
661 * a {@link java.util.Map} object.
667 * {@link eu.etaxonomy.taxeditor.ui.forms.MultilanguageTextElement}
670 public MultilanguageTextElement
createMultiLanguageTextElement(
671 ICdmFormElement parentElement
, String labelString
,
672 Map
<Language
, LanguageString
> multilanguageText
, int textHeight
,
674 MultilanguageTextElement element
= new MultilanguageTextElement(this,
675 parentElement
, labelString
, multilanguageText
, textHeight
,
678 parentElement
.addElement(element
);
682 public KeyStatementElement
createKeyStatementElement(
683 ICdmFormElement parentElement
, String labelString
,
684 KeyStatement keyStatement
, int textHeight
, int style
) {
685 KeyStatementElement element
= new KeyStatementElement(this,
686 parentElement
, labelString
, keyStatement
, textHeight
, style
);
688 parentElement
.addElement(element
);
694 * createTextWithLabelElement
698 * a {@link java.lang.String} object.
700 * a {@link java.lang.String} object.
703 * @param parentElement
704 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
706 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement}
709 public TextWithLabelElement
createTextWithLabelElement(
710 ICdmFormElement parentElement
, String labelString
,
711 String initialText
, int style
) {
712 TextWithLabelElement element
= new TextWithLabelElement(this,
713 parentElement
, labelString
, initialText
, null, style
);
715 parentElement
.addElement(element
);
719 public UriWithLabelElement
createUriWithLabelElement(
720 ICdmFormElement parentElement
, String labelString
, URI initialUri
,
722 UriWithLabelElement element
= new UriWithLabelElement(this,
723 parentElement
, labelString
, initialUri
, null, style
);
725 parentElement
.addElement(element
);
736 public OpenUrlSelectorElement
createOpenUrlSelectorElement(
737 ICdmFormElement parentElement
, String labelString
,
738 IOpenUrlEnabled openUrlEnabled
, int style
) {
739 OpenUrlSelectorElement element
= new OpenUrlSelectorElement(this,
740 parentElement
, labelString
, openUrlEnabled
, style
);
742 parentElement
.addElement(element
);
748 * @param parentElement
750 * @param conversationEnabled
755 public EditPasswordElement
createEditPasswordElement(
756 ICdmFormElement parentElement
, String labelString
,
757 ConversationHolder conversation
, User user
, int style
) {
758 EditPasswordElement element
= new EditPasswordElement(this,
759 parentElement
, labelString
, user
, conversation
);
761 parentElement
.addElement(element
);
767 * createIntegerTextWithLabelElement
770 * @param parentElement
771 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
774 * a {@link java.lang.String} object.
775 * @param initialInteger
776 * a {@link java.lang.Integer} object.
779 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement}
782 public NumberWithLabelElement
createIntegerTextWithLabelElement(
783 ICdmFormElement parentElement
, String labelString
,
784 Integer initialInteger
, int style
) {
785 NumberWithLabelElement element
= new NumberWithLabelElement(this,
786 parentElement
, labelString
, initialInteger
, style
);
788 parentElement
.addElement(element
);
794 * createFloatTextWithLabelElement
797 * @param parentElement
798 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
801 * a {@link java.lang.String} object.
802 * @param initialFloat
806 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement}
809 public NumberWithLabelElement
createFloatTextWithLabelElement(
810 ICdmFormElement parentElement
, String labelString
,
811 float initialFloat
, int style
) {
812 NumberWithLabelElement element
= new NumberWithLabelElement(this,
813 parentElement
, labelString
, initialFloat
, style
);
815 parentElement
.addElement(element
);
821 * createLanguageStringWithLabelElement
824 * @param parentElement
825 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
828 * a {@link java.lang.String} object.
829 * @param languageString
830 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
834 * {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement}
837 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
838 ICdmFormElement parentElement
, String labelString
,
839 LanguageString languageString
, int style
) {
840 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
841 this, parentElement
, labelString
, languageString
, style
);
843 parentElement
.addElement(element
);
849 * createLanguageStringWithLabelElement
852 * @param parentElement
853 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
856 * a {@link java.lang.String} object.
857 * @param languageString
858 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
864 * {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement}
867 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
868 ICdmFormElement parentElement
, String labelString
,
869 LanguageString languageString
, int height
, int style
) {
870 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
871 this, parentElement
, labelString
, languageString
, height
, style
);
873 parentElement
.addElement(element
);
882 * @param parentElement
883 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
886 * a {@link java.lang.String} object.
889 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement}
892 public TextWithLabelElement
createTextElement(
893 ICdmFormElement parentElement
, String initialText
, int style
) {
894 TextWithLabelElement element
= new TextWithLabelElement(this,
895 parentElement
, null, initialText
, null, style
);
897 parentElement
.addElement(element
);
903 * createKeyValueViewerElement
906 * @param parentElement
907 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
910 * a {@link java.lang.String} object.
911 * @param valueHeading
912 * a {@link java.lang.String} object.
914 * a {@link java.util.Map} object.
915 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.KeyValueViewerElement}
918 public KeyValueViewerElement
createKeyValueViewerElement(
919 ICdmFormElement parentElement
, String keyHeading
,
920 String valueHeading
, Map
<Object
, Object
> map
) {
921 KeyValueViewerElement element
= new KeyValueViewerElement(this,
922 parentElement
, keyHeading
, valueHeading
, map
);
924 parentElement
.addElement(element
);
930 * createTermComboElement
933 * @param termComboType
935 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.TermComboType}
937 * @param parentElement
938 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
941 * a {@link java.lang.String} object.
943 * a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase}
947 * @return a {@link eu.etaxonomy.taxeditor.ui.combo.TermComboElement}
951 public <T
extends DefinedTermBase
> TermComboElement
<T
> createTermComboElement(
952 Class
<T
> termComboType
, ICdmFormElement parentElement
,
953 String labelString
, T selection
, int style
) {
954 TermComboElement
<T
> element
= new TermComboElement
<T
>(this, parentElement
, termComboType
, labelString
, selection
, style
);
956 parentElement
.addElement(element
);
969 public <T
extends DefinedTermBase
> EmptyComboElement
<T
> createEmptyComboElement(
970 Class
<T
> clazz
, ICdmFormElement parentElement
, String labelString
,
971 Object selection
, int style
) {
972 EmptyComboElement
<T
> element
= new EmptyComboElement
<T
>(this, parentElement
, clazz
, labelString
, style
);
974 parentElement
.addElement(element
);
980 * createEnumComboElement
983 * @param enumComboType
985 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EnumComboType}
987 * @param parentElement
988 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
992 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
995 public <T
extends IDefinedTerm
> EnumComboElement
<T
> createEnumComboElement(
996 Class
<T
> enumComboType
, ICdmFormElement parentElement
,
998 EnumComboElement
<T
> element
= new EnumComboElement
<T
>(this, parentElement
, enumComboType
, style
);
1000 parentElement
.addElement(element
);
1006 * createBrowserElement
1010 * a {@link java.net.URI} object.
1013 * @param parentElement
1014 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1016 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.BrowserElement} object.
1018 public BrowserElement
createBrowserElement(ICdmFormElement parentElement
,
1019 URI imageUri
, int style
) {
1020 BrowserElement element
= new BrowserElement(this, parentElement
,
1023 parentElement
.addElement(element
);
1029 * createImageElement
1032 * @param parentElement
1033 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1036 * a {@link java.net.URI} object.
1039 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.ImageElement} object.
1041 public ImageElement
createImageElement(ICdmFormElement parentElement
,
1042 URI imageUri
, int style
) {
1043 ImageElement element
= new ImageElement(this, parentElement
, imageUri
,
1046 parentElement
.addElement(element
);
1052 * createTextActionElement
1055 * @param labelString
1056 * a {@link java.lang.String} object.
1057 * @param initialText
1058 * a {@link java.lang.String} object.
1061 * @param parentElement
1062 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1064 * @param buttonLabel
1065 * a {@link java.lang.String} object.
1066 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextActionElement}
1069 public TextActionElement
createTextActionElement(
1070 ICdmFormElement parentElement
, String labelString
,
1071 String buttonLabel
, String initialText
, int style
) {
1072 TextActionElement element
= new TextActionElement(this, parentElement
,
1073 labelString
, buttonLabel
, initialText
, style
);
1075 parentElement
.addElement(element
);
1081 * @author n.hoffmann
1082 * @created Mar 5, 2010
1085 public static enum SelectionType
{
1086 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
1094 * @param parentElement
1095 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1098 * a {@link java.lang.String} object.
1099 * @param initialState
1103 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.CheckboxElement} object.
1105 public CheckboxElement
createCheckbox(ICdmFormElement parentElement
,
1106 String label
, boolean initialState
, int style
) {
1107 CheckboxElement element
= new CheckboxElement(this, parentElement
,
1108 label
, initialState
, style
| orientation
);
1110 parentElement
.addElement(element
);
1115 * Creates a section as a part of the form.
1117 * @return the section widget
1119 * a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
1122 public Section
adapt(AbstractFormSection section
) {
1123 section
.setMenu(section
.getLayoutComposite().getMenu());
1124 adapt(section
, true, true);
1126 // handle focus and property change events for cdm use
1127 section
.addFocusListener(selectionFocusHandler
);
1128 section
.setPropertyChangeListeners(propertyChangeListeners
);
1130 if (section
.getToggle() != null) {
1131 section
.getToggle().setHoverDecorationColor(
1132 getColors().getColor(IFormColors
.TB_TOGGLE_HOVER
));
1133 section
.getToggle().setDecorationColor(
1134 getColors().getColor(IFormColors
.TB_TOGGLE
));
1137 section
.setFont(boldFontHolder2
.getBoldFont(section
1138 .getLayoutComposite().getFont()));
1140 if ((section
.getStyle() & Section
.TITLE_BAR
) != 0
1141 || (section
.getStyle() & Section
.SHORT_TITLE_BAR
) != 0) {
1142 getColors().initializeSectionToolBarColors();
1143 section
.setTitleBarBackground(getColors().getColor(
1144 IFormColors
.TB_BG
));
1145 section
.setTitleBarBorderColor(getColors().getColor(
1146 IFormColors
.TB_BORDER
));
1148 // call setTitleBarForeground regardless as it also sets the label color
1149 section
.setTitleBarForeground(getColors().getColor(
1150 IFormColors
.TB_TOGGLE
));
1154 private class BoldFontHolder2
{
1155 private Font normalFont
;
1157 private Font boldFont
;
1159 public BoldFontHolder2() {
1162 public Font
getBoldFont(Font font
) {
1163 createBoldFont(font
);
1167 private void createBoldFont(Font font
) {
1168 if (normalFont
== null || !normalFont
.equals(font
)) {
1172 if (boldFont
== null) {
1173 boldFont
= FormFonts
.getInstance().getBoldFont(
1174 getColors().getDisplay(), normalFont
);
1178 public void dispose() {
1179 if (boldFont
!= null) {
1180 FormFonts
.getInstance().markFinished(boldFont
,
1181 getColors().getDisplay());
1189 * createToggleableTextField
1192 * @param parentElement
1193 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1195 * @param labelString
1196 * a {@link java.lang.String} object.
1197 * @param initialText
1198 * a {@link java.lang.String} object.
1199 * @param initialState
1203 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.ToggleableTextElement}
1206 public ToggleableTextElement
createToggleableTextField(
1207 ICdmFormElement parentElement
, String labelString
,
1208 String initialText
, boolean initialState
, int style
) {
1209 ToggleableTextElement element
= new ToggleableTextElement(this,
1210 parentElement
, labelString
, initialText
, initialState
, style
1213 parentElement
.addElement(element
);
1219 * createTimePeriodElement
1222 * @param parentElement
1223 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1225 * @param labelString
1226 * a {@link java.lang.String} object.
1228 * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1231 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TimePeriodElement}
1234 public TimePeriodElement
createTimePeriodElement(
1235 ICdmFormElement parentElement
, String labelString
,
1236 TimePeriod timePeriod
, int style
) {
1237 TimePeriodElement element
= new TimePeriodElement(this, parentElement
,
1238 labelString
, timePeriod
, style
);
1240 parentElement
.addElement(element
);
1246 * createPointElement
1251 * @param parentElement
1252 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1255 * a {@link eu.etaxonomy.cdm.model.location.Point} object.
1256 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.PointElement} object.
1258 public PointElement
createPointElement(ICdmFormElement parentElement
,
1259 Point point
, int style
) {
1260 PointElement element
= new PointElement(this, parentElement
, point
,
1263 parentElement
.addElement(element
);
1269 * createDateDetailSection
1272 * @param parentElement
1273 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1277 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.DateDetailSection}
1280 public DateDetailSection
createDateDetailSection(
1281 ICdmFormElement parentElement
, int style
) {
1282 DateDetailSection section
= new DateDetailSection(this, parentElement
,
1284 parentElement
.addElement(section
);
1291 * createPartialElement
1294 * @param parentElement
1295 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1297 * @param labelString
1298 * a {@link java.lang.String} object.
1300 * a {@link org.joda.time.Partial} object.
1303 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.PartialElement} object.
1305 public PartialElement
createPartialElement(ICdmFormElement parentElement
,
1306 String labelString
, Partial partial
, int style
) {
1307 PartialElement element
= new PartialElement(this, parentElement
,
1308 labelString
, style
);
1310 parentElement
.addElement(element
);
1316 * addSelectionListener
1320 * a {@link org.eclipse.swt.events.SelectionListener} object.
1322 public void addSelectionListener(SelectionListener listener
) {
1323 selectionListenerList
.add(listener
);
1328 * removeSelectionListener
1332 * a {@link org.eclipse.swt.events.SelectionListener} object.
1334 public void removeSelectionListener(SelectionListener listener
) {
1335 if (listener
== null) {
1337 .error(this.getClass(),
1338 "Tried to remove a selection listener from this factories listeners but was null",
1341 selectionListenerList
.remove(listener
);
1347 * addPropertyChangeListener
1351 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1354 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
1355 if(propertyChangeListeners
.contains(listener
)){
1358 propertyChangeListeners
.add(0, listener
);
1363 * removePropertyChangeListener
1367 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1370 public void removePropertyChangeListener(IPropertyChangeListener listener
) {
1371 propertyChangeListeners
.remove(listener
);
1376 * createHorizontalSeparator
1379 * @param parentElement
1380 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1384 * @return a {@link org.eclipse.swt.widgets.Label} object.
1386 public Label
createHorizontalSeparator(ICdmFormElement parentElement
,
1388 Label separator
= this.createSeparator(
1389 parentElement
.getLayoutComposite(), SWT
.HORIZONTAL
| style
);
1390 separator
.setLayoutData(FILL_HORIZONTALLY());
1396 * createVersionElement
1399 * @param parentElement
1400 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1403 * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
1408 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
1411 public VersionElement
createVersionElement(ICdmFormElement parentElement
,
1412 VersionableEntity entity
, int style
) {
1413 VersionElement element
= new VersionElement(this, parentElement
,
1416 parentElement
.addElement(element
);
1422 * createVersionSection
1425 * @param parentElement
1426 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1431 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
1434 public VersionSection
createVersionSection(ICdmFormElement parentElement
,
1436 VersionSection section
= new VersionSection(this, parentElement
, style
);
1437 parentElement
.addElement(section
);
1444 * createEmptyElement
1447 * @param parentElement
1448 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1450 * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1452 public EmptyElement
createEmptyElement(ICdmFormElement parentElement
) {
1453 EmptyElement element
= new EmptyElement(this, parentElement
, null,
1456 parentElement
.addElement(element
);
1462 * createHeadlineSection
1465 * @param parentElement
1466 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1469 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
1472 public HeadlineSection
createHeadlineSection(ICdmFormElement parentElement
) {
1473 HeadlineSection section
= new HeadlineSection(this, parentElement
,
1475 parentElement
.addElement(section
);
1482 * createParsingMessageElement
1485 * @param parentElement
1486 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1488 * @param parserProblem
1489 * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
1494 * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
1497 public ParsingMessageElement
createParsingMessageElement(
1498 ICdmFormElement parentElement
, ParserProblem parserProblem
,
1500 ParsingMessageElement element
= new ParsingMessageElement(this,
1501 parentElement
, parserProblem
, style
);
1503 parentElement
.addElement(element
);
1512 public static enum DetailType
{
1516 NOMENCLATURALREFERENCE
,
1528 DERIVED_UNIT_FACADE
,
1532 FEATURE_DISTRIBUTION
,
1537 POLYTOMOUS_KEY_NODE
,
1539 DERIVED_UNIT_GENERAL
,
1551 public AbstractFormSection
createDefinedTermDetailSection(Class definedTermClass
,
1552 ConversationHolder conversation
, ICdmFormElement parentElement
,
1553 ISelectionProvider selectionProvider
, int style
) {
1555 AbstractFormSection section
= new DefinedTermDetailSection(this, definedTermClass
, conversation
, parentElement
, selectionProvider
, style
);
1557 parentElement
.addElement(section
);
1564 * @param definedTermClass
1565 * @param formElement
1569 public AbstractCdmDetailElement
createDefinedTermDetailElement(
1570 Class definedTermClass
, AbstractCdmDetailSection parentElement
,
1572 AbstractCdmDetailElement element
= null;
1574 if (NamedArea
.class.isAssignableFrom(definedTermClass
)){
1575 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1578 element
= new DefinedTermDetailElement(this, parentElement
);
1582 parentElement
.addElement(element
);
1588 * createCdmDetailSection
1593 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType}
1595 * @param parentElement
1596 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1598 * @param selectionProvider
1599 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1602 * @param conversation
1603 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1605 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
1608 public AbstractFormSection
createCdmDetailSection(DetailType detailType
,
1609 ConversationHolder conversation
, ICdmFormElement parentElement
,
1610 ISelectionProvider selectionProvider
, int style
) {
1611 AbstractFormSection section
= null;
1613 switch (detailType
) {
1614 case SCIENTIFICNAME
:
1615 section
= new NameDetailSection(this, conversation
, parentElement
,
1616 selectionProvider
, style
);
1619 section
= new ReferenceDetailSection(this, conversation
,
1620 parentElement
, selectionProvider
, style
);
1622 case NOMENCLATURALREFERENCE
:
1623 section
= new NomenclaturalReferenceDetailSection(this,
1624 conversation
, parentElement
, selectionProvider
, style
);
1627 section
= new TaxonBaseDetailSection(this, conversation
,
1628 parentElement
, selectionProvider
, style
);
1631 section
= new AuthorshipDetailSection(this, conversation
,
1632 parentElement
, selectionProvider
, style
);
1634 case TEAMORPERSONBASE
:
1635 section
= new TeamOrPersonBaseDetailSection(this, conversation
,
1636 parentElement
, selectionProvider
, style
);
1639 section
= new TeamDetailSection(this, conversation
, parentElement
,
1643 section
= new PersonDetailSection(this, conversation
,
1644 parentElement
, null, style
);
1647 section
= new DescriptionDetailSection(this, conversation
,
1648 parentElement
, selectionProvider
, style
);
1650 case DESCRIPTIONELEMENT
:
1651 section
= new DescriptionElementDetailSection(this, conversation
,
1652 parentElement
, selectionProvider
, style
);
1654 case PARSINGMESSAGE
:
1655 section
= new ParsingMessagesSection(this, conversation
,
1656 parentElement
, selectionProvider
, style
);
1659 section
= new NonViralNameDetailSection(this, conversation
,
1660 parentElement
, selectionProvider
, style
);
1663 section
= new eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection(
1664 this, conversation
, parentElement
, selectionProvider
, style
);
1666 case DERIVED_UNIT_FACADE
:
1667 section
= new DerivedUnitFacadeDetailSection(this, conversation
,
1668 parentElement
, selectionProvider
, style
);
1670 case FIELD_OBSERVATION
:
1671 section
= new FieldObservationDetailSection(this, conversation
,
1672 parentElement
, selectionProvider
, style
);
1674 case GATHERING_EVENT
:
1675 section
= new GatheringEventDetailSection(this, conversation
,
1676 parentElement
, selectionProvider
, style
);
1679 section
= new DerivedUnitBaseDetailSection(this, conversation
,
1680 parentElement
, selectionProvider
, style
);
1682 case NATURAL_LANGUAGE
:
1683 section
= new NaturalLanguageSection(this, conversation
,
1684 parentElement
, selectionProvider
, style
);
1686 case FEATURE_DISTRIBUTION
:
1687 section
= new FeatureDistributionDetailSection(this, conversation
,
1688 parentElement
, selectionProvider
, style
);
1690 case CLASSIFICATION
:
1691 section
= new ClassificationDetailSection(this, conversation
,
1692 parentElement
, selectionProvider
, style
);
1695 section
= new TaxonNodeDetailSection(this, conversation
,
1696 parentElement
, selectionProvider
, style
);
1698 case POLYTOMOUS_KEY
:
1699 section
= new PolytomousKeyDetailSection(this, conversation
,
1700 parentElement
, selectionProvider
, style
);
1702 case POLYTOMOUS_KEY_NODE
:
1703 section
= new PolytomousKeyNodeDetailSection(this, conversation
,
1704 parentElement
, selectionProvider
, style
);
1707 section
= new InstitutionDetailSection(this, conversation
,
1708 parentElement
, selectionProvider
, style
);
1710 case DERIVED_UNIT_GENERAL
:
1711 section
= new GeneralDetailSection(this, conversation
,
1712 parentElement
, selectionProvider
, style
);
1715 section
= new HybridDetailSection(this, conversation
,
1716 parentElement
, selectionProvider
, style
);
1719 section
= new UserDetailSection(this, conversation
, parentElement
,
1720 selectionProvider
, style
);
1723 section
= new GroupDetailSection(this, conversation
, parentElement
,
1724 selectionProvider
, style
);
1727 section
= new DeterminationDetailSection(this, conversation
, parentElement
,
1728 selectionProvider
, style
);
1730 case TAXON_RELATIONSHIP
:
1731 section
= new TaxonRelationshipDetailSection(this, conversation
, parentElement
,
1732 selectionProvider
, style
);
1734 case REFERENCED_ENTITY
:
1735 section
= new ReferencedEntityDetailSection(this, conversation
, parentElement
,
1736 selectionProvider
, style
);
1738 case TERM_VOCABULARY
:
1739 section
= new TermVocabularyDetailSection(this, conversation
, parentElement
,
1740 selectionProvider
, style
);
1743 section
= new NamedAreaDetailSection(this, conversation
, parentElement
,
1744 selectionProvider
, style
);
1748 if (section
== null) {
1749 throw new RuntimeException(
1750 "You tried to create a cdm detail section that is not implemented yet.");
1753 parentElement
.addElement(section
);
1762 * createCdmDetailElement
1767 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType}
1771 * @param parentElement
1772 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1775 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
1778 public AbstractCdmDetailElement
createCdmDetailElement(
1779 DetailType detailType
, ICdmFormElement parentElement
, int style
) {
1780 AbstractCdmDetailElement element
= null;
1782 switch (detailType
) {
1783 case SCIENTIFICNAME
:
1784 element
= new NameDetailElement(this, parentElement
, style
);
1787 element
= new ReferenceDetailElement(this, parentElement
, style
);
1789 case NOMENCLATURALREFERENCE
:
1790 element
= new NomenclaturalReferenceDetailElement(this,
1791 parentElement
, style
);
1794 element
= new TaxonBaseDetailElement(this, parentElement
, style
);
1797 element
= new AuthorshipDetailElement(this, parentElement
, style
);
1800 element
= new TeamDetailElement(this, parentElement
, style
);
1803 element
= new PersonDetailElement(this, parentElement
, style
);
1806 element
= new DescriptionDetailElement(this, parentElement
, style
);
1808 case DESCRIPTIONELEMENT
:
1809 element
= new DescriptionElementDetailElement(this, parentElement
,
1813 element
= new NonViralNameDetailElement(this, parentElement
);
1815 case DERIVED_UNIT_FACADE
:
1816 element
= new DerivedUnitFacadeDetailElement(this, parentElement
);
1818 case FIELD_OBSERVATION
:
1819 element
= new FieldObservationDetailElement(this, parentElement
);
1821 case GATHERING_EVENT
:
1822 element
= new GatheringEventDetailElement(this, parentElement
);
1825 element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1827 case NATURAL_LANGUAGE
:
1828 element
= new NaturalLanguageDetailElement(this, parentElement
);
1830 case FEATURE_DISTRIBUTION
:
1831 element
= new FeatureDistributionDetailElement(this, parentElement
);
1833 case CLASSIFICATION
:
1834 element
= new ClassificationDetailElement(this, parentElement
);
1837 element
= new TaxonNodeDetailElement(this, parentElement
);
1840 element
= new CollectionDetailElement(this, parentElement
);
1842 case POLYTOMOUS_KEY
:
1843 element
= new PolytomousKeyDetailElement(this, parentElement
);
1845 case POLYTOMOUS_KEY_NODE
:
1846 element
= new PolytomousKeyNodeDetailElement(this, parentElement
);
1849 element
= new InstitutionDetailElement(this, parentElement
);
1851 case DERIVED_UNIT_GENERAL
:
1852 element
= new GeneralDetailElement(this, parentElement
);
1855 element
= new HybridDetailElement(this, parentElement
);
1858 element
= new UserDetailElement(this, parentElement
);
1861 element
= new GroupDetailElement(this, parentElement
);
1864 element
= new DeterminationDetailElement(this, parentElement
);
1866 case TAXON_RELATIONSHIP
:
1867 element
= new TaxonRelationshipDetailElement(this, parentElement
);
1869 case REFERENCED_ENTITY
:
1870 element
= new RefereneEntityDetailElement(this, parentElement
);
1872 case TERM_VOCABULARY
:
1873 element
= new TermVocabularyDetailElement(this, parentElement
);
1876 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1878 case NAMED_AREA_LEVEL
:
1879 element
= new DefinedTermDetailElement
<NamedAreaLevel
>(this, parentElement
);
1883 if (element
== null) {
1885 .error(this.getClass(),
1886 "Detail element was not created. Seems like the case was not implemented for the requested detail type: "
1887 + detailType
, null);
1891 parentElement
.addElement(element
);
1897 * @author n.hoffmann
1898 * @created Mar 5, 2010
1901 public static enum EntityDetailType
{
1906 DESCRIPTIONELEMENTSOURCE
,
1910 DESCRIPTIONELEMENTMEDIA
,
1911 MEDIAREPRESENTATION
,
1912 MEDIAREPRESENTATIONPART
,
1914 NOMENCLATURALSTATUS
,
1923 STATISTICAL_MEASUREMENT_VALUE
,
1926 DETERMINATION_EVENT
,
1927 SPECIMEN_COLLECTION
,
1928 IDENTIFIABLE_SOURCE_COLLECTION
,
1935 DETERMINATION_CURRENT
,
1936 DETERMINATION_HISTORY
1941 * createEntityDetailSection
1944 * @param entityDetailType
1946 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EntityDetailType}
1950 * @param conversation
1951 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1953 * @param parentElement
1954 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1956 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
1959 public AbstractFormSection
createEntityDetailSection(
1960 EntityDetailType entityDetailType
, ConversationHolder conversation
,
1961 ICdmFormElement parentElement
, int style
) {
1962 AbstractFormSection section
= null;
1964 switch (entityDetailType
) {
1966 section
= new TeamDetailSection(this, conversation
, parentElement
,
1970 section
= new TeamMemberSection(this, conversation
, parentElement
,
1974 section
= new AnnotationSection(this, conversation
, parentElement
,
1978 section
= new CreditSection(this, conversation
, parentElement
,
1981 case DESCRIPTIONELEMENTSOURCE
:
1982 section
= new DescriptionElementSourceSection(this, conversation
,
1983 parentElement
, style
);
1986 section
= new ExtensionSection(this, conversation
, parentElement
,
1990 section
= new MarkerSection(this, conversation
, parentElement
,
1994 section
= new MediaSection(this, conversation
, parentElement
, style
);
1996 case DESCRIPTIONELEMENTMEDIA
:
1997 section
= new DescriptionElementMediaSection(this, conversation
,
1998 parentElement
, style
);
2000 case MEDIAREPRESENTATION
:
2001 section
= new MediaRepresentationSection(this, conversation
,
2002 parentElement
, style
);
2004 case MEDIAREPRESENTATIONPART
:
2005 section
= new MediaRepresentationPartSection(this, conversation
,
2006 parentElement
, style
);
2009 section
= new ModifierSection(this, conversation
, parentElement
,
2012 case NOMENCLATURALSTATUS
:
2013 section
= new NomenclaturalStatusSection(this, conversation
,
2014 parentElement
, style
);
2016 case NAME_RELATIONSHIP
:
2017 section
= new NameRelationshipDetailSection(this, conversation
,
2018 parentElement
, style
);
2021 section
= new ProtologueSection(this, conversation
, parentElement
,
2025 section
= new RightsSection(this, conversation
, parentElement
,
2029 section
= new SourceSection(this, conversation
, parentElement
,
2033 section
= new ScopeSection(this, conversation
, parentElement
, style
);
2035 case DESCRIPTIONSOURCE
:
2036 section
= new DescriptionSourceSection(this, conversation
,
2037 parentElement
, style
);
2039 case TYPEDESIGNATION
:
2040 section
= new TypeDesignationSection(this, conversation
,
2041 parentElement
, style
);
2044 section
= new StateDataSection(this, conversation
, parentElement
,
2047 case STATISTICAL_MEASUREMENT_VALUE
:
2048 section
= new StatisticalMeasurementValueSection(this,
2049 conversation
, parentElement
, style
);
2051 case DESCRIBED_SPECIMEN
:
2052 section
= new DescribedSpecimenSection(this, conversation
,
2053 parentElement
, style
);
2055 case COLLECTING_AREA
:
2056 section
= new CollectingAreasDetailSection(this, conversation
,
2057 parentElement
, style
);
2059 case DETERMINATION_CURRENT
:
2060 section
= new CurrentDeterminationDetailSection(this, conversation
,
2061 parentElement
, style
);
2063 case DETERMINATION_HISTORY
:
2064 section
= new DeterminationHistoryDetailSection(this, conversation
,
2065 parentElement
, style
);
2067 case SPECIMEN_COLLECTION
:
2068 section
= new SpecimenCollectionDetailSection(this, conversation
,
2069 parentElement
, style
);
2071 case IDENTIFIABLE_SOURCE_COLLECTION
:
2072 section
= new SourceCollectionDetailSection(this, conversation
,
2073 parentElement
, style
);
2075 case GEOGRAPHICAL_SCOPE
:
2076 section
= new GeographicalScopeDetailSection(this, conversation
,
2077 parentElement
, style
);
2079 case SCOPE_RESTRICTION
:
2080 section
= new ScopeRestrictionSection(this, conversation
,
2081 parentElement
, style
);
2084 section
= new MemberDetailSection(this, conversation
,
2085 parentElement
, style
);
2087 case GRANTED_AUTHORITY
:
2088 section
= new GrantedAuthorityDetailSection(this, conversation
,
2089 parentElement
, style
);
2091 case GROUPS_BY_USER
:
2092 section
= new GroupsByUserDetailSection(this, conversation
,
2093 parentElement
, style
);
2095 case TAXONOMIC_SCOPE
:
2096 section
= new TaxonomicScopeSection(this, conversation
,
2097 parentElement
, style
);
2100 parentElement
.addElement(section
);
2107 * createEntityCollectionElement
2110 * @param removeListener
2111 * a {@link org.eclipse.swt.events.SelectionListener} object.
2114 * @param parentElement
2115 * a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
2117 * @param versionableEntity
2118 * a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity}
2120 * @param backgroundColor
2121 * a {@link org.eclipse.swt.graphics.Color} object.
2123 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement}
2126 public AbstractEntityCollectionElement
createEntityCollectionElement(
2127 AbstractFormSection parentElement
, Object versionableEntity
,
2128 SelectionListener removeListener
, Color backgroundColor
, int style
) {
2129 AbstractEntityCollectionElement element
= null;
2131 Object entity
= HibernateProxyHelper
.deproxy(versionableEntity
);
2133 if (entity
instanceof Annotation
) {
2134 element
= new AnnotationElement(this, parentElement
,
2135 (Annotation
) entity
, removeListener
, style
);
2136 } else if (entity
instanceof Person
) {
2137 element
= new TeamMemberElement(this, parentElement
,
2138 (Person
) entity
, removeListener
, style
);
2139 } else if (entity
instanceof Credit
) {
2140 element
= new CreditElement(this, parentElement
, (Credit
) entity
,
2141 removeListener
, style
);
2142 } else if (entity
instanceof Extension
) {
2143 element
= new ExtensionElement(this, parentElement
,
2144 (Extension
) entity
, removeListener
, style
);
2145 } else if (entity
instanceof Marker
) {
2146 element
= new MarkerElement(this, parentElement
, (Marker
) entity
,
2147 removeListener
, style
);
2148 } else if (entity
instanceof Media
) {
2149 element
= new MediaElement(this, parentElement
, (Media
) entity
,
2150 removeListener
, style
);
2151 } else if (entity
instanceof MediaRepresentation
) {
2152 element
= new MediaRepresentationElement(this, parentElement
,
2153 (MediaRepresentation
) entity
, removeListener
, style
);
2154 } else if (entity
instanceof ImageFile
) {
2155 element
= new ImageFileElement(this, parentElement
,
2156 (ImageFile
) entity
, removeListener
, style
);
2157 } else if (entity
instanceof MediaRepresentationPart
){
2158 element
= new MediaRepresentationPartElement(this, parentElement
,
2159 (MediaRepresentationPart
) entity
, removeListener
, style
);
2160 } else if (entity
instanceof NomenclaturalStatus
) {
2161 element
= new NomenclaturalStatusElement(this, parentElement
,
2162 (NomenclaturalStatus
) entity
, removeListener
, style
);
2163 } else if (entity
instanceof Rights
) {
2164 element
= new RightsElement(this, parentElement
, (Rights
) entity
,
2165 removeListener
, style
);
2166 } else if (entity
instanceof DescriptionElementSource
) {
2167 element
= new DescriptionElementSourceElement(this, parentElement
,
2168 (DescriptionElementSource
) entity
, removeListener
, style
);
2169 } else if (entity
instanceof IdentifiableSource
) {
2170 element
= new IdentifiableSourceElement(this, parentElement
,
2171 (IdentifiableSource
) entity
, removeListener
, style
);
2172 } else if (entity
instanceof Scope
) {
2173 element
= new ScopeElement(this, parentElement
, (Scope
) entity
,
2174 removeListener
, style
);
2175 } else if (entity
instanceof Modifier
) {
2176 element
= new ModifierElement(this, parentElement
,
2177 (Modifier
) entity
, removeListener
, style
);
2178 } else if (entity
instanceof Reference
) {
2179 element
= new DescriptionSourceElement(this, parentElement
,
2180 (Reference
) entity
, removeListener
, style
);
2181 } else if (entity
instanceof NameTypeDesignation
) {
2182 element
= new NameTypeDesignationElement(this, parentElement
,
2183 (NameTypeDesignation
) entity
, removeListener
, style
);
2184 } else if (entity
instanceof NameRelationship
) {
2185 element
= new NameRelationshipDetailElement(this, parentElement
,
2186 (NameRelationship
) entity
, removeListener
, style
);
2187 } else if (entity
instanceof SpecimenTypeDesignation
) {
2188 element
= new SpecimenTypeDesignationElement(this, parentElement
,
2189 (SpecimenTypeDesignation
) entity
, removeListener
, style
);
2190 } else if (entity
instanceof StateData
) {
2191 element
= new StateDataElement(this, parentElement
,
2192 (StateData
) entity
, removeListener
, style
);
2193 } else if (entity
instanceof StatisticalMeasurementValue
) {
2194 element
= new StatisticalMeasurementValueElement(this,
2195 parentElement
, (StatisticalMeasurementValue
) entity
,
2196 removeListener
, style
);
2197 } else if (entity
instanceof DerivedUnit
) {
2198 element
= new DerivedUnitElement(this, parentElement
,
2199 (DerivedUnit
) entity
, removeListener
, style
);
2200 } else if (entity
instanceof NamedArea
) {
2201 element
= new NamedAreaDetailElement(this, parentElement
,
2202 (NamedArea
) entity
, removeListener
, style
);
2203 } else if (entity
instanceof DeterminationEvent
) {
2204 element
= new DeterminationEventDetailElement(this, parentElement
,
2205 (DeterminationEvent
) entity
, removeListener
, style
);
2206 } else if (entity
instanceof Specimen
) {
2207 element
= new SpecimenCollectionDetailElement(this, parentElement
,
2208 (Specimen
) entity
, removeListener
, style
);
2209 } else if (entity
instanceof User
) {
2210 element
= new MemberDetailElement(this, parentElement
,
2211 (User
) entity
, removeListener
, style
);
2212 } else if (entity
instanceof GrantedAuthority
) {
2213 element
= new GrantedAuthorityDetailElement(this, parentElement
,
2214 (GrantedAuthority
) entity
, removeListener
, style
);
2215 } else if (entity
instanceof Group
) {
2216 element
= new GroupsByUserDetailElement(this, parentElement
,
2217 (Group
) entity
, removeListener
, style
);
2218 } else if (entity
instanceof Taxon
) {
2219 element
= new TaxonDetailElement(this, parentElement
,
2220 (Taxon
) entity
, removeListener
, style
);
2221 } else if (entity
instanceof DescriptionElementBase
) {
2222 // this is the special case for protologs, maybe we can do this
2223 // differently when API improves
2224 DescriptionElementBase descriptionElement
= (DescriptionElementBase
) entity
;
2225 if (descriptionElement
.getFeature().equals(Feature
.PROTOLOGUE())) {
2226 element
= new ProtologueElement(this, parentElement
,
2227 descriptionElement
, removeListener
, style
);
2231 if (element
== null) {
2234 "No element for entity",
2236 "Could not generate element for entity. "
2237 + "Looks like the case is not handled already. Check implementation. Entity: "
2242 if (backgroundColor
!= null && !backgroundColor
.isDisposed()) {
2243 element
.setPersistentBackground(backgroundColor
);
2247 parentElement
.addElement(element
);
2253 * createSelectionElement
2256 * @param selectionType
2258 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType}
2260 * @param parentElement
2261 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
2263 * @param labelString
2264 * a {@link java.lang.String} object.
2265 * @param selectionType
2267 * a {@link eu.etaxonomy.cdm.model.common.IAnnotatableEntity}
2271 * @param conversation
2272 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
2275 * {@link eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement}
2278 public AbstractSelectionElement
createSelectionElement(
2279 SelectionType selectionType
, ConversationHolder conversation
,
2280 ICdmFormElement parentElement
, String labelString
,
2281 ICdmBase selection
, int mode
, int style
) {
2282 AbstractSelectionElement element
= null;
2284 IAnnotatableEntity entity
= (IAnnotatableEntity
) HibernateProxyHelper
2285 .deproxy(selection
);
2287 switch (selectionType
) {
2289 element
= new AgentSelectionElement(this, conversation
,
2290 parentElement
, labelString
, (TeamOrPersonBase
) entity
,
2294 element
= new PersonSelectionElement(this, conversation
,
2295 parentElement
, labelString
, (Person
) entity
, mode
, style
);
2298 element
= new TeamSelectionElement(this, conversation
,
2299 parentElement
, labelString
, (Team
) entity
, mode
, style
);
2302 element
= new NomenclaturalAuthorTeamSelectionElement(this,
2303 conversation
, parentElement
, labelString
, (Team
) entity
,
2307 element
= new InstitutionSelectionElement(this, conversation
,
2308 parentElement
, labelString
, (Institution
) entity
, mode
,
2312 element
= new NameSelectionElement(this, conversation
,
2313 parentElement
, labelString
, (TaxonNameBase
) entity
, mode
,
2317 element
= new ReferenceSelectionElement(this, conversation
,
2318 parentElement
, labelString
, (Reference
) entity
, mode
, style
);
2321 element
= new TaxonBaseSelectionElement(this, conversation
,
2322 parentElement
, labelString
, (TaxonBase
) entity
, mode
, style
);
2325 element
= new TaxonSelectionElement(this, conversation
,
2326 parentElement
, labelString
, (Taxon
) entity
, mode
, style
);
2329 element
= new SynonymSelectionElement(this, conversation
,
2330 parentElement
, labelString
, (Synonym
) entity
, mode
, style
);
2333 element
= new DerivedUnitBaseSelectionElement(this, conversation
,
2334 parentElement
, labelString
, (DerivedUnitBase
) entity
, mode
,
2337 case FIELD_OBSERVATION
:
2338 element
= new FieldObservationSelectionElement(this, conversation
,
2339 parentElement
, labelString
, (FieldObservation
) entity
,
2343 element
= new FeatureTreeSelectionElement(this, conversation
,
2344 parentElement
, labelString
, (FeatureTree
) entity
, mode
,
2347 case CLASSIFICATION
:
2348 element
= new ClassificationSelectionElement(this, conversation
,
2349 parentElement
, labelString
, (Classification
) entity
, mode
,
2353 element
= new TaxonNodeSelectionElement(this, conversation
,
2354 parentElement
, labelString
, (TaxonNode
) entity
, mode
, style
);
2357 element
= new CollectionSelectionElement(this, conversation
,
2358 parentElement
, labelString
, (Collection
) entity
, mode
,
2362 element
= new FeatureSelectionElement(this, conversation
,
2363 parentElement
, labelString
, (Feature
) entity
, mode
, style
);
2365 case POLYTOMOUS_KEY
:
2366 element
= new PolytomousKeySelectionElement(this, conversation
,
2367 parentElement
, labelString
, (PolytomousKey
) entity
, mode
,
2370 case POLYTOMOUS_KEY_NODE
:
2371 element
= new PolytomousKeyNodeSelectionElement(this, conversation
,
2372 parentElement
, labelString
, (PolytomousKeyNode
) entity
,
2376 element
= new UserSelectionElement(this, conversation
,
2377 parentElement
, labelString
, (User
) entity
, mode
, style
);
2380 element
= new GroupSelectionElement(this, conversation
,
2381 parentElement
, labelString
, (Group
) entity
, mode
, style
);
2384 new RuntimeException(
2385 "There is no selection composite for the desired selection type.");
2390 parentElement
.addElement(element
);
2396 * createNamedAreaSelectionElement
2399 * @param parentElement
2400 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
2402 * @param conversation
2403 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
2405 * @param labelString
2406 * a {@link java.lang.String} object.
2408 * a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
2412 * {@link eu.etaxonomy.taxeditor.ui.selection.NamedAreaSelectionElement}
2415 public NamedAreaSelectionElement
createNamedAreaSelectionElement(
2416 ICdmFormElement parentElement
, ConversationHolder conversation
,
2417 String labelString
, NamedArea selection
, int style
) {
2418 NamedAreaSelectionElement element
= new NamedAreaSelectionElement(this,
2419 conversation
, parentElement
, labelString
, selection
,
2420 AbstractSelectionElement
.NOTHING
, style
);
2422 parentElement
.addElement(element
);
2426 /** {@inheritDoc} */
2427 public LabelElement
createLabel(ICdmFormElement parentElement
, String text
) {
2428 LabelElement labelElement
= new LabelElement(this, parentElement
, text
);
2429 adapt(labelElement
);
2430 parentElement
.addElement(labelElement
);
2431 return labelElement
;
2436 * Getter for the field <code>selectionProvider</code>.
2439 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
2441 public ISelectionProvider
getSelectionProvider() {
2442 return selectionProvider
;
2447 * createDetailedDescriptionDetailElement
2450 * @param parentElement
2451 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
2455 * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
2460 * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
2463 public AbstractDetailedDescriptionDetailElement
createDetailedDescriptionDetailElement(
2464 ICdmFormElement parentElement
, DescriptionElementBase entity
,
2466 AbstractDetailedDescriptionDetailElement detailedDescriptionElement
= null;
2468 if (entity
instanceof CategoricalData
) {
2469 detailedDescriptionElement
= new CategoricalDataDetailElement(this,
2470 parentElement
, (CategoricalData
) entity
, style
);
2471 } else if (entity
instanceof CommonTaxonName
) {
2472 detailedDescriptionElement
= new CommonNameDetailElement(this,
2473 parentElement
, (CommonTaxonName
) entity
, style
);
2474 } else if (entity
instanceof Distribution
) {
2475 detailedDescriptionElement
= new DistributionDetailElement(this,
2476 parentElement
, (Distribution
) entity
, style
);
2477 } else if (entity
instanceof IndividualsAssociation
) {
2478 detailedDescriptionElement
= new IndividualsAssociationDetailElement(
2479 this, parentElement
, (IndividualsAssociation
) entity
, style
);
2480 } else if (entity
instanceof QuantitativeData
) {
2481 detailedDescriptionElement
= new QuantitativeDataDetailElement(
2482 this, parentElement
, (QuantitativeData
) entity
, style
);
2483 } else if (entity
instanceof TaxonInteraction
) {
2484 detailedDescriptionElement
= new TaxonInteractionDetailElement(
2485 this, parentElement
, (TaxonInteraction
) entity
, style
);
2486 } else if (entity
instanceof TextData
) {
2487 detailedDescriptionElement
= new TextDataDetailElement(this,
2488 parentElement
, (TextData
) entity
, style
);
2490 throw new IllegalStateException(
2491 "There is no interface for the given description element");
2493 adapt(detailedDescriptionElement
);
2494 parentElement
.addElement(detailedDescriptionElement
);
2495 return detailedDescriptionElement
;
2500 * Creates a styled text as a part of the form.
2505 * the text initial value
2508 * @return the text widget
2510 public StyledText
createStyledText(Composite parent
, String value
, int style
) {
2511 StyledText text
= new StyledText(parent
, getBorderStyle() | style
2512 | getOrientation());
2514 text
.setText(value
);
2515 text
.setForeground(getColors().getForeground());
2516 text
.setBackground(getColors().getBackground());
2517 // text.addFocusListener(visibilityHandler);