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
.IdentifiableSource
;
58 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
59 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
60 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
61 import eu
.etaxonomy
.cdm
.model
.common
.TimePeriod
;
62 import eu
.etaxonomy
.cdm
.model
.common
.User
;
63 import eu
.etaxonomy
.cdm
.model
.common
.VersionableEntity
;
64 import eu
.etaxonomy
.cdm
.model
.description
.CategoricalData
;
65 import eu
.etaxonomy
.cdm
.model
.description
.CommonTaxonName
;
66 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
67 import eu
.etaxonomy
.cdm
.model
.description
.Distribution
;
68 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
69 import eu
.etaxonomy
.cdm
.model
.description
.IndividualsAssociation
;
70 import eu
.etaxonomy
.cdm
.model
.description
.KeyStatement
;
71 import eu
.etaxonomy
.cdm
.model
.description
.QuantitativeData
;
72 import eu
.etaxonomy
.cdm
.model
.description
.StateData
;
73 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasurementValue
;
74 import eu
.etaxonomy
.cdm
.model
.description
.TaxonInteraction
;
75 import eu
.etaxonomy
.cdm
.model
.description
.TextData
;
76 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
77 import eu
.etaxonomy
.cdm
.model
.location
.NamedAreaLevel
;
78 import eu
.etaxonomy
.cdm
.model
.location
.Point
;
79 import eu
.etaxonomy
.cdm
.model
.media
.ImageFile
;
80 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
81 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
82 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentationPart
;
83 import eu
.etaxonomy
.cdm
.model
.media
.Rights
;
84 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationship
;
85 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignation
;
86 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
87 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignation
;
88 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
89 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationEvent
;
90 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
91 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
92 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
93 import eu
.etaxonomy
.cdm
.strategy
.parser
.ParserProblem
;
94 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
95 import eu
.etaxonomy
.taxeditor
.ui
.combo
.EnumComboElement
;
96 import eu
.etaxonomy
.taxeditor
.ui
.combo
.TermComboElement
;
97 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.IOpenUrlEnabled
;
98 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.OpenUrlSelectorElement
;
99 import eu
.etaxonomy
.taxeditor
.ui
.password
.EditPasswordElement
;
100 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
101 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailSection
;
102 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
103 import eu
.etaxonomy
.taxeditor
.ui
.section
.EmptyElement
;
104 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailElement
;
105 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailSection
;
106 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailElement
;
107 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailSection
;
108 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailElement
;
109 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailSection
;
110 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberElement
;
111 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberSection
;
112 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamOrPersonBaseDetailSection
;
113 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailElement
;
114 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailSection
;
115 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailElement
;
116 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailSection
;
117 import eu
.etaxonomy
.taxeditor
.ui
.section
.common
.ReferencedEntityDetailSection
;
118 import eu
.etaxonomy
.taxeditor
.ui
.section
.common
.RefereneEntityDetailElement
;
119 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DerivedUnitElement
;
120 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescribedSpecimenSection
;
121 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailElement
;
122 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailSection
;
123 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailElement
;
124 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailSection
;
125 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementMediaSection
;
126 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceElement
;
127 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceSection
;
128 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceElement
;
129 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceSection
;
130 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierElement
;
131 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierSection
;
132 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageDetailElement
;
133 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageSection
;
134 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeElement
;
135 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeSection
;
136 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataElement
;
137 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataSection
;
138 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueElement
;
139 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueSection
;
140 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.AbstractDetailedDescriptionDetailElement
;
141 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CategoricalDataDetailElement
;
142 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CommonNameDetailElement
;
143 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.DistributionDetailElement
;
144 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.IndividualsAssociationDetailElement
;
145 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.QuantitativeDataDetailElement
;
146 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TaxonInteractionDetailElement
;
147 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TextDataDetailElement
;
148 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailElement
;
149 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailSection
;
150 import eu
.etaxonomy
.taxeditor
.ui
.section
.grantedAuthority
.GrantedAuthorityCollectionElement
;
151 import eu
.etaxonomy
.taxeditor
.ui
.section
.grantedAuthority
.GrantedAuthorityDetailElement
;
152 import eu
.etaxonomy
.taxeditor
.ui
.section
.grantedAuthority
.GrantedAuthorityDetailSection
;
153 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailElement
;
154 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailSection
;
155 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailElement
;
156 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailSection
;
157 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.GeographicalScopeDetailSection
;
158 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailElement
;
159 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailSection
;
160 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailElement
;
161 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailSection
;
162 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.ScopeRestrictionSection
;
163 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.TaxonomicScopeSection
;
164 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.ImageFileElement
;
165 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaElement
;
166 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationElement
;
167 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationPartElement
;
168 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationPartSection
;
169 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationSection
;
170 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaSection
;
171 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailElement
;
172 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailSection
;
173 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailElement
;
174 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailSection
;
175 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailElement
;
176 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailSection
;
177 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailElement
;
178 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailSection
;
179 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameTypeDesignationElement
;
180 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusElement
;
181 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusSection
;
182 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailElement
;
183 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailSection
;
184 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueElement
;
185 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueSection
;
186 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.SpecimenTypeDesignationElement
;
187 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.TypeDesignationSection
;
188 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectingAreasDetailSection
;
189 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectionDetailElement
;
190 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CurrentDeterminationDetailSection
;
191 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailElement
;
192 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailSection
;
193 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailElement
;
194 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailSection
;
195 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailElement
;
196 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailSection
;
197 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationEventDetailElement
;
198 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationHistoryDetailSection
;
199 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailElement
;
200 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailSection
;
201 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailElement
;
202 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailSection
;
203 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailElement
;
204 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailSection
;
205 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.NamedAreaDetailElement
;
206 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SourceCollectionDetailSection
;
207 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailElement
;
208 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailSection
;
209 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailElement
;
210 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailSection
;
211 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailElement
;
212 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailSection
;
213 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationElement
;
214 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationSection
;
215 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CdmBaseElement
;
216 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CdmBaseSection
;
217 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditElement
;
218 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditSection
;
219 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionElement
;
220 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionSection
;
221 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.HeadlineSection
;
222 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.IdentifiableSourceElement
;
223 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerElement
;
224 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerSection
;
225 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsElement
;
226 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
227 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.SourceSection
;
228 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionElement
;
229 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionSection
;
230 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessageElement
;
231 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
232 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailElement
;
233 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
234 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonDetailElement
;
235 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailElement
;
236 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailSection
;
237 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailElement
;
238 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailSection
;
239 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailElement
;
240 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailSection
;
241 import eu
.etaxonomy
.taxeditor
.ui
.section
.userecords
.UseRecordDetailElement
;
242 import eu
.etaxonomy
.taxeditor
.ui
.section
.userecords
.UseRecordDetailSection
;
243 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.DefinedTermDetailElement
;
244 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.DefinedTermDetailSection
;
245 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailSection
;
246 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailElement
;
247 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailSection
;
248 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
249 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NomenclaturalAuthorTeamSelectionElement
;
250 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonNodeSelectionElement
;
254 * CdmFormFactory class.
258 * @created Feb 24, 2010
261 public class CdmFormFactory
extends FormToolkit
{
263 private BoldFontHolder2 boldFontHolder2
;
264 private MouseListener selectionMouseHandler
;
265 private FocusListener selectionFocusHandler
;
267 private final Set selectionListenerList
= new HashSet();
269 private final List
<IPropertyChangeListener
> propertyChangeListeners
= new ArrayList
<IPropertyChangeListener
>();
271 private final int orientation
= Window
.getDefaultOrientation();
272 private ISelectionProvider selectionProvider
;
274 /** Constant <code>EMPTY_SELECTION</code> */
275 public static ISelection EMPTY_SELECTION
= new ISelection() {
277 public boolean isEmpty() {
288 private class SelectionMouseHandler
extends MouseAdapter
{
290 public void mouseDown(MouseEvent e
) {
291 notifySelectionListeners(e
);
301 private class SelectionFocusHandler
extends FocusAdapter
{
303 public void focusGained(FocusEvent e
) {
304 notifySelectionListeners(e
);
308 private void notifySelectionListeners(TypedEvent e
) {
309 Event event
= new Event();
310 event
.widget
= e
.widget
;
311 SelectionEvent selectionEvent
= new SelectionEvent(event
);
313 for (Object listener
: selectionListenerList
) {
314 ((SelectionListener
) listener
).widgetSelected(selectionEvent
);
320 * Constructor for CdmFormFactory.
324 * a {@link org.eclipse.swt.widgets.Display} object.
325 * @param selectionProvider
326 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
328 public CdmFormFactory(Display display
, ISelectionProvider selectionProvider
) {
330 this.selectionProvider
= selectionProvider
;
336 * Constructor for CdmFormFactory.
340 * a {@link org.eclipse.swt.widgets.Display} object.
342 public CdmFormFactory(Display display
) {
350 private void init() {
351 boldFontHolder2
= new BoldFontHolder2();
352 selectionMouseHandler
= new SelectionMouseHandler();
353 selectionFocusHandler
= new SelectionFocusHandler();
357 * Creates an instance initialized with the correct selectionProvider
359 * Make sure to remove the instance when the entityComposite disposes via
360 * destroySelectionArbitrator(..)
362 * @param entityElement
363 * a {@link eu.etaxonomy.taxeditor.ui.element.IEntityElement}
365 * @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
368 public SelectionArbitrator
createSelectionArbitrator(
369 IEntityElement entityElement
) {
370 SelectionArbitrator selectionArbitrator
= new SelectionArbitrator(
372 selectionArbitrator
.addSelectionProvider(selectionProvider
);
373 selectionProvider
.addSelectionChangedListener(selectionArbitrator
);
374 addSelectionListener(selectionArbitrator
);
375 return selectionArbitrator
;
380 * destroySelectionArbitrator
383 * @param selectionArbitrator
384 * a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
387 public void destroySelectionArbitrator(
388 SelectionArbitrator selectionArbitrator
) {
389 removeSelectionListener(selectionArbitrator
);
390 if (selectionProvider
!= null) {
392 .removeSelectionChangedListener(selectionArbitrator
);
395 .error(this.getClass(),
396 "Tried to destroy a selection listener from this factories listeners but was null",
403 public void adapt(Composite composite
) {
404 composite
.addMouseListener(selectionMouseHandler
);
405 super.adapt(composite
);
415 * {@link eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement}
418 public void adapt(AbstractCdmFormElement formElement
) {
419 formElement
.setPropertyChangeListeners(propertyChangeListeners
);
424 public void adapt(Control control
, boolean trackFocus
, boolean trackKeyboard
) {
426 control
.addFocusListener(selectionFocusHandler
);
428 super.adapt(control
, trackFocus
, trackKeyboard
);
437 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
440 public void destroyElement(ICdmFormElement formElement
) {
441 // return if element was not initialized
442 if (formElement
== null) {
445 // destroy selection arbitrator, if any
446 if (formElement
instanceof ISelectableElement
) {
447 destroySelectionArbitrator(((ISelectableElement
) formElement
)
448 .getSelectionArbitrator());
450 // remove this element form its parents list of elements
451 // ICdmFormElement parentElement = formElement.getParentElement();
452 // if(parentElement != null){
453 // parentElement.removeElement(formElement);
455 // call destroy on child elements recursively
456 for (ICdmFormElement childElement
: formElement
.getElements()) {
457 destroyElement(childElement
);
459 // dispose of the controls
460 for (Control control
: formElement
.getControls()) {
461 // we added the layoutComposite of the parental element as the
462 // layout composite to this formElement
463 // but we do not want to destroy it.
464 if (control
.equals(formElement
.getLayoutComposite())) {
479 * a {@link org.eclipse.swt.widgets.Composite} object.
480 * @return a {@link org.eclipse.swt.widgets.Label} object.
482 public Label
createEmptyCell(Composite parent
) {
483 return this.createLabel(parent
, null);
488 * createMultilineTextWithLabel
492 * a {@link java.lang.String} object.
497 * @param parentElement
498 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
500 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
503 public TextWithLabelElement
createMultilineTextWithLabel(
504 ICdmFormElement parentElement
, String labelString
, int textHeight
,
506 TextWithLabelElement element
= new TextWithLabelElement(this,
507 parentElement
, labelString
, "", textHeight
, style
);
509 parentElement
.addElement(element
);
515 * createMultiLanguageTextElement
518 * @param parentElement
519 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
522 * a {@link java.lang.String} object.
523 * @param multilanguageText
524 * a {@link java.util.Map} object.
530 * {@link eu.etaxonomy.taxeditor.ui.element.MultilanguageTextElement}
533 public MultilanguageTextElement
createMultiLanguageTextElement(
534 ICdmFormElement parentElement
, String labelString
,
535 Map
<Language
, LanguageString
> multilanguageText
, int textHeight
,
537 MultilanguageTextElement element
= new MultilanguageTextElement(this,
538 parentElement
, labelString
, multilanguageText
, textHeight
,
541 parentElement
.addElement(element
);
545 public KeyStatementElement
createKeyStatementElement(
546 ICdmFormElement parentElement
, String labelString
,
547 KeyStatement keyStatement
, int textHeight
, int style
) {
548 KeyStatementElement element
= new KeyStatementElement(this,
549 parentElement
, labelString
, keyStatement
, textHeight
, style
);
551 parentElement
.addElement(element
);
557 * createTextWithLabelElement
561 * a {@link java.lang.String} object.
563 * a {@link java.lang.String} object.
566 * @param parentElement
567 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
569 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
572 public TextWithLabelElement
createTextWithLabelElement(
573 ICdmFormElement parentElement
, String labelString
,
574 String initialText
, int style
) {
575 TextWithLabelElement element
= new TextWithLabelElement(this,
576 parentElement
, labelString
, initialText
, null, style
);
578 parentElement
.addElement(element
);
582 public UriWithLabelElement
createUriWithLabelElement(
583 ICdmFormElement parentElement
, String labelString
, URI initialUri
,
585 UriWithLabelElement element
= new UriWithLabelElement(this,
586 parentElement
, labelString
, initialUri
, null, style
);
588 parentElement
.addElement(element
);
599 public OpenUrlSelectorElement
createOpenUrlSelectorElement(
600 ICdmFormElement parentElement
, String labelString
,
601 IOpenUrlEnabled openUrlEnabled
, int style
) {
602 OpenUrlSelectorElement element
= new OpenUrlSelectorElement(this,
603 parentElement
, labelString
, openUrlEnabled
, style
);
605 parentElement
.addElement(element
);
611 * @param parentElement
613 * @param conversationEnabled
618 public EditPasswordElement
createEditPasswordElement(
619 ICdmFormElement parentElement
, String labelString
,
620 ConversationHolder conversation
, User user
, int style
) {
621 EditPasswordElement element
= new EditPasswordElement(this,
622 parentElement
, labelString
, user
, conversation
);
624 parentElement
.addElement(element
);
630 * createIntegerTextWithLabelElement
633 * @param parentElement
634 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
637 * a {@link java.lang.String} object.
638 * @param initialInteger
639 * a {@link java.lang.Integer} object.
642 * @return a {@link eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement}
645 public NumberWithLabelElement
createNumberTextWithLabelElement(
646 ICdmFormElement parentElement
, String labelString
,
647 Number initialNumber
, int style
) {
648 NumberWithLabelElement element
= new NumberWithLabelElement(this,
649 parentElement
, labelString
, initialNumber
, style
);
651 parentElement
.addElement(element
);
658 * createLanguageStringWithLabelElement
661 * @param parentElement
662 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
665 * a {@link java.lang.String} object.
666 * @param languageString
667 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
671 * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
674 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
675 ICdmFormElement parentElement
, String labelString
,
676 LanguageString languageString
, int style
) {
677 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
678 this, parentElement
, labelString
, languageString
, style
);
680 parentElement
.addElement(element
);
686 * createLanguageStringWithLabelElement
689 * @param parentElement
690 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
693 * a {@link java.lang.String} object.
694 * @param languageString
695 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
701 * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
704 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
705 ICdmFormElement parentElement
, String labelString
,
706 LanguageString languageString
, int height
, int style
) {
707 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
708 this, parentElement
, labelString
, languageString
, height
, style
);
710 parentElement
.addElement(element
);
719 * @param parentElement
720 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
723 * a {@link java.lang.String} object.
726 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
729 public TextWithLabelElement
createTextElement(
730 ICdmFormElement parentElement
, String initialText
, int style
) {
731 TextWithLabelElement element
= new TextWithLabelElement(this,
732 parentElement
, null, initialText
, null, style
);
734 parentElement
.addElement(element
);
740 * createKeyValueViewerElement
743 * @param parentElement
744 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
747 * a {@link java.lang.String} object.
748 * @param valueHeading
749 * a {@link java.lang.String} object.
751 * a {@link java.util.Map} object.
752 * @return a {@link eu.etaxonomy.taxeditor.ui.element.KeyValueViewerElement}
755 public KeyValueViewerElement
createKeyValueViewerElement(
756 ICdmFormElement parentElement
, String keyHeading
,
757 String valueHeading
, Map
<Object
, Object
> map
) {
758 KeyValueViewerElement element
= new KeyValueViewerElement(this,
759 parentElement
, keyHeading
, valueHeading
, map
);
761 parentElement
.addElement(element
);
767 * createTermComboElement
770 * @param termComboType
772 * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.TermComboType}
774 * @param parentElement
775 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
778 * a {@link java.lang.String} object.
780 * a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase}
784 * @return a {@link eu.etaxonomy.taxeditor.ui.combo.TermComboElement}
788 public <T
extends DefinedTermBase
> TermComboElement
<T
> createTermComboElement(
789 Class
<T
> termComboType
, ICdmFormElement parentElement
,
790 String labelString
, T selection
, int style
) {
791 TermComboElement
<T
> element
= new TermComboElement
<T
>(this, parentElement
, termComboType
, labelString
, selection
, style
);
793 parentElement
.addElement(element
);
799 * createEnumComboElement
802 * @param enumComboType
804 * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EnumComboType}
806 * @param parentElement
807 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
811 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
814 public <T
extends IDefinedTerm
> EnumComboElement
<T
> createEnumComboElement(
815 Class
<T
> enumComboType
, ICdmFormElement parentElement
,
817 EnumComboElement
<T
> element
= new EnumComboElement
<T
>(this, parentElement
, enumComboType
, style
);
819 parentElement
.addElement(element
);
825 * createBrowserElement
829 * a {@link java.net.URI} object.
832 * @param parentElement
833 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
835 * @return a {@link eu.etaxonomy.taxeditor.ui.element.BrowserElement} object.
837 public BrowserElement
createBrowserElement(ICdmFormElement parentElement
,
838 URI imageUri
, int style
) {
839 BrowserElement element
= new BrowserElement(this, parentElement
,
842 parentElement
.addElement(element
);
851 * @param parentElement
852 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
855 * a {@link java.net.URI} object.
858 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ImageElement} object.
860 public ImageElement
createImageElement(ICdmFormElement parentElement
,
861 URI imageUri
, int style
) {
862 ImageElement element
= new ImageElement(this, parentElement
, imageUri
,
865 parentElement
.addElement(element
);
871 * createTextActionElement
875 * a {@link java.lang.String} object.
877 * a {@link java.lang.String} object.
880 * @param parentElement
881 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
884 * a {@link java.lang.String} object.
885 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextActionElement}
888 public TextActionElement
createTextActionElement(
889 ICdmFormElement parentElement
, String labelString
,
890 String buttonLabel
, String initialText
, int style
) {
891 TextActionElement element
= new TextActionElement(this, parentElement
,
892 labelString
, buttonLabel
, initialText
, style
);
894 parentElement
.addElement(element
);
903 * @param parentElement
904 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
907 * a {@link java.lang.String} object.
908 * @param initialState
912 * @return a {@link eu.etaxonomy.taxeditor.ui.element.CheckboxElement} object.
914 public CheckboxElement
createCheckbox(ICdmFormElement parentElement
,
915 String label
, boolean initialState
, int style
) {
916 CheckboxElement element
= new CheckboxElement(this, parentElement
,
917 label
, initialState
, style
| orientation
);
919 parentElement
.addElement(element
);
924 * Creates a section as a part of the form.
926 * @return the section widget
928 * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
931 public Section
adapt(AbstractFormSection section
) {
932 section
.setMenu(section
.getLayoutComposite().getMenu());
933 adapt(section
, true, true);
935 // handle focus and property change events for cdm use
936 section
.addFocusListener(selectionFocusHandler
);
937 section
.setPropertyChangeListeners(propertyChangeListeners
);
939 if (section
.getToggle() != null) {
940 section
.getToggle().setHoverDecorationColor(
941 getColors().getColor(IFormColors
.TB_TOGGLE_HOVER
));
942 section
.getToggle().setDecorationColor(
943 getColors().getColor(IFormColors
.TB_TOGGLE
));
946 section
.setFont(boldFontHolder2
.getBoldFont(section
947 .getLayoutComposite().getFont()));
949 if ((section
.getStyle() & Section
.TITLE_BAR
) != 0
950 || (section
.getStyle() & Section
.SHORT_TITLE_BAR
) != 0) {
951 getColors().initializeSectionToolBarColors();
952 section
.setTitleBarBackground(getColors().getColor(
954 section
.setTitleBarBorderColor(getColors().getColor(
955 IFormColors
.TB_BORDER
));
957 // call setTitleBarForeground regardless as it also sets the label color
958 section
.setTitleBarForeground(getColors().getColor(
959 IFormColors
.TB_TOGGLE
));
963 private class BoldFontHolder2
{
964 private Font normalFont
;
966 private Font boldFont
;
968 public BoldFontHolder2() {
971 public Font
getBoldFont(Font font
) {
972 createBoldFont(font
);
976 private void createBoldFont(Font font
) {
977 if (normalFont
== null || !normalFont
.equals(font
)) {
981 if (boldFont
== null) {
982 boldFont
= FormFonts
.getInstance().getBoldFont(
983 getColors().getDisplay(), normalFont
);
987 public void dispose() {
988 if (boldFont
!= null) {
989 FormFonts
.getInstance().markFinished(boldFont
,
990 getColors().getDisplay());
998 * createToggleableTextField
1001 * @param parentElement
1002 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1004 * @param labelString
1005 * a {@link java.lang.String} object.
1006 * @param initialText
1007 * a {@link java.lang.String} object.
1008 * @param initialState
1012 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement}
1015 public ToggleableTextElement
createToggleableTextField(
1016 ICdmFormElement parentElement
, String labelString
,
1017 String initialText
, boolean initialState
, int style
) {
1018 ToggleableTextElement element
= new ToggleableTextElement(this,
1019 parentElement
, labelString
, initialText
, initialState
, style
1022 parentElement
.addElement(element
);
1028 * createTimePeriodElement
1031 * @param parentElement
1032 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1034 * @param labelString
1035 * a {@link java.lang.String} object.
1037 * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1040 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TimePeriodElement}
1043 public TimePeriodElement
createTimePeriodElement(
1044 ICdmFormElement parentElement
, String labelString
,
1045 TimePeriod timePeriod
, int style
) {
1046 TimePeriodElement element
= new TimePeriodElement(this, parentElement
,
1047 labelString
, timePeriod
, style
);
1049 parentElement
.addElement(element
);
1055 * createPointElement
1060 * @param parentElement
1061 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1064 * a {@link eu.etaxonomy.cdm.model.location.Point} object.
1065 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PointElement} object.
1067 public PointElement
createPointElement(ICdmFormElement parentElement
,
1068 Point point
, int style
) {
1069 PointElement element
= new PointElement(this, parentElement
, point
,
1072 parentElement
.addElement(element
);
1078 * createDateDetailSection
1081 * @param parentElement
1082 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1086 * @return a {@link eu.etaxonomy.taxeditor.ui.element.DateDetailSection}
1089 public DateDetailSection
createDateDetailSection(
1090 ICdmFormElement parentElement
, int style
) {
1091 DateDetailSection section
= new DateDetailSection(this, parentElement
,
1093 parentElement
.addElement(section
);
1100 * createPartialElement
1103 * @param parentElement
1104 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1106 * @param labelString
1107 * a {@link java.lang.String} object.
1109 * a {@link org.joda.time.Partial} object.
1112 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PartialElement} object.
1114 public PartialElement
createPartialElement(ICdmFormElement parentElement
,
1115 String labelString
, Partial partial
, int style
) {
1116 PartialElement element
= new PartialElement(this, parentElement
,
1117 labelString
, style
);
1119 parentElement
.addElement(element
);
1125 * addSelectionListener
1129 * a {@link org.eclipse.swt.events.SelectionListener} object.
1131 public void addSelectionListener(SelectionListener listener
) {
1132 selectionListenerList
.add(listener
);
1137 * removeSelectionListener
1141 * a {@link org.eclipse.swt.events.SelectionListener} object.
1143 public void removeSelectionListener(SelectionListener listener
) {
1144 if (listener
== null) {
1146 .error(this.getClass(),
1147 "Tried to remove a selection listener from this factories listeners but was null",
1150 selectionListenerList
.remove(listener
);
1156 * addPropertyChangeListener
1160 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1163 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
1164 if(propertyChangeListeners
.contains(listener
)){
1167 propertyChangeListeners
.add(0, listener
);
1172 * removePropertyChangeListener
1176 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1179 public void removePropertyChangeListener(IPropertyChangeListener listener
) {
1180 propertyChangeListeners
.remove(listener
);
1185 * createHorizontalSeparator
1188 * @param parentElement
1189 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1193 * @return a {@link org.eclipse.swt.widgets.Label} object.
1195 public Label
createHorizontalSeparator(ICdmFormElement parentElement
,
1197 Label separator
= this.createSeparator(
1198 parentElement
.getLayoutComposite(), SWT
.HORIZONTAL
| style
);
1199 separator
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY());
1205 * createVersionElement
1208 * @param parentElement
1209 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1212 * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
1217 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
1220 public VersionElement
createVersionElement(ICdmFormElement parentElement
,
1221 VersionableEntity entity
, int style
) {
1222 VersionElement element
= new VersionElement(this, parentElement
,
1225 parentElement
.addElement(element
);
1230 * @param cdmBaseSection
1235 public CdmBaseElement
createCdmBaseElement(ICdmFormElement parentElement
,
1236 CdmBase entity
, int style
) {
1237 CdmBaseElement element
= new CdmBaseElement(this, parentElement
,
1240 parentElement
.addElement(element
);
1247 * createVersionSection
1250 * @param parentElement
1251 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1256 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
1259 public VersionSection
createVersionSection(ICdmFormElement parentElement
,
1261 VersionSection section
= new VersionSection(this, parentElement
, style
);
1262 parentElement
.addElement(section
);
1272 public CdmBaseSection
createCdmBaseSection(ICdmFormElement parentElement
, int style
) {
1273 CdmBaseSection section
= new CdmBaseSection(this, parentElement
, style
);
1274 parentElement
.addElement(section
);
1281 * createEmptyElement
1284 * @param parentElement
1285 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1287 * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1289 public EmptyElement
createEmptyElement(ICdmFormElement parentElement
) {
1290 EmptyElement element
= new EmptyElement(this, parentElement
, null,
1293 parentElement
.addElement(element
);
1299 * createHeadlineSection
1302 * @param parentElement
1303 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1306 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
1309 public HeadlineSection
createHeadlineSection(ICdmFormElement parentElement
) {
1310 HeadlineSection section
= new HeadlineSection(this, parentElement
,
1312 parentElement
.addElement(section
);
1319 * createParsingMessageElement
1322 * @param parentElement
1323 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1325 * @param parserProblem
1326 * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
1331 * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
1334 public ParsingMessageElement
createParsingMessageElement(
1335 ICdmFormElement parentElement
, ParserProblem parserProblem
,
1337 ParsingMessageElement element
= new ParsingMessageElement(this,
1338 parentElement
, parserProblem
, style
);
1340 parentElement
.addElement(element
);
1349 public static enum DetailType
{
1354 DERIVED_UNIT_FACADE
,
1355 DERIVED_UNIT_GENERAL
,
1359 FEATURE_DISTRIBUTION
,
1371 NOMENCLATURALREFERENCE
,
1376 POLYTOMOUS_KEY_NODE
,
1390 public AbstractFormSection
createDefinedTermDetailSection(Class definedTermClass
,
1391 ConversationHolder conversation
, ICdmFormElement parentElement
,
1392 ISelectionProvider selectionProvider
, int style
) {
1394 AbstractFormSection section
= new DefinedTermDetailSection(this, definedTermClass
, conversation
, parentElement
, selectionProvider
, style
);
1396 parentElement
.addElement(section
);
1403 * @param definedTermClass
1404 * @param formElement
1408 public AbstractCdmDetailElement
createDefinedTermDetailElement(
1409 Class definedTermClass
, AbstractCdmDetailSection parentElement
,
1411 AbstractCdmDetailElement element
= null;
1413 if (NamedArea
.class.isAssignableFrom(definedTermClass
)){
1414 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1417 element
= new DefinedTermDetailElement(this, parentElement
);
1421 parentElement
.addElement(element
);
1427 * createCdmDetailSection
1432 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
1434 * @param parentElement
1435 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1437 * @param selectionProvider
1438 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1441 * @param conversation
1442 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1444 * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1447 public AbstractFormSection
createCdmDetailSection(DetailType detailType
,
1448 ConversationHolder conversation
, ICdmFormElement parentElement
,
1449 ISelectionProvider selectionProvider
, int style
) {
1450 AbstractFormSection section
= null;
1452 switch (detailType
) {
1453 case SCIENTIFICNAME
:
1454 section
= new NameDetailSection(this, conversation
, parentElement
,
1455 selectionProvider
, style
);
1458 section
= new ReferenceDetailSection(this, conversation
,
1459 parentElement
, selectionProvider
, style
);
1461 case NOMENCLATURALREFERENCE
:
1462 section
= new NomenclaturalReferenceDetailSection(this,
1463 conversation
, parentElement
, selectionProvider
, style
);
1466 section
= new TaxonBaseDetailSection(this, conversation
,
1467 parentElement
, selectionProvider
, style
);
1470 section
= new AuthorshipDetailSection(this, conversation
,
1471 parentElement
, selectionProvider
, style
);
1473 case TEAMORPERSONBASE
:
1474 section
= new TeamOrPersonBaseDetailSection(this, conversation
,
1475 parentElement
, selectionProvider
, style
);
1478 section
= new TeamDetailSection(this, conversation
, parentElement
,
1482 section
= new PersonDetailSection(this, conversation
,
1483 parentElement
, null, style
);
1486 section
= new DescriptionDetailSection(this, conversation
,
1487 parentElement
, selectionProvider
, style
);
1489 case DESCRIPTIONELEMENT
:
1490 section
= new DescriptionElementDetailSection(this, conversation
,
1491 parentElement
, selectionProvider
, style
);
1493 case PARSINGMESSAGE
:
1494 section
= new ParsingMessagesSection(this, conversation
,
1495 parentElement
, selectionProvider
, style
);
1498 section
= new NonViralNameDetailSection(this, conversation
,
1499 parentElement
, selectionProvider
, style
);
1502 section
= new eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection(
1503 this, conversation
, parentElement
, selectionProvider
, style
);
1505 case DERIVED_UNIT_FACADE
:
1506 section
= new DerivedUnitFacadeDetailSection(this, conversation
,
1507 parentElement
, selectionProvider
, style
);
1509 case FIELD_OBSERVATION
:
1510 section
= new FieldObservationDetailSection(this, conversation
,
1511 parentElement
, selectionProvider
, style
);
1513 case GATHERING_EVENT
:
1514 section
= new GatheringEventDetailSection(this, conversation
,
1515 parentElement
, selectionProvider
, style
);
1518 section
= new DerivedUnitBaseDetailSection(this, conversation
,
1519 parentElement
, selectionProvider
, style
);
1521 case NATURAL_LANGUAGE
:
1522 section
= new NaturalLanguageSection(this, conversation
,
1523 parentElement
, selectionProvider
, style
);
1525 case FEATURE_DISTRIBUTION
:
1526 section
= new FeatureDistributionDetailSection(this, conversation
,
1527 parentElement
, selectionProvider
, style
);
1529 case CLASSIFICATION
:
1530 section
= new ClassificationDetailSection(this, conversation
,
1531 parentElement
, selectionProvider
, style
);
1534 section
= new TaxonNodeDetailSection(this, conversation
,
1535 parentElement
, selectionProvider
, style
);
1537 case POLYTOMOUS_KEY
:
1538 section
= new PolytomousKeyDetailSection(this, conversation
,
1539 parentElement
, selectionProvider
, style
);
1541 case POLYTOMOUS_KEY_NODE
:
1542 section
= new PolytomousKeyNodeDetailSection(this, conversation
,
1543 parentElement
, selectionProvider
, style
);
1546 section
= new InstitutionDetailSection(this, conversation
,
1547 parentElement
, selectionProvider
, style
);
1549 case DERIVED_UNIT_GENERAL
:
1550 section
= new GeneralDetailSection(this, conversation
,
1551 parentElement
, selectionProvider
, style
);
1554 section
= new HybridDetailSection(this, conversation
,
1555 parentElement
, selectionProvider
, style
);
1558 section
= new UserDetailSection(this, conversation
, parentElement
,
1559 selectionProvider
, style
);
1562 section
= new GroupDetailSection(this, conversation
, parentElement
,
1563 selectionProvider
, style
);
1566 section
= new DeterminationDetailSection(this, conversation
, parentElement
,
1567 selectionProvider
, style
);
1569 case TAXON_RELATIONSHIP
:
1570 section
= new TaxonRelationshipDetailSection(this, conversation
, parentElement
,
1571 selectionProvider
, style
);
1573 case REFERENCED_ENTITY
:
1574 section
= new ReferencedEntityDetailSection(this, conversation
, parentElement
,
1575 selectionProvider
, style
);
1577 case TERM_VOCABULARY
:
1578 section
= new TermVocabularyDetailSection(this, conversation
, parentElement
,
1579 selectionProvider
, style
);
1582 section
= new NamedAreaDetailSection(this, conversation
, parentElement
,
1583 selectionProvider
, style
);
1586 section
= new UseRecordDetailSection(this, conversation
, parentElement
,
1587 selectionProvider
, style
);
1592 if (section
== null) {
1593 throw new RuntimeException(
1594 "You tried to create a cdm detail section that is not implemented yet.");
1597 parentElement
.addElement(section
);
1606 * createCdmDetailElement
1611 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
1615 * @param parentElement
1616 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1619 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
1622 public AbstractCdmDetailElement
createCdmDetailElement(
1623 DetailType detailType
, ICdmFormElement parentElement
, int style
) {
1624 AbstractCdmDetailElement element
= null;
1626 switch (detailType
) {
1627 case SCIENTIFICNAME
:
1628 element
= new NameDetailElement(this, parentElement
, style
);
1631 element
= new ReferenceDetailElement(this, parentElement
, style
);
1633 case NOMENCLATURALREFERENCE
:
1634 element
= new NomenclaturalReferenceDetailElement(this,
1635 parentElement
, style
);
1638 element
= new TaxonBaseDetailElement(this, parentElement
, style
);
1641 element
= new AuthorshipDetailElement(this, parentElement
, style
);
1644 element
= new TeamDetailElement(this, parentElement
, style
);
1647 element
= new PersonDetailElement(this, parentElement
, style
);
1650 element
= new DescriptionDetailElement(this, parentElement
, style
);
1652 case DESCRIPTIONELEMENT
:
1653 element
= new DescriptionElementDetailElement(this, parentElement
,
1657 element
= new NonViralNameDetailElement(this, parentElement
);
1659 case DERIVED_UNIT_FACADE
:
1660 element
= new DerivedUnitFacadeDetailElement(this, parentElement
);
1662 case FIELD_OBSERVATION
:
1663 element
= new FieldObservationDetailElement(this, parentElement
);
1665 case GATHERING_EVENT
:
1666 element
= new GatheringEventDetailElement(this, parentElement
);
1669 element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1671 case NATURAL_LANGUAGE
:
1672 element
= new NaturalLanguageDetailElement(this, parentElement
);
1674 case FEATURE_DISTRIBUTION
:
1675 element
= new FeatureDistributionDetailElement(this, parentElement
);
1677 case CLASSIFICATION
:
1678 element
= new ClassificationDetailElement(this, parentElement
);
1681 element
= new TaxonNodeDetailElement(this, parentElement
);
1684 element
= new CollectionDetailElement(this, parentElement
);
1686 case POLYTOMOUS_KEY
:
1687 element
= new PolytomousKeyDetailElement(this, parentElement
);
1689 case POLYTOMOUS_KEY_NODE
:
1690 element
= new PolytomousKeyNodeDetailElement(this, parentElement
);
1693 element
= new InstitutionDetailElement(this, parentElement
);
1695 case DERIVED_UNIT_GENERAL
:
1696 element
= new GeneralDetailElement(this, parentElement
);
1699 element
= new HybridDetailElement(this, parentElement
);
1702 element
= new UserDetailElement(this, parentElement
);
1705 element
= new GroupDetailElement(this, parentElement
);
1707 case GRANTEDAUTHORITY
:
1708 element
= new GrantedAuthorityDetailElement(this, parentElement
);
1711 element
= new DeterminationDetailElement(this, parentElement
);
1713 case TAXON_RELATIONSHIP
:
1714 element
= new TaxonRelationshipDetailElement(this, parentElement
);
1716 case REFERENCED_ENTITY
:
1717 element
= new RefereneEntityDetailElement(this, parentElement
);
1719 case TERM_VOCABULARY
:
1720 element
= new TermVocabularyDetailElement(this, parentElement
);
1723 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1725 case NAMED_AREA_LEVEL
:
1726 element
= new DefinedTermDetailElement
<NamedAreaLevel
>(this, parentElement
);
1729 //element = new UseRecordDetailElement(this, parentElement, style);
1730 element
= new UseRecordDetailElement(this, parentElement
);
1734 if (element
== null) {
1736 .error(this.getClass(),
1737 "Detail element was not created. Seems like the case was not implemented for the requested detail type: "
1738 + detailType
, null);
1742 parentElement
.addElement(element
);
1748 * @author n.hoffmann
1749 * @created Mar 5, 2010
1752 public static enum EntityDetailType
{
1757 DESCRIPTIONELEMENTSOURCE
,
1761 DESCRIPTIONELEMENTMEDIA
,
1762 MEDIAREPRESENTATION
,
1763 MEDIAREPRESENTATIONPART
,
1765 NOMENCLATURALSTATUS
,
1774 STATISTICAL_MEASUREMENT_VALUE
,
1777 DETERMINATION_EVENT
,
1778 SPECIMEN_COLLECTION
,
1779 IDENTIFIABLE_SOURCE_COLLECTION
,
1786 DETERMINATION_CURRENT
,
1787 DETERMINATION_HISTORY
1792 * createEntityDetailSection
1795 * @param entityDetailType
1797 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType}
1801 * @param conversation
1802 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1804 * @param parentElement
1805 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1807 * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1810 public AbstractFormSection
createEntityDetailSection(
1811 EntityDetailType entityDetailType
, ConversationHolder conversation
,
1812 ICdmFormElement parentElement
, int style
) {
1813 AbstractFormSection section
= null;
1815 switch (entityDetailType
) {
1817 section
= new TeamDetailSection(this, conversation
, parentElement
,
1821 section
= new TeamMemberSection(this, conversation
, parentElement
,
1825 section
= new AnnotationSection(this, conversation
, parentElement
,
1829 section
= new CreditSection(this, conversation
, parentElement
,
1832 case DESCRIPTIONELEMENTSOURCE
:
1833 section
= new DescriptionElementSourceSection(this, conversation
,
1834 parentElement
, style
);
1837 section
= new ExtensionSection(this, conversation
, parentElement
,
1841 section
= new MarkerSection(this, conversation
, parentElement
,
1845 section
= new MediaSection(this, conversation
, parentElement
, style
);
1847 case DESCRIPTIONELEMENTMEDIA
:
1848 section
= new DescriptionElementMediaSection(this, conversation
,
1849 parentElement
, style
);
1851 case MEDIAREPRESENTATION
:
1852 section
= new MediaRepresentationSection(this, conversation
,
1853 parentElement
, style
);
1855 case MEDIAREPRESENTATIONPART
:
1856 section
= new MediaRepresentationPartSection(this, conversation
,
1857 parentElement
, style
);
1860 section
= new ModifierSection(this, conversation
, parentElement
,
1863 case NOMENCLATURALSTATUS
:
1864 section
= new NomenclaturalStatusSection(this, conversation
,
1865 parentElement
, style
);
1867 case NAME_RELATIONSHIP
:
1868 section
= new NameRelationshipDetailSection(this, conversation
,
1869 parentElement
, style
);
1872 section
= new ProtologueSection(this, conversation
, parentElement
,
1876 section
= new RightsSection(this, conversation
, parentElement
,
1880 section
= new SourceSection(this, conversation
, parentElement
,
1884 section
= new ScopeSection(this, conversation
, parentElement
, style
);
1886 case DESCRIPTIONSOURCE
:
1887 section
= new DescriptionSourceSection(this, conversation
,
1888 parentElement
, style
);
1890 case TYPEDESIGNATION
:
1891 section
= new TypeDesignationSection(this, conversation
,
1892 parentElement
, style
);
1895 section
= new StateDataSection(this, conversation
, parentElement
,
1898 case STATISTICAL_MEASUREMENT_VALUE
:
1899 section
= new StatisticalMeasurementValueSection(this,
1900 conversation
, parentElement
, style
);
1902 case DESCRIBED_SPECIMEN
:
1903 section
= new DescribedSpecimenSection(this, conversation
,
1904 parentElement
, style
);
1906 case COLLECTING_AREA
:
1907 section
= new CollectingAreasDetailSection(this, conversation
,
1908 parentElement
, style
);
1910 case DETERMINATION_CURRENT
:
1911 section
= new CurrentDeterminationDetailSection(this, conversation
,
1912 parentElement
, style
);
1914 case DETERMINATION_HISTORY
:
1915 section
= new DeterminationHistoryDetailSection(this, conversation
,
1916 parentElement
, style
);
1918 case SPECIMEN_COLLECTION
:
1919 section
= new SpecimenCollectionDetailSection(this, conversation
,
1920 parentElement
, style
);
1922 case IDENTIFIABLE_SOURCE_COLLECTION
:
1923 section
= new SourceCollectionDetailSection(this, conversation
,
1924 parentElement
, style
);
1926 case GEOGRAPHICAL_SCOPE
:
1927 section
= new GeographicalScopeDetailSection(this, conversation
,
1928 parentElement
, style
);
1930 case SCOPE_RESTRICTION
:
1931 section
= new ScopeRestrictionSection(this, conversation
,
1932 parentElement
, style
);
1935 section
= new MemberDetailSection(this, conversation
,
1936 parentElement
, style
);
1938 case GRANTED_AUTHORITY
:
1939 section
= new GrantedAuthorityDetailSection(this, conversation
,
1940 parentElement
, style
);
1942 case GROUPS_BY_USER
:
1943 section
= new GroupsByUserDetailSection(this, conversation
,
1944 parentElement
, style
);
1946 case TAXONOMIC_SCOPE
:
1947 section
= new TaxonomicScopeSection(this, conversation
,
1948 parentElement
, style
);
1951 parentElement
.addElement(section
);
1958 * createEntityCollectionElement
1961 * @param removeListener
1962 * a {@link org.eclipse.swt.events.SelectionListener} object.
1965 * @param parentElement
1966 * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1968 * @param versionableEntity
1969 * a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity}
1971 * @param backgroundColor
1972 * a {@link org.eclipse.swt.graphics.Color} object.
1974 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement}
1977 public AbstractEntityCollectionElement
createEntityCollectionElement(
1978 AbstractFormSection parentElement
, Object versionableEntity
,
1979 SelectionListener removeListener
, Color backgroundColor
, int style
) {
1980 AbstractEntityCollectionElement element
= null;
1982 Object entity
= HibernateProxyHelper
.deproxy(versionableEntity
);
1984 if (entity
instanceof Annotation
) {
1985 element
= new AnnotationElement(this, parentElement
,
1986 (Annotation
) entity
, removeListener
, style
);
1987 } else if (entity
instanceof Person
) {
1988 element
= new TeamMemberElement(this, parentElement
,
1989 (Person
) entity
, removeListener
, style
);
1990 } else if (entity
instanceof Credit
) {
1991 element
= new CreditElement(this, parentElement
, (Credit
) entity
,
1992 removeListener
, style
);
1993 } else if (entity
instanceof Extension
) {
1994 element
= new ExtensionElement(this, parentElement
,
1995 (Extension
) entity
, removeListener
, style
);
1996 } else if (entity
instanceof Marker
) {
1997 element
= new MarkerElement(this, parentElement
, (Marker
) entity
,
1998 removeListener
, style
);
1999 } else if (entity
instanceof Media
) {
2000 element
= new MediaElement(this, parentElement
, (Media
) entity
,
2001 removeListener
, style
);
2002 } else if (entity
instanceof MediaRepresentation
) {
2003 element
= new MediaRepresentationElement(this, parentElement
,
2004 (MediaRepresentation
) entity
, removeListener
, style
);
2005 } else if (entity
instanceof ImageFile
) {
2006 element
= new ImageFileElement(this, parentElement
,
2007 (ImageFile
) entity
, removeListener
, style
);
2008 } else if (entity
instanceof MediaRepresentationPart
){
2009 element
= new MediaRepresentationPartElement(this, parentElement
,
2010 (MediaRepresentationPart
) entity
, removeListener
, style
);
2011 } else if (entity
instanceof NomenclaturalStatus
) {
2012 element
= new NomenclaturalStatusElement(this, parentElement
,
2013 (NomenclaturalStatus
) entity
, removeListener
, style
);
2014 } else if (entity
instanceof Rights
) {
2015 element
= new RightsElement(this, parentElement
, (Rights
) entity
,
2016 removeListener
, style
);
2017 } else if (entity
instanceof DescriptionElementSource
) {
2018 element
= new DescriptionElementSourceElement(this, parentElement
,
2019 (DescriptionElementSource
) entity
, removeListener
, style
);
2020 } else if (entity
instanceof IdentifiableSource
) {
2021 element
= new IdentifiableSourceElement(this, parentElement
,
2022 (IdentifiableSource
) entity
, removeListener
, style
);
2023 } else if (entity
instanceof DefinedTerm
) {
2025 element
= new ScopeElement(this, parentElement
, (DefinedTerm
) entity
,
2026 removeListener
, style
);
2027 } else if (entity
instanceof DefinedTerm
) {
2028 element
= new ModifierElement(this, parentElement
,
2029 (DefinedTerm
) entity
, removeListener
, style
);
2030 } else if (entity
instanceof Reference
) {
2031 element
= new DescriptionSourceElement(this, parentElement
,
2032 (Reference
) entity
, removeListener
, style
);
2033 } else if (entity
instanceof NameTypeDesignation
) {
2034 element
= new NameTypeDesignationElement(this, parentElement
,
2035 (NameTypeDesignation
) entity
, removeListener
, style
);
2036 } else if (entity
instanceof NameRelationship
) {
2037 element
= new NameRelationshipDetailElement(this, parentElement
,
2038 (NameRelationship
) entity
, removeListener
, style
);
2039 } else if (entity
instanceof SpecimenTypeDesignation
) {
2040 element
= new SpecimenTypeDesignationElement(this, parentElement
,
2041 (SpecimenTypeDesignation
) entity
, removeListener
, style
);
2042 } else if (entity
instanceof StateData
) {
2043 element
= new StateDataElement(this, parentElement
,
2044 (StateData
) entity
, removeListener
, style
);
2045 } else if (entity
instanceof StatisticalMeasurementValue
) {
2046 element
= new StatisticalMeasurementValueElement(this,
2047 parentElement
, (StatisticalMeasurementValue
) entity
,
2048 removeListener
, style
);
2049 } else if (entity
instanceof DerivedUnit
) {
2051 element
= new DerivedUnitElement(this, parentElement
,
2052 (DerivedUnit
) entity
, removeListener
, style
);
2053 } else if (entity
instanceof NamedArea
) {
2054 element
= new NamedAreaDetailElement(this, parentElement
,
2055 (NamedArea
) entity
, removeListener
, style
);
2056 } else if (entity
instanceof DeterminationEvent
) {
2057 element
= new DeterminationEventDetailElement(this, parentElement
,
2058 (DeterminationEvent
) entity
, removeListener
, style
);
2059 } else if (entity
instanceof DerivedUnit
) {
2061 element
= new SpecimenCollectionDetailElement(this, parentElement
,
2062 (DerivedUnit
) entity
, removeListener
, style
);
2063 } else if (entity
instanceof User
) {
2064 element
= new MemberDetailElement(this, parentElement
,
2065 (User
) entity
, removeListener
, style
);
2066 } else if (entity
instanceof GrantedAuthority
) {
2067 element
= new GrantedAuthorityCollectionElement(this, parentElement
,
2068 (GrantedAuthorityImpl
) entity
, removeListener
, style
);
2069 } else if (entity
instanceof Group
) {
2070 element
= new GroupsByUserDetailElement(this, parentElement
,
2071 (Group
) entity
, removeListener
, style
);
2072 } else if (entity
instanceof Taxon
) {
2073 element
= new TaxonDetailElement(this, parentElement
,
2074 (Taxon
) entity
, removeListener
, style
);
2075 } else if (entity
instanceof DescriptionElementBase
) {
2076 // this is the special case for protologs, maybe we can do this
2077 // differently when API improves
2078 DescriptionElementBase descriptionElement
= (DescriptionElementBase
) entity
;
2079 if (descriptionElement
.getFeature().equals(Feature
.PROTOLOGUE())) {
2080 element
= new ProtologueElement(this, parentElement
,
2081 descriptionElement
, removeListener
, style
);
2085 if (element
== null) {
2088 "No element for entity",
2090 "Could not generate element for entity. "
2091 + "Looks like the case is not handled already. Check implementation. Entity: "
2096 if (backgroundColor
!= null && !backgroundColor
.isDisposed()) {
2097 element
.setPersistentBackground(backgroundColor
);
2101 parentElement
.addElement(element
);
2107 * Creates a selection element for the given type T.
2110 * <strong>Selection elements not handled by this method:</strong>
2112 * <li>{@link TaxonNodeSelectionElement} see {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}</li>
2113 * <li>{@link NomenclaturalAuthorTeamSelectionElement} see {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}</li>
2118 * a {@link Class} object of the type that you want the selection element to handle
2119 * @param parentElement
2120 * a {@link ICdmFormElement}
2122 * @param labelString
2123 * a {@link String} object.
2124 * @param selectionType
2126 * a {@link ICdmBase} object.
2129 * @param conversation
2130 * a {@link ConversationHolder} object.
2132 * {@link EntitySelectionElement}
2135 public <T
extends ICdmBase
> EntitySelectionElement
<T
> createSelectionElement(
2136 Class
<T
> clazz
, ConversationHolder conversation
,
2137 ICdmFormElement parentElement
, String labelString
,
2138 T selection
, int mode
, int style
) {
2139 EntitySelectionElement
<T
> element
= new EntitySelectionElement
<T
>(this, conversation
, parentElement
, clazz
, labelString
, selection
, mode
, style
);
2141 parentElement
.addElement(element
);
2145 public TaxonNodeSelectionElement
createTaxonNodeSelectionElement(
2146 ConversationHolder conversation
,
2147 ICdmFormElement parentElement
, String labelString
,
2148 TaxonNode selection
, int mode
, int style
) {
2149 TaxonNodeSelectionElement element
= new TaxonNodeSelectionElement(this, conversation
, parentElement
, labelString
, selection
, mode
, style
);
2151 parentElement
.addElement(element
);
2155 public NomenclaturalAuthorTeamSelectionElement
createNomenclaturalAuthorTeamSelectionElement(
2156 ConversationHolder conversation
,
2157 ICdmFormElement parentElement
, String labelString
,
2158 Team selection
, int mode
, int style
) {
2159 NomenclaturalAuthorTeamSelectionElement element
= new NomenclaturalAuthorTeamSelectionElement(this, conversation
, parentElement
, labelString
, selection
, mode
, style
);
2161 parentElement
.addElement(element
);
2166 /** {@inheritDoc} */
2167 public LabelElement
createLabel(ICdmFormElement parentElement
, String text
) {
2168 LabelElement labelElement
= new LabelElement(this, parentElement
, text
);
2169 adapt(labelElement
);
2170 parentElement
.addElement(labelElement
);
2171 return labelElement
;
2176 * Getter for the field <code>selectionProvider</code>.
2179 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
2181 public ISelectionProvider
getSelectionProvider() {
2182 return selectionProvider
;
2187 * createDetailedDescriptionDetailElement
2190 * @param parentElement
2191 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
2195 * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
2200 * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
2203 public AbstractDetailedDescriptionDetailElement
createDetailedDescriptionDetailElement(
2204 ICdmFormElement parentElement
, DescriptionElementBase entity
,
2206 AbstractDetailedDescriptionDetailElement detailedDescriptionElement
= null;
2208 if (entity
instanceof CategoricalData
) {
2209 detailedDescriptionElement
= new CategoricalDataDetailElement(this,
2210 parentElement
, (CategoricalData
) entity
, style
);
2211 } else if (entity
instanceof CommonTaxonName
) {
2212 detailedDescriptionElement
= new CommonNameDetailElement(this,
2213 parentElement
, (CommonTaxonName
) entity
, style
);
2214 } else if (entity
instanceof Distribution
) {
2215 detailedDescriptionElement
= new DistributionDetailElement(this,
2216 parentElement
, (Distribution
) entity
, style
);
2217 } else if (entity
instanceof IndividualsAssociation
) {
2218 detailedDescriptionElement
= new IndividualsAssociationDetailElement(
2219 this, parentElement
, (IndividualsAssociation
) entity
, style
);
2220 } else if (entity
instanceof QuantitativeData
) {
2221 detailedDescriptionElement
= new QuantitativeDataDetailElement(
2222 this, parentElement
, (QuantitativeData
) entity
, style
);
2223 } else if (entity
instanceof TaxonInteraction
) {
2224 detailedDescriptionElement
= new TaxonInteractionDetailElement(
2225 this, parentElement
, (TaxonInteraction
) entity
, style
);
2226 } else if (entity
instanceof TextData
) {
2227 detailedDescriptionElement
= new TextDataDetailElement(this,
2228 parentElement
, (TextData
) entity
, style
);
2230 throw new IllegalStateException(
2231 "There is no interface for the given description element");
2233 adapt(detailedDescriptionElement
);
2234 parentElement
.addElement(detailedDescriptionElement
);
2235 return detailedDescriptionElement
;
2240 * Creates a styled text as a part of the form.
2245 * the text initial value
2248 * @return the text widget
2250 public StyledText
createStyledText(Composite parent
, String value
, int style
) {
2251 StyledText text
= new StyledText(parent
, getBorderStyle() | style
2252 | getOrientation());
2254 text
.setText(value
);
2255 text
.setForeground(getColors().getForeground());
2256 text
.setBackground(getColors().getBackground());
2257 // text.addFocusListener(visibilityHandler);