4 package eu
.etaxonomy
.taxeditor
.ui
.forms
;
7 import java
.util
.ArrayList
;
8 import java
.util
.HashSet
;
13 import org
.eclipse
.jface
.util
.IPropertyChangeListener
;
14 import org
.eclipse
.jface
.viewers
.ISelection
;
15 import org
.eclipse
.jface
.viewers
.ISelectionProvider
;
16 import org
.eclipse
.jface
.window
.Window
;
17 import org
.eclipse
.swt
.SWT
;
18 import org
.eclipse
.swt
.custom
.StyledText
;
19 import org
.eclipse
.swt
.events
.FocusAdapter
;
20 import org
.eclipse
.swt
.events
.FocusEvent
;
21 import org
.eclipse
.swt
.events
.FocusListener
;
22 import org
.eclipse
.swt
.events
.MouseAdapter
;
23 import org
.eclipse
.swt
.events
.MouseEvent
;
24 import org
.eclipse
.swt
.events
.MouseListener
;
25 import org
.eclipse
.swt
.events
.SelectionEvent
;
26 import org
.eclipse
.swt
.events
.SelectionListener
;
27 import org
.eclipse
.swt
.events
.TypedEvent
;
28 import org
.eclipse
.swt
.graphics
.Color
;
29 import org
.eclipse
.swt
.graphics
.Font
;
30 import org
.eclipse
.swt
.widgets
.Composite
;
31 import org
.eclipse
.swt
.widgets
.Control
;
32 import org
.eclipse
.swt
.widgets
.Display
;
33 import org
.eclipse
.swt
.widgets
.Event
;
34 import org
.eclipse
.swt
.widgets
.Label
;
35 import org
.eclipse
.ui
.forms
.IFormColors
;
36 import org
.eclipse
.ui
.forms
.widgets
.FormToolkit
;
37 import org
.eclipse
.ui
.forms
.widgets
.Section
;
38 import org
.eclipse
.ui
.forms
.widgets
.TableWrapData
;
39 import org
.eclipse
.ui
.forms
.widgets
.TableWrapLayout
;
40 import org
.eclipse
.ui
.internal
.forms
.widgets
.FormFonts
;
41 import org
.joda
.time
.Partial
;
42 import org
.springframework
.security
.core
.GrantedAuthority
;
44 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
45 import eu
.etaxonomy
.cdm
.api
.facade
.DerivedUnitFacade
;
46 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
47 import eu
.etaxonomy
.cdm
.model
.agent
.Institution
;
48 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
49 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
50 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
51 import eu
.etaxonomy
.cdm
.model
.common
.Annotation
;
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
.TermVocabulary
;
65 import eu
.etaxonomy
.cdm
.model
.common
.TimePeriod
;
66 import eu
.etaxonomy
.cdm
.model
.common
.User
;
67 import eu
.etaxonomy
.cdm
.model
.common
.VersionableEntity
;
68 import eu
.etaxonomy
.cdm
.model
.description
.CategoricalData
;
69 import eu
.etaxonomy
.cdm
.model
.description
.CommonTaxonName
;
70 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionBase
;
71 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
72 import eu
.etaxonomy
.cdm
.model
.description
.Distribution
;
73 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
74 import eu
.etaxonomy
.cdm
.model
.description
.FeatureTree
;
75 import eu
.etaxonomy
.cdm
.model
.description
.IndividualsAssociation
;
76 import eu
.etaxonomy
.cdm
.model
.description
.KeyStatement
;
77 import eu
.etaxonomy
.cdm
.model
.description
.Modifier
;
78 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKey
;
79 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKeyNode
;
80 import eu
.etaxonomy
.cdm
.model
.description
.QuantitativeData
;
81 import eu
.etaxonomy
.cdm
.model
.description
.Scope
;
82 import eu
.etaxonomy
.cdm
.model
.description
.StateData
;
83 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasurementValue
;
84 import eu
.etaxonomy
.cdm
.model
.description
.TaxonInteraction
;
85 import eu
.etaxonomy
.cdm
.model
.description
.TextData
;
86 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
87 import eu
.etaxonomy
.cdm
.model
.location
.NamedAreaLevel
;
88 import eu
.etaxonomy
.cdm
.model
.location
.Point
;
89 import eu
.etaxonomy
.cdm
.model
.media
.ImageFile
;
90 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
91 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
92 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentationPart
;
93 import eu
.etaxonomy
.cdm
.model
.media
.Rights
;
94 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationship
;
95 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignation
;
96 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
97 import eu
.etaxonomy
.cdm
.model
.name
.NonViralName
;
98 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignation
;
99 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
100 import eu
.etaxonomy
.cdm
.model
.occurrence
.Collection
;
101 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
102 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnitBase
;
103 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationEvent
;
104 import eu
.etaxonomy
.cdm
.model
.occurrence
.FieldObservation
;
105 import eu
.etaxonomy
.cdm
.model
.occurrence
.GatheringEvent
;
106 import eu
.etaxonomy
.cdm
.model
.occurrence
.Specimen
;
107 import eu
.etaxonomy
.cdm
.model
.reference
.INomenclaturalReference
;
108 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
109 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
110 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
111 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
112 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
113 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
114 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
115 import eu
.etaxonomy
.cdm
.strategy
.parser
.ParserProblem
;
116 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
117 import eu
.etaxonomy
.taxeditor
.ui
.combo
.EnumComboElement
;
118 import eu
.etaxonomy
.taxeditor
.ui
.combo
.TermComboElement
;
119 import eu
.etaxonomy
.taxeditor
.ui
.forms
.password
.EditPasswordElement
;
120 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.IOpenUrlEnabled
;
121 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.OpenUrlSelectorElement
;
122 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
123 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailSection
;
124 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
125 import eu
.etaxonomy
.taxeditor
.ui
.section
.EmptyElement
;
126 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailElement
;
127 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailSection
;
128 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailElement
;
129 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailSection
;
130 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailElement
;
131 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailSection
;
132 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberElement
;
133 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberSection
;
134 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamOrPersonBaseDetailSection
;
135 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailElement
;
136 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailSection
;
137 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailElement
;
138 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailSection
;
139 import eu
.etaxonomy
.taxeditor
.ui
.section
.common
.ReferencedEntityDetailSection
;
140 import eu
.etaxonomy
.taxeditor
.ui
.section
.common
.RefereneEntityDetailElement
;
141 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DerivedUnitElement
;
142 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescribedSpecimenSection
;
143 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailElement
;
144 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailSection
;
145 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailElement
;
146 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailSection
;
147 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementMediaSection
;
148 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceElement
;
149 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceSection
;
150 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceElement
;
151 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceSection
;
152 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierElement
;
153 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierSection
;
154 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageDetailElement
;
155 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageSection
;
156 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeElement
;
157 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeSection
;
158 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataElement
;
159 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataSection
;
160 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueElement
;
161 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueSection
;
162 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.AbstractDetailedDescriptionDetailElement
;
163 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CategoricalDataDetailElement
;
164 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CommonNameDetailElement
;
165 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.DistributionDetailElement
;
166 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.IndividualsAssociationDetailElement
;
167 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.QuantitativeDataDetailElement
;
168 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TaxonInteractionDetailElement
;
169 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TextDataDetailElement
;
170 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailElement
;
171 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailSection
;
172 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GrantedAuthorityDetailElement
;
173 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GrantedAuthorityDetailSection
;
174 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailElement
;
175 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailSection
;
176 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailElement
;
177 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailSection
;
178 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.GeographicalScopeDetailSection
;
179 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailElement
;
180 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailSection
;
181 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailElement
;
182 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailSection
;
183 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.ScopeRestrictionSection
;
184 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.TaxonomicScopeSection
;
185 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.ImageFileElement
;
186 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaElement
;
187 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationElement
;
188 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationPartElement
;
189 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationPartSection
;
190 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationSection
;
191 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaSection
;
192 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailElement
;
193 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailSection
;
194 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailElement
;
195 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailSection
;
196 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailElement
;
197 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailSection
;
198 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailElement
;
199 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailSection
;
200 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameTypeDesignationElement
;
201 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusElement
;
202 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusSection
;
203 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailElement
;
204 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailSection
;
205 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueElement
;
206 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueSection
;
207 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.SpecimenTypeDesignationElement
;
208 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.TypeDesignationSection
;
209 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectingAreasDetailSection
;
210 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectionDetailElement
;
211 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CurrentDeterminationDetailSection
;
212 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailElement
;
213 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailSection
;
214 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailElement
;
215 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailSection
;
216 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailElement
;
217 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailSection
;
218 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationEventDetailElement
;
219 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationHistoryDetailSection
;
220 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailElement
;
221 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailSection
;
222 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailElement
;
223 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailSection
;
224 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailElement
;
225 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailSection
;
226 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.NamedAreaDetailElement
;
227 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SourceCollectionDetailSection
;
228 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailElement
;
229 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailSection
;
230 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailElement
;
231 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailSection
;
232 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailElement
;
233 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailSection
;
234 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationElement
;
235 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationSection
;
236 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditElement
;
237 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditSection
;
238 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionElement
;
239 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionSection
;
240 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.HeadlineSection
;
241 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.IdentifiableSourceElement
;
242 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerElement
;
243 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerSection
;
244 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsElement
;
245 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
246 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.SourceSection
;
247 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionElement
;
248 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionSection
;
249 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessageElement
;
250 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
251 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailElement
;
252 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
253 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonDetailElement
;
254 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailElement
;
255 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailSection
;
256 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailElement
;
257 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailSection
;
258 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailElement
;
259 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailSection
;
260 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.DefinedTermDetailElement
;
261 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.DefinedTermDetailSection
;
262 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailSection
;
263 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailElement
;
264 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailSection
;
265 import eu
.etaxonomy
.taxeditor
.ui
.selection
.AbstractSelectionElement
;
266 import eu
.etaxonomy
.taxeditor
.ui
.selection
.AgentSelectionElement
;
267 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ClassificationSelectionElement
;
268 import eu
.etaxonomy
.taxeditor
.ui
.selection
.CollectionSelectionElement
;
269 import eu
.etaxonomy
.taxeditor
.ui
.selection
.DerivedUnitBaseSelectionElement
;
270 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FeatureSelectionElement
;
271 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FeatureTreeSelectionElement
;
272 import eu
.etaxonomy
.taxeditor
.ui
.selection
.FieldObservationSelectionElement
;
273 import eu
.etaxonomy
.taxeditor
.ui
.selection
.GroupSelectionElement
;
274 import eu
.etaxonomy
.taxeditor
.ui
.selection
.InstitutionSelectionElement
;
275 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NameSelectionElement
;
276 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NamedAreaSelectionElement
;
277 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NomenclaturalAuthorTeamSelectionElement
;
278 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PersonSelectionElement
;
279 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PolytomousKeyNodeSelectionElement
;
280 import eu
.etaxonomy
.taxeditor
.ui
.selection
.PolytomousKeySelectionElement
;
281 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ReferenceSelectionElement
;
282 import eu
.etaxonomy
.taxeditor
.ui
.selection
.SynonymSelectionElement
;
283 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonBaseSelectionElement
;
284 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonNodeSelectionElement
;
285 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonSelectionElement
;
286 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TeamSelectionElement
;
287 import eu
.etaxonomy
.taxeditor
.ui
.selection
.UserSelectionElement
;
291 * CdmFormFactory class.
295 * @created Feb 24, 2010
298 public class CdmFormFactory
extends FormToolkit
{
300 private BoldFontHolder2 boldFontHolder2
;
301 private MouseListener selectionMouseHandler
;
302 private FocusListener selectionFocusHandler
;
304 private final Set selectionListenerList
= new HashSet();
306 private final List
<IPropertyChangeListener
> propertyChangeListeners
= new ArrayList
<IPropertyChangeListener
>();
308 private final int orientation
= Window
.getDefaultOrientation();
309 private ISelectionProvider selectionProvider
;
316 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
318 public static final TableWrapLayout
LAYOUT() {
319 return LAYOUT(1, false);
331 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
333 public static final TableWrapLayout
LAYOUT(int columns
, boolean equalWidth
) {
334 TableWrapLayout layout
= new TableWrapLayout();
335 layout
.topMargin
= 0;
336 layout
.rightMargin
= 0;
337 layout
.bottomMargin
= 0;
338 layout
.leftMargin
= 0;
339 layout
.numColumns
= columns
;
340 layout
.makeColumnsEqualWidth
= equalWidth
;
341 layout
.verticalSpacing
= 0;
342 layout
.horizontalSpacing
= 0;
351 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
353 public static final TableWrapData
FILL() {
362 * @param horizontalSpan
364 * @param verticalSpan
366 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
368 public static final TableWrapData
FILL(int horizontalSpan
, int verticalSpan
) {
369 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
,
370 TableWrapData
.FILL_GRAB
);
371 layoutData
.colspan
= horizontalSpan
;
372 layoutData
.rowspan
= verticalSpan
;
381 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
383 public static final TableWrapData
LEFT() {
384 return new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
);
392 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
394 public static final TableWrapData
RIGHT() {
395 return new TableWrapData(TableWrapData
.RIGHT
, TableWrapData
.TOP
);
403 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
405 public static final TableWrapData
FILL_HORIZONTALLY() {
406 return FILL_HORIZONTALLY(1, 1);
414 * @param horizontalSpan
416 * @param verticalSpan
418 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
420 public static final TableWrapData
FILL_HORIZONTALLY(int horizontalSpan
,
422 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
,
424 layoutData
.colspan
= horizontalSpan
;
425 layoutData
.rowspan
= verticalSpan
;
429 /** Constant <code>EMPTY_SELECTION</code> */
430 public static ISelection EMPTY_SELECTION
= new ISelection() {
432 public boolean isEmpty() {
437 private class SelectionMouseHandler
extends MouseAdapter
{
439 public void mouseDown(MouseEvent e
) {
440 notifySelectionListeners(e
);
444 private class SelectionFocusHandler
extends FocusAdapter
{
446 public void focusGained(FocusEvent e
) {
447 notifySelectionListeners(e
);
451 private void notifySelectionListeners(TypedEvent e
) {
452 Event event
= new Event();
453 event
.widget
= e
.widget
;
454 SelectionEvent selectionEvent
= new SelectionEvent(event
);
456 for (Object listener
: selectionListenerList
) {
457 ((SelectionListener
) listener
).widgetSelected(selectionEvent
);
463 * Constructor for CdmFormFactory.
467 * a {@link org.eclipse.swt.widgets.Display} object.
468 * @param selectionProvider
469 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
471 public CdmFormFactory(Display display
, ISelectionProvider selectionProvider
) {
473 this.selectionProvider
= selectionProvider
;
479 * Constructor for CdmFormFactory.
483 * a {@link org.eclipse.swt.widgets.Display} object.
485 public CdmFormFactory(Display display
) {
493 private void init() {
494 boldFontHolder2
= new BoldFontHolder2();
495 selectionMouseHandler
= new SelectionMouseHandler();
496 selectionFocusHandler
= new SelectionFocusHandler();
500 * Creates an instance initialized with the correct selectionProvider
502 * Make sure to remove the instance when the entityComposite disposes via
503 * destroySelectionArbitrator(..)
505 * @param entityElement
506 * a {@link eu.etaxonomy.taxeditor.ui.forms.IEntityElement}
508 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator}
511 public SelectionArbitrator
createSelectionArbitrator(
512 IEntityElement entityElement
) {
513 SelectionArbitrator selectionArbitrator
= new SelectionArbitrator(
515 selectionArbitrator
.addSelectionProvider(selectionProvider
);
516 selectionProvider
.addSelectionChangedListener(selectionArbitrator
);
517 addSelectionListener(selectionArbitrator
);
518 return selectionArbitrator
;
523 * destroySelectionArbitrator
526 * @param selectionArbitrator
527 * a {@link eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator}
530 public void destroySelectionArbitrator(
531 SelectionArbitrator selectionArbitrator
) {
532 removeSelectionListener(selectionArbitrator
);
533 if (selectionProvider
!= null) {
535 .removeSelectionChangedListener(selectionArbitrator
);
538 .error(this.getClass(),
539 "Tried to destroy a selection listener from this factories listeners but was null",
546 public void adapt(Composite composite
) {
547 composite
.addMouseListener(selectionMouseHandler
);
548 super.adapt(composite
);
558 * {@link eu.etaxonomy.taxeditor.ui.forms.AbstractCdmFormElement}
561 public void adapt(AbstractCdmFormElement formElement
) {
562 formElement
.setPropertyChangeListeners(propertyChangeListeners
);
567 public void adapt(Control control
, boolean trackFocus
, boolean trackKeyboard
) {
569 control
.addFocusListener(selectionFocusHandler
);
571 super.adapt(control
, trackFocus
, trackKeyboard
);
580 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
583 public void destroyElement(ICdmFormElement formElement
) {
584 // return if element was not initialized
585 if (formElement
== null) {
588 // destroy selection arbitrator, if any
589 if (formElement
instanceof ISelectableElement
) {
590 destroySelectionArbitrator(((ISelectableElement
) formElement
)
591 .getSelectionArbitrator());
593 // remove this element form its parents list of elements
594 // ICdmFormElement parentElement = formElement.getParentElement();
595 // if(parentElement != null){
596 // parentElement.removeElement(formElement);
598 // call destroy on child elements recursively
599 for (ICdmFormElement childElement
: formElement
.getElements()) {
600 destroyElement(childElement
);
602 // dispose of the controls
603 for (Control control
: formElement
.getControls()) {
604 // we added the layoutComposite of the parental element as the
605 // layout composite to this formElement
606 // but we do not want to destroy it.
607 if (control
.equals(formElement
.getLayoutComposite())) {
622 * a {@link org.eclipse.swt.widgets.Composite} object.
623 * @return a {@link org.eclipse.swt.widgets.Label} object.
625 public Label
createEmptyCell(Composite parent
) {
626 return this.createLabel(parent
, null);
631 * createMultilineTextWithLabel
635 * a {@link java.lang.String} object.
640 * @param parentElement
641 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
643 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement}
646 public TextWithLabelElement
createMultilineTextWithLabel(
647 ICdmFormElement parentElement
, String labelString
, int textHeight
,
649 TextWithLabelElement element
= new TextWithLabelElement(this,
650 parentElement
, labelString
, "", textHeight
, style
);
652 parentElement
.addElement(element
);
658 * createMultiLanguageTextElement
661 * @param parentElement
662 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
665 * a {@link java.lang.String} object.
666 * @param multilanguageText
667 * a {@link java.util.Map} object.
673 * {@link eu.etaxonomy.taxeditor.ui.forms.MultilanguageTextElement}
676 public MultilanguageTextElement
createMultiLanguageTextElement(
677 ICdmFormElement parentElement
, String labelString
,
678 Map
<Language
, LanguageString
> multilanguageText
, int textHeight
,
680 MultilanguageTextElement element
= new MultilanguageTextElement(this,
681 parentElement
, labelString
, multilanguageText
, textHeight
,
684 parentElement
.addElement(element
);
688 public KeyStatementElement
createKeyStatementElement(
689 ICdmFormElement parentElement
, String labelString
,
690 KeyStatement keyStatement
, int textHeight
, int style
) {
691 KeyStatementElement element
= new KeyStatementElement(this,
692 parentElement
, labelString
, keyStatement
, textHeight
, style
);
694 parentElement
.addElement(element
);
700 * createTextWithLabelElement
704 * a {@link java.lang.String} object.
706 * a {@link java.lang.String} object.
709 * @param parentElement
710 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
712 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement}
715 public TextWithLabelElement
createTextWithLabelElement(
716 ICdmFormElement parentElement
, String labelString
,
717 String initialText
, int style
) {
718 TextWithLabelElement element
= new TextWithLabelElement(this,
719 parentElement
, labelString
, initialText
, null, style
);
721 parentElement
.addElement(element
);
725 public UriWithLabelElement
createUriWithLabelElement(
726 ICdmFormElement parentElement
, String labelString
, URI initialUri
,
728 UriWithLabelElement element
= new UriWithLabelElement(this,
729 parentElement
, labelString
, initialUri
, null, style
);
731 parentElement
.addElement(element
);
742 public OpenUrlSelectorElement
createOpenUrlSelectorElement(
743 ICdmFormElement parentElement
, String labelString
,
744 IOpenUrlEnabled openUrlEnabled
, int style
) {
745 OpenUrlSelectorElement element
= new OpenUrlSelectorElement(this,
746 parentElement
, labelString
, openUrlEnabled
, style
);
748 parentElement
.addElement(element
);
754 * @param parentElement
756 * @param conversationEnabled
761 public EditPasswordElement
createEditPasswordElement(
762 ICdmFormElement parentElement
, String labelString
,
763 ConversationHolder conversation
, User user
, int style
) {
764 EditPasswordElement element
= new EditPasswordElement(this,
765 parentElement
, labelString
, user
, conversation
);
767 parentElement
.addElement(element
);
773 * createIntegerTextWithLabelElement
776 * @param parentElement
777 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
780 * a {@link java.lang.String} object.
781 * @param initialInteger
782 * a {@link java.lang.Integer} object.
785 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement}
788 public NumberWithLabelElement
createIntegerTextWithLabelElement(
789 ICdmFormElement parentElement
, String labelString
,
790 Integer initialInteger
, int style
) {
791 NumberWithLabelElement element
= new NumberWithLabelElement(this,
792 parentElement
, labelString
, initialInteger
, style
);
794 parentElement
.addElement(element
);
800 * createFloatTextWithLabelElement
803 * @param parentElement
804 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
807 * a {@link java.lang.String} object.
808 * @param initialFloat
812 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement}
815 public NumberWithLabelElement
createFloatTextWithLabelElement(
816 ICdmFormElement parentElement
, String labelString
,
817 float initialFloat
, int style
) {
818 NumberWithLabelElement element
= new NumberWithLabelElement(this,
819 parentElement
, labelString
, initialFloat
, style
);
821 parentElement
.addElement(element
);
827 * createLanguageStringWithLabelElement
830 * @param parentElement
831 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
834 * a {@link java.lang.String} object.
835 * @param languageString
836 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
840 * {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement}
843 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
844 ICdmFormElement parentElement
, String labelString
,
845 LanguageString languageString
, int style
) {
846 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
847 this, parentElement
, labelString
, languageString
, style
);
849 parentElement
.addElement(element
);
855 * createLanguageStringWithLabelElement
858 * @param parentElement
859 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
862 * a {@link java.lang.String} object.
863 * @param languageString
864 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
870 * {@link eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement}
873 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
874 ICdmFormElement parentElement
, String labelString
,
875 LanguageString languageString
, int height
, int style
) {
876 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
877 this, parentElement
, labelString
, languageString
, height
, style
);
879 parentElement
.addElement(element
);
888 * @param parentElement
889 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
892 * a {@link java.lang.String} object.
895 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement}
898 public TextWithLabelElement
createTextElement(
899 ICdmFormElement parentElement
, String initialText
, int style
) {
900 TextWithLabelElement element
= new TextWithLabelElement(this,
901 parentElement
, null, initialText
, null, style
);
903 parentElement
.addElement(element
);
909 * createKeyValueViewerElement
912 * @param parentElement
913 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
916 * a {@link java.lang.String} object.
917 * @param valueHeading
918 * a {@link java.lang.String} object.
920 * a {@link java.util.Map} object.
921 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.KeyValueViewerElement}
924 public KeyValueViewerElement
createKeyValueViewerElement(
925 ICdmFormElement parentElement
, String keyHeading
,
926 String valueHeading
, Map
<Object
, Object
> map
) {
927 KeyValueViewerElement element
= new KeyValueViewerElement(this,
928 parentElement
, keyHeading
, valueHeading
, map
);
930 parentElement
.addElement(element
);
936 * createTermComboElement
939 * @param termComboType
941 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.TermComboType}
943 * @param parentElement
944 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
947 * a {@link java.lang.String} object.
949 * a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase}
953 * @return a {@link eu.etaxonomy.taxeditor.ui.combo.TermComboElement}
957 public <T
extends DefinedTermBase
> TermComboElement
createTermComboElement(
958 Class
<T
> termComboType
, ICdmFormElement parentElement
,
959 String labelString
, T selection
, int style
) {
960 TermComboElement element
= new TermComboElement
<T
>(this, parentElement
, termComboType
, labelString
, selection
, style
);
962 parentElement
.addElement(element
);
968 * createEnumComboElement
971 * @param enumComboType
973 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EnumComboType}
975 * @param parentElement
976 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
980 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
983 public <T
extends IDefinedTerm
> EnumComboElement
<T
> createEnumComboElement(
984 Class
<T
> enumComboType
, ICdmFormElement parentElement
,
986 EnumComboElement
<T
> element
= new EnumComboElement
<T
>(this, parentElement
, enumComboType
, style
);
988 parentElement
.addElement(element
);
994 * createBrowserElement
998 * a {@link java.net.URI} object.
1001 * @param parentElement
1002 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1004 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.BrowserElement} object.
1006 public BrowserElement
createBrowserElement(ICdmFormElement parentElement
,
1007 URI imageUri
, int style
) {
1008 BrowserElement element
= new BrowserElement(this, parentElement
,
1011 parentElement
.addElement(element
);
1017 * createImageElement
1020 * @param parentElement
1021 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1024 * a {@link java.net.URI} object.
1027 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.ImageElement} object.
1029 public ImageElement
createImageElement(ICdmFormElement parentElement
,
1030 URI imageUri
, int style
) {
1031 ImageElement element
= new ImageElement(this, parentElement
, imageUri
,
1034 parentElement
.addElement(element
);
1040 * createTextActionElement
1043 * @param labelString
1044 * a {@link java.lang.String} object.
1045 * @param initialText
1046 * a {@link java.lang.String} object.
1049 * @param parentElement
1050 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1052 * @param buttonLabel
1053 * a {@link java.lang.String} object.
1054 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TextActionElement}
1057 public TextActionElement
createTextActionElement(
1058 ICdmFormElement parentElement
, String labelString
,
1059 String buttonLabel
, String initialText
, int style
) {
1060 TextActionElement element
= new TextActionElement(this, parentElement
,
1061 labelString
, buttonLabel
, initialText
, style
);
1063 parentElement
.addElement(element
);
1069 * @author n.hoffmann
1070 * @created Mar 5, 2010
1073 public static enum SelectionType
{
1074 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
1082 * @param parentElement
1083 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1086 * a {@link java.lang.String} object.
1087 * @param initialState
1091 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.CheckboxElement} object.
1093 public CheckboxElement
createCheckbox(ICdmFormElement parentElement
,
1094 String label
, boolean initialState
, int style
) {
1095 CheckboxElement element
= new CheckboxElement(this, parentElement
,
1096 label
, initialState
, style
| orientation
);
1098 parentElement
.addElement(element
);
1103 * Creates a section as a part of the form.
1105 * @return the section widget
1107 * a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
1110 public Section
adapt(AbstractFormSection section
) {
1111 section
.setMenu(section
.getLayoutComposite().getMenu());
1112 adapt(section
, true, true);
1114 // handle focus and property change events for cdm use
1115 section
.addFocusListener(selectionFocusHandler
);
1116 section
.setPropertyChangeListeners(propertyChangeListeners
);
1118 if (section
.getToggle() != null) {
1119 section
.getToggle().setHoverDecorationColor(
1120 getColors().getColor(IFormColors
.TB_TOGGLE_HOVER
));
1121 section
.getToggle().setDecorationColor(
1122 getColors().getColor(IFormColors
.TB_TOGGLE
));
1125 section
.setFont(boldFontHolder2
.getBoldFont(section
1126 .getLayoutComposite().getFont()));
1128 if ((section
.getStyle() & Section
.TITLE_BAR
) != 0
1129 || (section
.getStyle() & Section
.SHORT_TITLE_BAR
) != 0) {
1130 getColors().initializeSectionToolBarColors();
1131 section
.setTitleBarBackground(getColors().getColor(
1132 IFormColors
.TB_BG
));
1133 section
.setTitleBarBorderColor(getColors().getColor(
1134 IFormColors
.TB_BORDER
));
1136 // call setTitleBarForeground regardless as it also sets the label color
1137 section
.setTitleBarForeground(getColors().getColor(
1138 IFormColors
.TB_TOGGLE
));
1142 private class BoldFontHolder2
{
1143 private Font normalFont
;
1145 private Font boldFont
;
1147 public BoldFontHolder2() {
1150 public Font
getBoldFont(Font font
) {
1151 createBoldFont(font
);
1155 private void createBoldFont(Font font
) {
1156 if (normalFont
== null || !normalFont
.equals(font
)) {
1160 if (boldFont
== null) {
1161 boldFont
= FormFonts
.getInstance().getBoldFont(
1162 getColors().getDisplay(), normalFont
);
1166 public void dispose() {
1167 if (boldFont
!= null) {
1168 FormFonts
.getInstance().markFinished(boldFont
,
1169 getColors().getDisplay());
1177 * createToggleableTextField
1180 * @param parentElement
1181 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1183 * @param labelString
1184 * a {@link java.lang.String} object.
1185 * @param initialText
1186 * a {@link java.lang.String} object.
1187 * @param initialState
1191 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.ToggleableTextElement}
1194 public ToggleableTextElement
createToggleableTextField(
1195 ICdmFormElement parentElement
, String labelString
,
1196 String initialText
, boolean initialState
, int style
) {
1197 ToggleableTextElement element
= new ToggleableTextElement(this,
1198 parentElement
, labelString
, initialText
, initialState
, style
1201 parentElement
.addElement(element
);
1207 * createTimePeriodElement
1210 * @param parentElement
1211 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1213 * @param labelString
1214 * a {@link java.lang.String} object.
1216 * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1219 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.TimePeriodElement}
1222 public TimePeriodElement
createTimePeriodElement(
1223 ICdmFormElement parentElement
, String labelString
,
1224 TimePeriod timePeriod
, int style
) {
1225 TimePeriodElement element
= new TimePeriodElement(this, parentElement
,
1226 labelString
, timePeriod
, style
);
1228 parentElement
.addElement(element
);
1234 * createPointElement
1239 * @param parentElement
1240 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1243 * a {@link eu.etaxonomy.cdm.model.location.Point} object.
1244 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.PointElement} object.
1246 public PointElement
createPointElement(ICdmFormElement parentElement
,
1247 Point point
, int style
) {
1248 PointElement element
= new PointElement(this, parentElement
, point
,
1251 parentElement
.addElement(element
);
1257 * createDateDetailSection
1260 * @param parentElement
1261 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1265 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.DateDetailSection}
1268 public DateDetailSection
createDateDetailSection(
1269 ICdmFormElement parentElement
, int style
) {
1270 DateDetailSection section
= new DateDetailSection(this, parentElement
,
1272 parentElement
.addElement(section
);
1279 * createPartialElement
1282 * @param parentElement
1283 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1285 * @param labelString
1286 * a {@link java.lang.String} object.
1288 * a {@link org.joda.time.Partial} object.
1291 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.PartialElement} object.
1293 public PartialElement
createPartialElement(ICdmFormElement parentElement
,
1294 String labelString
, Partial partial
, int style
) {
1295 PartialElement element
= new PartialElement(this, parentElement
,
1296 labelString
, style
);
1298 parentElement
.addElement(element
);
1304 * addSelectionListener
1308 * a {@link org.eclipse.swt.events.SelectionListener} object.
1310 public void addSelectionListener(SelectionListener listener
) {
1311 selectionListenerList
.add(listener
);
1316 * removeSelectionListener
1320 * a {@link org.eclipse.swt.events.SelectionListener} object.
1322 public void removeSelectionListener(SelectionListener listener
) {
1323 if (listener
== null) {
1325 .error(this.getClass(),
1326 "Tried to remove a selection listener from this factories listeners but was null",
1329 selectionListenerList
.remove(listener
);
1335 * addPropertyChangeListener
1339 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1342 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
1343 if(propertyChangeListeners
.contains(listener
)){
1346 propertyChangeListeners
.add(0, listener
);
1351 * removePropertyChangeListener
1355 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1358 public void removePropertyChangeListener(IPropertyChangeListener listener
) {
1359 propertyChangeListeners
.remove(listener
);
1364 * createHorizontalSeparator
1367 * @param parentElement
1368 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1372 * @return a {@link org.eclipse.swt.widgets.Label} object.
1374 public Label
createHorizontalSeparator(ICdmFormElement parentElement
,
1376 Label separator
= this.createSeparator(
1377 parentElement
.getLayoutComposite(), SWT
.HORIZONTAL
| style
);
1378 separator
.setLayoutData(FILL_HORIZONTALLY());
1384 * createVersionElement
1387 * @param parentElement
1388 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1391 * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
1396 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
1399 public VersionElement
createVersionElement(ICdmFormElement parentElement
,
1400 VersionableEntity entity
, int style
) {
1401 VersionElement element
= new VersionElement(this, parentElement
,
1404 parentElement
.addElement(element
);
1410 * createVersionSection
1413 * @param parentElement
1414 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1419 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
1422 public VersionSection
createVersionSection(ICdmFormElement parentElement
,
1424 VersionSection section
= new VersionSection(this, parentElement
, style
);
1425 parentElement
.addElement(section
);
1432 * createEmptyElement
1435 * @param parentElement
1436 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1438 * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1440 public EmptyElement
createEmptyElement(ICdmFormElement parentElement
) {
1441 EmptyElement element
= new EmptyElement(this, parentElement
, null,
1444 parentElement
.addElement(element
);
1450 * createHeadlineSection
1453 * @param parentElement
1454 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1457 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
1460 public HeadlineSection
createHeadlineSection(ICdmFormElement parentElement
) {
1461 HeadlineSection section
= new HeadlineSection(this, parentElement
,
1463 parentElement
.addElement(section
);
1470 * createParsingMessageElement
1473 * @param parentElement
1474 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1476 * @param parserProblem
1477 * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
1482 * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
1485 public ParsingMessageElement
createParsingMessageElement(
1486 ICdmFormElement parentElement
, ParserProblem parserProblem
,
1488 ParsingMessageElement element
= new ParsingMessageElement(this,
1489 parentElement
, parserProblem
, style
);
1491 parentElement
.addElement(element
);
1500 public static enum DetailType
{
1504 NOMENCLATURALREFERENCE
,
1516 DERIVED_UNIT_FACADE
,
1520 FEATURE_DISTRIBUTION
,
1525 POLYTOMOUS_KEY_NODE
,
1527 DERIVED_UNIT_GENERAL
,
1539 public AbstractFormSection
createDefinedTermDetailSection(Class definedTermClass
,
1540 ConversationHolder conversation
, ICdmFormElement parentElement
,
1541 ISelectionProvider selectionProvider
, int style
) {
1543 AbstractFormSection section
= new DefinedTermDetailSection(this, definedTermClass
, conversation
, parentElement
, selectionProvider
, style
);
1545 parentElement
.addElement(section
);
1552 * @param definedTermClass
1553 * @param formElement
1557 public AbstractCdmDetailElement
createDefinedTermDetailElement(
1558 Class definedTermClass
, AbstractCdmDetailSection parentElement
,
1560 AbstractCdmDetailElement element
= null;
1562 if (NamedArea
.class.isAssignableFrom(definedTermClass
)){
1563 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1566 element
= new DefinedTermDetailElement(this, parentElement
);
1570 parentElement
.addElement(element
);
1576 * createCdmDetailSection
1581 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType}
1583 * @param parentElement
1584 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1586 * @param selectionProvider
1587 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1590 * @param conversation
1591 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1593 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
1596 public AbstractFormSection
createCdmDetailSection(DetailType detailType
,
1597 ConversationHolder conversation
, ICdmFormElement parentElement
,
1598 ISelectionProvider selectionProvider
, int style
) {
1599 AbstractFormSection section
= null;
1601 switch (detailType
) {
1602 case SCIENTIFICNAME
:
1603 section
= new NameDetailSection(this, conversation
, parentElement
,
1604 selectionProvider
, style
);
1607 section
= new ReferenceDetailSection(this, conversation
,
1608 parentElement
, selectionProvider
, style
);
1610 case NOMENCLATURALREFERENCE
:
1611 section
= new NomenclaturalReferenceDetailSection(this,
1612 conversation
, parentElement
, selectionProvider
, style
);
1615 section
= new TaxonBaseDetailSection(this, conversation
,
1616 parentElement
, selectionProvider
, style
);
1619 section
= new AuthorshipDetailSection(this, conversation
,
1620 parentElement
, selectionProvider
, style
);
1622 case TEAMORPERSONBASE
:
1623 section
= new TeamOrPersonBaseDetailSection(this, conversation
,
1624 parentElement
, selectionProvider
, style
);
1627 section
= new TeamDetailSection(this, conversation
, parentElement
,
1631 section
= new PersonDetailSection(this, conversation
,
1632 parentElement
, null, style
);
1635 section
= new DescriptionDetailSection(this, conversation
,
1636 parentElement
, selectionProvider
, style
);
1638 case DESCRIPTIONELEMENT
:
1639 section
= new DescriptionElementDetailSection(this, conversation
,
1640 parentElement
, selectionProvider
, style
);
1642 case PARSINGMESSAGE
:
1643 section
= new ParsingMessagesSection(this, conversation
,
1644 parentElement
, selectionProvider
, style
);
1647 section
= new NonViralNameDetailSection(this, conversation
,
1648 parentElement
, selectionProvider
, style
);
1651 section
= new eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection(
1652 this, conversation
, parentElement
, selectionProvider
, style
);
1654 case DERIVED_UNIT_FACADE
:
1655 section
= new DerivedUnitFacadeDetailSection(this, conversation
,
1656 parentElement
, selectionProvider
, style
);
1658 case FIELD_OBSERVATION
:
1659 section
= new FieldObservationDetailSection(this, conversation
,
1660 parentElement
, selectionProvider
, style
);
1662 case GATHERING_EVENT
:
1663 section
= new GatheringEventDetailSection(this, conversation
,
1664 parentElement
, selectionProvider
, style
);
1667 section
= new DerivedUnitBaseDetailSection(this, conversation
,
1668 parentElement
, selectionProvider
, style
);
1670 case NATURAL_LANGUAGE
:
1671 section
= new NaturalLanguageSection(this, conversation
,
1672 parentElement
, selectionProvider
, style
);
1674 case FEATURE_DISTRIBUTION
:
1675 section
= new FeatureDistributionDetailSection(this, conversation
,
1676 parentElement
, selectionProvider
, style
);
1678 case CLASSIFICATION
:
1679 section
= new ClassificationDetailSection(this, conversation
,
1680 parentElement
, selectionProvider
, style
);
1683 section
= new TaxonNodeDetailSection(this, conversation
,
1684 parentElement
, selectionProvider
, style
);
1686 case POLYTOMOUS_KEY
:
1687 section
= new PolytomousKeyDetailSection(this, conversation
,
1688 parentElement
, selectionProvider
, style
);
1690 case POLYTOMOUS_KEY_NODE
:
1691 section
= new PolytomousKeyNodeDetailSection(this, conversation
,
1692 parentElement
, selectionProvider
, style
);
1695 section
= new InstitutionDetailSection(this, conversation
,
1696 parentElement
, selectionProvider
, style
);
1698 case DERIVED_UNIT_GENERAL
:
1699 section
= new GeneralDetailSection(this, conversation
,
1700 parentElement
, selectionProvider
, style
);
1703 section
= new HybridDetailSection(this, conversation
,
1704 parentElement
, selectionProvider
, style
);
1707 section
= new UserDetailSection(this, conversation
, parentElement
,
1708 selectionProvider
, style
);
1711 section
= new GroupDetailSection(this, conversation
, parentElement
,
1712 selectionProvider
, style
);
1715 section
= new DeterminationDetailSection(this, conversation
, parentElement
,
1716 selectionProvider
, style
);
1718 case TAXON_RELATIONSHIP
:
1719 section
= new TaxonRelationshipDetailSection(this, conversation
, parentElement
,
1720 selectionProvider
, style
);
1722 case REFERENCED_ENTITY
:
1723 section
= new ReferencedEntityDetailSection(this, conversation
, parentElement
,
1724 selectionProvider
, style
);
1726 case TERM_VOCABULARY
:
1727 section
= new TermVocabularyDetailSection(this, conversation
, parentElement
,
1728 selectionProvider
, style
);
1731 section
= new NamedAreaDetailSection(this, conversation
, parentElement
,
1732 selectionProvider
, style
);
1736 if (section
== null) {
1737 throw new RuntimeException(
1738 "You tried to create a cdm detail section that is not implemented yet.");
1741 parentElement
.addElement(section
);
1750 * createCdmDetailElement
1755 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType}
1759 * @param parentElement
1760 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1763 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
1766 public AbstractCdmDetailElement
createCdmDetailElement(
1767 DetailType detailType
, ICdmFormElement parentElement
, int style
) {
1768 AbstractCdmDetailElement element
= null;
1770 switch (detailType
) {
1771 case SCIENTIFICNAME
:
1772 element
= new NameDetailElement(this, parentElement
, style
);
1775 element
= new ReferenceDetailElement(this, parentElement
, style
);
1777 case NOMENCLATURALREFERENCE
:
1778 element
= new NomenclaturalReferenceDetailElement(this,
1779 parentElement
, style
);
1782 element
= new TaxonBaseDetailElement(this, parentElement
, style
);
1785 element
= new AuthorshipDetailElement(this, parentElement
, style
);
1788 element
= new TeamDetailElement(this, parentElement
, style
);
1791 element
= new PersonDetailElement(this, parentElement
, style
);
1794 element
= new DescriptionDetailElement(this, parentElement
, style
);
1796 case DESCRIPTIONELEMENT
:
1797 element
= new DescriptionElementDetailElement(this, parentElement
,
1801 element
= new NonViralNameDetailElement(this, parentElement
);
1803 case DERIVED_UNIT_FACADE
:
1804 element
= new DerivedUnitFacadeDetailElement(this, parentElement
);
1806 case FIELD_OBSERVATION
:
1807 element
= new FieldObservationDetailElement(this, parentElement
);
1809 case GATHERING_EVENT
:
1810 element
= new GatheringEventDetailElement(this, parentElement
);
1813 element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1815 case NATURAL_LANGUAGE
:
1816 element
= new NaturalLanguageDetailElement(this, parentElement
);
1818 case FEATURE_DISTRIBUTION
:
1819 element
= new FeatureDistributionDetailElement(this, parentElement
);
1821 case CLASSIFICATION
:
1822 element
= new ClassificationDetailElement(this, parentElement
);
1825 element
= new TaxonNodeDetailElement(this, parentElement
);
1828 element
= new CollectionDetailElement(this, parentElement
);
1830 case POLYTOMOUS_KEY
:
1831 element
= new PolytomousKeyDetailElement(this, parentElement
);
1833 case POLYTOMOUS_KEY_NODE
:
1834 element
= new PolytomousKeyNodeDetailElement(this, parentElement
);
1837 element
= new InstitutionDetailElement(this, parentElement
);
1839 case DERIVED_UNIT_GENERAL
:
1840 element
= new GeneralDetailElement(this, parentElement
);
1843 element
= new HybridDetailElement(this, parentElement
);
1846 element
= new UserDetailElement(this, parentElement
);
1849 element
= new GroupDetailElement(this, parentElement
);
1852 element
= new DeterminationDetailElement(this, parentElement
);
1854 case TAXON_RELATIONSHIP
:
1855 element
= new TaxonRelationshipDetailElement(this, parentElement
);
1857 case REFERENCED_ENTITY
:
1858 element
= new RefereneEntityDetailElement(this, parentElement
);
1860 case TERM_VOCABULARY
:
1861 element
= new TermVocabularyDetailElement(this, parentElement
);
1864 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1866 case NAMED_AREA_LEVEL
:
1867 element
= new DefinedTermDetailElement
<NamedAreaLevel
>(this, parentElement
);
1871 if (element
== null) {
1873 .error(this.getClass(),
1874 "Detail element was not created. Seems like the case was not implemented for the requested detail type: "
1875 + detailType
, null);
1879 parentElement
.addElement(element
);
1885 * @author n.hoffmann
1886 * @created Mar 5, 2010
1889 public static enum EntityDetailType
{
1894 DESCRIPTIONELEMENTSOURCE
,
1898 DESCRIPTIONELEMENTMEDIA
,
1899 MEDIAREPRESENTATION
,
1900 MEDIAREPRESENTATIONPART
,
1902 NOMENCLATURALSTATUS
,
1911 STATISTICAL_MEASUREMENT_VALUE
,
1914 DETERMINATION_EVENT
,
1915 SPECIMEN_COLLECTION
,
1916 IDENTIFIABLE_SOURCE_COLLECTION
,
1923 DETERMINATION_CURRENT
,
1924 DETERMINATION_HISTORY
1929 * createEntityDetailSection
1932 * @param entityDetailType
1934 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EntityDetailType}
1938 * @param conversation
1939 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1941 * @param parentElement
1942 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
1944 * @return a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
1947 public AbstractFormSection
createEntityDetailSection(
1948 EntityDetailType entityDetailType
, ConversationHolder conversation
,
1949 ICdmFormElement parentElement
, int style
) {
1950 AbstractFormSection section
= null;
1952 switch (entityDetailType
) {
1954 section
= new TeamDetailSection(this, conversation
, parentElement
,
1958 section
= new TeamMemberSection(this, conversation
, parentElement
,
1962 section
= new AnnotationSection(this, conversation
, parentElement
,
1966 section
= new CreditSection(this, conversation
, parentElement
,
1969 case DESCRIPTIONELEMENTSOURCE
:
1970 section
= new DescriptionElementSourceSection(this, conversation
,
1971 parentElement
, style
);
1974 section
= new ExtensionSection(this, conversation
, parentElement
,
1978 section
= new MarkerSection(this, conversation
, parentElement
,
1982 section
= new MediaSection(this, conversation
, parentElement
, style
);
1984 case DESCRIPTIONELEMENTMEDIA
:
1985 section
= new DescriptionElementMediaSection(this, conversation
,
1986 parentElement
, style
);
1988 case MEDIAREPRESENTATION
:
1989 section
= new MediaRepresentationSection(this, conversation
,
1990 parentElement
, style
);
1992 case MEDIAREPRESENTATIONPART
:
1993 section
= new MediaRepresentationPartSection(this, conversation
,
1994 parentElement
, style
);
1997 section
= new ModifierSection(this, conversation
, parentElement
,
2000 case NOMENCLATURALSTATUS
:
2001 section
= new NomenclaturalStatusSection(this, conversation
,
2002 parentElement
, style
);
2004 case NAME_RELATIONSHIP
:
2005 section
= new NameRelationshipDetailSection(this, conversation
,
2006 parentElement
, style
);
2009 section
= new ProtologueSection(this, conversation
, parentElement
,
2013 section
= new RightsSection(this, conversation
, parentElement
,
2017 section
= new SourceSection(this, conversation
, parentElement
,
2021 section
= new ScopeSection(this, conversation
, parentElement
, style
);
2023 case DESCRIPTIONSOURCE
:
2024 section
= new DescriptionSourceSection(this, conversation
,
2025 parentElement
, style
);
2027 case TYPEDESIGNATION
:
2028 section
= new TypeDesignationSection(this, conversation
,
2029 parentElement
, style
);
2032 section
= new StateDataSection(this, conversation
, parentElement
,
2035 case STATISTICAL_MEASUREMENT_VALUE
:
2036 section
= new StatisticalMeasurementValueSection(this,
2037 conversation
, parentElement
, style
);
2039 case DESCRIBED_SPECIMEN
:
2040 section
= new DescribedSpecimenSection(this, conversation
,
2041 parentElement
, style
);
2043 case COLLECTING_AREA
:
2044 section
= new CollectingAreasDetailSection(this, conversation
,
2045 parentElement
, style
);
2047 case DETERMINATION_CURRENT
:
2048 section
= new CurrentDeterminationDetailSection(this, conversation
,
2049 parentElement
, style
);
2051 case DETERMINATION_HISTORY
:
2052 section
= new DeterminationHistoryDetailSection(this, conversation
,
2053 parentElement
, style
);
2055 case SPECIMEN_COLLECTION
:
2056 section
= new SpecimenCollectionDetailSection(this, conversation
,
2057 parentElement
, style
);
2059 case IDENTIFIABLE_SOURCE_COLLECTION
:
2060 section
= new SourceCollectionDetailSection(this, conversation
,
2061 parentElement
, style
);
2063 case GEOGRAPHICAL_SCOPE
:
2064 section
= new GeographicalScopeDetailSection(this, conversation
,
2065 parentElement
, style
);
2067 case SCOPE_RESTRICTION
:
2068 section
= new ScopeRestrictionSection(this, conversation
,
2069 parentElement
, style
);
2072 section
= new MemberDetailSection(this, conversation
,
2073 parentElement
, style
);
2075 case GRANTED_AUTHORITY
:
2076 section
= new GrantedAuthorityDetailSection(this, conversation
,
2077 parentElement
, style
);
2079 case GROUPS_BY_USER
:
2080 section
= new GroupsByUserDetailSection(this, conversation
,
2081 parentElement
, style
);
2083 case TAXONOMIC_SCOPE
:
2084 section
= new TaxonomicScopeSection(this, conversation
,
2085 parentElement
, style
);
2088 parentElement
.addElement(section
);
2095 * createEntityCollectionElement
2098 * @param removeListener
2099 * a {@link org.eclipse.swt.events.SelectionListener} object.
2102 * @param parentElement
2103 * a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
2105 * @param versionableEntity
2106 * a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity}
2108 * @param backgroundColor
2109 * a {@link org.eclipse.swt.graphics.Color} object.
2111 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement}
2114 public AbstractEntityCollectionElement
createEntityCollectionElement(
2115 AbstractFormSection parentElement
, Object versionableEntity
,
2116 SelectionListener removeListener
, Color backgroundColor
, int style
) {
2117 AbstractEntityCollectionElement element
= null;
2119 Object entity
= HibernateProxyHelper
.deproxy(versionableEntity
);
2121 if (entity
instanceof Annotation
) {
2122 element
= new AnnotationElement(this, parentElement
,
2123 (Annotation
) entity
, removeListener
, style
);
2124 } else if (entity
instanceof Person
) {
2125 element
= new TeamMemberElement(this, parentElement
,
2126 (Person
) entity
, removeListener
, style
);
2127 } else if (entity
instanceof Credit
) {
2128 element
= new CreditElement(this, parentElement
, (Credit
) entity
,
2129 removeListener
, style
);
2130 } else if (entity
instanceof Extension
) {
2131 element
= new ExtensionElement(this, parentElement
,
2132 (Extension
) entity
, removeListener
, style
);
2133 } else if (entity
instanceof Marker
) {
2134 element
= new MarkerElement(this, parentElement
, (Marker
) entity
,
2135 removeListener
, style
);
2136 } else if (entity
instanceof Media
) {
2137 element
= new MediaElement(this, parentElement
, (Media
) entity
,
2138 removeListener
, style
);
2139 } else if (entity
instanceof MediaRepresentation
) {
2140 element
= new MediaRepresentationElement(this, parentElement
,
2141 (MediaRepresentation
) entity
, removeListener
, style
);
2142 } else if (entity
instanceof ImageFile
) {
2143 element
= new ImageFileElement(this, parentElement
,
2144 (ImageFile
) entity
, removeListener
, style
);
2145 } else if (entity
instanceof MediaRepresentationPart
){
2146 element
= new MediaRepresentationPartElement(this, parentElement
,
2147 (MediaRepresentationPart
) entity
, removeListener
, style
);
2148 } else if (entity
instanceof NomenclaturalStatus
) {
2149 element
= new NomenclaturalStatusElement(this, parentElement
,
2150 (NomenclaturalStatus
) entity
, removeListener
, style
);
2151 } else if (entity
instanceof Rights
) {
2152 element
= new RightsElement(this, parentElement
, (Rights
) entity
,
2153 removeListener
, style
);
2154 } else if (entity
instanceof DescriptionElementSource
) {
2155 element
= new DescriptionElementSourceElement(this, parentElement
,
2156 (DescriptionElementSource
) entity
, removeListener
, style
);
2157 } else if (entity
instanceof IdentifiableSource
) {
2158 element
= new IdentifiableSourceElement(this, parentElement
,
2159 (IdentifiableSource
) entity
, removeListener
, style
);
2160 } else if (entity
instanceof Scope
) {
2161 element
= new ScopeElement(this, parentElement
, (Scope
) entity
,
2162 removeListener
, style
);
2163 } else if (entity
instanceof Modifier
) {
2164 element
= new ModifierElement(this, parentElement
,
2165 (Modifier
) entity
, removeListener
, style
);
2166 } else if (entity
instanceof Reference
) {
2167 element
= new DescriptionSourceElement(this, parentElement
,
2168 (Reference
) entity
, removeListener
, style
);
2169 } else if (entity
instanceof NameTypeDesignation
) {
2170 element
= new NameTypeDesignationElement(this, parentElement
,
2171 (NameTypeDesignation
) entity
, removeListener
, style
);
2172 } else if (entity
instanceof NameRelationship
) {
2173 element
= new NameRelationshipDetailElement(this, parentElement
,
2174 (NameRelationship
) entity
, removeListener
, style
);
2175 } else if (entity
instanceof SpecimenTypeDesignation
) {
2176 element
= new SpecimenTypeDesignationElement(this, parentElement
,
2177 (SpecimenTypeDesignation
) entity
, removeListener
, style
);
2178 } else if (entity
instanceof StateData
) {
2179 element
= new StateDataElement(this, parentElement
,
2180 (StateData
) entity
, removeListener
, style
);
2181 } else if (entity
instanceof StatisticalMeasurementValue
) {
2182 element
= new StatisticalMeasurementValueElement(this,
2183 parentElement
, (StatisticalMeasurementValue
) entity
,
2184 removeListener
, style
);
2185 } else if (entity
instanceof DerivedUnit
) {
2186 element
= new DerivedUnitElement(this, parentElement
,
2187 (DerivedUnit
) entity
, removeListener
, style
);
2188 } else if (entity
instanceof NamedArea
) {
2189 element
= new NamedAreaDetailElement(this, parentElement
,
2190 (NamedArea
) entity
, removeListener
, style
);
2191 } else if (entity
instanceof DeterminationEvent
) {
2192 element
= new DeterminationEventDetailElement(this, parentElement
,
2193 (DeterminationEvent
) entity
, removeListener
, style
);
2194 } else if (entity
instanceof Specimen
) {
2195 element
= new SpecimenCollectionDetailElement(this, parentElement
,
2196 (Specimen
) entity
, removeListener
, style
);
2197 } else if (entity
instanceof User
) {
2198 element
= new MemberDetailElement(this, parentElement
,
2199 (User
) entity
, removeListener
, style
);
2200 } else if (entity
instanceof GrantedAuthority
) {
2201 element
= new GrantedAuthorityDetailElement(this, parentElement
,
2202 (GrantedAuthority
) entity
, removeListener
, style
);
2203 } else if (entity
instanceof Group
) {
2204 element
= new GroupsByUserDetailElement(this, parentElement
,
2205 (Group
) entity
, removeListener
, style
);
2206 } else if (entity
instanceof Taxon
) {
2207 element
= new TaxonDetailElement(this, parentElement
,
2208 (Taxon
) entity
, removeListener
, style
);
2209 } else if (entity
instanceof DescriptionElementBase
) {
2210 // this is the special case for protologs, maybe we can do this
2211 // differently when API improves
2212 DescriptionElementBase descriptionElement
= (DescriptionElementBase
) entity
;
2213 if (descriptionElement
.getFeature().equals(Feature
.PROTOLOGUE())) {
2214 element
= new ProtologueElement(this, parentElement
,
2215 descriptionElement
, removeListener
, style
);
2219 if (element
== null) {
2222 "No element for entity",
2224 "Could not generate element for entity. "
2225 + "Looks like the case is not handled already. Check implementation. Entity: "
2230 if (backgroundColor
!= null && !backgroundColor
.isDisposed()) {
2231 element
.setPersistentBackground(backgroundColor
);
2235 parentElement
.addElement(element
);
2241 * createSelectionElement
2244 * @param selectionType
2246 * {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType}
2248 * @param parentElement
2249 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
2251 * @param labelString
2252 * a {@link java.lang.String} object.
2253 * @param selectionType
2255 * a {@link eu.etaxonomy.cdm.model.common.IAnnotatableEntity}
2259 * @param conversation
2260 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
2263 * {@link eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement}
2266 public AbstractSelectionElement
createSelectionElement(
2267 SelectionType selectionType
, ConversationHolder conversation
,
2268 ICdmFormElement parentElement
, String labelString
,
2269 ICdmBase selection
, int mode
, int style
) {
2270 AbstractSelectionElement element
= null;
2272 IAnnotatableEntity entity
= (IAnnotatableEntity
) HibernateProxyHelper
2273 .deproxy(selection
);
2275 switch (selectionType
) {
2277 element
= new AgentSelectionElement(this, conversation
,
2278 parentElement
, labelString
, (TeamOrPersonBase
) entity
,
2282 element
= new PersonSelectionElement(this, conversation
,
2283 parentElement
, labelString
, (Person
) entity
, mode
, style
);
2286 element
= new TeamSelectionElement(this, conversation
,
2287 parentElement
, labelString
, (Team
) entity
, mode
, style
);
2290 element
= new NomenclaturalAuthorTeamSelectionElement(this,
2291 conversation
, parentElement
, labelString
, (Team
) entity
,
2295 element
= new InstitutionSelectionElement(this, conversation
,
2296 parentElement
, labelString
, (Institution
) entity
, mode
,
2300 element
= new NameSelectionElement(this, conversation
,
2301 parentElement
, labelString
, (TaxonNameBase
) entity
, mode
,
2305 element
= new ReferenceSelectionElement(this, conversation
,
2306 parentElement
, labelString
, (Reference
) entity
, mode
, style
);
2309 element
= new TaxonBaseSelectionElement(this, conversation
,
2310 parentElement
, labelString
, (TaxonBase
) entity
, mode
, style
);
2313 element
= new TaxonSelectionElement(this, conversation
,
2314 parentElement
, labelString
, (Taxon
) entity
, mode
, style
);
2317 element
= new SynonymSelectionElement(this, conversation
,
2318 parentElement
, labelString
, (Synonym
) entity
, mode
, style
);
2321 element
= new DerivedUnitBaseSelectionElement(this, conversation
,
2322 parentElement
, labelString
, (DerivedUnitBase
) entity
, mode
,
2325 case FIELD_OBSERVATION
:
2326 element
= new FieldObservationSelectionElement(this, conversation
,
2327 parentElement
, labelString
, (FieldObservation
) entity
,
2331 element
= new FeatureTreeSelectionElement(this, conversation
,
2332 parentElement
, labelString
, (FeatureTree
) entity
, mode
,
2335 case CLASSIFICATION
:
2336 element
= new ClassificationSelectionElement(this, conversation
,
2337 parentElement
, labelString
, (Classification
) entity
, mode
,
2341 element
= new TaxonNodeSelectionElement(this, conversation
,
2342 parentElement
, labelString
, (TaxonNode
) entity
, mode
, style
);
2345 element
= new CollectionSelectionElement(this, conversation
,
2346 parentElement
, labelString
, (Collection
) entity
, mode
,
2350 element
= new FeatureSelectionElement(this, conversation
,
2351 parentElement
, labelString
, (Feature
) entity
, mode
, style
);
2353 case POLYTOMOUS_KEY
:
2354 element
= new PolytomousKeySelectionElement(this, conversation
,
2355 parentElement
, labelString
, (PolytomousKey
) entity
, mode
,
2358 case POLYTOMOUS_KEY_NODE
:
2359 element
= new PolytomousKeyNodeSelectionElement(this, conversation
,
2360 parentElement
, labelString
, (PolytomousKeyNode
) entity
,
2364 element
= new UserSelectionElement(this, conversation
,
2365 parentElement
, labelString
, (User
) entity
, mode
, style
);
2368 element
= new GroupSelectionElement(this, conversation
,
2369 parentElement
, labelString
, (Group
) entity
, mode
, style
);
2372 new RuntimeException(
2373 "There is no selection composite for the desired selection type.");
2378 parentElement
.addElement(element
);
2384 * createNamedAreaSelectionElement
2387 * @param parentElement
2388 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
2390 * @param conversation
2391 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
2393 * @param labelString
2394 * a {@link java.lang.String} object.
2396 * a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
2400 * {@link eu.etaxonomy.taxeditor.ui.selection.NamedAreaSelectionElement}
2403 public NamedAreaSelectionElement
createNamedAreaSelectionElement(
2404 ICdmFormElement parentElement
, ConversationHolder conversation
,
2405 String labelString
, NamedArea selection
, int style
) {
2406 NamedAreaSelectionElement element
= new NamedAreaSelectionElement(this,
2407 conversation
, parentElement
, labelString
, selection
,
2408 AbstractSelectionElement
.NOTHING
, style
);
2410 parentElement
.addElement(element
);
2414 /** {@inheritDoc} */
2415 public LabelElement
createLabel(ICdmFormElement parentElement
, String text
) {
2416 LabelElement labelElement
= new LabelElement(this, parentElement
, text
);
2417 adapt(labelElement
);
2418 parentElement
.addElement(labelElement
);
2419 return labelElement
;
2424 * Getter for the field <code>selectionProvider</code>.
2427 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
2429 public ISelectionProvider
getSelectionProvider() {
2430 return selectionProvider
;
2435 * createDetailedDescriptionDetailElement
2438 * @param parentElement
2439 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
2443 * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
2448 * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
2451 public AbstractDetailedDescriptionDetailElement
createDetailedDescriptionDetailElement(
2452 ICdmFormElement parentElement
, DescriptionElementBase entity
,
2454 AbstractDetailedDescriptionDetailElement detailedDescriptionElement
= null;
2456 if (entity
instanceof CategoricalData
) {
2457 detailedDescriptionElement
= new CategoricalDataDetailElement(this,
2458 parentElement
, (CategoricalData
) entity
, style
);
2459 } else if (entity
instanceof CommonTaxonName
) {
2460 detailedDescriptionElement
= new CommonNameDetailElement(this,
2461 parentElement
, (CommonTaxonName
) entity
, style
);
2462 } else if (entity
instanceof Distribution
) {
2463 detailedDescriptionElement
= new DistributionDetailElement(this,
2464 parentElement
, (Distribution
) entity
, style
);
2465 } else if (entity
instanceof IndividualsAssociation
) {
2466 detailedDescriptionElement
= new IndividualsAssociationDetailElement(
2467 this, parentElement
, (IndividualsAssociation
) entity
, style
);
2468 } else if (entity
instanceof QuantitativeData
) {
2469 detailedDescriptionElement
= new QuantitativeDataDetailElement(
2470 this, parentElement
, (QuantitativeData
) entity
, style
);
2471 } else if (entity
instanceof TaxonInteraction
) {
2472 detailedDescriptionElement
= new TaxonInteractionDetailElement(
2473 this, parentElement
, (TaxonInteraction
) entity
, style
);
2474 } else if (entity
instanceof TextData
) {
2475 detailedDescriptionElement
= new TextDataDetailElement(this,
2476 parentElement
, (TextData
) entity
, style
);
2478 throw new IllegalStateException(
2479 "There is no interface for the given description element");
2481 adapt(detailedDescriptionElement
);
2482 parentElement
.addElement(detailedDescriptionElement
);
2483 return detailedDescriptionElement
;
2488 * Creates a styled text as a part of the form.
2493 * the text initial value
2496 * @return the text widget
2498 public StyledText
createStyledText(Composite parent
, String value
, int style
) {
2499 StyledText text
= new StyledText(parent
, getBorderStyle() | style
2500 | getOrientation());
2502 text
.setText(value
);
2503 text
.setForeground(getColors().getForeground());
2504 text
.setBackground(getColors().getBackground());
2505 // text.addFocusListener(visibilityHandler);