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
.CdmBase
;
52 import eu
.etaxonomy
.cdm
.model
.common
.Credit
;
53 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
54 import eu
.etaxonomy
.cdm
.model
.common
.DescriptionElementSource
;
55 import eu
.etaxonomy
.cdm
.model
.common
.Extension
;
56 import eu
.etaxonomy
.cdm
.model
.common
.Group
;
57 import eu
.etaxonomy
.cdm
.model
.common
.IAnnotatableEntity
;
58 import eu
.etaxonomy
.cdm
.model
.common
.ICdmBase
;
59 import eu
.etaxonomy
.cdm
.model
.common
.IDefinedTerm
;
60 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableSource
;
61 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
62 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
63 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
64 import eu
.etaxonomy
.cdm
.model
.common
.TimePeriod
;
65 import eu
.etaxonomy
.cdm
.model
.common
.User
;
66 import eu
.etaxonomy
.cdm
.model
.common
.VersionableEntity
;
67 import eu
.etaxonomy
.cdm
.model
.description
.CategoricalData
;
68 import eu
.etaxonomy
.cdm
.model
.description
.CommonTaxonName
;
69 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
70 import eu
.etaxonomy
.cdm
.model
.description
.Distribution
;
71 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
72 import eu
.etaxonomy
.cdm
.model
.description
.FeatureTree
;
73 import eu
.etaxonomy
.cdm
.model
.description
.IndividualsAssociation
;
74 import eu
.etaxonomy
.cdm
.model
.description
.KeyStatement
;
75 import eu
.etaxonomy
.cdm
.model
.description
.Modifier
;
76 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKey
;
77 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKeyNode
;
78 import eu
.etaxonomy
.cdm
.model
.description
.QuantitativeData
;
79 import eu
.etaxonomy
.cdm
.model
.description
.Scope
;
80 import eu
.etaxonomy
.cdm
.model
.description
.StateData
;
81 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasurementValue
;
82 import eu
.etaxonomy
.cdm
.model
.description
.TaxonInteraction
;
83 import eu
.etaxonomy
.cdm
.model
.description
.TextData
;
84 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
85 import eu
.etaxonomy
.cdm
.model
.location
.NamedAreaLevel
;
86 import eu
.etaxonomy
.cdm
.model
.location
.Point
;
87 import eu
.etaxonomy
.cdm
.model
.media
.ImageFile
;
88 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
89 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
90 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentationPart
;
91 import eu
.etaxonomy
.cdm
.model
.media
.Rights
;
92 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationship
;
93 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignation
;
94 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
95 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignation
;
96 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
97 import eu
.etaxonomy
.cdm
.model
.occurrence
.Collection
;
98 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
99 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnitBase
;
100 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationEvent
;
101 import eu
.etaxonomy
.cdm
.model
.occurrence
.FieldObservation
;
102 import eu
.etaxonomy
.cdm
.model
.occurrence
.Specimen
;
103 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
104 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
105 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
106 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
107 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
108 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
109 import eu
.etaxonomy
.cdm
.strategy
.parser
.ParserProblem
;
110 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
111 import eu
.etaxonomy
.taxeditor
.ui
.combo
.EnumComboElement
;
112 import eu
.etaxonomy
.taxeditor
.ui
.combo
.TermComboElement
;
113 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.IOpenUrlEnabled
;
114 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.OpenUrlSelectorElement
;
115 import eu
.etaxonomy
.taxeditor
.ui
.password
.EditPasswordElement
;
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
.CdmBaseElement
;
231 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CdmBaseSection
;
232 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditElement
;
233 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditSection
;
234 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionElement
;
235 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionSection
;
236 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.HeadlineSection
;
237 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.IdentifiableSourceElement
;
238 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerElement
;
239 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerSection
;
240 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsElement
;
241 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
242 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.SourceSection
;
243 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionElement
;
244 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionSection
;
245 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessageElement
;
246 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
247 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailElement
;
248 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
249 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonDetailElement
;
250 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailElement
;
251 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailSection
;
252 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailElement
;
253 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailSection
;
254 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailElement
;
255 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailSection
;
256 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.DefinedTermDetailElement
;
257 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.DefinedTermDetailSection
;
258 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailSection
;
259 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailElement
;
260 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailSection
;
261 import eu
.etaxonomy
.taxeditor
.ui
.selection
.AbstractSelectionElement
;
262 import eu
.etaxonomy
.taxeditor
.ui
.selection
.AgentSelectionElement
;
263 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ClassificationSelectionElement
;
264 import eu
.etaxonomy
.taxeditor
.ui
.selection
.CollectionSelectionElement
;
265 import eu
.etaxonomy
.taxeditor
.ui
.selection
.DerivedUnitBaseSelectionElement
;
266 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FeatureSelectionElement
;
267 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FeatureTreeSelectionElement
;
268 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FieldObservationSelectionElement
;
269 import eu
.etaxonomy
.taxeditor
.ui
.selection
.GroupSelectionElement
;
270 import eu
.etaxonomy
.taxeditor
.ui
.selection
.InstitutionSelectionElement
;
271 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NameSelectionElement
;
272 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NamedAreaSelectionElement
;
273 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NomenclaturalAuthorTeamSelectionElement
;
274 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PersonSelectionElement
;
275 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PolytomousKeyNodeSelectionElement
;
276 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PolytomousKeySelectionElement
;
277 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ReferenceSelectionElement
;
278 import eu
.etaxonomy
.taxeditor
.ui
.selection
.SynonymSelectionElement
;
279 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonBaseSelectionElement
;
280 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonNodeSelectionElement
;
281 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonSelectionElement
;
282 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TeamSelectionElement
;
283 import eu
.etaxonomy
.taxeditor
.ui
.selection
.UserSelectionElement
;
287 * CdmFormFactory class.
291 * @created Feb 24, 2010
294 public class CdmFormFactory
extends FormToolkit
{
296 private BoldFontHolder2 boldFontHolder2
;
297 private MouseListener selectionMouseHandler
;
298 private FocusListener selectionFocusHandler
;
300 private final Set selectionListenerList
= new HashSet();
302 private final List
<IPropertyChangeListener
> propertyChangeListeners
= new ArrayList
<IPropertyChangeListener
>();
304 private final int orientation
= Window
.getDefaultOrientation();
305 private ISelectionProvider selectionProvider
;
312 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
314 public static final TableWrapLayout
LAYOUT() {
315 return LAYOUT(1, false);
327 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
329 public static final TableWrapLayout
LAYOUT(int columns
, boolean equalWidth
) {
330 TableWrapLayout layout
= new TableWrapLayout();
331 layout
.topMargin
= 0;
332 layout
.rightMargin
= 0;
333 layout
.bottomMargin
= 0;
334 layout
.leftMargin
= 0;
335 layout
.numColumns
= columns
;
336 layout
.makeColumnsEqualWidth
= equalWidth
;
337 layout
.verticalSpacing
= 0;
338 layout
.horizontalSpacing
= 0;
347 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
349 public static final TableWrapData
FILL() {
358 * @param horizontalSpan
360 * @param verticalSpan
362 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
364 public static final TableWrapData
FILL(int horizontalSpan
, int verticalSpan
) {
365 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
,
366 TableWrapData
.FILL_GRAB
);
367 layoutData
.colspan
= horizontalSpan
;
368 layoutData
.rowspan
= verticalSpan
;
377 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
379 public static final TableWrapData
LEFT() {
380 return new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
);
388 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
390 public static final TableWrapData
RIGHT() {
391 return new TableWrapData(TableWrapData
.RIGHT
, TableWrapData
.TOP
);
399 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
401 public static final TableWrapData
FILL_HORIZONTALLY() {
402 return FILL_HORIZONTALLY(1, 1);
410 * @param horizontalSpan
412 * @param verticalSpan
414 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
416 public static final TableWrapData
FILL_HORIZONTALLY(int horizontalSpan
,
418 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
,
420 layoutData
.colspan
= horizontalSpan
;
421 layoutData
.rowspan
= verticalSpan
;
425 /** Constant <code>EMPTY_SELECTION</code> */
426 public static ISelection EMPTY_SELECTION
= new ISelection() {
428 public boolean isEmpty() {
433 private class SelectionMouseHandler
extends MouseAdapter
{
435 public void mouseDown(MouseEvent e
) {
436 notifySelectionListeners(e
);
440 private class SelectionFocusHandler
extends FocusAdapter
{
442 public void focusGained(FocusEvent e
) {
443 notifySelectionListeners(e
);
447 private void notifySelectionListeners(TypedEvent e
) {
448 Event event
= new Event();
449 event
.widget
= e
.widget
;
450 SelectionEvent selectionEvent
= new SelectionEvent(event
);
452 for (Object listener
: selectionListenerList
) {
453 ((SelectionListener
) listener
).widgetSelected(selectionEvent
);
459 * Constructor for CdmFormFactory.
463 * a {@link org.eclipse.swt.widgets.Display} object.
464 * @param selectionProvider
465 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
467 public CdmFormFactory(Display display
, ISelectionProvider selectionProvider
) {
469 this.selectionProvider
= selectionProvider
;
475 * Constructor for CdmFormFactory.
479 * a {@link org.eclipse.swt.widgets.Display} object.
481 public CdmFormFactory(Display display
) {
489 private void init() {
490 boldFontHolder2
= new BoldFontHolder2();
491 selectionMouseHandler
= new SelectionMouseHandler();
492 selectionFocusHandler
= new SelectionFocusHandler();
496 * Creates an instance initialized with the correct selectionProvider
498 * Make sure to remove the instance when the entityComposite disposes via
499 * destroySelectionArbitrator(..)
501 * @param entityElement
502 * a {@link eu.etaxonomy.taxeditor.ui.element.IEntityElement}
504 * @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
507 public SelectionArbitrator
createSelectionArbitrator(
508 IEntityElement entityElement
) {
509 SelectionArbitrator selectionArbitrator
= new SelectionArbitrator(
511 selectionArbitrator
.addSelectionProvider(selectionProvider
);
512 selectionProvider
.addSelectionChangedListener(selectionArbitrator
);
513 addSelectionListener(selectionArbitrator
);
514 return selectionArbitrator
;
519 * destroySelectionArbitrator
522 * @param selectionArbitrator
523 * a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
526 public void destroySelectionArbitrator(
527 SelectionArbitrator selectionArbitrator
) {
528 removeSelectionListener(selectionArbitrator
);
529 if (selectionProvider
!= null) {
531 .removeSelectionChangedListener(selectionArbitrator
);
534 .error(this.getClass(),
535 "Tried to destroy a selection listener from this factories listeners but was null",
542 public void adapt(Composite composite
) {
543 composite
.addMouseListener(selectionMouseHandler
);
544 super.adapt(composite
);
554 * {@link eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement}
557 public void adapt(AbstractCdmFormElement formElement
) {
558 formElement
.setPropertyChangeListeners(propertyChangeListeners
);
563 public void adapt(Control control
, boolean trackFocus
, boolean trackKeyboard
) {
565 control
.addFocusListener(selectionFocusHandler
);
567 super.adapt(control
, trackFocus
, trackKeyboard
);
576 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
579 public void destroyElement(ICdmFormElement formElement
) {
580 // return if element was not initialized
581 if (formElement
== null) {
584 // destroy selection arbitrator, if any
585 if (formElement
instanceof ISelectableElement
) {
586 destroySelectionArbitrator(((ISelectableElement
) formElement
)
587 .getSelectionArbitrator());
589 // remove this element form its parents list of elements
590 // ICdmFormElement parentElement = formElement.getParentElement();
591 // if(parentElement != null){
592 // parentElement.removeElement(formElement);
594 // call destroy on child elements recursively
595 for (ICdmFormElement childElement
: formElement
.getElements()) {
596 destroyElement(childElement
);
598 // dispose of the controls
599 for (Control control
: formElement
.getControls()) {
600 // we added the layoutComposite of the parental element as the
601 // layout composite to this formElement
602 // but we do not want to destroy it.
603 if (control
.equals(formElement
.getLayoutComposite())) {
618 * a {@link org.eclipse.swt.widgets.Composite} object.
619 * @return a {@link org.eclipse.swt.widgets.Label} object.
621 public Label
createEmptyCell(Composite parent
) {
622 return this.createLabel(parent
, null);
627 * createMultilineTextWithLabel
631 * a {@link java.lang.String} object.
636 * @param parentElement
637 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
639 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
642 public TextWithLabelElement
createMultilineTextWithLabel(
643 ICdmFormElement parentElement
, String labelString
, int textHeight
,
645 TextWithLabelElement element
= new TextWithLabelElement(this,
646 parentElement
, labelString
, "", textHeight
, style
);
648 parentElement
.addElement(element
);
654 * createMultiLanguageTextElement
657 * @param parentElement
658 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
661 * a {@link java.lang.String} object.
662 * @param multilanguageText
663 * a {@link java.util.Map} object.
669 * {@link eu.etaxonomy.taxeditor.ui.element.MultilanguageTextElement}
672 public MultilanguageTextElement
createMultiLanguageTextElement(
673 ICdmFormElement parentElement
, String labelString
,
674 Map
<Language
, LanguageString
> multilanguageText
, int textHeight
,
676 MultilanguageTextElement element
= new MultilanguageTextElement(this,
677 parentElement
, labelString
, multilanguageText
, textHeight
,
680 parentElement
.addElement(element
);
684 public KeyStatementElement
createKeyStatementElement(
685 ICdmFormElement parentElement
, String labelString
,
686 KeyStatement keyStatement
, int textHeight
, int style
) {
687 KeyStatementElement element
= new KeyStatementElement(this,
688 parentElement
, labelString
, keyStatement
, textHeight
, style
);
690 parentElement
.addElement(element
);
696 * createTextWithLabelElement
700 * a {@link java.lang.String} object.
702 * a {@link java.lang.String} object.
705 * @param parentElement
706 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
708 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
711 public TextWithLabelElement
createTextWithLabelElement(
712 ICdmFormElement parentElement
, String labelString
,
713 String initialText
, int style
) {
714 TextWithLabelElement element
= new TextWithLabelElement(this,
715 parentElement
, labelString
, initialText
, null, style
);
717 parentElement
.addElement(element
);
721 public UriWithLabelElement
createUriWithLabelElement(
722 ICdmFormElement parentElement
, String labelString
, URI initialUri
,
724 UriWithLabelElement element
= new UriWithLabelElement(this,
725 parentElement
, labelString
, initialUri
, null, style
);
727 parentElement
.addElement(element
);
738 public OpenUrlSelectorElement
createOpenUrlSelectorElement(
739 ICdmFormElement parentElement
, String labelString
,
740 IOpenUrlEnabled openUrlEnabled
, int style
) {
741 OpenUrlSelectorElement element
= new OpenUrlSelectorElement(this,
742 parentElement
, labelString
, openUrlEnabled
, style
);
744 parentElement
.addElement(element
);
750 * @param parentElement
752 * @param conversationEnabled
757 public EditPasswordElement
createEditPasswordElement(
758 ICdmFormElement parentElement
, String labelString
,
759 ConversationHolder conversation
, User user
, int style
) {
760 EditPasswordElement element
= new EditPasswordElement(this,
761 parentElement
, labelString
, user
, conversation
);
763 parentElement
.addElement(element
);
769 * createIntegerTextWithLabelElement
772 * @param parentElement
773 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
776 * a {@link java.lang.String} object.
777 * @param initialInteger
778 * a {@link java.lang.Integer} object.
781 * @return a {@link eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement}
784 public NumberWithLabelElement
createIntegerTextWithLabelElement(
785 ICdmFormElement parentElement
, String labelString
,
786 Integer initialInteger
, int style
) {
787 NumberWithLabelElement element
= new NumberWithLabelElement(this,
788 parentElement
, labelString
, initialInteger
, style
);
790 parentElement
.addElement(element
);
796 * createFloatTextWithLabelElement
799 * @param parentElement
800 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
803 * a {@link java.lang.String} object.
804 * @param initialFloat
808 * @return a {@link eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement}
811 public NumberWithLabelElement
createFloatTextWithLabelElement(
812 ICdmFormElement parentElement
, String labelString
,
813 float initialFloat
, int style
) {
814 NumberWithLabelElement element
= new NumberWithLabelElement(this,
815 parentElement
, labelString
, initialFloat
, style
);
817 parentElement
.addElement(element
);
823 * createLanguageStringWithLabelElement
826 * @param parentElement
827 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
830 * a {@link java.lang.String} object.
831 * @param languageString
832 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
836 * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
839 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
840 ICdmFormElement parentElement
, String labelString
,
841 LanguageString languageString
, int style
) {
842 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
843 this, parentElement
, labelString
, languageString
, style
);
845 parentElement
.addElement(element
);
851 * createLanguageStringWithLabelElement
854 * @param parentElement
855 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
858 * a {@link java.lang.String} object.
859 * @param languageString
860 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
866 * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
869 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
870 ICdmFormElement parentElement
, String labelString
,
871 LanguageString languageString
, int height
, int style
) {
872 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
873 this, parentElement
, labelString
, languageString
, height
, style
);
875 parentElement
.addElement(element
);
884 * @param parentElement
885 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
888 * a {@link java.lang.String} object.
891 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
894 public TextWithLabelElement
createTextElement(
895 ICdmFormElement parentElement
, String initialText
, int style
) {
896 TextWithLabelElement element
= new TextWithLabelElement(this,
897 parentElement
, null, initialText
, null, style
);
899 parentElement
.addElement(element
);
905 * createKeyValueViewerElement
908 * @param parentElement
909 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
912 * a {@link java.lang.String} object.
913 * @param valueHeading
914 * a {@link java.lang.String} object.
916 * a {@link java.util.Map} object.
917 * @return a {@link eu.etaxonomy.taxeditor.ui.element.KeyValueViewerElement}
920 public KeyValueViewerElement
createKeyValueViewerElement(
921 ICdmFormElement parentElement
, String keyHeading
,
922 String valueHeading
, Map
<Object
, Object
> map
) {
923 KeyValueViewerElement element
= new KeyValueViewerElement(this,
924 parentElement
, keyHeading
, valueHeading
, map
);
926 parentElement
.addElement(element
);
932 * createTermComboElement
935 * @param termComboType
937 * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.TermComboType}
939 * @param parentElement
940 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
943 * a {@link java.lang.String} object.
945 * a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase}
949 * @return a {@link eu.etaxonomy.taxeditor.ui.combo.TermComboElement}
953 public <T
extends DefinedTermBase
> TermComboElement
<T
> createTermComboElement(
954 Class
<T
> termComboType
, ICdmFormElement parentElement
,
955 String labelString
, T selection
, int style
) {
956 TermComboElement
<T
> element
= new TermComboElement
<T
>(this, parentElement
, termComboType
, labelString
, selection
, style
);
958 parentElement
.addElement(element
);
964 * createEnumComboElement
967 * @param enumComboType
969 * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EnumComboType}
971 * @param parentElement
972 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
976 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
979 public <T
extends IDefinedTerm
> EnumComboElement
<T
> createEnumComboElement(
980 Class
<T
> enumComboType
, ICdmFormElement parentElement
,
982 EnumComboElement
<T
> element
= new EnumComboElement
<T
>(this, parentElement
, enumComboType
, style
);
984 parentElement
.addElement(element
);
990 * createBrowserElement
994 * a {@link java.net.URI} object.
997 * @param parentElement
998 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1000 * @return a {@link eu.etaxonomy.taxeditor.ui.element.BrowserElement} object.
1002 public BrowserElement
createBrowserElement(ICdmFormElement parentElement
,
1003 URI imageUri
, int style
) {
1004 BrowserElement element
= new BrowserElement(this, parentElement
,
1007 parentElement
.addElement(element
);
1013 * createImageElement
1016 * @param parentElement
1017 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1020 * a {@link java.net.URI} object.
1023 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ImageElement} object.
1025 public ImageElement
createImageElement(ICdmFormElement parentElement
,
1026 URI imageUri
, int style
) {
1027 ImageElement element
= new ImageElement(this, parentElement
, imageUri
,
1030 parentElement
.addElement(element
);
1036 * createTextActionElement
1039 * @param labelString
1040 * a {@link java.lang.String} object.
1041 * @param initialText
1042 * a {@link java.lang.String} object.
1045 * @param parentElement
1046 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1048 * @param buttonLabel
1049 * a {@link java.lang.String} object.
1050 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextActionElement}
1053 public TextActionElement
createTextActionElement(
1054 ICdmFormElement parentElement
, String labelString
,
1055 String buttonLabel
, String initialText
, int style
) {
1056 TextActionElement element
= new TextActionElement(this, parentElement
,
1057 labelString
, buttonLabel
, initialText
, style
);
1059 parentElement
.addElement(element
);
1065 * @author n.hoffmann
1066 * @created Mar 5, 2010
1069 public static enum SelectionType
{
1070 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
1078 * @param parentElement
1079 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1082 * a {@link java.lang.String} object.
1083 * @param initialState
1087 * @return a {@link eu.etaxonomy.taxeditor.ui.element.CheckboxElement} object.
1089 public CheckboxElement
createCheckbox(ICdmFormElement parentElement
,
1090 String label
, boolean initialState
, int style
) {
1091 CheckboxElement element
= new CheckboxElement(this, parentElement
,
1092 label
, initialState
, style
| orientation
);
1094 parentElement
.addElement(element
);
1099 * Creates a section as a part of the form.
1101 * @return the section widget
1103 * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1106 public Section
adapt(AbstractFormSection section
) {
1107 section
.setMenu(section
.getLayoutComposite().getMenu());
1108 adapt(section
, true, true);
1110 // handle focus and property change events for cdm use
1111 section
.addFocusListener(selectionFocusHandler
);
1112 section
.setPropertyChangeListeners(propertyChangeListeners
);
1114 if (section
.getToggle() != null) {
1115 section
.getToggle().setHoverDecorationColor(
1116 getColors().getColor(IFormColors
.TB_TOGGLE_HOVER
));
1117 section
.getToggle().setDecorationColor(
1118 getColors().getColor(IFormColors
.TB_TOGGLE
));
1121 section
.setFont(boldFontHolder2
.getBoldFont(section
1122 .getLayoutComposite().getFont()));
1124 if ((section
.getStyle() & Section
.TITLE_BAR
) != 0
1125 || (section
.getStyle() & Section
.SHORT_TITLE_BAR
) != 0) {
1126 getColors().initializeSectionToolBarColors();
1127 section
.setTitleBarBackground(getColors().getColor(
1128 IFormColors
.TB_BG
));
1129 section
.setTitleBarBorderColor(getColors().getColor(
1130 IFormColors
.TB_BORDER
));
1132 // call setTitleBarForeground regardless as it also sets the label color
1133 section
.setTitleBarForeground(getColors().getColor(
1134 IFormColors
.TB_TOGGLE
));
1138 private class BoldFontHolder2
{
1139 private Font normalFont
;
1141 private Font boldFont
;
1143 public BoldFontHolder2() {
1146 public Font
getBoldFont(Font font
) {
1147 createBoldFont(font
);
1151 private void createBoldFont(Font font
) {
1152 if (normalFont
== null || !normalFont
.equals(font
)) {
1156 if (boldFont
== null) {
1157 boldFont
= FormFonts
.getInstance().getBoldFont(
1158 getColors().getDisplay(), normalFont
);
1162 public void dispose() {
1163 if (boldFont
!= null) {
1164 FormFonts
.getInstance().markFinished(boldFont
,
1165 getColors().getDisplay());
1173 * createToggleableTextField
1176 * @param parentElement
1177 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1179 * @param labelString
1180 * a {@link java.lang.String} object.
1181 * @param initialText
1182 * a {@link java.lang.String} object.
1183 * @param initialState
1187 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement}
1190 public ToggleableTextElement
createToggleableTextField(
1191 ICdmFormElement parentElement
, String labelString
,
1192 String initialText
, boolean initialState
, int style
) {
1193 ToggleableTextElement element
= new ToggleableTextElement(this,
1194 parentElement
, labelString
, initialText
, initialState
, style
1197 parentElement
.addElement(element
);
1203 * createTimePeriodElement
1206 * @param parentElement
1207 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1209 * @param labelString
1210 * a {@link java.lang.String} object.
1212 * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1215 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TimePeriodElement}
1218 public TimePeriodElement
createTimePeriodElement(
1219 ICdmFormElement parentElement
, String labelString
,
1220 TimePeriod timePeriod
, int style
) {
1221 TimePeriodElement element
= new TimePeriodElement(this, parentElement
,
1222 labelString
, timePeriod
, style
);
1224 parentElement
.addElement(element
);
1230 * createPointElement
1235 * @param parentElement
1236 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1239 * a {@link eu.etaxonomy.cdm.model.location.Point} object.
1240 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PointElement} object.
1242 public PointElement
createPointElement(ICdmFormElement parentElement
,
1243 Point point
, int style
) {
1244 PointElement element
= new PointElement(this, parentElement
, point
,
1247 parentElement
.addElement(element
);
1253 * createDateDetailSection
1256 * @param parentElement
1257 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1261 * @return a {@link eu.etaxonomy.taxeditor.ui.element.DateDetailSection}
1264 public DateDetailSection
createDateDetailSection(
1265 ICdmFormElement parentElement
, int style
) {
1266 DateDetailSection section
= new DateDetailSection(this, parentElement
,
1268 parentElement
.addElement(section
);
1275 * createPartialElement
1278 * @param parentElement
1279 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1281 * @param labelString
1282 * a {@link java.lang.String} object.
1284 * a {@link org.joda.time.Partial} object.
1287 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PartialElement} object.
1289 public PartialElement
createPartialElement(ICdmFormElement parentElement
,
1290 String labelString
, Partial partial
, int style
) {
1291 PartialElement element
= new PartialElement(this, parentElement
,
1292 labelString
, style
);
1294 parentElement
.addElement(element
);
1300 * addSelectionListener
1304 * a {@link org.eclipse.swt.events.SelectionListener} object.
1306 public void addSelectionListener(SelectionListener listener
) {
1307 selectionListenerList
.add(listener
);
1312 * removeSelectionListener
1316 * a {@link org.eclipse.swt.events.SelectionListener} object.
1318 public void removeSelectionListener(SelectionListener listener
) {
1319 if (listener
== null) {
1321 .error(this.getClass(),
1322 "Tried to remove a selection listener from this factories listeners but was null",
1325 selectionListenerList
.remove(listener
);
1331 * addPropertyChangeListener
1335 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1338 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
1339 if(propertyChangeListeners
.contains(listener
)){
1342 propertyChangeListeners
.add(0, listener
);
1347 * removePropertyChangeListener
1351 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1354 public void removePropertyChangeListener(IPropertyChangeListener listener
) {
1355 propertyChangeListeners
.remove(listener
);
1360 * createHorizontalSeparator
1363 * @param parentElement
1364 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1368 * @return a {@link org.eclipse.swt.widgets.Label} object.
1370 public Label
createHorizontalSeparator(ICdmFormElement parentElement
,
1372 Label separator
= this.createSeparator(
1373 parentElement
.getLayoutComposite(), SWT
.HORIZONTAL
| style
);
1374 separator
.setLayoutData(FILL_HORIZONTALLY());
1380 * createVersionElement
1383 * @param parentElement
1384 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1387 * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
1392 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
1395 public VersionElement
createVersionElement(ICdmFormElement parentElement
,
1396 VersionableEntity entity
, int style
) {
1397 VersionElement element
= new VersionElement(this, parentElement
,
1400 parentElement
.addElement(element
);
1405 * @param cdmBaseSection
1410 public CdmBaseElement
createCdmBaseElement(ICdmFormElement parentElement
,
1411 CdmBase entity
, int style
) {
1412 CdmBaseElement element
= new CdmBaseElement(this, parentElement
,
1415 parentElement
.addElement(element
);
1422 * createVersionSection
1425 * @param parentElement
1426 * a {@link eu.etaxonomy.taxeditor.ui.element.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
);
1447 public CdmBaseSection
createCdmBaseSection(ICdmFormElement parentElement
, int style
) {
1448 CdmBaseSection section
= new CdmBaseSection(this, parentElement
, style
);
1449 parentElement
.addElement(section
);
1456 * createEmptyElement
1459 * @param parentElement
1460 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1462 * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1464 public EmptyElement
createEmptyElement(ICdmFormElement parentElement
) {
1465 EmptyElement element
= new EmptyElement(this, parentElement
, null,
1468 parentElement
.addElement(element
);
1474 * createHeadlineSection
1477 * @param parentElement
1478 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1481 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
1484 public HeadlineSection
createHeadlineSection(ICdmFormElement parentElement
) {
1485 HeadlineSection section
= new HeadlineSection(this, parentElement
,
1487 parentElement
.addElement(section
);
1494 * createParsingMessageElement
1497 * @param parentElement
1498 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1500 * @param parserProblem
1501 * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
1506 * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
1509 public ParsingMessageElement
createParsingMessageElement(
1510 ICdmFormElement parentElement
, ParserProblem parserProblem
,
1512 ParsingMessageElement element
= new ParsingMessageElement(this,
1513 parentElement
, parserProblem
, style
);
1515 parentElement
.addElement(element
);
1524 public static enum DetailType
{
1528 NOMENCLATURALREFERENCE
,
1540 DERIVED_UNIT_FACADE
,
1544 FEATURE_DISTRIBUTION
,
1549 POLYTOMOUS_KEY_NODE
,
1551 DERIVED_UNIT_GENERAL
,
1563 public AbstractFormSection
createDefinedTermDetailSection(Class definedTermClass
,
1564 ConversationHolder conversation
, ICdmFormElement parentElement
,
1565 ISelectionProvider selectionProvider
, int style
) {
1567 AbstractFormSection section
= new DefinedTermDetailSection(this, definedTermClass
, conversation
, parentElement
, selectionProvider
, style
);
1569 parentElement
.addElement(section
);
1576 * @param definedTermClass
1577 * @param formElement
1581 public AbstractCdmDetailElement
createDefinedTermDetailElement(
1582 Class definedTermClass
, AbstractCdmDetailSection parentElement
,
1584 AbstractCdmDetailElement element
= null;
1586 if (NamedArea
.class.isAssignableFrom(definedTermClass
)){
1587 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1590 element
= new DefinedTermDetailElement(this, parentElement
);
1594 parentElement
.addElement(element
);
1600 * createCdmDetailSection
1605 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
1607 * @param parentElement
1608 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1610 * @param selectionProvider
1611 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1614 * @param conversation
1615 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1617 * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1620 public AbstractFormSection
createCdmDetailSection(DetailType detailType
,
1621 ConversationHolder conversation
, ICdmFormElement parentElement
,
1622 ISelectionProvider selectionProvider
, int style
) {
1623 AbstractFormSection section
= null;
1625 switch (detailType
) {
1626 case SCIENTIFICNAME
:
1627 section
= new NameDetailSection(this, conversation
, parentElement
,
1628 selectionProvider
, style
);
1631 section
= new ReferenceDetailSection(this, conversation
,
1632 parentElement
, selectionProvider
, style
);
1634 case NOMENCLATURALREFERENCE
:
1635 section
= new NomenclaturalReferenceDetailSection(this,
1636 conversation
, parentElement
, selectionProvider
, style
);
1639 section
= new TaxonBaseDetailSection(this, conversation
,
1640 parentElement
, selectionProvider
, style
);
1643 section
= new AuthorshipDetailSection(this, conversation
,
1644 parentElement
, selectionProvider
, style
);
1646 case TEAMORPERSONBASE
:
1647 section
= new TeamOrPersonBaseDetailSection(this, conversation
,
1648 parentElement
, selectionProvider
, style
);
1651 section
= new TeamDetailSection(this, conversation
, parentElement
,
1655 section
= new PersonDetailSection(this, conversation
,
1656 parentElement
, null, style
);
1659 section
= new DescriptionDetailSection(this, conversation
,
1660 parentElement
, selectionProvider
, style
);
1662 case DESCRIPTIONELEMENT
:
1663 section
= new DescriptionElementDetailSection(this, conversation
,
1664 parentElement
, selectionProvider
, style
);
1666 case PARSINGMESSAGE
:
1667 section
= new ParsingMessagesSection(this, conversation
,
1668 parentElement
, selectionProvider
, style
);
1671 section
= new NonViralNameDetailSection(this, conversation
,
1672 parentElement
, selectionProvider
, style
);
1675 section
= new eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection(
1676 this, conversation
, parentElement
, selectionProvider
, style
);
1678 case DERIVED_UNIT_FACADE
:
1679 section
= new DerivedUnitFacadeDetailSection(this, conversation
,
1680 parentElement
, selectionProvider
, style
);
1682 case FIELD_OBSERVATION
:
1683 section
= new FieldObservationDetailSection(this, conversation
,
1684 parentElement
, selectionProvider
, style
);
1686 case GATHERING_EVENT
:
1687 section
= new GatheringEventDetailSection(this, conversation
,
1688 parentElement
, selectionProvider
, style
);
1691 section
= new DerivedUnitBaseDetailSection(this, conversation
,
1692 parentElement
, selectionProvider
, style
);
1694 case NATURAL_LANGUAGE
:
1695 section
= new NaturalLanguageSection(this, conversation
,
1696 parentElement
, selectionProvider
, style
);
1698 case FEATURE_DISTRIBUTION
:
1699 section
= new FeatureDistributionDetailSection(this, conversation
,
1700 parentElement
, selectionProvider
, style
);
1702 case CLASSIFICATION
:
1703 section
= new ClassificationDetailSection(this, conversation
,
1704 parentElement
, selectionProvider
, style
);
1707 section
= new TaxonNodeDetailSection(this, conversation
,
1708 parentElement
, selectionProvider
, style
);
1710 case POLYTOMOUS_KEY
:
1711 section
= new PolytomousKeyDetailSection(this, conversation
,
1712 parentElement
, selectionProvider
, style
);
1714 case POLYTOMOUS_KEY_NODE
:
1715 section
= new PolytomousKeyNodeDetailSection(this, conversation
,
1716 parentElement
, selectionProvider
, style
);
1719 section
= new InstitutionDetailSection(this, conversation
,
1720 parentElement
, selectionProvider
, style
);
1722 case DERIVED_UNIT_GENERAL
:
1723 section
= new GeneralDetailSection(this, conversation
,
1724 parentElement
, selectionProvider
, style
);
1727 section
= new HybridDetailSection(this, conversation
,
1728 parentElement
, selectionProvider
, style
);
1731 section
= new UserDetailSection(this, conversation
, parentElement
,
1732 selectionProvider
, style
);
1735 section
= new GroupDetailSection(this, conversation
, parentElement
,
1736 selectionProvider
, style
);
1739 section
= new DeterminationDetailSection(this, conversation
, parentElement
,
1740 selectionProvider
, style
);
1742 case TAXON_RELATIONSHIP
:
1743 section
= new TaxonRelationshipDetailSection(this, conversation
, parentElement
,
1744 selectionProvider
, style
);
1746 case REFERENCED_ENTITY
:
1747 section
= new ReferencedEntityDetailSection(this, conversation
, parentElement
,
1748 selectionProvider
, style
);
1750 case TERM_VOCABULARY
:
1751 section
= new TermVocabularyDetailSection(this, conversation
, parentElement
,
1752 selectionProvider
, style
);
1755 section
= new NamedAreaDetailSection(this, conversation
, parentElement
,
1756 selectionProvider
, style
);
1760 if (section
== null) {
1761 throw new RuntimeException(
1762 "You tried to create a cdm detail section that is not implemented yet.");
1765 parentElement
.addElement(section
);
1774 * createCdmDetailElement
1779 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
1783 * @param parentElement
1784 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1787 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
1790 public AbstractCdmDetailElement
createCdmDetailElement(
1791 DetailType detailType
, ICdmFormElement parentElement
, int style
) {
1792 AbstractCdmDetailElement element
= null;
1794 switch (detailType
) {
1795 case SCIENTIFICNAME
:
1796 element
= new NameDetailElement(this, parentElement
, style
);
1799 element
= new ReferenceDetailElement(this, parentElement
, style
);
1801 case NOMENCLATURALREFERENCE
:
1802 element
= new NomenclaturalReferenceDetailElement(this,
1803 parentElement
, style
);
1806 element
= new TaxonBaseDetailElement(this, parentElement
, style
);
1809 element
= new AuthorshipDetailElement(this, parentElement
, style
);
1812 element
= new TeamDetailElement(this, parentElement
, style
);
1815 element
= new PersonDetailElement(this, parentElement
, style
);
1818 element
= new DescriptionDetailElement(this, parentElement
, style
);
1820 case DESCRIPTIONELEMENT
:
1821 element
= new DescriptionElementDetailElement(this, parentElement
,
1825 element
= new NonViralNameDetailElement(this, parentElement
);
1827 case DERIVED_UNIT_FACADE
:
1828 element
= new DerivedUnitFacadeDetailElement(this, parentElement
);
1830 case FIELD_OBSERVATION
:
1831 element
= new FieldObservationDetailElement(this, parentElement
);
1833 case GATHERING_EVENT
:
1834 element
= new GatheringEventDetailElement(this, parentElement
);
1837 element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1839 case NATURAL_LANGUAGE
:
1840 element
= new NaturalLanguageDetailElement(this, parentElement
);
1842 case FEATURE_DISTRIBUTION
:
1843 element
= new FeatureDistributionDetailElement(this, parentElement
);
1845 case CLASSIFICATION
:
1846 element
= new ClassificationDetailElement(this, parentElement
);
1849 element
= new TaxonNodeDetailElement(this, parentElement
);
1852 element
= new CollectionDetailElement(this, parentElement
);
1854 case POLYTOMOUS_KEY
:
1855 element
= new PolytomousKeyDetailElement(this, parentElement
);
1857 case POLYTOMOUS_KEY_NODE
:
1858 element
= new PolytomousKeyNodeDetailElement(this, parentElement
);
1861 element
= new InstitutionDetailElement(this, parentElement
);
1863 case DERIVED_UNIT_GENERAL
:
1864 element
= new GeneralDetailElement(this, parentElement
);
1867 element
= new HybridDetailElement(this, parentElement
);
1870 element
= new UserDetailElement(this, parentElement
);
1873 element
= new GroupDetailElement(this, parentElement
);
1876 element
= new DeterminationDetailElement(this, parentElement
);
1878 case TAXON_RELATIONSHIP
:
1879 element
= new TaxonRelationshipDetailElement(this, parentElement
);
1881 case REFERENCED_ENTITY
:
1882 element
= new RefereneEntityDetailElement(this, parentElement
);
1884 case TERM_VOCABULARY
:
1885 element
= new TermVocabularyDetailElement(this, parentElement
);
1888 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1890 case NAMED_AREA_LEVEL
:
1891 element
= new DefinedTermDetailElement
<NamedAreaLevel
>(this, parentElement
);
1895 if (element
== null) {
1897 .error(this.getClass(),
1898 "Detail element was not created. Seems like the case was not implemented for the requested detail type: "
1899 + detailType
, null);
1903 parentElement
.addElement(element
);
1909 * @author n.hoffmann
1910 * @created Mar 5, 2010
1913 public static enum EntityDetailType
{
1918 DESCRIPTIONELEMENTSOURCE
,
1922 DESCRIPTIONELEMENTMEDIA
,
1923 MEDIAREPRESENTATION
,
1924 MEDIAREPRESENTATIONPART
,
1926 NOMENCLATURALSTATUS
,
1935 STATISTICAL_MEASUREMENT_VALUE
,
1938 DETERMINATION_EVENT
,
1939 SPECIMEN_COLLECTION
,
1940 IDENTIFIABLE_SOURCE_COLLECTION
,
1947 DETERMINATION_CURRENT
,
1948 DETERMINATION_HISTORY
1953 * createEntityDetailSection
1956 * @param entityDetailType
1958 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType}
1962 * @param conversation
1963 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1965 * @param parentElement
1966 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1968 * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1971 public AbstractFormSection
createEntityDetailSection(
1972 EntityDetailType entityDetailType
, ConversationHolder conversation
,
1973 ICdmFormElement parentElement
, int style
) {
1974 AbstractFormSection section
= null;
1976 switch (entityDetailType
) {
1978 section
= new TeamDetailSection(this, conversation
, parentElement
,
1982 section
= new TeamMemberSection(this, conversation
, parentElement
,
1986 section
= new AnnotationSection(this, conversation
, parentElement
,
1990 section
= new CreditSection(this, conversation
, parentElement
,
1993 case DESCRIPTIONELEMENTSOURCE
:
1994 section
= new DescriptionElementSourceSection(this, conversation
,
1995 parentElement
, style
);
1998 section
= new ExtensionSection(this, conversation
, parentElement
,
2002 section
= new MarkerSection(this, conversation
, parentElement
,
2006 section
= new MediaSection(this, conversation
, parentElement
, style
);
2008 case DESCRIPTIONELEMENTMEDIA
:
2009 section
= new DescriptionElementMediaSection(this, conversation
,
2010 parentElement
, style
);
2012 case MEDIAREPRESENTATION
:
2013 section
= new MediaRepresentationSection(this, conversation
,
2014 parentElement
, style
);
2016 case MEDIAREPRESENTATIONPART
:
2017 section
= new MediaRepresentationPartSection(this, conversation
,
2018 parentElement
, style
);
2021 section
= new ModifierSection(this, conversation
, parentElement
,
2024 case NOMENCLATURALSTATUS
:
2025 section
= new NomenclaturalStatusSection(this, conversation
,
2026 parentElement
, style
);
2028 case NAME_RELATIONSHIP
:
2029 section
= new NameRelationshipDetailSection(this, conversation
,
2030 parentElement
, style
);
2033 section
= new ProtologueSection(this, conversation
, parentElement
,
2037 section
= new RightsSection(this, conversation
, parentElement
,
2041 section
= new SourceSection(this, conversation
, parentElement
,
2045 section
= new ScopeSection(this, conversation
, parentElement
, style
);
2047 case DESCRIPTIONSOURCE
:
2048 section
= new DescriptionSourceSection(this, conversation
,
2049 parentElement
, style
);
2051 case TYPEDESIGNATION
:
2052 section
= new TypeDesignationSection(this, conversation
,
2053 parentElement
, style
);
2056 section
= new StateDataSection(this, conversation
, parentElement
,
2059 case STATISTICAL_MEASUREMENT_VALUE
:
2060 section
= new StatisticalMeasurementValueSection(this,
2061 conversation
, parentElement
, style
);
2063 case DESCRIBED_SPECIMEN
:
2064 section
= new DescribedSpecimenSection(this, conversation
,
2065 parentElement
, style
);
2067 case COLLECTING_AREA
:
2068 section
= new CollectingAreasDetailSection(this, conversation
,
2069 parentElement
, style
);
2071 case DETERMINATION_CURRENT
:
2072 section
= new CurrentDeterminationDetailSection(this, conversation
,
2073 parentElement
, style
);
2075 case DETERMINATION_HISTORY
:
2076 section
= new DeterminationHistoryDetailSection(this, conversation
,
2077 parentElement
, style
);
2079 case SPECIMEN_COLLECTION
:
2080 section
= new SpecimenCollectionDetailSection(this, conversation
,
2081 parentElement
, style
);
2083 case IDENTIFIABLE_SOURCE_COLLECTION
:
2084 section
= new SourceCollectionDetailSection(this, conversation
,
2085 parentElement
, style
);
2087 case GEOGRAPHICAL_SCOPE
:
2088 section
= new GeographicalScopeDetailSection(this, conversation
,
2089 parentElement
, style
);
2091 case SCOPE_RESTRICTION
:
2092 section
= new ScopeRestrictionSection(this, conversation
,
2093 parentElement
, style
);
2096 section
= new MemberDetailSection(this, conversation
,
2097 parentElement
, style
);
2099 case GRANTED_AUTHORITY
:
2100 section
= new GrantedAuthorityDetailSection(this, conversation
,
2101 parentElement
, style
);
2103 case GROUPS_BY_USER
:
2104 section
= new GroupsByUserDetailSection(this, conversation
,
2105 parentElement
, style
);
2107 case TAXONOMIC_SCOPE
:
2108 section
= new TaxonomicScopeSection(this, conversation
,
2109 parentElement
, style
);
2112 parentElement
.addElement(section
);
2119 * createEntityCollectionElement
2122 * @param removeListener
2123 * a {@link org.eclipse.swt.events.SelectionListener} object.
2126 * @param parentElement
2127 * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
2129 * @param versionableEntity
2130 * a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity}
2132 * @param backgroundColor
2133 * a {@link org.eclipse.swt.graphics.Color} object.
2135 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement}
2138 public AbstractEntityCollectionElement
createEntityCollectionElement(
2139 AbstractFormSection parentElement
, Object versionableEntity
,
2140 SelectionListener removeListener
, Color backgroundColor
, int style
) {
2141 AbstractEntityCollectionElement element
= null;
2143 Object entity
= HibernateProxyHelper
.deproxy(versionableEntity
);
2145 if (entity
instanceof Annotation
) {
2146 element
= new AnnotationElement(this, parentElement
,
2147 (Annotation
) entity
, removeListener
, style
);
2148 } else if (entity
instanceof Person
) {
2149 element
= new TeamMemberElement(this, parentElement
,
2150 (Person
) entity
, removeListener
, style
);
2151 } else if (entity
instanceof Credit
) {
2152 element
= new CreditElement(this, parentElement
, (Credit
) entity
,
2153 removeListener
, style
);
2154 } else if (entity
instanceof Extension
) {
2155 element
= new ExtensionElement(this, parentElement
,
2156 (Extension
) entity
, removeListener
, style
);
2157 } else if (entity
instanceof Marker
) {
2158 element
= new MarkerElement(this, parentElement
, (Marker
) entity
,
2159 removeListener
, style
);
2160 } else if (entity
instanceof Media
) {
2161 element
= new MediaElement(this, parentElement
, (Media
) entity
,
2162 removeListener
, style
);
2163 } else if (entity
instanceof MediaRepresentation
) {
2164 element
= new MediaRepresentationElement(this, parentElement
,
2165 (MediaRepresentation
) entity
, removeListener
, style
);
2166 } else if (entity
instanceof ImageFile
) {
2167 element
= new ImageFileElement(this, parentElement
,
2168 (ImageFile
) entity
, removeListener
, style
);
2169 } else if (entity
instanceof MediaRepresentationPart
){
2170 element
= new MediaRepresentationPartElement(this, parentElement
,
2171 (MediaRepresentationPart
) entity
, removeListener
, style
);
2172 } else if (entity
instanceof NomenclaturalStatus
) {
2173 element
= new NomenclaturalStatusElement(this, parentElement
,
2174 (NomenclaturalStatus
) entity
, removeListener
, style
);
2175 } else if (entity
instanceof Rights
) {
2176 element
= new RightsElement(this, parentElement
, (Rights
) entity
,
2177 removeListener
, style
);
2178 } else if (entity
instanceof DescriptionElementSource
) {
2179 element
= new DescriptionElementSourceElement(this, parentElement
,
2180 (DescriptionElementSource
) entity
, removeListener
, style
);
2181 } else if (entity
instanceof IdentifiableSource
) {
2182 element
= new IdentifiableSourceElement(this, parentElement
,
2183 (IdentifiableSource
) entity
, removeListener
, style
);
2184 } else if (entity
instanceof Scope
) {
2185 element
= new ScopeElement(this, parentElement
, (Scope
) entity
,
2186 removeListener
, style
);
2187 } else if (entity
instanceof Modifier
) {
2188 element
= new ModifierElement(this, parentElement
,
2189 (Modifier
) entity
, removeListener
, style
);
2190 } else if (entity
instanceof Reference
) {
2191 element
= new DescriptionSourceElement(this, parentElement
,
2192 (Reference
) entity
, removeListener
, style
);
2193 } else if (entity
instanceof NameTypeDesignation
) {
2194 element
= new NameTypeDesignationElement(this, parentElement
,
2195 (NameTypeDesignation
) entity
, removeListener
, style
);
2196 } else if (entity
instanceof NameRelationship
) {
2197 element
= new NameRelationshipDetailElement(this, parentElement
,
2198 (NameRelationship
) entity
, removeListener
, style
);
2199 } else if (entity
instanceof SpecimenTypeDesignation
) {
2200 element
= new SpecimenTypeDesignationElement(this, parentElement
,
2201 (SpecimenTypeDesignation
) entity
, removeListener
, style
);
2202 } else if (entity
instanceof StateData
) {
2203 element
= new StateDataElement(this, parentElement
,
2204 (StateData
) entity
, removeListener
, style
);
2205 } else if (entity
instanceof StatisticalMeasurementValue
) {
2206 element
= new StatisticalMeasurementValueElement(this,
2207 parentElement
, (StatisticalMeasurementValue
) entity
,
2208 removeListener
, style
);
2209 } else if (entity
instanceof DerivedUnit
) {
2210 element
= new DerivedUnitElement(this, parentElement
,
2211 (DerivedUnit
) entity
, removeListener
, style
);
2212 } else if (entity
instanceof NamedArea
) {
2213 element
= new NamedAreaDetailElement(this, parentElement
,
2214 (NamedArea
) entity
, removeListener
, style
);
2215 } else if (entity
instanceof DeterminationEvent
) {
2216 element
= new DeterminationEventDetailElement(this, parentElement
,
2217 (DeterminationEvent
) entity
, removeListener
, style
);
2218 } else if (entity
instanceof Specimen
) {
2219 element
= new SpecimenCollectionDetailElement(this, parentElement
,
2220 (Specimen
) entity
, removeListener
, style
);
2221 } else if (entity
instanceof User
) {
2222 element
= new MemberDetailElement(this, parentElement
,
2223 (User
) entity
, removeListener
, style
);
2224 } else if (entity
instanceof GrantedAuthority
) {
2225 element
= new GrantedAuthorityDetailElement(this, parentElement
,
2226 (GrantedAuthority
) entity
, removeListener
, style
);
2227 } else if (entity
instanceof Group
) {
2228 element
= new GroupsByUserDetailElement(this, parentElement
,
2229 (Group
) entity
, removeListener
, style
);
2230 } else if (entity
instanceof Taxon
) {
2231 element
= new TaxonDetailElement(this, parentElement
,
2232 (Taxon
) entity
, removeListener
, style
);
2233 } else if (entity
instanceof DescriptionElementBase
) {
2234 // this is the special case for protologs, maybe we can do this
2235 // differently when API improves
2236 DescriptionElementBase descriptionElement
= (DescriptionElementBase
) entity
;
2237 if (descriptionElement
.getFeature().equals(Feature
.PROTOLOGUE())) {
2238 element
= new ProtologueElement(this, parentElement
,
2239 descriptionElement
, removeListener
, style
);
2243 if (element
== null) {
2246 "No element for entity",
2248 "Could not generate element for entity. "
2249 + "Looks like the case is not handled already. Check implementation. Entity: "
2254 if (backgroundColor
!= null && !backgroundColor
.isDisposed()) {
2255 element
.setPersistentBackground(backgroundColor
);
2259 parentElement
.addElement(element
);
2265 * createSelectionElement
2268 * @param selectionType
2270 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.SelectionType}
2272 * @param parentElement
2273 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
2275 * @param labelString
2276 * a {@link java.lang.String} object.
2277 * @param selectionType
2279 * a {@link eu.etaxonomy.cdm.model.common.IAnnotatableEntity}
2283 * @param conversation
2284 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
2287 * {@link eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement}
2290 public AbstractSelectionElement
createSelectionElement(
2291 SelectionType selectionType
, ConversationHolder conversation
,
2292 ICdmFormElement parentElement
, String labelString
,
2293 ICdmBase selection
, int mode
, int style
) {
2294 AbstractSelectionElement element
= null;
2296 IAnnotatableEntity entity
= (IAnnotatableEntity
) HibernateProxyHelper
2297 .deproxy(selection
);
2299 switch (selectionType
) {
2301 element
= new AgentSelectionElement(this, conversation
,
2302 parentElement
, labelString
, (TeamOrPersonBase
) entity
,
2306 element
= new PersonSelectionElement(this, conversation
,
2307 parentElement
, labelString
, (Person
) entity
, mode
, style
);
2310 element
= new TeamSelectionElement(this, conversation
,
2311 parentElement
, labelString
, (Team
) entity
, mode
, style
);
2314 element
= new NomenclaturalAuthorTeamSelectionElement(this,
2315 conversation
, parentElement
, labelString
, (Team
) entity
,
2319 element
= new InstitutionSelectionElement(this, conversation
,
2320 parentElement
, labelString
, (Institution
) entity
, mode
,
2324 element
= new NameSelectionElement(this, conversation
,
2325 parentElement
, labelString
, (TaxonNameBase
) entity
, mode
,
2329 element
= new ReferenceSelectionElement(this, conversation
,
2330 parentElement
, labelString
, (Reference
) entity
, mode
, style
);
2333 element
= new TaxonBaseSelectionElement(this, conversation
,
2334 parentElement
, labelString
, (TaxonBase
) entity
, mode
, style
);
2337 element
= new TaxonSelectionElement(this, conversation
,
2338 parentElement
, labelString
, (Taxon
) entity
, mode
, style
);
2341 element
= new SynonymSelectionElement(this, conversation
,
2342 parentElement
, labelString
, (Synonym
) entity
, mode
, style
);
2345 element
= new DerivedUnitBaseSelectionElement(this, conversation
,
2346 parentElement
, labelString
, (DerivedUnitBase
) entity
, mode
,
2349 case FIELD_OBSERVATION
:
2350 element
= new FieldObservationSelectionElement(this, conversation
,
2351 parentElement
, labelString
, (FieldObservation
) entity
,
2355 element
= new FeatureTreeSelectionElement(this, conversation
,
2356 parentElement
, labelString
, (FeatureTree
) entity
, mode
,
2359 case CLASSIFICATION
:
2360 element
= new ClassificationSelectionElement(this, conversation
,
2361 parentElement
, labelString
, (Classification
) entity
, mode
,
2365 element
= new TaxonNodeSelectionElement(this, conversation
,
2366 parentElement
, labelString
, (TaxonNode
) entity
, mode
, style
);
2369 element
= new CollectionSelectionElement(this, conversation
,
2370 parentElement
, labelString
, (Collection
) entity
, mode
,
2374 element
= new FeatureSelectionElement(this, conversation
,
2375 parentElement
, labelString
, (Feature
) entity
, mode
, style
);
2377 case POLYTOMOUS_KEY
:
2378 element
= new PolytomousKeySelectionElement(this, conversation
,
2379 parentElement
, labelString
, (PolytomousKey
) entity
, mode
,
2382 case POLYTOMOUS_KEY_NODE
:
2383 element
= new PolytomousKeyNodeSelectionElement(this, conversation
,
2384 parentElement
, labelString
, (PolytomousKeyNode
) entity
,
2388 element
= new UserSelectionElement(this, conversation
,
2389 parentElement
, labelString
, (User
) entity
, mode
, style
);
2392 element
= new GroupSelectionElement(this, conversation
,
2393 parentElement
, labelString
, (Group
) entity
, mode
, style
);
2396 new RuntimeException(
2397 "There is no selection composite for the desired selection type.");
2402 parentElement
.addElement(element
);
2408 * createNamedAreaSelectionElement
2411 * @param parentElement
2412 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
2414 * @param conversation
2415 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
2417 * @param labelString
2418 * a {@link java.lang.String} object.
2420 * a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
2424 * {@link eu.etaxonomy.taxeditor.ui.selection.NamedAreaSelectionElement}
2427 public NamedAreaSelectionElement
createNamedAreaSelectionElement(
2428 ICdmFormElement parentElement
, ConversationHolder conversation
,
2429 String labelString
, NamedArea selection
, int style
) {
2430 NamedAreaSelectionElement element
= new NamedAreaSelectionElement(this,
2431 conversation
, parentElement
, labelString
, selection
,
2432 AbstractSelectionElement
.NOTHING
, style
);
2434 parentElement
.addElement(element
);
2438 /** {@inheritDoc} */
2439 public LabelElement
createLabel(ICdmFormElement parentElement
, String text
) {
2440 LabelElement labelElement
= new LabelElement(this, parentElement
, text
);
2441 adapt(labelElement
);
2442 parentElement
.addElement(labelElement
);
2443 return labelElement
;
2448 * Getter for the field <code>selectionProvider</code>.
2451 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
2453 public ISelectionProvider
getSelectionProvider() {
2454 return selectionProvider
;
2459 * createDetailedDescriptionDetailElement
2462 * @param parentElement
2463 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
2467 * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
2472 * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
2475 public AbstractDetailedDescriptionDetailElement
createDetailedDescriptionDetailElement(
2476 ICdmFormElement parentElement
, DescriptionElementBase entity
,
2478 AbstractDetailedDescriptionDetailElement detailedDescriptionElement
= null;
2480 if (entity
instanceof CategoricalData
) {
2481 detailedDescriptionElement
= new CategoricalDataDetailElement(this,
2482 parentElement
, (CategoricalData
) entity
, style
);
2483 } else if (entity
instanceof CommonTaxonName
) {
2484 detailedDescriptionElement
= new CommonNameDetailElement(this,
2485 parentElement
, (CommonTaxonName
) entity
, style
);
2486 } else if (entity
instanceof Distribution
) {
2487 detailedDescriptionElement
= new DistributionDetailElement(this,
2488 parentElement
, (Distribution
) entity
, style
);
2489 } else if (entity
instanceof IndividualsAssociation
) {
2490 detailedDescriptionElement
= new IndividualsAssociationDetailElement(
2491 this, parentElement
, (IndividualsAssociation
) entity
, style
);
2492 } else if (entity
instanceof QuantitativeData
) {
2493 detailedDescriptionElement
= new QuantitativeDataDetailElement(
2494 this, parentElement
, (QuantitativeData
) entity
, style
);
2495 } else if (entity
instanceof TaxonInteraction
) {
2496 detailedDescriptionElement
= new TaxonInteractionDetailElement(
2497 this, parentElement
, (TaxonInteraction
) entity
, style
);
2498 } else if (entity
instanceof TextData
) {
2499 detailedDescriptionElement
= new TextDataDetailElement(this,
2500 parentElement
, (TextData
) entity
, style
);
2502 throw new IllegalStateException(
2503 "There is no interface for the given description element");
2505 adapt(detailedDescriptionElement
);
2506 parentElement
.addElement(detailedDescriptionElement
);
2507 return detailedDescriptionElement
;
2512 * Creates a styled text as a part of the form.
2517 * the text initial value
2520 * @return the text widget
2522 public StyledText
createStyledText(Composite parent
, String value
, int style
) {
2523 StyledText text
= new StyledText(parent
, getBorderStyle() | style
2524 | getOrientation());
2526 text
.setText(value
);
2527 text
.setForeground(getColors().getForeground());
2528 text
.setBackground(getColors().getBackground());
2529 // text.addFocusListener(visibilityHandler);