4 package eu
.etaxonomy
.taxeditor
.ui
.element
;
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
.EnumComboElement
;
111 import eu
.etaxonomy
.taxeditor
.ui
.combo
.TermComboElement
;
112 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.IOpenUrlEnabled
;
113 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.OpenUrlSelectorElement
;
114 import eu
.etaxonomy
.taxeditor
.ui
.password
.EditPasswordElement
;
115 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
116 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailSection
;
117 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
118 import eu
.etaxonomy
.taxeditor
.ui
.section
.EmptyElement
;
119 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailElement
;
120 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailSection
;
121 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailElement
;
122 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailSection
;
123 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailElement
;
124 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailSection
;
125 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberElement
;
126 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberSection
;
127 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamOrPersonBaseDetailSection
;
128 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailElement
;
129 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailSection
;
130 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailElement
;
131 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailSection
;
132 import eu
.etaxonomy
.taxeditor
.ui
.section
.common
.ReferencedEntityDetailSection
;
133 import eu
.etaxonomy
.taxeditor
.ui
.section
.common
.RefereneEntityDetailElement
;
134 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DerivedUnitElement
;
135 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescribedSpecimenSection
;
136 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailElement
;
137 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailSection
;
138 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailElement
;
139 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailSection
;
140 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementMediaSection
;
141 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceElement
;
142 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceSection
;
143 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceElement
;
144 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceSection
;
145 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierElement
;
146 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierSection
;
147 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageDetailElement
;
148 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageSection
;
149 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeElement
;
150 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeSection
;
151 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataElement
;
152 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataSection
;
153 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueElement
;
154 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueSection
;
155 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.AbstractDetailedDescriptionDetailElement
;
156 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CategoricalDataDetailElement
;
157 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CommonNameDetailElement
;
158 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.DistributionDetailElement
;
159 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.IndividualsAssociationDetailElement
;
160 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.QuantitativeDataDetailElement
;
161 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TaxonInteractionDetailElement
;
162 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TextDataDetailElement
;
163 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailElement
;
164 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailSection
;
165 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GrantedAuthorityDetailElement
;
166 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GrantedAuthorityDetailSection
;
167 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailElement
;
168 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailSection
;
169 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailElement
;
170 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailSection
;
171 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.GeographicalScopeDetailSection
;
172 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailElement
;
173 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailSection
;
174 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailElement
;
175 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailSection
;
176 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.ScopeRestrictionSection
;
177 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.TaxonomicScopeSection
;
178 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.ImageFileElement
;
179 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaElement
;
180 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationElement
;
181 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationPartElement
;
182 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationPartSection
;
183 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationSection
;
184 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaSection
;
185 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailElement
;
186 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailSection
;
187 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailElement
;
188 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailSection
;
189 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailElement
;
190 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailSection
;
191 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailElement
;
192 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailSection
;
193 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameTypeDesignationElement
;
194 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusElement
;
195 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusSection
;
196 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailElement
;
197 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailSection
;
198 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueElement
;
199 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueSection
;
200 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.SpecimenTypeDesignationElement
;
201 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.TypeDesignationSection
;
202 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectingAreasDetailSection
;
203 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectionDetailElement
;
204 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CurrentDeterminationDetailSection
;
205 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailElement
;
206 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailSection
;
207 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailElement
;
208 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailSection
;
209 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailElement
;
210 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailSection
;
211 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationEventDetailElement
;
212 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationHistoryDetailSection
;
213 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailElement
;
214 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailSection
;
215 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailElement
;
216 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailSection
;
217 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailElement
;
218 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailSection
;
219 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.NamedAreaDetailElement
;
220 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SourceCollectionDetailSection
;
221 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailElement
;
222 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailSection
;
223 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailElement
;
224 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailSection
;
225 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailElement
;
226 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailSection
;
227 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationElement
;
228 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationSection
;
229 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditElement
;
230 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditSection
;
231 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionElement
;
232 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionSection
;
233 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.HeadlineSection
;
234 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.IdentifiableSourceElement
;
235 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerElement
;
236 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerSection
;
237 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsElement
;
238 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
239 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.SourceSection
;
240 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionElement
;
241 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionSection
;
242 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessageElement
;
243 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
244 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailElement
;
245 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
246 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonDetailElement
;
247 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailElement
;
248 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailSection
;
249 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailElement
;
250 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailSection
;
251 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailElement
;
252 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailSection
;
253 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.DefinedTermDetailElement
;
254 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.DefinedTermDetailSection
;
255 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailSection
;
256 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailElement
;
257 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailSection
;
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
;
284 * CdmFormFactory class.
288 * @created Feb 24, 2010
291 public class CdmFormFactory
extends FormToolkit
{
293 private BoldFontHolder2 boldFontHolder2
;
294 private MouseListener selectionMouseHandler
;
295 private FocusListener selectionFocusHandler
;
297 private final Set selectionListenerList
= new HashSet();
299 private final List
<IPropertyChangeListener
> propertyChangeListeners
= new ArrayList
<IPropertyChangeListener
>();
301 private final int orientation
= Window
.getDefaultOrientation();
302 private ISelectionProvider selectionProvider
;
309 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
311 public static final TableWrapLayout
LAYOUT() {
312 return LAYOUT(1, false);
324 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
326 public static final TableWrapLayout
LAYOUT(int columns
, boolean equalWidth
) {
327 TableWrapLayout layout
= new TableWrapLayout();
328 layout
.topMargin
= 0;
329 layout
.rightMargin
= 0;
330 layout
.bottomMargin
= 0;
331 layout
.leftMargin
= 0;
332 layout
.numColumns
= columns
;
333 layout
.makeColumnsEqualWidth
= equalWidth
;
334 layout
.verticalSpacing
= 0;
335 layout
.horizontalSpacing
= 0;
344 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
346 public static final TableWrapData
FILL() {
355 * @param horizontalSpan
357 * @param verticalSpan
359 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
361 public static final TableWrapData
FILL(int horizontalSpan
, int verticalSpan
) {
362 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
,
363 TableWrapData
.FILL_GRAB
);
364 layoutData
.colspan
= horizontalSpan
;
365 layoutData
.rowspan
= verticalSpan
;
374 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
376 public static final TableWrapData
LEFT() {
377 return new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
);
385 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
387 public static final TableWrapData
RIGHT() {
388 return new TableWrapData(TableWrapData
.RIGHT
, TableWrapData
.TOP
);
396 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
398 public static final TableWrapData
FILL_HORIZONTALLY() {
399 return FILL_HORIZONTALLY(1, 1);
407 * @param horizontalSpan
409 * @param verticalSpan
411 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
413 public static final TableWrapData
FILL_HORIZONTALLY(int horizontalSpan
,
415 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
,
417 layoutData
.colspan
= horizontalSpan
;
418 layoutData
.rowspan
= verticalSpan
;
422 /** Constant <code>EMPTY_SELECTION</code> */
423 public static ISelection EMPTY_SELECTION
= new ISelection() {
425 public boolean isEmpty() {
430 private class SelectionMouseHandler
extends MouseAdapter
{
432 public void mouseDown(MouseEvent e
) {
433 notifySelectionListeners(e
);
437 private class SelectionFocusHandler
extends FocusAdapter
{
439 public void focusGained(FocusEvent e
) {
440 notifySelectionListeners(e
);
444 private void notifySelectionListeners(TypedEvent e
) {
445 Event event
= new Event();
446 event
.widget
= e
.widget
;
447 SelectionEvent selectionEvent
= new SelectionEvent(event
);
449 for (Object listener
: selectionListenerList
) {
450 ((SelectionListener
) listener
).widgetSelected(selectionEvent
);
456 * Constructor for CdmFormFactory.
460 * a {@link org.eclipse.swt.widgets.Display} object.
461 * @param selectionProvider
462 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
464 public CdmFormFactory(Display display
, ISelectionProvider selectionProvider
) {
466 this.selectionProvider
= selectionProvider
;
472 * Constructor for CdmFormFactory.
476 * a {@link org.eclipse.swt.widgets.Display} object.
478 public CdmFormFactory(Display display
) {
486 private void init() {
487 boldFontHolder2
= new BoldFontHolder2();
488 selectionMouseHandler
= new SelectionMouseHandler();
489 selectionFocusHandler
= new SelectionFocusHandler();
493 * Creates an instance initialized with the correct selectionProvider
495 * Make sure to remove the instance when the entityComposite disposes via
496 * destroySelectionArbitrator(..)
498 * @param entityElement
499 * a {@link eu.etaxonomy.taxeditor.ui.element.IEntityElement}
501 * @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
504 public SelectionArbitrator
createSelectionArbitrator(
505 IEntityElement entityElement
) {
506 SelectionArbitrator selectionArbitrator
= new SelectionArbitrator(
508 selectionArbitrator
.addSelectionProvider(selectionProvider
);
509 selectionProvider
.addSelectionChangedListener(selectionArbitrator
);
510 addSelectionListener(selectionArbitrator
);
511 return selectionArbitrator
;
516 * destroySelectionArbitrator
519 * @param selectionArbitrator
520 * a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
523 public void destroySelectionArbitrator(
524 SelectionArbitrator selectionArbitrator
) {
525 removeSelectionListener(selectionArbitrator
);
526 if (selectionProvider
!= null) {
528 .removeSelectionChangedListener(selectionArbitrator
);
531 .error(this.getClass(),
532 "Tried to destroy a selection listener from this factories listeners but was null",
539 public void adapt(Composite composite
) {
540 composite
.addMouseListener(selectionMouseHandler
);
541 super.adapt(composite
);
551 * {@link eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement}
554 public void adapt(AbstractCdmFormElement formElement
) {
555 formElement
.setPropertyChangeListeners(propertyChangeListeners
);
560 public void adapt(Control control
, boolean trackFocus
, boolean trackKeyboard
) {
562 control
.addFocusListener(selectionFocusHandler
);
564 super.adapt(control
, trackFocus
, trackKeyboard
);
573 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
576 public void destroyElement(ICdmFormElement formElement
) {
577 // return if element was not initialized
578 if (formElement
== null) {
581 // destroy selection arbitrator, if any
582 if (formElement
instanceof ISelectableElement
) {
583 destroySelectionArbitrator(((ISelectableElement
) formElement
)
584 .getSelectionArbitrator());
586 // remove this element form its parents list of elements
587 // ICdmFormElement parentElement = formElement.getParentElement();
588 // if(parentElement != null){
589 // parentElement.removeElement(formElement);
591 // call destroy on child elements recursively
592 for (ICdmFormElement childElement
: formElement
.getElements()) {
593 destroyElement(childElement
);
595 // dispose of the controls
596 for (Control control
: formElement
.getControls()) {
597 // we added the layoutComposite of the parental element as the
598 // layout composite to this formElement
599 // but we do not want to destroy it.
600 if (control
.equals(formElement
.getLayoutComposite())) {
615 * a {@link org.eclipse.swt.widgets.Composite} object.
616 * @return a {@link org.eclipse.swt.widgets.Label} object.
618 public Label
createEmptyCell(Composite parent
) {
619 return this.createLabel(parent
, null);
624 * createMultilineTextWithLabel
628 * a {@link java.lang.String} object.
633 * @param parentElement
634 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
636 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
639 public TextWithLabelElement
createMultilineTextWithLabel(
640 ICdmFormElement parentElement
, String labelString
, int textHeight
,
642 TextWithLabelElement element
= new TextWithLabelElement(this,
643 parentElement
, labelString
, "", textHeight
, style
);
645 parentElement
.addElement(element
);
651 * createMultiLanguageTextElement
654 * @param parentElement
655 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
658 * a {@link java.lang.String} object.
659 * @param multilanguageText
660 * a {@link java.util.Map} object.
666 * {@link eu.etaxonomy.taxeditor.ui.element.MultilanguageTextElement}
669 public MultilanguageTextElement
createMultiLanguageTextElement(
670 ICdmFormElement parentElement
, String labelString
,
671 Map
<Language
, LanguageString
> multilanguageText
, int textHeight
,
673 MultilanguageTextElement element
= new MultilanguageTextElement(this,
674 parentElement
, labelString
, multilanguageText
, textHeight
,
677 parentElement
.addElement(element
);
681 public KeyStatementElement
createKeyStatementElement(
682 ICdmFormElement parentElement
, String labelString
,
683 KeyStatement keyStatement
, int textHeight
, int style
) {
684 KeyStatementElement element
= new KeyStatementElement(this,
685 parentElement
, labelString
, keyStatement
, textHeight
, style
);
687 parentElement
.addElement(element
);
693 * createTextWithLabelElement
697 * a {@link java.lang.String} object.
699 * a {@link java.lang.String} object.
702 * @param parentElement
703 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
705 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
708 public TextWithLabelElement
createTextWithLabelElement(
709 ICdmFormElement parentElement
, String labelString
,
710 String initialText
, int style
) {
711 TextWithLabelElement element
= new TextWithLabelElement(this,
712 parentElement
, labelString
, initialText
, null, style
);
714 parentElement
.addElement(element
);
718 public UriWithLabelElement
createUriWithLabelElement(
719 ICdmFormElement parentElement
, String labelString
, URI initialUri
,
721 UriWithLabelElement element
= new UriWithLabelElement(this,
722 parentElement
, labelString
, initialUri
, null, style
);
724 parentElement
.addElement(element
);
735 public OpenUrlSelectorElement
createOpenUrlSelectorElement(
736 ICdmFormElement parentElement
, String labelString
,
737 IOpenUrlEnabled openUrlEnabled
, int style
) {
738 OpenUrlSelectorElement element
= new OpenUrlSelectorElement(this,
739 parentElement
, labelString
, openUrlEnabled
, style
);
741 parentElement
.addElement(element
);
747 * @param parentElement
749 * @param conversationEnabled
754 public EditPasswordElement
createEditPasswordElement(
755 ICdmFormElement parentElement
, String labelString
,
756 ConversationHolder conversation
, User user
, int style
) {
757 EditPasswordElement element
= new EditPasswordElement(this,
758 parentElement
, labelString
, user
, conversation
);
760 parentElement
.addElement(element
);
766 * createIntegerTextWithLabelElement
769 * @param parentElement
770 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
773 * a {@link java.lang.String} object.
774 * @param initialInteger
775 * a {@link java.lang.Integer} object.
778 * @return a {@link eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement}
781 public NumberWithLabelElement
createIntegerTextWithLabelElement(
782 ICdmFormElement parentElement
, String labelString
,
783 Integer initialInteger
, int style
) {
784 NumberWithLabelElement element
= new NumberWithLabelElement(this,
785 parentElement
, labelString
, initialInteger
, style
);
787 parentElement
.addElement(element
);
793 * createFloatTextWithLabelElement
796 * @param parentElement
797 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
800 * a {@link java.lang.String} object.
801 * @param initialFloat
805 * @return a {@link eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement}
808 public NumberWithLabelElement
createFloatTextWithLabelElement(
809 ICdmFormElement parentElement
, String labelString
,
810 float initialFloat
, int style
) {
811 NumberWithLabelElement element
= new NumberWithLabelElement(this,
812 parentElement
, labelString
, initialFloat
, style
);
814 parentElement
.addElement(element
);
820 * createLanguageStringWithLabelElement
823 * @param parentElement
824 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
827 * a {@link java.lang.String} object.
828 * @param languageString
829 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
833 * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
836 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
837 ICdmFormElement parentElement
, String labelString
,
838 LanguageString languageString
, int style
) {
839 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
840 this, parentElement
, labelString
, languageString
, style
);
842 parentElement
.addElement(element
);
848 * createLanguageStringWithLabelElement
851 * @param parentElement
852 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
855 * a {@link java.lang.String} object.
856 * @param languageString
857 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
863 * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
866 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
867 ICdmFormElement parentElement
, String labelString
,
868 LanguageString languageString
, int height
, int style
) {
869 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
870 this, parentElement
, labelString
, languageString
, height
, style
);
872 parentElement
.addElement(element
);
881 * @param parentElement
882 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
885 * a {@link java.lang.String} object.
888 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
891 public TextWithLabelElement
createTextElement(
892 ICdmFormElement parentElement
, String initialText
, int style
) {
893 TextWithLabelElement element
= new TextWithLabelElement(this,
894 parentElement
, null, initialText
, null, style
);
896 parentElement
.addElement(element
);
902 * createKeyValueViewerElement
905 * @param parentElement
906 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
909 * a {@link java.lang.String} object.
910 * @param valueHeading
911 * a {@link java.lang.String} object.
913 * a {@link java.util.Map} object.
914 * @return a {@link eu.etaxonomy.taxeditor.ui.element.KeyValueViewerElement}
917 public KeyValueViewerElement
createKeyValueViewerElement(
918 ICdmFormElement parentElement
, String keyHeading
,
919 String valueHeading
, Map
<Object
, Object
> map
) {
920 KeyValueViewerElement element
= new KeyValueViewerElement(this,
921 parentElement
, keyHeading
, valueHeading
, map
);
923 parentElement
.addElement(element
);
929 * createTermComboElement
932 * @param termComboType
934 * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.TermComboType}
936 * @param parentElement
937 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
940 * a {@link java.lang.String} object.
942 * a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase}
946 * @return a {@link eu.etaxonomy.taxeditor.ui.combo.TermComboElement}
950 public <T
extends DefinedTermBase
> TermComboElement
<T
> createTermComboElement(
951 Class
<T
> termComboType
, ICdmFormElement parentElement
,
952 String labelString
, T selection
, int style
) {
953 TermComboElement
<T
> element
= new TermComboElement
<T
>(this, parentElement
, termComboType
, labelString
, selection
, style
);
955 parentElement
.addElement(element
);
961 * createEnumComboElement
964 * @param enumComboType
966 * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EnumComboType}
968 * @param parentElement
969 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
973 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
976 public <T
extends IDefinedTerm
> EnumComboElement
<T
> createEnumComboElement(
977 Class
<T
> enumComboType
, ICdmFormElement parentElement
,
979 EnumComboElement
<T
> element
= new EnumComboElement
<T
>(this, parentElement
, enumComboType
, style
);
981 parentElement
.addElement(element
);
987 * createBrowserElement
991 * a {@link java.net.URI} object.
994 * @param parentElement
995 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
997 * @return a {@link eu.etaxonomy.taxeditor.ui.element.BrowserElement} object.
999 public BrowserElement
createBrowserElement(ICdmFormElement parentElement
,
1000 URI imageUri
, int style
) {
1001 BrowserElement element
= new BrowserElement(this, parentElement
,
1004 parentElement
.addElement(element
);
1010 * createImageElement
1013 * @param parentElement
1014 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1017 * a {@link java.net.URI} object.
1020 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ImageElement} object.
1022 public ImageElement
createImageElement(ICdmFormElement parentElement
,
1023 URI imageUri
, int style
) {
1024 ImageElement element
= new ImageElement(this, parentElement
, imageUri
,
1027 parentElement
.addElement(element
);
1033 * createTextActionElement
1036 * @param labelString
1037 * a {@link java.lang.String} object.
1038 * @param initialText
1039 * a {@link java.lang.String} object.
1042 * @param parentElement
1043 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1045 * @param buttonLabel
1046 * a {@link java.lang.String} object.
1047 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextActionElement}
1050 public TextActionElement
createTextActionElement(
1051 ICdmFormElement parentElement
, String labelString
,
1052 String buttonLabel
, String initialText
, int style
) {
1053 TextActionElement element
= new TextActionElement(this, parentElement
,
1054 labelString
, buttonLabel
, initialText
, style
);
1056 parentElement
.addElement(element
);
1062 * @author n.hoffmann
1063 * @created Mar 5, 2010
1066 public static enum SelectionType
{
1067 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
1075 * @param parentElement
1076 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1079 * a {@link java.lang.String} object.
1080 * @param initialState
1084 * @return a {@link eu.etaxonomy.taxeditor.ui.element.CheckboxElement} object.
1086 public CheckboxElement
createCheckbox(ICdmFormElement parentElement
,
1087 String label
, boolean initialState
, int style
) {
1088 CheckboxElement element
= new CheckboxElement(this, parentElement
,
1089 label
, initialState
, style
| orientation
);
1091 parentElement
.addElement(element
);
1096 * Creates a section as a part of the form.
1098 * @return the section widget
1100 * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1103 public Section
adapt(AbstractFormSection section
) {
1104 section
.setMenu(section
.getLayoutComposite().getMenu());
1105 adapt(section
, true, true);
1107 // handle focus and property change events for cdm use
1108 section
.addFocusListener(selectionFocusHandler
);
1109 section
.setPropertyChangeListeners(propertyChangeListeners
);
1111 if (section
.getToggle() != null) {
1112 section
.getToggle().setHoverDecorationColor(
1113 getColors().getColor(IFormColors
.TB_TOGGLE_HOVER
));
1114 section
.getToggle().setDecorationColor(
1115 getColors().getColor(IFormColors
.TB_TOGGLE
));
1118 section
.setFont(boldFontHolder2
.getBoldFont(section
1119 .getLayoutComposite().getFont()));
1121 if ((section
.getStyle() & Section
.TITLE_BAR
) != 0
1122 || (section
.getStyle() & Section
.SHORT_TITLE_BAR
) != 0) {
1123 getColors().initializeSectionToolBarColors();
1124 section
.setTitleBarBackground(getColors().getColor(
1125 IFormColors
.TB_BG
));
1126 section
.setTitleBarBorderColor(getColors().getColor(
1127 IFormColors
.TB_BORDER
));
1129 // call setTitleBarForeground regardless as it also sets the label color
1130 section
.setTitleBarForeground(getColors().getColor(
1131 IFormColors
.TB_TOGGLE
));
1135 private class BoldFontHolder2
{
1136 private Font normalFont
;
1138 private Font boldFont
;
1140 public BoldFontHolder2() {
1143 public Font
getBoldFont(Font font
) {
1144 createBoldFont(font
);
1148 private void createBoldFont(Font font
) {
1149 if (normalFont
== null || !normalFont
.equals(font
)) {
1153 if (boldFont
== null) {
1154 boldFont
= FormFonts
.getInstance().getBoldFont(
1155 getColors().getDisplay(), normalFont
);
1159 public void dispose() {
1160 if (boldFont
!= null) {
1161 FormFonts
.getInstance().markFinished(boldFont
,
1162 getColors().getDisplay());
1170 * createToggleableTextField
1173 * @param parentElement
1174 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1176 * @param labelString
1177 * a {@link java.lang.String} object.
1178 * @param initialText
1179 * a {@link java.lang.String} object.
1180 * @param initialState
1184 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement}
1187 public ToggleableTextElement
createToggleableTextField(
1188 ICdmFormElement parentElement
, String labelString
,
1189 String initialText
, boolean initialState
, int style
) {
1190 ToggleableTextElement element
= new ToggleableTextElement(this,
1191 parentElement
, labelString
, initialText
, initialState
, style
1194 parentElement
.addElement(element
);
1200 * createTimePeriodElement
1203 * @param parentElement
1204 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1206 * @param labelString
1207 * a {@link java.lang.String} object.
1209 * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1212 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TimePeriodElement}
1215 public TimePeriodElement
createTimePeriodElement(
1216 ICdmFormElement parentElement
, String labelString
,
1217 TimePeriod timePeriod
, int style
) {
1218 TimePeriodElement element
= new TimePeriodElement(this, parentElement
,
1219 labelString
, timePeriod
, style
);
1221 parentElement
.addElement(element
);
1227 * createPointElement
1232 * @param parentElement
1233 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1236 * a {@link eu.etaxonomy.cdm.model.location.Point} object.
1237 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PointElement} object.
1239 public PointElement
createPointElement(ICdmFormElement parentElement
,
1240 Point point
, int style
) {
1241 PointElement element
= new PointElement(this, parentElement
, point
,
1244 parentElement
.addElement(element
);
1250 * createDateDetailSection
1253 * @param parentElement
1254 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1258 * @return a {@link eu.etaxonomy.taxeditor.ui.element.DateDetailSection}
1261 public DateDetailSection
createDateDetailSection(
1262 ICdmFormElement parentElement
, int style
) {
1263 DateDetailSection section
= new DateDetailSection(this, parentElement
,
1265 parentElement
.addElement(section
);
1272 * createPartialElement
1275 * @param parentElement
1276 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1278 * @param labelString
1279 * a {@link java.lang.String} object.
1281 * a {@link org.joda.time.Partial} object.
1284 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PartialElement} object.
1286 public PartialElement
createPartialElement(ICdmFormElement parentElement
,
1287 String labelString
, Partial partial
, int style
) {
1288 PartialElement element
= new PartialElement(this, parentElement
,
1289 labelString
, style
);
1291 parentElement
.addElement(element
);
1297 * addSelectionListener
1301 * a {@link org.eclipse.swt.events.SelectionListener} object.
1303 public void addSelectionListener(SelectionListener listener
) {
1304 selectionListenerList
.add(listener
);
1309 * removeSelectionListener
1313 * a {@link org.eclipse.swt.events.SelectionListener} object.
1315 public void removeSelectionListener(SelectionListener listener
) {
1316 if (listener
== null) {
1318 .error(this.getClass(),
1319 "Tried to remove a selection listener from this factories listeners but was null",
1322 selectionListenerList
.remove(listener
);
1328 * addPropertyChangeListener
1332 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1335 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
1336 if(propertyChangeListeners
.contains(listener
)){
1339 propertyChangeListeners
.add(0, listener
);
1344 * removePropertyChangeListener
1348 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1351 public void removePropertyChangeListener(IPropertyChangeListener listener
) {
1352 propertyChangeListeners
.remove(listener
);
1357 * createHorizontalSeparator
1360 * @param parentElement
1361 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1365 * @return a {@link org.eclipse.swt.widgets.Label} object.
1367 public Label
createHorizontalSeparator(ICdmFormElement parentElement
,
1369 Label separator
= this.createSeparator(
1370 parentElement
.getLayoutComposite(), SWT
.HORIZONTAL
| style
);
1371 separator
.setLayoutData(FILL_HORIZONTALLY());
1377 * createVersionElement
1380 * @param parentElement
1381 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1384 * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
1389 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
1392 public VersionElement
createVersionElement(ICdmFormElement parentElement
,
1393 VersionableEntity entity
, int style
) {
1394 VersionElement element
= new VersionElement(this, parentElement
,
1397 parentElement
.addElement(element
);
1403 * createVersionSection
1406 * @param parentElement
1407 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1412 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
1415 public VersionSection
createVersionSection(ICdmFormElement parentElement
,
1417 VersionSection section
= new VersionSection(this, parentElement
, style
);
1418 parentElement
.addElement(section
);
1425 * createEmptyElement
1428 * @param parentElement
1429 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1431 * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1433 public EmptyElement
createEmptyElement(ICdmFormElement parentElement
) {
1434 EmptyElement element
= new EmptyElement(this, parentElement
, null,
1437 parentElement
.addElement(element
);
1443 * createHeadlineSection
1446 * @param parentElement
1447 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1450 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
1453 public HeadlineSection
createHeadlineSection(ICdmFormElement parentElement
) {
1454 HeadlineSection section
= new HeadlineSection(this, parentElement
,
1456 parentElement
.addElement(section
);
1463 * createParsingMessageElement
1466 * @param parentElement
1467 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1469 * @param parserProblem
1470 * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
1475 * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
1478 public ParsingMessageElement
createParsingMessageElement(
1479 ICdmFormElement parentElement
, ParserProblem parserProblem
,
1481 ParsingMessageElement element
= new ParsingMessageElement(this,
1482 parentElement
, parserProblem
, style
);
1484 parentElement
.addElement(element
);
1493 public static enum DetailType
{
1497 NOMENCLATURALREFERENCE
,
1509 DERIVED_UNIT_FACADE
,
1513 FEATURE_DISTRIBUTION
,
1518 POLYTOMOUS_KEY_NODE
,
1520 DERIVED_UNIT_GENERAL
,
1532 public AbstractFormSection
createDefinedTermDetailSection(Class definedTermClass
,
1533 ConversationHolder conversation
, ICdmFormElement parentElement
,
1534 ISelectionProvider selectionProvider
, int style
) {
1536 AbstractFormSection section
= new DefinedTermDetailSection(this, definedTermClass
, conversation
, parentElement
, selectionProvider
, style
);
1538 parentElement
.addElement(section
);
1545 * @param definedTermClass
1546 * @param formElement
1550 public AbstractCdmDetailElement
createDefinedTermDetailElement(
1551 Class definedTermClass
, AbstractCdmDetailSection parentElement
,
1553 AbstractCdmDetailElement element
= null;
1555 if (NamedArea
.class.isAssignableFrom(definedTermClass
)){
1556 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1559 element
= new DefinedTermDetailElement(this, parentElement
);
1563 parentElement
.addElement(element
);
1569 * createCdmDetailSection
1574 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
1576 * @param parentElement
1577 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1579 * @param selectionProvider
1580 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1583 * @param conversation
1584 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1586 * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1589 public AbstractFormSection
createCdmDetailSection(DetailType detailType
,
1590 ConversationHolder conversation
, ICdmFormElement parentElement
,
1591 ISelectionProvider selectionProvider
, int style
) {
1592 AbstractFormSection section
= null;
1594 switch (detailType
) {
1595 case SCIENTIFICNAME
:
1596 section
= new NameDetailSection(this, conversation
, parentElement
,
1597 selectionProvider
, style
);
1600 section
= new ReferenceDetailSection(this, conversation
,
1601 parentElement
, selectionProvider
, style
);
1603 case NOMENCLATURALREFERENCE
:
1604 section
= new NomenclaturalReferenceDetailSection(this,
1605 conversation
, parentElement
, selectionProvider
, style
);
1608 section
= new TaxonBaseDetailSection(this, conversation
,
1609 parentElement
, selectionProvider
, style
);
1612 section
= new AuthorshipDetailSection(this, conversation
,
1613 parentElement
, selectionProvider
, style
);
1615 case TEAMORPERSONBASE
:
1616 section
= new TeamOrPersonBaseDetailSection(this, conversation
,
1617 parentElement
, selectionProvider
, style
);
1620 section
= new TeamDetailSection(this, conversation
, parentElement
,
1624 section
= new PersonDetailSection(this, conversation
,
1625 parentElement
, null, style
);
1628 section
= new DescriptionDetailSection(this, conversation
,
1629 parentElement
, selectionProvider
, style
);
1631 case DESCRIPTIONELEMENT
:
1632 section
= new DescriptionElementDetailSection(this, conversation
,
1633 parentElement
, selectionProvider
, style
);
1635 case PARSINGMESSAGE
:
1636 section
= new ParsingMessagesSection(this, conversation
,
1637 parentElement
, selectionProvider
, style
);
1640 section
= new NonViralNameDetailSection(this, conversation
,
1641 parentElement
, selectionProvider
, style
);
1644 section
= new eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection(
1645 this, conversation
, parentElement
, selectionProvider
, style
);
1647 case DERIVED_UNIT_FACADE
:
1648 section
= new DerivedUnitFacadeDetailSection(this, conversation
,
1649 parentElement
, selectionProvider
, style
);
1651 case FIELD_OBSERVATION
:
1652 section
= new FieldObservationDetailSection(this, conversation
,
1653 parentElement
, selectionProvider
, style
);
1655 case GATHERING_EVENT
:
1656 section
= new GatheringEventDetailSection(this, conversation
,
1657 parentElement
, selectionProvider
, style
);
1660 section
= new DerivedUnitBaseDetailSection(this, conversation
,
1661 parentElement
, selectionProvider
, style
);
1663 case NATURAL_LANGUAGE
:
1664 section
= new NaturalLanguageSection(this, conversation
,
1665 parentElement
, selectionProvider
, style
);
1667 case FEATURE_DISTRIBUTION
:
1668 section
= new FeatureDistributionDetailSection(this, conversation
,
1669 parentElement
, selectionProvider
, style
);
1671 case CLASSIFICATION
:
1672 section
= new ClassificationDetailSection(this, conversation
,
1673 parentElement
, selectionProvider
, style
);
1676 section
= new TaxonNodeDetailSection(this, conversation
,
1677 parentElement
, selectionProvider
, style
);
1679 case POLYTOMOUS_KEY
:
1680 section
= new PolytomousKeyDetailSection(this, conversation
,
1681 parentElement
, selectionProvider
, style
);
1683 case POLYTOMOUS_KEY_NODE
:
1684 section
= new PolytomousKeyNodeDetailSection(this, conversation
,
1685 parentElement
, selectionProvider
, style
);
1688 section
= new InstitutionDetailSection(this, conversation
,
1689 parentElement
, selectionProvider
, style
);
1691 case DERIVED_UNIT_GENERAL
:
1692 section
= new GeneralDetailSection(this, conversation
,
1693 parentElement
, selectionProvider
, style
);
1696 section
= new HybridDetailSection(this, conversation
,
1697 parentElement
, selectionProvider
, style
);
1700 section
= new UserDetailSection(this, conversation
, parentElement
,
1701 selectionProvider
, style
);
1704 section
= new GroupDetailSection(this, conversation
, parentElement
,
1705 selectionProvider
, style
);
1708 section
= new DeterminationDetailSection(this, conversation
, parentElement
,
1709 selectionProvider
, style
);
1711 case TAXON_RELATIONSHIP
:
1712 section
= new TaxonRelationshipDetailSection(this, conversation
, parentElement
,
1713 selectionProvider
, style
);
1715 case REFERENCED_ENTITY
:
1716 section
= new ReferencedEntityDetailSection(this, conversation
, parentElement
,
1717 selectionProvider
, style
);
1719 case TERM_VOCABULARY
:
1720 section
= new TermVocabularyDetailSection(this, conversation
, parentElement
,
1721 selectionProvider
, style
);
1724 section
= new NamedAreaDetailSection(this, conversation
, parentElement
,
1725 selectionProvider
, style
);
1729 if (section
== null) {
1730 throw new RuntimeException(
1731 "You tried to create a cdm detail section that is not implemented yet.");
1734 parentElement
.addElement(section
);
1743 * createCdmDetailElement
1748 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
1752 * @param parentElement
1753 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1756 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
1759 public AbstractCdmDetailElement
createCdmDetailElement(
1760 DetailType detailType
, ICdmFormElement parentElement
, int style
) {
1761 AbstractCdmDetailElement element
= null;
1763 switch (detailType
) {
1764 case SCIENTIFICNAME
:
1765 element
= new NameDetailElement(this, parentElement
, style
);
1768 element
= new ReferenceDetailElement(this, parentElement
, style
);
1770 case NOMENCLATURALREFERENCE
:
1771 element
= new NomenclaturalReferenceDetailElement(this,
1772 parentElement
, style
);
1775 element
= new TaxonBaseDetailElement(this, parentElement
, style
);
1778 element
= new AuthorshipDetailElement(this, parentElement
, style
);
1781 element
= new TeamDetailElement(this, parentElement
, style
);
1784 element
= new PersonDetailElement(this, parentElement
, style
);
1787 element
= new DescriptionDetailElement(this, parentElement
, style
);
1789 case DESCRIPTIONELEMENT
:
1790 element
= new DescriptionElementDetailElement(this, parentElement
,
1794 element
= new NonViralNameDetailElement(this, parentElement
);
1796 case DERIVED_UNIT_FACADE
:
1797 element
= new DerivedUnitFacadeDetailElement(this, parentElement
);
1799 case FIELD_OBSERVATION
:
1800 element
= new FieldObservationDetailElement(this, parentElement
);
1802 case GATHERING_EVENT
:
1803 element
= new GatheringEventDetailElement(this, parentElement
);
1806 element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1808 case NATURAL_LANGUAGE
:
1809 element
= new NaturalLanguageDetailElement(this, parentElement
);
1811 case FEATURE_DISTRIBUTION
:
1812 element
= new FeatureDistributionDetailElement(this, parentElement
);
1814 case CLASSIFICATION
:
1815 element
= new ClassificationDetailElement(this, parentElement
);
1818 element
= new TaxonNodeDetailElement(this, parentElement
);
1821 element
= new CollectionDetailElement(this, parentElement
);
1823 case POLYTOMOUS_KEY
:
1824 element
= new PolytomousKeyDetailElement(this, parentElement
);
1826 case POLYTOMOUS_KEY_NODE
:
1827 element
= new PolytomousKeyNodeDetailElement(this, parentElement
);
1830 element
= new InstitutionDetailElement(this, parentElement
);
1832 case DERIVED_UNIT_GENERAL
:
1833 element
= new GeneralDetailElement(this, parentElement
);
1836 element
= new HybridDetailElement(this, parentElement
);
1839 element
= new UserDetailElement(this, parentElement
);
1842 element
= new GroupDetailElement(this, parentElement
);
1845 element
= new DeterminationDetailElement(this, parentElement
);
1847 case TAXON_RELATIONSHIP
:
1848 element
= new TaxonRelationshipDetailElement(this, parentElement
);
1850 case REFERENCED_ENTITY
:
1851 element
= new RefereneEntityDetailElement(this, parentElement
);
1853 case TERM_VOCABULARY
:
1854 element
= new TermVocabularyDetailElement(this, parentElement
);
1857 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1859 case NAMED_AREA_LEVEL
:
1860 element
= new DefinedTermDetailElement
<NamedAreaLevel
>(this, parentElement
);
1864 if (element
== null) {
1866 .error(this.getClass(),
1867 "Detail element was not created. Seems like the case was not implemented for the requested detail type: "
1868 + detailType
, null);
1872 parentElement
.addElement(element
);
1878 * @author n.hoffmann
1879 * @created Mar 5, 2010
1882 public static enum EntityDetailType
{
1887 DESCRIPTIONELEMENTSOURCE
,
1891 DESCRIPTIONELEMENTMEDIA
,
1892 MEDIAREPRESENTATION
,
1893 MEDIAREPRESENTATIONPART
,
1895 NOMENCLATURALSTATUS
,
1904 STATISTICAL_MEASUREMENT_VALUE
,
1907 DETERMINATION_EVENT
,
1908 SPECIMEN_COLLECTION
,
1909 IDENTIFIABLE_SOURCE_COLLECTION
,
1916 DETERMINATION_CURRENT
,
1917 DETERMINATION_HISTORY
1922 * createEntityDetailSection
1925 * @param entityDetailType
1927 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType}
1931 * @param conversation
1932 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1934 * @param parentElement
1935 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1937 * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1940 public AbstractFormSection
createEntityDetailSection(
1941 EntityDetailType entityDetailType
, ConversationHolder conversation
,
1942 ICdmFormElement parentElement
, int style
) {
1943 AbstractFormSection section
= null;
1945 switch (entityDetailType
) {
1947 section
= new TeamDetailSection(this, conversation
, parentElement
,
1951 section
= new TeamMemberSection(this, conversation
, parentElement
,
1955 section
= new AnnotationSection(this, conversation
, parentElement
,
1959 section
= new CreditSection(this, conversation
, parentElement
,
1962 case DESCRIPTIONELEMENTSOURCE
:
1963 section
= new DescriptionElementSourceSection(this, conversation
,
1964 parentElement
, style
);
1967 section
= new ExtensionSection(this, conversation
, parentElement
,
1971 section
= new MarkerSection(this, conversation
, parentElement
,
1975 section
= new MediaSection(this, conversation
, parentElement
, style
);
1977 case DESCRIPTIONELEMENTMEDIA
:
1978 section
= new DescriptionElementMediaSection(this, conversation
,
1979 parentElement
, style
);
1981 case MEDIAREPRESENTATION
:
1982 section
= new MediaRepresentationSection(this, conversation
,
1983 parentElement
, style
);
1985 case MEDIAREPRESENTATIONPART
:
1986 section
= new MediaRepresentationPartSection(this, conversation
,
1987 parentElement
, style
);
1990 section
= new ModifierSection(this, conversation
, parentElement
,
1993 case NOMENCLATURALSTATUS
:
1994 section
= new NomenclaturalStatusSection(this, conversation
,
1995 parentElement
, style
);
1997 case NAME_RELATIONSHIP
:
1998 section
= new NameRelationshipDetailSection(this, conversation
,
1999 parentElement
, style
);
2002 section
= new ProtologueSection(this, conversation
, parentElement
,
2006 section
= new RightsSection(this, conversation
, parentElement
,
2010 section
= new SourceSection(this, conversation
, parentElement
,
2014 section
= new ScopeSection(this, conversation
, parentElement
, style
);
2016 case DESCRIPTIONSOURCE
:
2017 section
= new DescriptionSourceSection(this, conversation
,
2018 parentElement
, style
);
2020 case TYPEDESIGNATION
:
2021 section
= new TypeDesignationSection(this, conversation
,
2022 parentElement
, style
);
2025 section
= new StateDataSection(this, conversation
, parentElement
,
2028 case STATISTICAL_MEASUREMENT_VALUE
:
2029 section
= new StatisticalMeasurementValueSection(this,
2030 conversation
, parentElement
, style
);
2032 case DESCRIBED_SPECIMEN
:
2033 section
= new DescribedSpecimenSection(this, conversation
,
2034 parentElement
, style
);
2036 case COLLECTING_AREA
:
2037 section
= new CollectingAreasDetailSection(this, conversation
,
2038 parentElement
, style
);
2040 case DETERMINATION_CURRENT
:
2041 section
= new CurrentDeterminationDetailSection(this, conversation
,
2042 parentElement
, style
);
2044 case DETERMINATION_HISTORY
:
2045 section
= new DeterminationHistoryDetailSection(this, conversation
,
2046 parentElement
, style
);
2048 case SPECIMEN_COLLECTION
:
2049 section
= new SpecimenCollectionDetailSection(this, conversation
,
2050 parentElement
, style
);
2052 case IDENTIFIABLE_SOURCE_COLLECTION
:
2053 section
= new SourceCollectionDetailSection(this, conversation
,
2054 parentElement
, style
);
2056 case GEOGRAPHICAL_SCOPE
:
2057 section
= new GeographicalScopeDetailSection(this, conversation
,
2058 parentElement
, style
);
2060 case SCOPE_RESTRICTION
:
2061 section
= new ScopeRestrictionSection(this, conversation
,
2062 parentElement
, style
);
2065 section
= new MemberDetailSection(this, conversation
,
2066 parentElement
, style
);
2068 case GRANTED_AUTHORITY
:
2069 section
= new GrantedAuthorityDetailSection(this, conversation
,
2070 parentElement
, style
);
2072 case GROUPS_BY_USER
:
2073 section
= new GroupsByUserDetailSection(this, conversation
,
2074 parentElement
, style
);
2076 case TAXONOMIC_SCOPE
:
2077 section
= new TaxonomicScopeSection(this, conversation
,
2078 parentElement
, style
);
2081 parentElement
.addElement(section
);
2088 * createEntityCollectionElement
2091 * @param removeListener
2092 * a {@link org.eclipse.swt.events.SelectionListener} object.
2095 * @param parentElement
2096 * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
2098 * @param versionableEntity
2099 * a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity}
2101 * @param backgroundColor
2102 * a {@link org.eclipse.swt.graphics.Color} object.
2104 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement}
2107 public AbstractEntityCollectionElement
createEntityCollectionElement(
2108 AbstractFormSection parentElement
, Object versionableEntity
,
2109 SelectionListener removeListener
, Color backgroundColor
, int style
) {
2110 AbstractEntityCollectionElement element
= null;
2112 Object entity
= HibernateProxyHelper
.deproxy(versionableEntity
);
2114 if (entity
instanceof Annotation
) {
2115 element
= new AnnotationElement(this, parentElement
,
2116 (Annotation
) entity
, removeListener
, style
);
2117 } else if (entity
instanceof Person
) {
2118 element
= new TeamMemberElement(this, parentElement
,
2119 (Person
) entity
, removeListener
, style
);
2120 } else if (entity
instanceof Credit
) {
2121 element
= new CreditElement(this, parentElement
, (Credit
) entity
,
2122 removeListener
, style
);
2123 } else if (entity
instanceof Extension
) {
2124 element
= new ExtensionElement(this, parentElement
,
2125 (Extension
) entity
, removeListener
, style
);
2126 } else if (entity
instanceof Marker
) {
2127 element
= new MarkerElement(this, parentElement
, (Marker
) entity
,
2128 removeListener
, style
);
2129 } else if (entity
instanceof Media
) {
2130 element
= new MediaElement(this, parentElement
, (Media
) entity
,
2131 removeListener
, style
);
2132 } else if (entity
instanceof MediaRepresentation
) {
2133 element
= new MediaRepresentationElement(this, parentElement
,
2134 (MediaRepresentation
) entity
, removeListener
, style
);
2135 } else if (entity
instanceof ImageFile
) {
2136 element
= new ImageFileElement(this, parentElement
,
2137 (ImageFile
) entity
, removeListener
, style
);
2138 } else if (entity
instanceof MediaRepresentationPart
){
2139 element
= new MediaRepresentationPartElement(this, parentElement
,
2140 (MediaRepresentationPart
) entity
, removeListener
, style
);
2141 } else if (entity
instanceof NomenclaturalStatus
) {
2142 element
= new NomenclaturalStatusElement(this, parentElement
,
2143 (NomenclaturalStatus
) entity
, removeListener
, style
);
2144 } else if (entity
instanceof Rights
) {
2145 element
= new RightsElement(this, parentElement
, (Rights
) entity
,
2146 removeListener
, style
);
2147 } else if (entity
instanceof DescriptionElementSource
) {
2148 element
= new DescriptionElementSourceElement(this, parentElement
,
2149 (DescriptionElementSource
) entity
, removeListener
, style
);
2150 } else if (entity
instanceof IdentifiableSource
) {
2151 element
= new IdentifiableSourceElement(this, parentElement
,
2152 (IdentifiableSource
) entity
, removeListener
, style
);
2153 } else if (entity
instanceof Scope
) {
2154 element
= new ScopeElement(this, parentElement
, (Scope
) entity
,
2155 removeListener
, style
);
2156 } else if (entity
instanceof Modifier
) {
2157 element
= new ModifierElement(this, parentElement
,
2158 (Modifier
) entity
, removeListener
, style
);
2159 } else if (entity
instanceof Reference
) {
2160 element
= new DescriptionSourceElement(this, parentElement
,
2161 (Reference
) entity
, removeListener
, style
);
2162 } else if (entity
instanceof NameTypeDesignation
) {
2163 element
= new NameTypeDesignationElement(this, parentElement
,
2164 (NameTypeDesignation
) entity
, removeListener
, style
);
2165 } else if (entity
instanceof NameRelationship
) {
2166 element
= new NameRelationshipDetailElement(this, parentElement
,
2167 (NameRelationship
) entity
, removeListener
, style
);
2168 } else if (entity
instanceof SpecimenTypeDesignation
) {
2169 element
= new SpecimenTypeDesignationElement(this, parentElement
,
2170 (SpecimenTypeDesignation
) entity
, removeListener
, style
);
2171 } else if (entity
instanceof StateData
) {
2172 element
= new StateDataElement(this, parentElement
,
2173 (StateData
) entity
, removeListener
, style
);
2174 } else if (entity
instanceof StatisticalMeasurementValue
) {
2175 element
= new StatisticalMeasurementValueElement(this,
2176 parentElement
, (StatisticalMeasurementValue
) entity
,
2177 removeListener
, style
);
2178 } else if (entity
instanceof DerivedUnit
) {
2179 element
= new DerivedUnitElement(this, parentElement
,
2180 (DerivedUnit
) entity
, removeListener
, style
);
2181 } else if (entity
instanceof NamedArea
) {
2182 element
= new NamedAreaDetailElement(this, parentElement
,
2183 (NamedArea
) entity
, removeListener
, style
);
2184 } else if (entity
instanceof DeterminationEvent
) {
2185 element
= new DeterminationEventDetailElement(this, parentElement
,
2186 (DeterminationEvent
) entity
, removeListener
, style
);
2187 } else if (entity
instanceof Specimen
) {
2188 element
= new SpecimenCollectionDetailElement(this, parentElement
,
2189 (Specimen
) entity
, removeListener
, style
);
2190 } else if (entity
instanceof User
) {
2191 element
= new MemberDetailElement(this, parentElement
,
2192 (User
) entity
, removeListener
, style
);
2193 } else if (entity
instanceof GrantedAuthority
) {
2194 element
= new GrantedAuthorityDetailElement(this, parentElement
,
2195 (GrantedAuthority
) entity
, removeListener
, style
);
2196 } else if (entity
instanceof Group
) {
2197 element
= new GroupsByUserDetailElement(this, parentElement
,
2198 (Group
) entity
, removeListener
, style
);
2199 } else if (entity
instanceof Taxon
) {
2200 element
= new TaxonDetailElement(this, parentElement
,
2201 (Taxon
) entity
, removeListener
, style
);
2202 } else if (entity
instanceof DescriptionElementBase
) {
2203 // this is the special case for protologs, maybe we can do this
2204 // differently when API improves
2205 DescriptionElementBase descriptionElement
= (DescriptionElementBase
) entity
;
2206 if (descriptionElement
.getFeature().equals(Feature
.PROTOLOGUE())) {
2207 element
= new ProtologueElement(this, parentElement
,
2208 descriptionElement
, removeListener
, style
);
2212 if (element
== null) {
2215 "No element for entity",
2217 "Could not generate element for entity. "
2218 + "Looks like the case is not handled already. Check implementation. Entity: "
2223 if (backgroundColor
!= null && !backgroundColor
.isDisposed()) {
2224 element
.setPersistentBackground(backgroundColor
);
2228 parentElement
.addElement(element
);
2234 * createSelectionElement
2237 * @param selectionType
2239 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.SelectionType}
2241 * @param parentElement
2242 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
2244 * @param labelString
2245 * a {@link java.lang.String} object.
2246 * @param selectionType
2248 * a {@link eu.etaxonomy.cdm.model.common.IAnnotatableEntity}
2252 * @param conversation
2253 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
2256 * {@link eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement}
2259 public AbstractSelectionElement
createSelectionElement(
2260 SelectionType selectionType
, ConversationHolder conversation
,
2261 ICdmFormElement parentElement
, String labelString
,
2262 ICdmBase selection
, int mode
, int style
) {
2263 AbstractSelectionElement element
= null;
2265 IAnnotatableEntity entity
= (IAnnotatableEntity
) HibernateProxyHelper
2266 .deproxy(selection
);
2268 switch (selectionType
) {
2270 element
= new AgentSelectionElement(this, conversation
,
2271 parentElement
, labelString
, (TeamOrPersonBase
) entity
,
2275 element
= new PersonSelectionElement(this, conversation
,
2276 parentElement
, labelString
, (Person
) entity
, mode
, style
);
2279 element
= new TeamSelectionElement(this, conversation
,
2280 parentElement
, labelString
, (Team
) entity
, mode
, style
);
2283 element
= new NomenclaturalAuthorTeamSelectionElement(this,
2284 conversation
, parentElement
, labelString
, (Team
) entity
,
2288 element
= new InstitutionSelectionElement(this, conversation
,
2289 parentElement
, labelString
, (Institution
) entity
, mode
,
2293 element
= new NameSelectionElement(this, conversation
,
2294 parentElement
, labelString
, (TaxonNameBase
) entity
, mode
,
2298 element
= new ReferenceSelectionElement(this, conversation
,
2299 parentElement
, labelString
, (Reference
) entity
, mode
, style
);
2302 element
= new TaxonBaseSelectionElement(this, conversation
,
2303 parentElement
, labelString
, (TaxonBase
) entity
, mode
, style
);
2306 element
= new TaxonSelectionElement(this, conversation
,
2307 parentElement
, labelString
, (Taxon
) entity
, mode
, style
);
2310 element
= new SynonymSelectionElement(this, conversation
,
2311 parentElement
, labelString
, (Synonym
) entity
, mode
, style
);
2314 element
= new DerivedUnitBaseSelectionElement(this, conversation
,
2315 parentElement
, labelString
, (DerivedUnitBase
) entity
, mode
,
2318 case FIELD_OBSERVATION
:
2319 element
= new FieldObservationSelectionElement(this, conversation
,
2320 parentElement
, labelString
, (FieldObservation
) entity
,
2324 element
= new FeatureTreeSelectionElement(this, conversation
,
2325 parentElement
, labelString
, (FeatureTree
) entity
, mode
,
2328 case CLASSIFICATION
:
2329 element
= new ClassificationSelectionElement(this, conversation
,
2330 parentElement
, labelString
, (Classification
) entity
, mode
,
2334 element
= new TaxonNodeSelectionElement(this, conversation
,
2335 parentElement
, labelString
, (TaxonNode
) entity
, mode
, style
);
2338 element
= new CollectionSelectionElement(this, conversation
,
2339 parentElement
, labelString
, (Collection
) entity
, mode
,
2343 element
= new FeatureSelectionElement(this, conversation
,
2344 parentElement
, labelString
, (Feature
) entity
, mode
, style
);
2346 case POLYTOMOUS_KEY
:
2347 element
= new PolytomousKeySelectionElement(this, conversation
,
2348 parentElement
, labelString
, (PolytomousKey
) entity
, mode
,
2351 case POLYTOMOUS_KEY_NODE
:
2352 element
= new PolytomousKeyNodeSelectionElement(this, conversation
,
2353 parentElement
, labelString
, (PolytomousKeyNode
) entity
,
2357 element
= new UserSelectionElement(this, conversation
,
2358 parentElement
, labelString
, (User
) entity
, mode
, style
);
2361 element
= new GroupSelectionElement(this, conversation
,
2362 parentElement
, labelString
, (Group
) entity
, mode
, style
);
2365 new RuntimeException(
2366 "There is no selection composite for the desired selection type.");
2371 parentElement
.addElement(element
);
2377 * createNamedAreaSelectionElement
2380 * @param parentElement
2381 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
2383 * @param conversation
2384 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
2386 * @param labelString
2387 * a {@link java.lang.String} object.
2389 * a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
2393 * {@link eu.etaxonomy.taxeditor.ui.selection.NamedAreaSelectionElement}
2396 public NamedAreaSelectionElement
createNamedAreaSelectionElement(
2397 ICdmFormElement parentElement
, ConversationHolder conversation
,
2398 String labelString
, NamedArea selection
, int style
) {
2399 NamedAreaSelectionElement element
= new NamedAreaSelectionElement(this,
2400 conversation
, parentElement
, labelString
, selection
,
2401 AbstractSelectionElement
.NOTHING
, style
);
2403 parentElement
.addElement(element
);
2407 /** {@inheritDoc} */
2408 public LabelElement
createLabel(ICdmFormElement parentElement
, String text
) {
2409 LabelElement labelElement
= new LabelElement(this, parentElement
, text
);
2410 adapt(labelElement
);
2411 parentElement
.addElement(labelElement
);
2412 return labelElement
;
2417 * Getter for the field <code>selectionProvider</code>.
2420 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
2422 public ISelectionProvider
getSelectionProvider() {
2423 return selectionProvider
;
2428 * createDetailedDescriptionDetailElement
2431 * @param parentElement
2432 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
2436 * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
2441 * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
2444 public AbstractDetailedDescriptionDetailElement
createDetailedDescriptionDetailElement(
2445 ICdmFormElement parentElement
, DescriptionElementBase entity
,
2447 AbstractDetailedDescriptionDetailElement detailedDescriptionElement
= null;
2449 if (entity
instanceof CategoricalData
) {
2450 detailedDescriptionElement
= new CategoricalDataDetailElement(this,
2451 parentElement
, (CategoricalData
) entity
, style
);
2452 } else if (entity
instanceof CommonTaxonName
) {
2453 detailedDescriptionElement
= new CommonNameDetailElement(this,
2454 parentElement
, (CommonTaxonName
) entity
, style
);
2455 } else if (entity
instanceof Distribution
) {
2456 detailedDescriptionElement
= new DistributionDetailElement(this,
2457 parentElement
, (Distribution
) entity
, style
);
2458 } else if (entity
instanceof IndividualsAssociation
) {
2459 detailedDescriptionElement
= new IndividualsAssociationDetailElement(
2460 this, parentElement
, (IndividualsAssociation
) entity
, style
);
2461 } else if (entity
instanceof QuantitativeData
) {
2462 detailedDescriptionElement
= new QuantitativeDataDetailElement(
2463 this, parentElement
, (QuantitativeData
) entity
, style
);
2464 } else if (entity
instanceof TaxonInteraction
) {
2465 detailedDescriptionElement
= new TaxonInteractionDetailElement(
2466 this, parentElement
, (TaxonInteraction
) entity
, style
);
2467 } else if (entity
instanceof TextData
) {
2468 detailedDescriptionElement
= new TextDataDetailElement(this,
2469 parentElement
, (TextData
) entity
, style
);
2471 throw new IllegalStateException(
2472 "There is no interface for the given description element");
2474 adapt(detailedDescriptionElement
);
2475 parentElement
.addElement(detailedDescriptionElement
);
2476 return detailedDescriptionElement
;
2481 * Creates a styled text as a part of the form.
2486 * the text initial value
2489 * @return the text widget
2491 public StyledText
createStyledText(Composite parent
, String value
, int style
) {
2492 StyledText text
= new StyledText(parent
, getBorderStyle() | style
2493 | getOrientation());
2495 text
.setText(value
);
2496 text
.setForeground(getColors().getForeground());
2497 text
.setBackground(getColors().getBackground());
2498 // text.addFocusListener(visibilityHandler);