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
.internal
.forms
.widgets
.FormFonts
;
39 import org
.joda
.time
.Partial
;
40 import org
.springframework
.security
.core
.GrantedAuthority
;
42 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
43 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
44 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
45 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
46 import eu
.etaxonomy
.cdm
.model
.common
.Annotation
;
47 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
48 import eu
.etaxonomy
.cdm
.model
.common
.Credit
;
49 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTerm
;
50 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
51 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementSource
;
52 import eu
.etaxonomy
.cdm
.model
.common
.Extension
;
53 import eu
.etaxonomy
.cdm
.model
.common
.GrantedAuthorityImpl
;
54 import eu
.etaxonomy
.cdm
.model
.common
.Group
;
55 import eu
.etaxonomy
.cdm
.model
.common
.ICdmBase
;
56 import eu
.etaxonomy
.cdm
.model
.common
.IDefinedTerm
;
57 import eu
.etaxonomy
.cdm
.model
.common
.IEnumTerm
;
58 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableSource
;
59 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
60 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
61 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
62 import eu
.etaxonomy
.cdm
.model
.common
.TermType
;
63 import eu
.etaxonomy
.cdm
.model
.common
.TimePeriod
;
64 import eu
.etaxonomy
.cdm
.model
.common
.User
;
65 import eu
.etaxonomy
.cdm
.model
.common
.VersionableEntity
;
66 import eu
.etaxonomy
.cdm
.model
.description
.CategoricalData
;
67 import eu
.etaxonomy
.cdm
.model
.description
.CommonTaxonName
;
68 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
69 import eu
.etaxonomy
.cdm
.model
.description
.Distribution
;
70 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
71 import eu
.etaxonomy
.cdm
.model
.description
.IndividualsAssociation
;
72 import eu
.etaxonomy
.cdm
.model
.description
.KeyStatement
;
73 import eu
.etaxonomy
.cdm
.model
.description
.QuantitativeData
;
74 import eu
.etaxonomy
.cdm
.model
.description
.StateData
;
75 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasurementValue
;
76 import eu
.etaxonomy
.cdm
.model
.description
.TaxonInteraction
;
77 import eu
.etaxonomy
.cdm
.model
.description
.TextData
;
78 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
79 import eu
.etaxonomy
.cdm
.model
.location
.NamedAreaLevel
;
80 import eu
.etaxonomy
.cdm
.model
.location
.Point
;
81 import eu
.etaxonomy
.cdm
.model
.media
.ImageFile
;
82 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
83 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
84 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentationPart
;
85 import eu
.etaxonomy
.cdm
.model
.media
.Rights
;
86 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationship
;
87 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignation
;
88 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
89 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignation
;
90 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
91 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationEvent
;
92 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
93 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
94 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
95 import eu
.etaxonomy
.cdm
.strategy
.parser
.ParserProblem
;
96 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
97 import eu
.etaxonomy
.taxeditor
.ui
.combo
.EnumComboElement
;
98 import eu
.etaxonomy
.taxeditor
.ui
.combo
.TermComboElement
;
99 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.IOpenUrlEnabled
;
100 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.OpenUrlSelectorElement
;
101 import eu
.etaxonomy
.taxeditor
.ui
.password
.EditPasswordElement
;
102 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
103 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailSection
;
104 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
105 import eu
.etaxonomy
.taxeditor
.ui
.section
.EmptyElement
;
106 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailElement
;
107 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailSection
;
108 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailElement
;
109 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailSection
;
110 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailElement
;
111 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailSection
;
112 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberElement
;
113 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberSection
;
114 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamOrPersonBaseDetailSection
;
115 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailElement
;
116 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailSection
;
117 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailElement
;
118 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailSection
;
119 import eu
.etaxonomy
.taxeditor
.ui
.section
.common
.ReferencedEntityDetailSection
;
120 import eu
.etaxonomy
.taxeditor
.ui
.section
.common
.RefereneEntityDetailElement
;
121 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DerivedUnitElement
;
122 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescribedSpecimenSection
;
123 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailElement
;
124 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailSection
;
125 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailElement
;
126 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailSection
;
127 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementMediaSection
;
128 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceElement
;
129 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceSection
;
130 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceElement
;
131 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceSection
;
132 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierElement
;
133 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierSection
;
134 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageDetailElement
;
135 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageSection
;
136 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeElement
;
137 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeSection
;
138 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataElement
;
139 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataSection
;
140 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueElement
;
141 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueSection
;
142 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.AbstractDetailedDescriptionDetailElement
;
143 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CategoricalDataDetailElement
;
144 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CommonNameDetailElement
;
145 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.DistributionDetailElement
;
146 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.IndividualsAssociationDetailElement
;
147 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.QuantitativeDataDetailElement
;
148 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TaxonInteractionDetailElement
;
149 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TextDataDetailElement
;
150 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailElement
;
151 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailSection
;
152 import eu
.etaxonomy
.taxeditor
.ui
.section
.grantedAuthority
.GrantedAuthorityCollectionElement
;
153 import eu
.etaxonomy
.taxeditor
.ui
.section
.grantedAuthority
.GrantedAuthorityDetailElement
;
154 import eu
.etaxonomy
.taxeditor
.ui
.section
.grantedAuthority
.GrantedAuthorityDetailSection
;
155 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailElement
;
156 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailSection
;
157 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailElement
;
158 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailSection
;
159 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.GeographicalScopeDetailSection
;
160 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailElement
;
161 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailSection
;
162 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailElement
;
163 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailSection
;
164 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.ScopeRestrictionSection
;
165 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.TaxonomicScopeSection
;
166 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.ImageFileElement
;
167 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaElement
;
168 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationElement
;
169 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationPartElement
;
170 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationPartSection
;
171 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationSection
;
172 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaSection
;
173 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailElement
;
174 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailSection
;
175 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailElement
;
176 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailSection
;
177 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailElement
;
178 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailSection
;
179 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailElement
;
180 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailSection
;
181 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameTypeDesignationElement
;
182 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusElement
;
183 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusSection
;
184 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailElement
;
185 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailSection
;
186 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueElement
;
187 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueSection
;
188 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.SpecimenTypeDesignationElement
;
189 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.TypeDesignationSection
;
190 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectingAreasDetailSection
;
191 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectionDetailElement
;
192 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CurrentDeterminationDetailSection
;
193 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailElement
;
194 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailSection
;
195 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailElement
;
196 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailSection
;
197 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailElement
;
198 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailSection
;
199 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationEventDetailElement
;
200 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationHistoryDetailSection
;
201 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailElement
;
202 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailSection
;
203 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailElement
;
204 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailSection
;
205 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailElement
;
206 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailSection
;
207 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.NamedAreaDetailElement
;
208 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SourceCollectionDetailSection
;
209 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailElement
;
210 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailSection
;
211 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailElement
;
212 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailSection
;
213 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailElement
;
214 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailSection
;
215 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationElement
;
216 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationSection
;
217 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CdmBaseElement
;
218 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CdmBaseSection
;
219 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditElement
;
220 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditSection
;
221 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionElement
;
222 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionSection
;
223 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.HeadlineSection
;
224 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.IdentifiableSourceElement
;
225 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerElement
;
226 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerSection
;
227 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsElement
;
228 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
229 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.SourceSection
;
230 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionElement
;
231 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionSection
;
232 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessageElement
;
233 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
234 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailElement
;
235 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
236 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonDetailElement
;
237 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailElement
;
238 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailSection
;
239 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailElement
;
240 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailSection
;
241 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailElement
;
242 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailSection
;
243 import eu
.etaxonomy
.taxeditor
.ui
.section
.userecords
.UseRecordDetailElement
;
244 import eu
.etaxonomy
.taxeditor
.ui
.section
.userecords
.UseRecordDetailSection
;
245 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.DefinedTermDetailElement
;
246 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.DefinedTermDetailSection
;
247 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailSection
;
248 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailElement
;
249 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailSection
;
250 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
251 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NomenclaturalAuthorTeamSelectionElement
;
252 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonNodeSelectionElement
;
256 * CdmFormFactory class.
260 * @created Feb 24, 2010
263 public class CdmFormFactory
extends FormToolkit
{
265 private BoldFontHolder2 boldFontHolder2
;
266 private MouseListener selectionMouseHandler
;
267 private FocusListener selectionFocusHandler
;
269 private final Set selectionListenerList
= new HashSet();
271 private final List
<IPropertyChangeListener
> propertyChangeListeners
= new ArrayList
<IPropertyChangeListener
>();
273 private final int orientation
= Window
.getDefaultOrientation();
274 private ISelectionProvider selectionProvider
;
276 /** Constant <code>EMPTY_SELECTION</code> */
277 public static ISelection EMPTY_SELECTION
= new ISelection() {
279 public boolean isEmpty() {
290 private class SelectionMouseHandler
extends MouseAdapter
{
292 public void mouseDown(MouseEvent e
) {
293 notifySelectionListeners(e
);
303 private class SelectionFocusHandler
extends FocusAdapter
{
305 public void focusGained(FocusEvent e
) {
306 notifySelectionListeners(e
);
310 private void notifySelectionListeners(TypedEvent e
) {
311 Event event
= new Event();
312 event
.widget
= e
.widget
;
313 SelectionEvent selectionEvent
= new SelectionEvent(event
);
315 for (Object listener
: selectionListenerList
) {
316 ((SelectionListener
) listener
).widgetSelected(selectionEvent
);
322 * Constructor for CdmFormFactory.
326 * a {@link org.eclipse.swt.widgets.Display} object.
327 * @param selectionProvider
328 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
330 public CdmFormFactory(Display display
, ISelectionProvider selectionProvider
) {
332 this.selectionProvider
= selectionProvider
;
338 * Constructor for CdmFormFactory.
342 * a {@link org.eclipse.swt.widgets.Display} object.
344 public CdmFormFactory(Display display
) {
352 private void init() {
353 boldFontHolder2
= new BoldFontHolder2();
354 selectionMouseHandler
= new SelectionMouseHandler();
355 selectionFocusHandler
= new SelectionFocusHandler();
359 * Creates an instance initialized with the correct selectionProvider
361 * Make sure to remove the instance when the entityComposite disposes via
362 * destroySelectionArbitrator(..)
364 * @param entityElement
365 * a {@link eu.etaxonomy.taxeditor.ui.element.IEntityElement}
367 * @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
370 public SelectionArbitrator
createSelectionArbitrator(
371 IEntityElement entityElement
) {
372 SelectionArbitrator selectionArbitrator
= new SelectionArbitrator(
374 selectionArbitrator
.addSelectionProvider(selectionProvider
);
375 selectionProvider
.addSelectionChangedListener(selectionArbitrator
);
376 addSelectionListener(selectionArbitrator
);
377 return selectionArbitrator
;
382 * destroySelectionArbitrator
385 * @param selectionArbitrator
386 * a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
389 public void destroySelectionArbitrator(
390 SelectionArbitrator selectionArbitrator
) {
391 removeSelectionListener(selectionArbitrator
);
392 if (selectionProvider
!= null) {
394 .removeSelectionChangedListener(selectionArbitrator
);
397 .error(this.getClass(),
398 "Tried to destroy a selection listener from this factories listeners but was null",
405 public void adapt(Composite composite
) {
406 composite
.addMouseListener(selectionMouseHandler
);
407 super.adapt(composite
);
417 * {@link eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement}
420 public void adapt(AbstractCdmFormElement formElement
) {
421 formElement
.setPropertyChangeListeners(propertyChangeListeners
);
426 public void adapt(Control control
, boolean trackFocus
, boolean trackKeyboard
) {
428 control
.addFocusListener(selectionFocusHandler
);
430 super.adapt(control
, trackFocus
, trackKeyboard
);
439 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
442 public void destroyElement(ICdmFormElement formElement
) {
443 // return if element was not initialized
444 if (formElement
== null) {
447 // destroy selection arbitrator, if any
448 if (formElement
instanceof ISelectableElement
) {
449 destroySelectionArbitrator(((ISelectableElement
) formElement
)
450 .getSelectionArbitrator());
452 // remove this element form its parents list of elements
453 // ICdmFormElement parentElement = formElement.getParentElement();
454 // if(parentElement != null){
455 // parentElement.removeElement(formElement);
457 // call destroy on child elements recursively
458 for (ICdmFormElement childElement
: formElement
.getElements()) {
459 destroyElement(childElement
);
461 // dispose of the controls
462 for (Control control
: formElement
.getControls()) {
463 // we added the layoutComposite of the parental element as the
464 // layout composite to this formElement
465 // but we do not want to destroy it.
466 if (control
.equals(formElement
.getLayoutComposite())) {
481 * a {@link org.eclipse.swt.widgets.Composite} object.
482 * @return a {@link org.eclipse.swt.widgets.Label} object.
484 public Label
createEmptyCell(Composite parent
) {
485 return this.createLabel(parent
, null);
490 * createMultilineTextWithLabel
494 * a {@link java.lang.String} object.
499 * @param parentElement
500 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
502 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
505 public TextWithLabelElement
createMultilineTextWithLabel(
506 ICdmFormElement parentElement
, String labelString
, int textHeight
,
508 TextWithLabelElement element
= new TextWithLabelElement(this,
509 parentElement
, labelString
, "", textHeight
, style
);
511 parentElement
.addElement(element
);
517 * createMultiLanguageTextElement
520 * @param parentElement
521 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
524 * a {@link java.lang.String} object.
525 * @param multilanguageText
526 * a {@link java.util.Map} object.
532 * {@link eu.etaxonomy.taxeditor.ui.element.MultilanguageTextElement}
535 public MultilanguageTextElement
createMultiLanguageTextElement(
536 ICdmFormElement parentElement
, String labelString
,
537 Map
<Language
, LanguageString
> multilanguageText
, int textHeight
,
539 MultilanguageTextElement element
= new MultilanguageTextElement(this,
540 parentElement
, labelString
, multilanguageText
, textHeight
,
543 parentElement
.addElement(element
);
547 public KeyStatementElement
createKeyStatementElement(
548 ICdmFormElement parentElement
, String labelString
,
549 KeyStatement keyStatement
, int textHeight
, int style
) {
550 KeyStatementElement element
= new KeyStatementElement(this,
551 parentElement
, labelString
, keyStatement
, textHeight
, style
);
553 parentElement
.addElement(element
);
559 * createTextWithLabelElement
563 * a {@link java.lang.String} object.
565 * a {@link java.lang.String} object.
568 * @param parentElement
569 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
571 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
574 public TextWithLabelElement
createTextWithLabelElement(
575 ICdmFormElement parentElement
, String labelString
,
576 String initialText
, int style
) {
577 TextWithLabelElement element
= new TextWithLabelElement(this,
578 parentElement
, labelString
, initialText
, null, style
);
580 parentElement
.addElement(element
);
584 public UriWithLabelElement
createUriWithLabelElement(
585 ICdmFormElement parentElement
, String labelString
, URI initialUri
,
587 UriWithLabelElement element
= new UriWithLabelElement(this,
588 parentElement
, labelString
, initialUri
, null, style
);
590 parentElement
.addElement(element
);
601 public OpenUrlSelectorElement
createOpenUrlSelectorElement(
602 ICdmFormElement parentElement
, String labelString
,
603 IOpenUrlEnabled openUrlEnabled
, int style
) {
604 OpenUrlSelectorElement element
= new OpenUrlSelectorElement(this,
605 parentElement
, labelString
, openUrlEnabled
, style
);
607 parentElement
.addElement(element
);
613 * @param parentElement
615 * @param conversationEnabled
620 public EditPasswordElement
createEditPasswordElement(
621 ICdmFormElement parentElement
, String labelString
,
622 ConversationHolder conversation
, User user
, int style
) {
623 EditPasswordElement element
= new EditPasswordElement(this,
624 parentElement
, labelString
, user
, conversation
);
626 parentElement
.addElement(element
);
632 * createIntegerTextWithLabelElement
635 * @param parentElement
636 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
639 * a {@link java.lang.String} object.
640 * @param initialInteger
641 * a {@link java.lang.Integer} object.
644 * @return a {@link eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement}
647 public NumberWithLabelElement
createNumberTextWithLabelElement(
648 ICdmFormElement parentElement
, String labelString
,
649 Number initialNumber
, int style
) {
650 NumberWithLabelElement element
= new NumberWithLabelElement(this,
651 parentElement
, labelString
, initialNumber
, style
);
653 parentElement
.addElement(element
);
660 * createLanguageStringWithLabelElement
663 * @param parentElement
664 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
667 * a {@link java.lang.String} object.
668 * @param languageString
669 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
673 * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
676 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
677 ICdmFormElement parentElement
, String labelString
,
678 LanguageString languageString
, int style
) {
679 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
680 this, parentElement
, labelString
, languageString
, style
);
682 parentElement
.addElement(element
);
688 * createLanguageStringWithLabelElement
691 * @param parentElement
692 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
695 * a {@link java.lang.String} object.
696 * @param languageString
697 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
703 * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
706 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
707 ICdmFormElement parentElement
, String labelString
,
708 LanguageString languageString
, int height
, int style
) {
709 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
710 this, parentElement
, labelString
, languageString
, height
, style
);
712 parentElement
.addElement(element
);
721 * @param parentElement
722 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
725 * a {@link java.lang.String} object.
728 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
731 public TextWithLabelElement
createTextElement(
732 ICdmFormElement parentElement
, String initialText
, int style
) {
733 TextWithLabelElement element
= new TextWithLabelElement(this,
734 parentElement
, null, initialText
, null, style
);
736 parentElement
.addElement(element
);
742 * createKeyValueViewerElement
745 * @param parentElement
746 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
749 * a {@link java.lang.String} object.
750 * @param valueHeading
751 * a {@link java.lang.String} object.
753 * a {@link java.util.Map} object.
754 * @return a {@link eu.etaxonomy.taxeditor.ui.element.KeyValueViewerElement}
757 public KeyValueViewerElement
createKeyValueViewerElement(
758 ICdmFormElement parentElement
, String keyHeading
,
759 String valueHeading
, Map
<Object
, Object
> map
) {
760 KeyValueViewerElement element
= new KeyValueViewerElement(this,
761 parentElement
, keyHeading
, valueHeading
, map
);
763 parentElement
.addElement(element
);
769 * createTermComboElement
772 * @param termComboType
774 * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.TermComboType}
776 * @param parentElement
777 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
780 * a {@link java.lang.String} object.
782 * a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase}
786 * @return a {@link eu.etaxonomy.taxeditor.ui.combo.TermComboElement}
790 public <T
extends DefinedTermBase
> TermComboElement
<T
> createTermComboElement(
791 Class
<T
> termComboType
, ICdmFormElement parentElement
,
792 String labelString
, T selection
, int style
) {
793 TermComboElement
<T
> element
= new TermComboElement
<T
>(this, parentElement
, termComboType
, labelString
, selection
, style
);
795 parentElement
.addElement(element
);
801 * createEnumComboElement
804 * @param enumComboType
806 * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EnumComboType}
808 * @param parentElement
809 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
813 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
816 public <T
extends IEnumTerm
> EnumComboElement
<T
> createEnumComboElement(
817 Class
<T
> enumComboType
, ICdmFormElement parentElement
,
819 EnumComboElement
<T
> element
= new EnumComboElement
<T
>(this, parentElement
, enumComboType
, style
);
821 parentElement
.addElement(element
);
827 * createBrowserElement
831 * a {@link java.net.URI} object.
834 * @param parentElement
835 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
837 * @return a {@link eu.etaxonomy.taxeditor.ui.element.BrowserElement} object.
839 public BrowserElement
createBrowserElement(ICdmFormElement parentElement
,
840 URI imageUri
, int style
) {
841 BrowserElement element
= new BrowserElement(this, parentElement
,
844 parentElement
.addElement(element
);
853 * @param parentElement
854 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
857 * a {@link java.net.URI} object.
860 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ImageElement} object.
862 public ImageElement
createImageElement(ICdmFormElement parentElement
,
863 URI imageUri
, int style
) {
864 ImageElement element
= new ImageElement(this, parentElement
, imageUri
,
867 parentElement
.addElement(element
);
873 * createTextActionElement
877 * a {@link java.lang.String} object.
879 * a {@link java.lang.String} object.
882 * @param parentElement
883 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
886 * a {@link java.lang.String} object.
887 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextActionElement}
890 public TextActionElement
createTextActionElement(
891 ICdmFormElement parentElement
, String labelString
,
892 String buttonLabel
, String initialText
, int style
) {
893 TextActionElement element
= new TextActionElement(this, parentElement
,
894 labelString
, buttonLabel
, initialText
, style
);
896 parentElement
.addElement(element
);
905 * @param parentElement
906 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
909 * a {@link java.lang.String} object.
910 * @param initialState
914 * @return a {@link eu.etaxonomy.taxeditor.ui.element.CheckboxElement} object.
916 public CheckboxElement
createCheckbox(ICdmFormElement parentElement
,
917 String label
, boolean initialState
, int style
) {
918 CheckboxElement element
= new CheckboxElement(this, parentElement
,
919 label
, initialState
, style
| orientation
);
921 parentElement
.addElement(element
);
926 * Creates a section as a part of the form.
928 * @return the section widget
930 * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
933 public Section
adapt(AbstractFormSection section
) {
934 section
.setMenu(section
.getLayoutComposite().getMenu());
935 adapt(section
, true, true);
937 // handle focus and property change events for cdm use
938 section
.addFocusListener(selectionFocusHandler
);
939 section
.setPropertyChangeListeners(propertyChangeListeners
);
941 if (section
.getToggle() != null) {
942 section
.getToggle().setHoverDecorationColor(
943 getColors().getColor(IFormColors
.TB_TOGGLE_HOVER
));
944 section
.getToggle().setDecorationColor(
945 getColors().getColor(IFormColors
.TB_TOGGLE
));
948 section
.setFont(boldFontHolder2
.getBoldFont(section
949 .getLayoutComposite().getFont()));
951 if ((section
.getStyle() & Section
.TITLE_BAR
) != 0
952 || (section
.getStyle() & Section
.SHORT_TITLE_BAR
) != 0) {
953 getColors().initializeSectionToolBarColors();
954 section
.setTitleBarBackground(getColors().getColor(
956 section
.setTitleBarBorderColor(getColors().getColor(
957 IFormColors
.TB_BORDER
));
959 // call setTitleBarForeground regardless as it also sets the label color
960 section
.setTitleBarForeground(getColors().getColor(
961 IFormColors
.TB_TOGGLE
));
965 private class BoldFontHolder2
{
966 private Font normalFont
;
968 private Font boldFont
;
970 public BoldFontHolder2() {
973 public Font
getBoldFont(Font font
) {
974 createBoldFont(font
);
978 private void createBoldFont(Font font
) {
979 if (normalFont
== null || !normalFont
.equals(font
)) {
983 if (boldFont
== null) {
984 boldFont
= FormFonts
.getInstance().getBoldFont(
985 getColors().getDisplay(), normalFont
);
989 public void dispose() {
990 if (boldFont
!= null) {
991 FormFonts
.getInstance().markFinished(boldFont
,
992 getColors().getDisplay());
1000 * createToggleableTextField
1003 * @param parentElement
1004 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1006 * @param labelString
1007 * a {@link java.lang.String} object.
1008 * @param initialText
1009 * a {@link java.lang.String} object.
1010 * @param initialState
1014 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement}
1017 public ToggleableTextElement
createToggleableTextField(
1018 ICdmFormElement parentElement
, String labelString
,
1019 String initialText
, boolean initialState
, int style
) {
1020 ToggleableTextElement element
= new ToggleableTextElement(this,
1021 parentElement
, labelString
, initialText
, initialState
, style
1024 parentElement
.addElement(element
);
1030 * createTimePeriodElement
1033 * @param parentElement
1034 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1036 * @param labelString
1037 * a {@link java.lang.String} object.
1039 * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1042 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TimePeriodElement}
1045 public TimePeriodElement
createTimePeriodElement(
1046 ICdmFormElement parentElement
, String labelString
,
1047 TimePeriod timePeriod
, int style
) {
1048 TimePeriodElement element
= new TimePeriodElement(this, parentElement
,
1049 labelString
, timePeriod
, style
);
1051 parentElement
.addElement(element
);
1057 * createPointElement
1062 * @param parentElement
1063 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1066 * a {@link eu.etaxonomy.cdm.model.location.Point} object.
1067 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PointElement} object.
1069 public PointElement
createPointElement(ICdmFormElement parentElement
,
1070 Point point
, int style
) {
1071 PointElement element
= new PointElement(this, parentElement
, point
,
1074 parentElement
.addElement(element
);
1080 * createDateDetailSection
1083 * @param parentElement
1084 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1088 * @return a {@link eu.etaxonomy.taxeditor.ui.element.DateDetailSection}
1091 public DateDetailSection
createDateDetailSection(
1092 ICdmFormElement parentElement
, int style
) {
1093 DateDetailSection section
= new DateDetailSection(this, parentElement
,
1095 parentElement
.addElement(section
);
1102 * createPartialElement
1105 * @param parentElement
1106 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1108 * @param labelString
1109 * a {@link java.lang.String} object.
1111 * a {@link org.joda.time.Partial} object.
1114 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PartialElement} object.
1116 public PartialElement
createPartialElement(ICdmFormElement parentElement
,
1117 String labelString
, Partial partial
, int style
) {
1118 PartialElement element
= new PartialElement(this, parentElement
,
1119 labelString
, style
);
1121 parentElement
.addElement(element
);
1127 * addSelectionListener
1131 * a {@link org.eclipse.swt.events.SelectionListener} object.
1133 public void addSelectionListener(SelectionListener listener
) {
1134 selectionListenerList
.add(listener
);
1139 * removeSelectionListener
1143 * a {@link org.eclipse.swt.events.SelectionListener} object.
1145 public void removeSelectionListener(SelectionListener listener
) {
1146 if (listener
== null) {
1148 .error(this.getClass(),
1149 "Tried to remove a selection listener from this factories listeners but was null",
1152 selectionListenerList
.remove(listener
);
1158 * addPropertyChangeListener
1162 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1165 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
1166 if(propertyChangeListeners
.contains(listener
)){
1169 propertyChangeListeners
.add(0, listener
);
1174 * removePropertyChangeListener
1178 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1181 public void removePropertyChangeListener(IPropertyChangeListener listener
) {
1182 propertyChangeListeners
.remove(listener
);
1187 * createHorizontalSeparator
1190 * @param parentElement
1191 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1195 * @return a {@link org.eclipse.swt.widgets.Label} object.
1197 public Label
createHorizontalSeparator(ICdmFormElement parentElement
,
1199 Label separator
= this.createSeparator(
1200 parentElement
.getLayoutComposite(), SWT
.HORIZONTAL
| style
);
1201 separator
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY());
1207 * createVersionElement
1210 * @param parentElement
1211 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1214 * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
1219 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
1222 public VersionElement
createVersionElement(ICdmFormElement parentElement
,
1223 VersionableEntity entity
, int style
) {
1224 VersionElement element
= new VersionElement(this, parentElement
,
1227 parentElement
.addElement(element
);
1232 * @param cdmBaseSection
1237 public CdmBaseElement
createCdmBaseElement(ICdmFormElement parentElement
,
1238 CdmBase entity
, int style
) {
1239 CdmBaseElement element
= new CdmBaseElement(this, parentElement
,
1242 parentElement
.addElement(element
);
1249 * createVersionSection
1252 * @param parentElement
1253 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1258 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
1261 public VersionSection
createVersionSection(ICdmFormElement parentElement
,
1263 VersionSection section
= new VersionSection(this, parentElement
, style
);
1264 parentElement
.addElement(section
);
1274 public CdmBaseSection
createCdmBaseSection(ICdmFormElement parentElement
, int style
) {
1275 CdmBaseSection section
= new CdmBaseSection(this, parentElement
, style
);
1276 parentElement
.addElement(section
);
1283 * createEmptyElement
1286 * @param parentElement
1287 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1289 * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1291 public EmptyElement
createEmptyElement(ICdmFormElement parentElement
) {
1292 EmptyElement element
= new EmptyElement(this, parentElement
, null,
1295 parentElement
.addElement(element
);
1301 * createHeadlineSection
1304 * @param parentElement
1305 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1308 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
1311 public HeadlineSection
createHeadlineSection(ICdmFormElement parentElement
) {
1312 HeadlineSection section
= new HeadlineSection(this, parentElement
,
1314 parentElement
.addElement(section
);
1321 * createParsingMessageElement
1324 * @param parentElement
1325 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1327 * @param parserProblem
1328 * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
1333 * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
1336 public ParsingMessageElement
createParsingMessageElement(
1337 ICdmFormElement parentElement
, ParserProblem parserProblem
,
1339 ParsingMessageElement element
= new ParsingMessageElement(this,
1340 parentElement
, parserProblem
, style
);
1342 parentElement
.addElement(element
);
1351 public static enum DetailType
{
1356 DERIVED_UNIT_FACADE
,
1357 DERIVED_UNIT_GENERAL
,
1361 FEATURE_DISTRIBUTION
,
1373 NOMENCLATURALREFERENCE
,
1378 POLYTOMOUS_KEY_NODE
,
1392 public AbstractFormSection
createDefinedTermDetailSection(Class definedTermClass
,
1393 ConversationHolder conversation
, ICdmFormElement parentElement
,
1394 ISelectionProvider selectionProvider
, int style
) {
1396 AbstractFormSection section
= new DefinedTermDetailSection(this, definedTermClass
, conversation
, parentElement
, selectionProvider
, style
);
1398 parentElement
.addElement(section
);
1405 * @param definedTermClass
1406 * @param formElement
1410 public AbstractCdmDetailElement
createDefinedTermDetailElement(
1411 Class definedTermClass
, AbstractCdmDetailSection parentElement
,
1413 AbstractCdmDetailElement element
= null;
1415 if (NamedArea
.class.isAssignableFrom(definedTermClass
)){
1416 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1419 element
= new DefinedTermDetailElement(this, parentElement
);
1423 parentElement
.addElement(element
);
1429 * createCdmDetailSection
1434 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
1436 * @param parentElement
1437 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1439 * @param selectionProvider
1440 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1443 * @param conversation
1444 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1446 * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1449 public AbstractFormSection
createCdmDetailSection(DetailType detailType
,
1450 ConversationHolder conversation
, ICdmFormElement parentElement
,
1451 ISelectionProvider selectionProvider
, int style
) {
1452 AbstractFormSection section
= null;
1454 switch (detailType
) {
1455 case SCIENTIFICNAME
:
1456 section
= new NameDetailSection(this, conversation
, parentElement
,
1457 selectionProvider
, style
);
1460 section
= new ReferenceDetailSection(this, conversation
,
1461 parentElement
, selectionProvider
, style
);
1463 case NOMENCLATURALREFERENCE
:
1464 section
= new NomenclaturalReferenceDetailSection(this,
1465 conversation
, parentElement
, selectionProvider
, style
);
1468 section
= new TaxonBaseDetailSection(this, conversation
,
1469 parentElement
, selectionProvider
, style
);
1472 section
= new AuthorshipDetailSection(this, conversation
,
1473 parentElement
, selectionProvider
, style
);
1475 case TEAMORPERSONBASE
:
1476 section
= new TeamOrPersonBaseDetailSection(this, conversation
,
1477 parentElement
, selectionProvider
, style
);
1480 section
= new TeamDetailSection(this, conversation
, parentElement
,
1484 section
= new PersonDetailSection(this, conversation
,
1485 parentElement
, null, style
);
1488 section
= new DescriptionDetailSection(this, conversation
,
1489 parentElement
, selectionProvider
, style
);
1491 case DESCRIPTIONELEMENT
:
1492 section
= new DescriptionElementDetailSection(this, conversation
,
1493 parentElement
, selectionProvider
, style
);
1495 case PARSINGMESSAGE
:
1496 section
= new ParsingMessagesSection(this, conversation
,
1497 parentElement
, selectionProvider
, style
);
1500 section
= new NonViralNameDetailSection(this, conversation
,
1501 parentElement
, selectionProvider
, style
);
1504 section
= new eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection(
1505 this, conversation
, parentElement
, selectionProvider
, style
);
1507 case DERIVED_UNIT_FACADE
:
1508 section
= new DerivedUnitFacadeDetailSection(this, conversation
,
1509 parentElement
, selectionProvider
, style
);
1511 case FIELD_OBSERVATION
:
1512 section
= new FieldObservationDetailSection(this, conversation
,
1513 parentElement
, selectionProvider
, style
);
1515 case GATHERING_EVENT
:
1516 section
= new GatheringEventDetailSection(this, conversation
,
1517 parentElement
, selectionProvider
, style
);
1520 section
= new DerivedUnitBaseDetailSection(this, conversation
,
1521 parentElement
, selectionProvider
, style
);
1523 case NATURAL_LANGUAGE
:
1524 section
= new NaturalLanguageSection(this, conversation
,
1525 parentElement
, selectionProvider
, style
);
1527 case FEATURE_DISTRIBUTION
:
1528 section
= new FeatureDistributionDetailSection(this, conversation
,
1529 parentElement
, selectionProvider
, style
);
1531 case CLASSIFICATION
:
1532 section
= new ClassificationDetailSection(this, conversation
,
1533 parentElement
, selectionProvider
, style
);
1536 section
= new TaxonNodeDetailSection(this, conversation
,
1537 parentElement
, selectionProvider
, style
);
1539 case POLYTOMOUS_KEY
:
1540 section
= new PolytomousKeyDetailSection(this, conversation
,
1541 parentElement
, selectionProvider
, style
);
1543 case POLYTOMOUS_KEY_NODE
:
1544 section
= new PolytomousKeyNodeDetailSection(this, conversation
,
1545 parentElement
, selectionProvider
, style
);
1548 section
= new InstitutionDetailSection(this, conversation
,
1549 parentElement
, selectionProvider
, style
);
1551 case DERIVED_UNIT_GENERAL
:
1552 section
= new GeneralDetailSection(this, conversation
,
1553 parentElement
, selectionProvider
, style
);
1556 section
= new HybridDetailSection(this, conversation
,
1557 parentElement
, selectionProvider
, style
);
1560 section
= new UserDetailSection(this, conversation
, parentElement
,
1561 selectionProvider
, style
);
1564 section
= new GroupDetailSection(this, conversation
, parentElement
,
1565 selectionProvider
, style
);
1568 section
= new DeterminationDetailSection(this, conversation
, parentElement
,
1569 selectionProvider
, style
);
1571 case TAXON_RELATIONSHIP
:
1572 section
= new TaxonRelationshipDetailSection(this, conversation
, parentElement
,
1573 selectionProvider
, style
);
1575 case REFERENCED_ENTITY
:
1576 section
= new ReferencedEntityDetailSection(this, conversation
, parentElement
,
1577 selectionProvider
, style
);
1579 case TERM_VOCABULARY
:
1580 section
= new TermVocabularyDetailSection(this, conversation
, parentElement
,
1581 selectionProvider
, style
);
1584 section
= new NamedAreaDetailSection(this, conversation
, parentElement
,
1585 selectionProvider
, style
);
1588 section
= new UseRecordDetailSection(this, conversation
, parentElement
,
1589 selectionProvider
, style
);
1594 if (section
== null) {
1595 throw new RuntimeException(
1596 "You tried to create a cdm detail section that is not implemented yet.");
1599 parentElement
.addElement(section
);
1608 * createCdmDetailElement
1613 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
1617 * @param parentElement
1618 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1621 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
1624 public AbstractCdmDetailElement
createCdmDetailElement(
1625 DetailType detailType
, ICdmFormElement parentElement
, int style
) {
1626 AbstractCdmDetailElement element
= null;
1628 switch (detailType
) {
1629 case SCIENTIFICNAME
:
1630 element
= new NameDetailElement(this, parentElement
, style
);
1633 element
= new ReferenceDetailElement(this, parentElement
, style
);
1635 case NOMENCLATURALREFERENCE
:
1636 element
= new NomenclaturalReferenceDetailElement(this,
1637 parentElement
, style
);
1640 element
= new TaxonBaseDetailElement(this, parentElement
, style
);
1643 element
= new AuthorshipDetailElement(this, parentElement
, style
);
1646 element
= new TeamDetailElement(this, parentElement
, style
);
1649 element
= new PersonDetailElement(this, parentElement
, style
);
1652 element
= new DescriptionDetailElement(this, parentElement
, style
);
1654 case DESCRIPTIONELEMENT
:
1655 element
= new DescriptionElementDetailElement(this, parentElement
,
1659 element
= new NonViralNameDetailElement(this, parentElement
);
1661 case DERIVED_UNIT_FACADE
:
1662 element
= new DerivedUnitFacadeDetailElement(this, parentElement
);
1664 case FIELD_OBSERVATION
:
1665 element
= new FieldObservationDetailElement(this, parentElement
);
1667 case GATHERING_EVENT
:
1668 element
= new GatheringEventDetailElement(this, parentElement
);
1671 element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1673 case NATURAL_LANGUAGE
:
1674 element
= new NaturalLanguageDetailElement(this, parentElement
);
1676 case FEATURE_DISTRIBUTION
:
1677 element
= new FeatureDistributionDetailElement(this, parentElement
);
1679 case CLASSIFICATION
:
1680 element
= new ClassificationDetailElement(this, parentElement
);
1683 element
= new TaxonNodeDetailElement(this, parentElement
);
1686 element
= new CollectionDetailElement(this, parentElement
);
1688 case POLYTOMOUS_KEY
:
1689 element
= new PolytomousKeyDetailElement(this, parentElement
);
1691 case POLYTOMOUS_KEY_NODE
:
1692 element
= new PolytomousKeyNodeDetailElement(this, parentElement
);
1695 element
= new InstitutionDetailElement(this, parentElement
);
1697 case DERIVED_UNIT_GENERAL
:
1698 element
= new GeneralDetailElement(this, parentElement
);
1701 element
= new HybridDetailElement(this, parentElement
);
1704 element
= new UserDetailElement(this, parentElement
);
1707 element
= new GroupDetailElement(this, parentElement
);
1709 case GRANTEDAUTHORITY
:
1710 element
= new GrantedAuthorityDetailElement(this, parentElement
);
1713 element
= new DeterminationDetailElement(this, parentElement
);
1715 case TAXON_RELATIONSHIP
:
1716 element
= new TaxonRelationshipDetailElement(this, parentElement
);
1718 case REFERENCED_ENTITY
:
1719 element
= new RefereneEntityDetailElement(this, parentElement
);
1721 case TERM_VOCABULARY
:
1722 element
= new TermVocabularyDetailElement(this, parentElement
);
1725 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1727 case NAMED_AREA_LEVEL
:
1728 element
= new DefinedTermDetailElement
<NamedAreaLevel
>(this, parentElement
);
1731 //element = new UseRecordDetailElement(this, parentElement, style);
1732 element
= new UseRecordDetailElement(this, parentElement
);
1736 if (element
== null) {
1738 .error(this.getClass(),
1739 "Detail element was not created. Seems like the case was not implemented for the requested detail type: "
1740 + detailType
, null);
1744 parentElement
.addElement(element
);
1750 * @author n.hoffmann
1751 * @created Mar 5, 2010
1754 public static enum EntityDetailType
{
1759 DESCRIPTIONELEMENTSOURCE
,
1763 DESCRIPTIONELEMENTMEDIA
,
1764 MEDIAREPRESENTATION
,
1765 MEDIAREPRESENTATIONPART
,
1767 NOMENCLATURALSTATUS
,
1776 STATISTICAL_MEASUREMENT_VALUE
,
1779 DETERMINATION_EVENT
,
1780 SPECIMEN_COLLECTION
,
1781 IDENTIFIABLE_SOURCE_COLLECTION
,
1788 DETERMINATION_CURRENT
,
1789 DETERMINATION_HISTORY
1794 * createEntityDetailSection
1797 * @param entityDetailType
1799 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType}
1803 * @param conversation
1804 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1806 * @param parentElement
1807 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1809 * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1812 public AbstractFormSection
createEntityDetailSection(
1813 EntityDetailType entityDetailType
, ConversationHolder conversation
,
1814 ICdmFormElement parentElement
, int style
) {
1815 AbstractFormSection section
= null;
1817 switch (entityDetailType
) {
1819 section
= new TeamDetailSection(this, conversation
, parentElement
,
1823 section
= new TeamMemberSection(this, conversation
, parentElement
,
1827 section
= new AnnotationSection(this, conversation
, parentElement
,
1831 section
= new CreditSection(this, conversation
, parentElement
,
1834 case DESCRIPTIONELEMENTSOURCE
:
1835 section
= new DescriptionElementSourceSection(this, conversation
,
1836 parentElement
, style
);
1839 section
= new ExtensionSection(this, conversation
, parentElement
,
1843 section
= new MarkerSection(this, conversation
, parentElement
,
1847 section
= new MediaSection(this, conversation
, parentElement
, style
);
1849 case DESCRIPTIONELEMENTMEDIA
:
1850 section
= new DescriptionElementMediaSection(this, conversation
,
1851 parentElement
, style
);
1853 case MEDIAREPRESENTATION
:
1854 section
= new MediaRepresentationSection(this, conversation
,
1855 parentElement
, style
);
1857 case MEDIAREPRESENTATIONPART
:
1858 section
= new MediaRepresentationPartSection(this, conversation
,
1859 parentElement
, style
);
1862 section
= new ModifierSection(this, conversation
, parentElement
,
1865 case NOMENCLATURALSTATUS
:
1866 section
= new NomenclaturalStatusSection(this, conversation
,
1867 parentElement
, style
);
1869 case NAME_RELATIONSHIP
:
1870 section
= new NameRelationshipDetailSection(this, conversation
,
1871 parentElement
, style
);
1874 section
= new ProtologueSection(this, conversation
, parentElement
,
1878 section
= new RightsSection(this, conversation
, parentElement
,
1882 section
= new SourceSection(this, conversation
, parentElement
,
1886 section
= new ScopeSection(this, conversation
, parentElement
, style
);
1888 case DESCRIPTIONSOURCE
:
1889 section
= new DescriptionSourceSection(this, conversation
,
1890 parentElement
, style
);
1892 case TYPEDESIGNATION
:
1893 section
= new TypeDesignationSection(this, conversation
,
1894 parentElement
, style
);
1897 section
= new StateDataSection(this, conversation
, parentElement
,
1900 case STATISTICAL_MEASUREMENT_VALUE
:
1901 section
= new StatisticalMeasurementValueSection(this,
1902 conversation
, parentElement
, style
);
1904 case DESCRIBED_SPECIMEN
:
1905 section
= new DescribedSpecimenSection(this, conversation
,
1906 parentElement
, style
);
1908 case COLLECTING_AREA
:
1909 section
= new CollectingAreasDetailSection(this, conversation
,
1910 parentElement
, style
);
1912 case DETERMINATION_CURRENT
:
1913 section
= new CurrentDeterminationDetailSection(this, conversation
,
1914 parentElement
, style
);
1916 case DETERMINATION_HISTORY
:
1917 section
= new DeterminationHistoryDetailSection(this, conversation
,
1918 parentElement
, style
);
1920 case SPECIMEN_COLLECTION
:
1921 section
= new SpecimenCollectionDetailSection(this, conversation
,
1922 parentElement
, style
);
1924 case IDENTIFIABLE_SOURCE_COLLECTION
:
1925 section
= new SourceCollectionDetailSection(this, conversation
,
1926 parentElement
, style
);
1928 case GEOGRAPHICAL_SCOPE
:
1929 section
= new GeographicalScopeDetailSection(this, conversation
,
1930 parentElement
, style
);
1932 case SCOPE_RESTRICTION
:
1933 section
= new ScopeRestrictionSection(this, conversation
,
1934 parentElement
, style
);
1937 section
= new MemberDetailSection(this, conversation
,
1938 parentElement
, style
);
1940 case GRANTED_AUTHORITY
:
1941 section
= new GrantedAuthorityDetailSection(this, conversation
,
1942 parentElement
, style
);
1944 case GROUPS_BY_USER
:
1945 section
= new GroupsByUserDetailSection(this, conversation
,
1946 parentElement
, style
);
1948 case TAXONOMIC_SCOPE
:
1949 section
= new TaxonomicScopeSection(this, conversation
,
1950 parentElement
, style
);
1953 parentElement
.addElement(section
);
1960 * createEntityCollectionElement
1963 * @param removeListener
1964 * a {@link org.eclipse.swt.events.SelectionListener} object.
1967 * @param parentElement
1968 * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1970 * @param versionableEntity
1971 * a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity}
1973 * @param backgroundColor
1974 * a {@link org.eclipse.swt.graphics.Color} object.
1976 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement}
1979 public AbstractEntityCollectionElement
createEntityCollectionElement(
1980 AbstractFormSection parentElement
, Object versionableEntity
,
1981 SelectionListener removeListener
, Color backgroundColor
, int style
) {
1982 AbstractEntityCollectionElement element
= null;
1984 Object entity
= HibernateProxyHelper
.deproxy(versionableEntity
);
1986 if (entity
instanceof Annotation
) {
1987 element
= new AnnotationElement(this, parentElement
,
1988 (Annotation
) entity
, removeListener
, style
);
1989 } else if (entity
instanceof Person
) {
1990 element
= new TeamMemberElement(this, parentElement
,
1991 (Person
) entity
, removeListener
, style
);
1992 } else if (entity
instanceof Credit
) {
1993 element
= new CreditElement(this, parentElement
, (Credit
) entity
,
1994 removeListener
, style
);
1995 } else if (entity
instanceof Extension
) {
1996 element
= new ExtensionElement(this, parentElement
,
1997 (Extension
) entity
, removeListener
, style
);
1998 } else if (entity
instanceof Marker
) {
1999 element
= new MarkerElement(this, parentElement
, (Marker
) entity
,
2000 removeListener
, style
);
2001 } else if (entity
instanceof Media
) {
2002 element
= new MediaElement(this, parentElement
, (Media
) entity
,
2003 removeListener
, style
);
2004 } else if (entity
instanceof MediaRepresentation
) {
2005 element
= new MediaRepresentationElement(this, parentElement
,
2006 (MediaRepresentation
) entity
, removeListener
, style
);
2007 } else if (entity
instanceof ImageFile
) {
2008 element
= new ImageFileElement(this, parentElement
,
2009 (ImageFile
) entity
, removeListener
, style
);
2010 } else if (entity
instanceof MediaRepresentationPart
){
2011 element
= new MediaRepresentationPartElement(this, parentElement
,
2012 (MediaRepresentationPart
) entity
, removeListener
, style
);
2013 } else if (entity
instanceof NomenclaturalStatus
) {
2014 element
= new NomenclaturalStatusElement(this, parentElement
,
2015 (NomenclaturalStatus
) entity
, removeListener
, style
);
2016 } else if (entity
instanceof Rights
) {
2017 element
= new RightsElement(this, parentElement
, (Rights
) entity
,
2018 removeListener
, style
);
2019 } else if (entity
instanceof DescriptionElementSource
) {
2020 element
= new DescriptionElementSourceElement(this, parentElement
,
2021 (DescriptionElementSource
) entity
, removeListener
, style
);
2022 } else if (entity
instanceof IdentifiableSource
) {
2023 element
= new IdentifiableSourceElement(this, parentElement
,
2024 (IdentifiableSource
) entity
, removeListener
, style
);
2025 } else if (entity
instanceof DefinedTerm
) {
2026 switch(((DefinedTerm
)entity
).getTermType()) {
2028 element
= new ScopeElement(this,
2030 (DefinedTerm
) entity
,
2035 element
= new ModifierElement(this,
2037 (DefinedTerm
) entity
,
2042 //FIXME : Actually we should through an exception here
2047 } else if (entity
instanceof Reference
) {
2048 element
= new DescriptionSourceElement(this, parentElement
,
2049 (Reference
) entity
, removeListener
, style
);
2050 } else if (entity
instanceof NameTypeDesignation
) {
2051 element
= new NameTypeDesignationElement(this, parentElement
,
2052 (NameTypeDesignation
) entity
, removeListener
, style
);
2053 } else if (entity
instanceof NameRelationship
) {
2054 element
= new NameRelationshipDetailElement(this, parentElement
,
2055 (NameRelationship
) entity
, removeListener
, style
);
2056 } else if (entity
instanceof SpecimenTypeDesignation
) {
2057 element
= new SpecimenTypeDesignationElement(this, parentElement
,
2058 (SpecimenTypeDesignation
) entity
, removeListener
, style
);
2059 } else if (entity
instanceof StateData
) {
2060 element
= new StateDataElement(this, parentElement
,
2061 (StateData
) entity
, removeListener
, style
);
2062 } else if (entity
instanceof StatisticalMeasurementValue
) {
2063 element
= new StatisticalMeasurementValueElement(this,
2064 parentElement
, (StatisticalMeasurementValue
) entity
,
2065 removeListener
, style
);
2066 } else if (entity
instanceof DerivedUnit
) {
2067 switch(((DerivedUnit
)entity
).getRecordBasis()) {
2068 case LivingSpecimen
:
2069 case PreservedSpecimen
:
2071 element
= new SpecimenCollectionDetailElement(this,
2073 (DerivedUnit
) entity
,
2078 element
= new DerivedUnitElement(this,
2080 (DerivedUnit
) entity
,
2085 } else if (entity
instanceof NamedArea
) {
2086 element
= new NamedAreaDetailElement(this, parentElement
,
2087 (NamedArea
) entity
, removeListener
, style
);
2088 } else if (entity
instanceof DeterminationEvent
) {
2089 element
= new DeterminationEventDetailElement(this, parentElement
,
2090 (DeterminationEvent
) entity
, removeListener
, style
);
2091 } else if (entity
instanceof User
) {
2092 element
= new MemberDetailElement(this, parentElement
,
2093 (User
) entity
, removeListener
, style
);
2094 } else if (entity
instanceof GrantedAuthority
) {
2095 element
= new GrantedAuthorityCollectionElement(this, parentElement
,
2096 (GrantedAuthorityImpl
) entity
, removeListener
, style
);
2097 } else if (entity
instanceof Group
) {
2098 element
= new GroupsByUserDetailElement(this, parentElement
,
2099 (Group
) entity
, removeListener
, style
);
2100 } else if (entity
instanceof Taxon
) {
2101 element
= new TaxonDetailElement(this, parentElement
,
2102 (Taxon
) entity
, removeListener
, style
);
2103 } else if (entity
instanceof DescriptionElementBase
) {
2104 // this is the special case for protologs, maybe we can do this
2105 // differently when API improves
2106 DescriptionElementBase descriptionElement
= (DescriptionElementBase
) entity
;
2107 if (descriptionElement
.getFeature().equals(Feature
.PROTOLOGUE())) {
2108 element
= new ProtologueElement(this, parentElement
,
2109 descriptionElement
, removeListener
, style
);
2113 if (element
== null) {
2116 "No element for entity",
2118 "Could not generate element for entity. "
2119 + "Looks like the case is not handled already. Check implementation. Entity: "
2124 if (backgroundColor
!= null && !backgroundColor
.isDisposed()) {
2125 element
.setPersistentBackground(backgroundColor
);
2129 parentElement
.addElement(element
);
2135 * Creates a selection element for the given type T.
2138 * <strong>Selection elements not handled by this method:</strong>
2140 * <li>{@link TaxonNodeSelectionElement} see {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}</li>
2141 * <li>{@link NomenclaturalAuthorTeamSelectionElement} see {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}</li>
2146 * a {@link Class} object of the type that you want the selection element to handle
2147 * @param parentElement
2148 * a {@link ICdmFormElement}
2150 * @param labelString
2151 * a {@link String} object.
2152 * @param selectionType
2154 * a {@link ICdmBase} object.
2157 * @param conversation
2158 * a {@link ConversationHolder} object.
2160 * {@link EntitySelectionElement}
2163 public <T
extends ICdmBase
> EntitySelectionElement
<T
> createSelectionElement(
2164 Class
<T
> clazz
, ConversationHolder conversation
,
2165 ICdmFormElement parentElement
, String labelString
,
2166 T selection
, int mode
, int style
) {
2167 EntitySelectionElement
<T
> element
= new EntitySelectionElement
<T
>(this, conversation
, parentElement
, clazz
, labelString
, selection
, mode
, style
);
2169 parentElement
.addElement(element
);
2173 public TaxonNodeSelectionElement
createTaxonNodeSelectionElement(
2174 ConversationHolder conversation
,
2175 ICdmFormElement parentElement
, String labelString
,
2176 TaxonNode selection
, int mode
, int style
) {
2177 TaxonNodeSelectionElement element
= new TaxonNodeSelectionElement(this, conversation
, parentElement
, labelString
, selection
, mode
, style
);
2179 parentElement
.addElement(element
);
2183 public NomenclaturalAuthorTeamSelectionElement
createNomenclaturalAuthorTeamSelectionElement(
2184 ConversationHolder conversation
,
2185 ICdmFormElement parentElement
, String labelString
,
2186 Team selection
, int mode
, int style
) {
2187 NomenclaturalAuthorTeamSelectionElement element
= new NomenclaturalAuthorTeamSelectionElement(this, conversation
, parentElement
, labelString
, selection
, mode
, style
);
2189 parentElement
.addElement(element
);
2194 /** {@inheritDoc} */
2195 public LabelElement
createLabel(ICdmFormElement parentElement
, String text
) {
2196 LabelElement labelElement
= new LabelElement(this, parentElement
, text
);
2197 adapt(labelElement
);
2198 parentElement
.addElement(labelElement
);
2199 return labelElement
;
2204 * Getter for the field <code>selectionProvider</code>.
2207 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
2209 public ISelectionProvider
getSelectionProvider() {
2210 return selectionProvider
;
2215 * createDetailedDescriptionDetailElement
2218 * @param parentElement
2219 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
2223 * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
2228 * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
2231 public AbstractDetailedDescriptionDetailElement
createDetailedDescriptionDetailElement(
2232 ICdmFormElement parentElement
, DescriptionElementBase entity
,
2234 AbstractDetailedDescriptionDetailElement detailedDescriptionElement
= null;
2236 if (entity
instanceof CategoricalData
) {
2237 detailedDescriptionElement
= new CategoricalDataDetailElement(this,
2238 parentElement
, (CategoricalData
) entity
, style
);
2239 } else if (entity
instanceof CommonTaxonName
) {
2240 detailedDescriptionElement
= new CommonNameDetailElement(this,
2241 parentElement
, (CommonTaxonName
) entity
, style
);
2242 } else if (entity
instanceof Distribution
) {
2243 detailedDescriptionElement
= new DistributionDetailElement(this,
2244 parentElement
, (Distribution
) entity
, style
);
2245 } else if (entity
instanceof IndividualsAssociation
) {
2246 detailedDescriptionElement
= new IndividualsAssociationDetailElement(
2247 this, parentElement
, (IndividualsAssociation
) entity
, style
);
2248 } else if (entity
instanceof QuantitativeData
) {
2249 detailedDescriptionElement
= new QuantitativeDataDetailElement(
2250 this, parentElement
, (QuantitativeData
) entity
, style
);
2251 } else if (entity
instanceof TaxonInteraction
) {
2252 detailedDescriptionElement
= new TaxonInteractionDetailElement(
2253 this, parentElement
, (TaxonInteraction
) entity
, style
);
2254 } else if (entity
instanceof TextData
) {
2255 detailedDescriptionElement
= new TextDataDetailElement(this,
2256 parentElement
, (TextData
) entity
, style
);
2258 throw new IllegalStateException(
2259 "There is no interface for the given description element");
2261 adapt(detailedDescriptionElement
);
2262 parentElement
.addElement(detailedDescriptionElement
);
2263 return detailedDescriptionElement
;
2268 * Creates a styled text as a part of the form.
2273 * the text initial value
2276 * @return the text widget
2278 public StyledText
createStyledText(Composite parent
, String value
, int style
) {
2279 StyledText text
= new StyledText(parent
, getBorderStyle() | style
2280 | getOrientation());
2282 text
.setText(value
);
2283 text
.setForeground(getColors().getForeground());
2284 text
.setBackground(getColors().getBackground());
2285 // text.addFocusListener(visibilityHandler);