4 package eu
.etaxonomy
.taxeditor
.forms
;
7 import java
.util
.HashSet
;
11 import org
.eclipse
.jface
.util
.IPropertyChangeListener
;
12 import org
.eclipse
.jface
.viewers
.ISelection
;
13 import org
.eclipse
.jface
.viewers
.ISelectionProvider
;
14 import org
.eclipse
.jface
.window
.Window
;
15 import org
.eclipse
.swt
.SWT
;
16 import org
.eclipse
.swt
.custom
.StyledText
;
17 import org
.eclipse
.swt
.events
.FocusAdapter
;
18 import org
.eclipse
.swt
.events
.FocusEvent
;
19 import org
.eclipse
.swt
.events
.FocusListener
;
20 import org
.eclipse
.swt
.events
.MouseAdapter
;
21 import org
.eclipse
.swt
.events
.MouseEvent
;
22 import org
.eclipse
.swt
.events
.MouseListener
;
23 import org
.eclipse
.swt
.events
.SelectionEvent
;
24 import org
.eclipse
.swt
.events
.SelectionListener
;
25 import org
.eclipse
.swt
.events
.TypedEvent
;
26 import org
.eclipse
.swt
.graphics
.Color
;
27 import org
.eclipse
.swt
.graphics
.Font
;
28 import org
.eclipse
.swt
.widgets
.Composite
;
29 import org
.eclipse
.swt
.widgets
.Control
;
30 import org
.eclipse
.swt
.widgets
.Display
;
31 import org
.eclipse
.swt
.widgets
.Event
;
32 import org
.eclipse
.swt
.widgets
.Label
;
33 import org
.eclipse
.ui
.forms
.IFormColors
;
34 import org
.eclipse
.ui
.forms
.widgets
.FormToolkit
;
35 import org
.eclipse
.ui
.forms
.widgets
.Section
;
36 import org
.eclipse
.ui
.forms
.widgets
.TableWrapData
;
37 import org
.eclipse
.ui
.forms
.widgets
.TableWrapLayout
;
38 import org
.eclipse
.ui
.internal
.forms
.widgets
.FormFonts
;
39 import org
.joda
.time
.Partial
;
41 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
42 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
43 import eu
.etaxonomy
.cdm
.model
.agent
.Institution
;
44 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
45 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
46 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
47 import eu
.etaxonomy
.cdm
.model
.common
.Annotation
;
48 import eu
.etaxonomy
.cdm
.model
.common
.AnnotationType
;
49 import eu
.etaxonomy
.cdm
.model
.common
.Credit
;
50 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
51 import eu
.etaxonomy
.cdm
.model
.common
.DescriptionElementSource
;
52 import eu
.etaxonomy
.cdm
.model
.common
.Extension
;
53 import eu
.etaxonomy
.cdm
.model
.common
.ExtensionType
;
54 import eu
.etaxonomy
.cdm
.model
.common
.IAnnotatableEntity
;
55 import eu
.etaxonomy
.cdm
.model
.common
.IVersionableEntity
;
56 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableSource
;
57 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
58 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
59 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
60 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
61 import eu
.etaxonomy
.cdm
.model
.common
.TimePeriod
;
62 import eu
.etaxonomy
.cdm
.model
.common
.VersionableEntity
;
63 import eu
.etaxonomy
.cdm
.model
.description
.CategoricalData
;
64 import eu
.etaxonomy
.cdm
.model
.description
.CommonTaxonName
;
65 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
66 import eu
.etaxonomy
.cdm
.model
.description
.Distribution
;
67 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
68 import eu
.etaxonomy
.cdm
.model
.description
.FeatureTree
;
69 import eu
.etaxonomy
.cdm
.model
.description
.IndividualsAssociation
;
70 import eu
.etaxonomy
.cdm
.model
.description
.MeasurementUnit
;
71 import eu
.etaxonomy
.cdm
.model
.description
.Modifier
;
72 import eu
.etaxonomy
.cdm
.model
.description
.PresenceAbsenceTermBase
;
73 import eu
.etaxonomy
.cdm
.model
.description
.QuantitativeData
;
74 import eu
.etaxonomy
.cdm
.model
.description
.Scope
;
75 import eu
.etaxonomy
.cdm
.model
.description
.Sex
;
76 import eu
.etaxonomy
.cdm
.model
.description
.Stage
;
77 import eu
.etaxonomy
.cdm
.model
.description
.State
;
78 import eu
.etaxonomy
.cdm
.model
.description
.StateData
;
79 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasure
;
80 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasurementValue
;
81 import eu
.etaxonomy
.cdm
.model
.description
.TaxonInteraction
;
82 import eu
.etaxonomy
.cdm
.model
.description
.TextData
;
83 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
84 import eu
.etaxonomy
.cdm
.model
.location
.NamedAreaType
;
85 import eu
.etaxonomy
.cdm
.model
.location
.Point
;
86 import eu
.etaxonomy
.cdm
.model
.location
.ReferenceSystem
;
87 import eu
.etaxonomy
.cdm
.model
.media
.ImageFile
;
88 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
89 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
90 import eu
.etaxonomy
.cdm
.model
.media
.Rights
;
91 import eu
.etaxonomy
.cdm
.model
.media
.RightsTerm
;
92 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationship
;
93 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationshipType
;
94 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignation
;
95 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignationStatus
;
96 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
97 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatusType
;
98 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
99 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignation
;
100 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignationStatus
;
101 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
102 import eu
.etaxonomy
.cdm
.model
.occurrence
.Collection
;
103 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
104 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnitBase
;
105 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationEvent
;
106 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationModifier
;
107 import eu
.etaxonomy
.cdm
.model
.occurrence
.FieldObservation
;
108 import eu
.etaxonomy
.cdm
.model
.occurrence
.PreservationMethod
;
109 import eu
.etaxonomy
.cdm
.model
.occurrence
.Specimen
;
110 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
111 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
112 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
113 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
114 import eu
.etaxonomy
.cdm
.strategy
.parser
.ParserProblem
;
115 import eu
.etaxonomy
.taxeditor
.editor
.EditorUtil
;
116 import eu
.etaxonomy
.taxeditor
.forms
.selection
.AbstractSelectionElement
;
117 import eu
.etaxonomy
.taxeditor
.forms
.selection
.AgentSelectionElement
;
118 import eu
.etaxonomy
.taxeditor
.forms
.selection
.ClassificationSelectionElement
;
119 import eu
.etaxonomy
.taxeditor
.forms
.selection
.CollectionSelectionElement
;
120 import eu
.etaxonomy
.taxeditor
.forms
.selection
.DerivedUnitBaseSelectionElement
;
121 import eu
.etaxonomy
.taxeditor
.forms
.selection
.FeatureTreeSelectionElement
;
122 import eu
.etaxonomy
.taxeditor
.forms
.selection
.FieldObservationSelectionElement
;
123 import eu
.etaxonomy
.taxeditor
.forms
.selection
.InstitutionSelectionElement
;
124 import eu
.etaxonomy
.taxeditor
.forms
.selection
.NameSelectionElement
;
125 import eu
.etaxonomy
.taxeditor
.forms
.selection
.NamedAreaSelectionElement
;
126 import eu
.etaxonomy
.taxeditor
.forms
.selection
.NomenclaturalAuthorTeamSelectionElement
;
127 import eu
.etaxonomy
.taxeditor
.forms
.selection
.PersonSelectionElement
;
128 import eu
.etaxonomy
.taxeditor
.forms
.selection
.ReferenceSelectionElement
;
129 import eu
.etaxonomy
.taxeditor
.forms
.selection
.TaxonBaseSelectionElement
;
130 import eu
.etaxonomy
.taxeditor
.forms
.selection
.TaxonNodeSelectionElement
;
131 import eu
.etaxonomy
.taxeditor
.forms
.selection
.TeamSelectionElement
;
132 import eu
.etaxonomy
.taxeditor
.forms
.term
.AbstractEnumComboElement
;
133 import eu
.etaxonomy
.taxeditor
.forms
.term
.AbstractTermComboElement
;
134 import eu
.etaxonomy
.taxeditor
.forms
.term
.AnnotationTypeComboElement
;
135 import eu
.etaxonomy
.taxeditor
.forms
.term
.DeterminationModifierComboElement
;
136 import eu
.etaxonomy
.taxeditor
.forms
.term
.EmptyComboElement
;
137 import eu
.etaxonomy
.taxeditor
.forms
.term
.ExtensionTypeComboElement
;
138 import eu
.etaxonomy
.taxeditor
.forms
.term
.LanguageComboElement
;
139 import eu
.etaxonomy
.taxeditor
.forms
.term
.MarkerTypeComboElement
;
140 import eu
.etaxonomy
.taxeditor
.forms
.term
.MeasurementUnitComboElement
;
141 import eu
.etaxonomy
.taxeditor
.forms
.term
.ModifierComboElement
;
142 import eu
.etaxonomy
.taxeditor
.forms
.term
.NameRelationshipTypeComboElement
;
143 import eu
.etaxonomy
.taxeditor
.forms
.term
.NameTypeDesignationStatusComboElement
;
144 import eu
.etaxonomy
.taxeditor
.forms
.term
.NamedAreaTypeComboElement
;
145 import eu
.etaxonomy
.taxeditor
.forms
.term
.NomenclaturalCodeComboElement
;
146 import eu
.etaxonomy
.taxeditor
.forms
.term
.NomenclaturalStatusTypeComboElement
;
147 import eu
.etaxonomy
.taxeditor
.forms
.term
.PresenceAbsenceTermComboElement
;
148 import eu
.etaxonomy
.taxeditor
.forms
.term
.PreservationMethodComboElement
;
149 import eu
.etaxonomy
.taxeditor
.forms
.term
.RankComboElement
;
150 import eu
.etaxonomy
.taxeditor
.forms
.term
.ReferenceSystemComboElement
;
151 import eu
.etaxonomy
.taxeditor
.forms
.term
.ReferenceTypeComboElement
;
152 import eu
.etaxonomy
.taxeditor
.forms
.term
.RightsTypeComboElement
;
153 import eu
.etaxonomy
.taxeditor
.forms
.term
.ScopeComboElement
;
154 import eu
.etaxonomy
.taxeditor
.forms
.term
.SexComboElement
;
155 import eu
.etaxonomy
.taxeditor
.forms
.term
.SpecimenTypeDesignationStatusComboElement
;
156 import eu
.etaxonomy
.taxeditor
.forms
.term
.StageComboElement
;
157 import eu
.etaxonomy
.taxeditor
.forms
.term
.StateComboElement
;
158 import eu
.etaxonomy
.taxeditor
.forms
.term
.StatisticalMeasureComboElement
;
159 import eu
.etaxonomy
.taxeditor
.section
.AbstractCdmDetailElement
;
160 import eu
.etaxonomy
.taxeditor
.section
.AbstractEntityCollectionElement
;
161 import eu
.etaxonomy
.taxeditor
.section
.EmptyElement
;
162 import eu
.etaxonomy
.taxeditor
.section
.agent
.PersonDetailElement
;
163 import eu
.etaxonomy
.taxeditor
.section
.agent
.PersonDetailSection
;
164 import eu
.etaxonomy
.taxeditor
.section
.agent
.TeamDetailElement
;
165 import eu
.etaxonomy
.taxeditor
.section
.agent
.TeamDetailSection
;
166 import eu
.etaxonomy
.taxeditor
.section
.agent
.TeamMemberElement
;
167 import eu
.etaxonomy
.taxeditor
.section
.agent
.TeamMemberSection
;
168 import eu
.etaxonomy
.taxeditor
.section
.agent
.TeamOrPersonBaseDetailSection
;
169 import eu
.etaxonomy
.taxeditor
.section
.classification
.ClassificationDetailElement
;
170 import eu
.etaxonomy
.taxeditor
.section
.classification
.ClassificationDetailSection
;
171 import eu
.etaxonomy
.taxeditor
.section
.classification
.TaxonNodeDetailElement
;
172 import eu
.etaxonomy
.taxeditor
.section
.classification
.TaxonNodeDetailSection
;
173 import eu
.etaxonomy
.taxeditor
.section
.description
.DerivedUnitElement
;
174 import eu
.etaxonomy
.taxeditor
.section
.description
.DescribedSpecimenSection
;
175 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionDetailElement
;
176 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionDetailSection
;
177 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionElementDetailElement
;
178 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionElementDetailSection
;
179 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionElementMediaSection
;
180 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionElementSourceElement
;
181 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionElementSourceSection
;
182 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionSourceElement
;
183 import eu
.etaxonomy
.taxeditor
.section
.description
.DescriptionSourceSection
;
184 import eu
.etaxonomy
.taxeditor
.section
.description
.ModifierElement
;
185 import eu
.etaxonomy
.taxeditor
.section
.description
.ModifierSection
;
186 import eu
.etaxonomy
.taxeditor
.section
.description
.NaturalLanguageDetailElement
;
187 import eu
.etaxonomy
.taxeditor
.section
.description
.NaturalLanguageSection
;
188 import eu
.etaxonomy
.taxeditor
.section
.description
.ScopeElement
;
189 import eu
.etaxonomy
.taxeditor
.section
.description
.ScopeSection
;
190 import eu
.etaxonomy
.taxeditor
.section
.description
.StateDataElement
;
191 import eu
.etaxonomy
.taxeditor
.section
.description
.StateDataSection
;
192 import eu
.etaxonomy
.taxeditor
.section
.description
.StatisticalMeasurementValueElement
;
193 import eu
.etaxonomy
.taxeditor
.section
.description
.StatisticalMeasurementValueSection
;
194 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.AbstractDetailedDescriptionDetailElement
;
195 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.CategoricalDataDetailElement
;
196 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.CommonNameDetailElement
;
197 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.DistributionDetailElement
;
198 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.IndividualsAssociationDetailElement
;
199 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.QuantitativeDataDetailElement
;
200 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.TaxonInteractionDetailElement
;
201 import eu
.etaxonomy
.taxeditor
.section
.description
.detail
.TextDataDetailElement
;
202 import eu
.etaxonomy
.taxeditor
.section
.feature
.FeatureDistributionDetailElement
;
203 import eu
.etaxonomy
.taxeditor
.section
.feature
.FeatureDistributionDetailSection
;
204 import eu
.etaxonomy
.taxeditor
.section
.name
.AuthorshipDetailElement
;
205 import eu
.etaxonomy
.taxeditor
.section
.name
.AuthorshipDetailSection
;
206 import eu
.etaxonomy
.taxeditor
.section
.name
.NameDetailElement
;
207 import eu
.etaxonomy
.taxeditor
.section
.name
.NameDetailSection
;
208 import eu
.etaxonomy
.taxeditor
.section
.name
.NameRelationshipDetailElement
;
209 import eu
.etaxonomy
.taxeditor
.section
.name
.NameRelationshipDetailSection
;
210 import eu
.etaxonomy
.taxeditor
.section
.name
.NameTypeDesignationElement
;
211 import eu
.etaxonomy
.taxeditor
.section
.name
.NomenclaturalStatusElement
;
212 import eu
.etaxonomy
.taxeditor
.section
.name
.NomenclaturalStatusSection
;
213 import eu
.etaxonomy
.taxeditor
.section
.name
.NonViralNameDetailElement
;
214 import eu
.etaxonomy
.taxeditor
.section
.name
.NonViralNameDetailSection
;
215 import eu
.etaxonomy
.taxeditor
.section
.name
.ProtologueElement
;
216 import eu
.etaxonomy
.taxeditor
.section
.name
.ProtologueSection
;
217 import eu
.etaxonomy
.taxeditor
.section
.name
.SpecimenTypeDesignationElement
;
218 import eu
.etaxonomy
.taxeditor
.section
.name
.TypeDesignationSection
;
219 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.CollectingAreasDetailElement
;
220 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.CollectingAreasDetailSection
;
221 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.CollectionDetailElement
;
222 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DerivedUnitBaseDetailElement
;
223 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DerivedUnitBaseDetailSection
;
224 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DerivedUnitFacadeDetailElement
;
225 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DerivedUnitFacadeDetailSection
;
226 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DeterminationEventDetailElement
;
227 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DeterminationEventDetailSection
;
228 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.FieldObservationDetailElement
;
229 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.FieldObservationDetailSection
;
230 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.GatheringEventDetailElement
;
231 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.GatheringEventDetailSection
;
232 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.SourceCollectionDetailSection
;
233 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.SpecimenCollectionDetailElement
;
234 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.SpecimenCollectionDetailSection
;
235 import eu
.etaxonomy
.taxeditor
.section
.reference
.NomenclaturalReferenceDetailElement
;
236 import eu
.etaxonomy
.taxeditor
.section
.reference
.NomenclaturalReferenceDetailSection
;
237 import eu
.etaxonomy
.taxeditor
.section
.reference
.ReferenceBaseDetailElement
;
238 import eu
.etaxonomy
.taxeditor
.section
.reference
.ReferenceBaseDetailSection
;
239 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.AnnotationElement
;
240 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.AnnotationSection
;
241 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.CreditElement
;
242 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.CreditSection
;
243 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.ExtensionElement
;
244 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.ExtensionSection
;
245 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.HeadlineSection
;
246 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.IdentifiableSourceElement
;
247 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.ImageFileElement
;
248 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MarkerElement
;
249 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MarkerSection
;
250 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MediaElement
;
251 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MediaRepresentationElement
;
252 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MediaRepresentationPartSection
;
253 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MediaRepresentationSection
;
254 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.MediaSection
;
255 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.RightsElement
;
256 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.RightsSection
;
257 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.SourceSection
;
258 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.VersionElement
;
259 import eu
.etaxonomy
.taxeditor
.section
.supplemental
.VersionSection
;
260 import eu
.etaxonomy
.taxeditor
.section
.taxon
.ParsingMessageElement
;
261 import eu
.etaxonomy
.taxeditor
.section
.taxon
.ParsingMessagesSection
;
262 import eu
.etaxonomy
.taxeditor
.section
.taxon
.TaxonBaseDetailElement
;
263 import eu
.etaxonomy
.taxeditor
.section
.taxon
.TaxonBaseDetailSection
;
266 * <p>CdmFormFactory class.</p>
269 * @created Feb 24, 2010
272 public class CdmFormFactory
extends FormToolkit
{
274 private BoldFontHolder2 boldFontHolder2
;
275 private MouseListener selectionMouseHandler
;
276 private FocusListener selectionFocusHandler
;
278 private Set selectionListenerList
= new HashSet();
280 private Set
<IPropertyChangeListener
> propertyChangeListeners
= new HashSet
<IPropertyChangeListener
>();
282 private int orientation
= Window
.getDefaultOrientation();
283 private ISelectionProvider selectionProvider
;
288 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
290 public static final TableWrapLayout
LAYOUT(){
291 return LAYOUT(1, false);
297 * @param columns a int.
298 * @param equalWidth a boolean.
299 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
301 public static final TableWrapLayout
LAYOUT(int columns
, boolean equalWidth
){
302 TableWrapLayout layout
= new TableWrapLayout();
303 layout
.topMargin
= 0;
304 layout
.rightMargin
= 0;
305 layout
.bottomMargin
= 0;
306 layout
.leftMargin
= 0;
307 layout
.numColumns
= columns
;
308 layout
.makeColumnsEqualWidth
= equalWidth
;
309 layout
.verticalSpacing
= 0;
310 layout
.horizontalSpacing
= 0;
317 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
319 public static final TableWrapData
FILL(){
326 * @param horizontalSpan a int.
327 * @param verticalSpan a int.
328 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
330 public static final TableWrapData
FILL(int horizontalSpan
, int verticalSpan
){
331 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.FILL_GRAB
);
332 layoutData
.colspan
= horizontalSpan
;
333 layoutData
.rowspan
= verticalSpan
;
340 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
342 public static final TableWrapData
LEFT(){
343 return new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
);
349 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
351 public static final TableWrapData
RIGHT(){
352 return new TableWrapData(TableWrapData
.RIGHT
, TableWrapData
.TOP
);
356 * <p>FILL_HORIZONTALLY</p>
358 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
360 public static final TableWrapData
FILL_HORIZONTALLY(){
361 return FILL_HORIZONTALLY(1, 1);
365 * <p>FILL_HORIZONTALLY</p>
367 * @param horizontalSpan a int.
368 * @param verticalSpan a int.
369 * @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
371 public static final TableWrapData
FILL_HORIZONTALLY(int horizontalSpan
, int verticalSpan
){
372 TableWrapData layoutData
= new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
);
373 layoutData
.colspan
= horizontalSpan
;
374 layoutData
.rowspan
= verticalSpan
;
378 /** Constant <code>EMPTY_SELECTION</code> */
379 public static ISelection EMPTY_SELECTION
= new ISelection() {
380 public boolean isEmpty() {
385 private class SelectionMouseHandler
extends MouseAdapter
{
387 public void mouseDown(MouseEvent e
) {
388 notifySelectionListeners(e
);
392 private class SelectionFocusHandler
extends FocusAdapter
{
394 public void focusGained(FocusEvent e
) {
395 notifySelectionListeners(e
);
399 private void notifySelectionListeners(TypedEvent e
){
400 Event event
= new Event();
401 event
.widget
= e
.widget
;
402 SelectionEvent selectionEvent
= new SelectionEvent(event
);
404 for(Object listener
: selectionListenerList
){
405 ((SelectionListener
) listener
).widgetSelected(selectionEvent
);
410 * <p>Constructor for CdmFormFactory.</p>
412 * @param display a {@link org.eclipse.swt.widgets.Display} object.
413 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
415 public CdmFormFactory(Display display
, ISelectionProvider selectionProvider
) {
417 this.selectionProvider
= selectionProvider
;
422 * <p>Constructor for CdmFormFactory.</p>
424 * @param display a {@link org.eclipse.swt.widgets.Display} object.
426 public CdmFormFactory(Display display
){
434 private void init() {
435 boldFontHolder2
= new BoldFontHolder2();
436 selectionMouseHandler
= new SelectionMouseHandler();
437 selectionFocusHandler
= new SelectionFocusHandler();
441 * Creates an instance initialized with the correct selectionProvider
443 * Make sure to remove the instance when the entityComposite disposes via
444 * destroySelectionArbitrator(..)
446 * @param entityElement a {@link eu.etaxonomy.taxeditor.forms.IEntityElement} object.
447 * @return a {@link eu.etaxonomy.taxeditor.forms.SelectionArbitrator} object.
449 public SelectionArbitrator
createSelectionArbitrator(IEntityElement entityElement
){
450 SelectionArbitrator selectionArbitrator
= new SelectionArbitrator(entityElement
);
451 selectionArbitrator
.addSelectionProvider(selectionProvider
);
452 selectionProvider
.addSelectionChangedListener(selectionArbitrator
);
453 addSelectionListener(selectionArbitrator
);
454 return selectionArbitrator
;
458 * <p>destroySelectionArbitrator</p>
460 * @param selectionArbitrator a {@link eu.etaxonomy.taxeditor.forms.SelectionArbitrator} object.
462 public void destroySelectionArbitrator(SelectionArbitrator selectionArbitrator
){
463 removeSelectionListener(selectionArbitrator
);
464 if(selectionProvider
!= null){
465 selectionProvider
.removeSelectionChangedListener(selectionArbitrator
);
467 EditorUtil
.error(this.getClass(), "Tried to destroy a selection listener from this factories listeners but was null", null);
473 public void adapt(Composite composite
) {
474 composite
.addMouseListener(selectionMouseHandler
);
475 super.adapt(composite
);
481 * @param formElement a {@link eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement} object.
483 public void adapt(AbstractCdmFormElement formElement
){
484 formElement
.setPropertyChangeListeners(propertyChangeListeners
);
489 public void adapt(Control control
, boolean trackFocus
, boolean trackKeyboard
) {
491 control
.addFocusListener(selectionFocusHandler
);
493 super.adapt(control
, trackFocus
, trackKeyboard
);
497 * <p>destroyElement</p>
499 * @param formElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
501 public void destroyElement(ICdmFormElement formElement
){
502 // return if element was not initialized
503 if(formElement
== null){
506 // destroy selection arbitrator, if any
507 if(formElement
instanceof ISelectableElement
){
508 destroySelectionArbitrator(((ISelectableElement
) formElement
).getSelectionArbitrator());
510 // remove this element form its parents list of elements
511 // ICdmFormElement parentElement = formElement.getParentElement();
512 // if(parentElement != null){
513 // parentElement.removeElement(formElement);
515 // call destroy on child elements recursively
516 for(ICdmFormElement childElement
: formElement
.getElements()){
517 destroyElement(childElement
);
519 // dispose of the controls
520 for(Control control
: formElement
.getControls()){
521 // we added the layoutComposite of the parental element as the layout composite to this formElement
522 // but we do not want to destroy it.
523 if(control
.equals(formElement
.getLayoutComposite())){
534 * <p>createEmptyCell</p>
536 * @param parent a {@link org.eclipse.swt.widgets.Composite} object.
537 * @return a {@link org.eclipse.swt.widgets.Label} object.
539 public Label
createEmptyCell(Composite parent
){
540 return this.createLabel(parent
, null);
544 * <p>createMultilineTextWithLabel</p>
546 * @param labelString a {@link java.lang.String} object.
547 * @param textHeight a int.
548 * @param style a int.
549 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
550 * @return a {@link eu.etaxonomy.taxeditor.forms.TextWithLabelElement} object.
552 public TextWithLabelElement
createMultilineTextWithLabel(ICdmFormElement parentElement
, String labelString
, int textHeight
, int style
){
553 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, labelString
, "", textHeight
, style
);
555 parentElement
.addElement(element
);
561 * <p>createMultiLanguageTextElement</p>
563 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
564 * @param labelString a {@link java.lang.String} object.
565 * @param multilanguageText a {@link java.util.Map} object.
566 * @param textHeight a int.
567 * @param style a int.
568 * @return a {@link eu.etaxonomy.taxeditor.forms.MultilanguageTextElement} object.
570 public MultilanguageTextElement
createMultiLanguageTextElement(
571 ICdmFormElement parentElement
, String labelString
, Map
<Language
, LanguageString
> multilanguageText
, int textHeight
,
573 MultilanguageTextElement element
= new MultilanguageTextElement(this, parentElement
, labelString
, multilanguageText
, textHeight
, style
);
575 parentElement
.addElement(element
);
581 * <p>createTextWithLabelElement</p>
583 * @param labelString a {@link java.lang.String} object.
584 * @param initialText a {@link java.lang.String} object.
585 * @param style a int.
586 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
587 * @return a {@link eu.etaxonomy.taxeditor.forms.TextWithLabelElement} object.
589 public TextWithLabelElement
createTextWithLabelElement(ICdmFormElement parentElement
, String labelString
, String initialText
, int style
){
590 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, labelString
, initialText
, null, style
);
592 parentElement
.addElement(element
);
597 * <p>createIntegerTextWithLabelElement</p>
599 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
600 * @param labelString a {@link java.lang.String} object.
601 * @param initialInteger a {@link java.lang.Integer} object.
602 * @param style a int.
603 * @return a {@link eu.etaxonomy.taxeditor.forms.NumberWithLabelElement} object.
605 public NumberWithLabelElement
createIntegerTextWithLabelElement(ICdmFormElement parentElement
, String labelString
, Integer initialInteger
, int style
){
606 NumberWithLabelElement element
= new NumberWithLabelElement(this, parentElement
, labelString
, initialInteger
, style
);
608 parentElement
.addElement(element
);
614 * <p>createFloatTextWithLabelElement</p>
616 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
617 * @param labelString a {@link java.lang.String} object.
618 * @param initialFloat a float.
619 * @param style a int.
620 * @return a {@link eu.etaxonomy.taxeditor.forms.NumberWithLabelElement} object.
622 public NumberWithLabelElement
createFloatTextWithLabelElement(
623 ICdmFormElement parentElement
, String labelString
, float initialFloat
,
625 NumberWithLabelElement element
= new NumberWithLabelElement(this, parentElement
, labelString
, initialFloat
, style
);
627 parentElement
.addElement(element
);
632 * <p>createLanguageStringWithLabelElement</p>
634 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
635 * @param labelString a {@link java.lang.String} object.
636 * @param languageString a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
637 * @param style a int.
638 * @return a {@link eu.etaxonomy.taxeditor.forms.LanguageStringWithLabelElement} object.
640 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(ICdmFormElement parentElement
, String labelString
, LanguageString languageString
, int style
){
641 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(this, parentElement
, labelString
, languageString
, style
);
643 parentElement
.addElement(element
);
648 * <p>createLanguageStringWithLabelElement</p>
650 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
651 * @param labelString a {@link java.lang.String} object.
652 * @param languageString a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
653 * @param height a int.
654 * @param style a int.
655 * @return a {@link eu.etaxonomy.taxeditor.forms.LanguageStringWithLabelElement} object.
657 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(ICdmFormElement parentElement
, String labelString
, LanguageString languageString
, int height
, int style
){
658 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(this, parentElement
, labelString
, languageString
, height
, style
);
660 parentElement
.addElement(element
);
665 * <p>createTextElement</p>
667 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
668 * @param initialText a {@link java.lang.String} object.
669 * @param style a int.
670 * @return a {@link eu.etaxonomy.taxeditor.forms.TextWithLabelElement} object.
672 public TextWithLabelElement
createTextElement(ICdmFormElement parentElement
, String initialText
, int style
){
673 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, null, initialText
, null, style
);
675 parentElement
.addElement(element
);
680 * <p>createKeyValueViewerElement</p>
682 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
683 * @param keyHeading a {@link java.lang.String} object.
684 * @param valueHeading a {@link java.lang.String} object.
685 * @param map a {@link java.util.Map} object.
686 * @return a {@link eu.etaxonomy.taxeditor.forms.KeyValueViewerElement} object.
688 public KeyValueViewerElement
createKeyValueViewerElement(ICdmFormElement parentElement
, String keyHeading
, String valueHeading
, Map
<Object
, Object
> map
){
689 KeyValueViewerElement element
= new KeyValueViewerElement(this, parentElement
, keyHeading
, valueHeading
, map
);
691 parentElement
.addElement(element
);
696 public static enum TermComboType
{
700 NOMENCLATURALSTATUSTYPE
,
705 PRESENCEABSENCESTATUS
,
707 NAMETYPEDESIGNATIONSTATUS
,
708 SPECIMENTYPEDESIGNATIONSTATUS
,
718 DETERMINATION_MODIFIER
,
723 * <p>createTermComboElement</p>
725 * @param termComboType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.TermComboType} object.
726 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
727 * @param labelString a {@link java.lang.String} object.
728 * @param selection a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase} object.
729 * @param style a int.
730 * @return a {@link eu.etaxonomy.taxeditor.forms.term.AbstractTermComboElement} object.
732 public AbstractTermComboElement
createTermComboElement(TermComboType termComboType
, ICdmFormElement parentElement
, String labelString
, DefinedTermBase selection
, int style
){
733 AbstractTermComboElement element
= null;
735 switch(termComboType
){
737 element
= new EmptyComboElement
<DefinedTermBase
>(this, parentElement
, labelString
, style
);
740 element
= new ExtensionTypeComboElement(this, parentElement
, labelString
, (ExtensionType
) selection
, style
);
743 element
= new LanguageComboElement(this, parentElement
, labelString
, (Language
) selection
, style
);
746 element
= new MarkerTypeComboElement(this, parentElement
, labelString
, (MarkerType
) selection
, style
);
748 case NOMENCLATURALSTATUSTYPE
:
749 element
= new NomenclaturalStatusTypeComboElement(this, parentElement
, labelString
, (NomenclaturalStatusType
) selection
, style
);
752 element
= new RankComboElement(this, parentElement
, labelString
, (Rank
) selection
, style
);
755 element
= new RightsTypeComboElement(this, parentElement
, labelString
, (RightsTerm
) selection
, style
);
757 case NAMERELATIONSHIP
:
758 element
= new NameRelationshipTypeComboElement(this, parentElement
, labelString
, (NameRelationshipType
) selection
, style
);
761 element
= new NamedAreaTypeComboElement(this, parentElement
, labelString
, (NamedAreaType
) selection
, style
);
764 element
= new AnnotationTypeComboElement(this, parentElement
, labelString
, (AnnotationType
) selection
, style
);
766 case PRESENCEABSENCESTATUS
:
767 element
= new PresenceAbsenceTermComboElement(this, parentElement
, labelString
, (PresenceAbsenceTermBase
) selection
, style
);
769 case NAMETYPEDESIGNATIONSTATUS
:
770 element
= new NameTypeDesignationStatusComboElement(this, parentElement
, labelString
, (NameTypeDesignationStatus
) selection
, style
);
772 case SPECIMENTYPEDESIGNATIONSTATUS
:
773 element
= new SpecimenTypeDesignationStatusComboElement(this, parentElement
, labelString
, (SpecimenTypeDesignationStatus
) selection
, style
);
776 element
= new SexComboElement(this, parentElement
, labelString
, (Sex
) selection
, style
);
779 element
= new StageComboElement(this, parentElement
, labelString
, (Stage
) selection
, style
);
781 case PRESERVATION_METHOD
:
782 element
= new PreservationMethodComboElement(this, parentElement
, labelString
, (PreservationMethod
) selection
, style
);
784 case MEASUREMENT_UNIT
:
785 element
= new MeasurementUnitComboElement(this, parentElement
, labelString
, (MeasurementUnit
) selection
, style
);
788 element
= new StateComboElement(this, parentElement
, labelString
, (State
) selection
, style
);
791 element
= new ScopeComboElement(this, parentElement
, labelString
, (Scope
) selection
, style
);
794 element
= new ModifierComboElement(this, parentElement
, labelString
, (Modifier
) selection
, style
);
796 case STATISTICAL_MEASURE
:
797 element
= new StatisticalMeasureComboElement(this, parentElement
, labelString
, (StatisticalMeasure
) selection
, style
);
799 case DETERMINATION_MODIFIER
:
800 element
= new DeterminationModifierComboElement(this, parentElement
, labelString
, (DeterminationModifier
) selection
, style
);
802 case REFERENCE_SYSTEM
:
803 element
= new ReferenceSystemComboElement(this, parentElement
, labelString
, (ReferenceSystem
) selection
, style
);
808 parentElement
.addElement(element
);
812 public static enum EnumComboType
{
818 * <p>createEnumComboElement</p>
820 * @param enumComboType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.EnumComboType} object.
821 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
822 * @param style a int.
823 * @return a {@link eu.etaxonomy.taxeditor.forms.term.AbstractEnumComboElement} object.
825 public AbstractEnumComboElement
createEnumComboElement(EnumComboType enumComboType
, ICdmFormElement parentElement
, int style
){
826 AbstractEnumComboElement element
= null;
828 switch(enumComboType
){
830 element
= new ReferenceTypeComboElement(this, parentElement
, "Reference Type", null, style
);
832 case NOMENCLATURALCODE
:
833 element
= new NomenclaturalCodeComboElement(this, parentElement
, "Nomenclatural Code", null, style
);
837 parentElement
.addElement(element
);
842 * <p>createBrowserElement</p>
844 * @param imageUri a {@link java.net.URI} object.
845 * @param style a int.
846 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
847 * @return a {@link eu.etaxonomy.taxeditor.forms.BrowserElement} object.
849 public BrowserElement
createBrowserElement(ICdmFormElement parentElement
, URI imageUri
, int style
){
850 BrowserElement element
= new BrowserElement(this, parentElement
, imageUri
, style
);
852 parentElement
.addElement(element
);
857 * <p>createImageElement</p>
859 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
860 * @param imageUri a {@link java.net.URI} object.
861 * @param style a int.
862 * @return a {@link eu.etaxonomy.taxeditor.forms.ImageElement} object.
864 public ImageElement
createImageElement(ICdmFormElement parentElement
, URI imageUri
, int style
) {
865 ImageElement element
= new ImageElement(this, parentElement
, imageUri
, style
);
867 parentElement
.addElement(element
);
872 * <p>createTextActionElement</p>
874 * @param labelString a {@link java.lang.String} object.
875 * @param initialText a {@link java.lang.String} object.
876 * @param style a int.
877 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
878 * @param buttonLabel a {@link java.lang.String} object.
879 * @return a {@link eu.etaxonomy.taxeditor.forms.TextActionElement} object.
881 public TextActionElement
createTextActionElement(ICdmFormElement parentElement
, String labelString
, String buttonLabel
, String initialText
, int style
){
882 TextActionElement element
= new TextActionElement(this, parentElement
, labelString
, buttonLabel
, initialText
, style
);
884 parentElement
.addElement(element
);
891 * @created Mar 5, 2010
894 public static enum SelectionType
{
912 * <p>createCheckbox</p>
914 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
915 * @param label a {@link java.lang.String} object.
916 * @param initialState a boolean.
917 * @param style a int.
918 * @return a {@link eu.etaxonomy.taxeditor.forms.CheckboxElement} object.
920 public CheckboxElement
createCheckbox(ICdmFormElement parentElement
, String label
, boolean initialState
, int style
) {
921 CheckboxElement element
= new CheckboxElement(this, parentElement
, label
, initialState
, style
| orientation
);
923 parentElement
.addElement(element
);
930 * Creates a section as a part of the form.
932 * @return the section widget
933 * @param section a {@link eu.etaxonomy.taxeditor.forms.AbstractFormSection} object.
935 public Section
adapt(AbstractFormSection section
) {
936 section
.setMenu(section
.getLayoutComposite().getMenu());
937 adapt(section
, true, true);
939 // handle focus and property change events for cdm use
940 section
.addFocusListener(selectionFocusHandler
);
941 section
.setPropertyChangeListeners(propertyChangeListeners
);
943 if (section
.getToggle() != null) {
944 section
.getToggle().setHoverDecorationColor(getColors()
945 .getColor(IFormColors
.TB_TOGGLE_HOVER
));
946 section
.getToggle().setDecorationColor(getColors()
947 .getColor(IFormColors
.TB_TOGGLE
));
950 section
.setFont(boldFontHolder2
.getBoldFont(section
.getLayoutComposite().getFont()));
952 if ((section
.getStyle() & Section
.TITLE_BAR
) != 0
953 || (section
.getStyle() & Section
.SHORT_TITLE_BAR
) != 0) {
954 getColors().initializeSectionToolBarColors();
955 section
.setTitleBarBackground(getColors().getColor(IFormColors
.TB_BG
));
956 section
.setTitleBarBorderColor(getColors()
957 .getColor(IFormColors
.TB_BORDER
));
959 // call setTitleBarForeground regardless as it also sets the label color
960 section
.setTitleBarForeground(getColors()
961 .getColor(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(getColors().getDisplay(),
989 public void dispose() {
990 if (boldFont
!= null) {
991 FormFonts
.getInstance().markFinished(boldFont
, getColors().getDisplay());
998 * <p>createToggleableTextField</p>
1000 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1001 * @param labelString a {@link java.lang.String} object.
1002 * @param initialText a {@link java.lang.String} object.
1003 * @param initialState a boolean.
1004 * @param style a int.
1005 * @return a {@link eu.etaxonomy.taxeditor.forms.ToggleableTextElement} object.
1007 public ToggleableTextElement
createToggleableTextField(ICdmFormElement parentElement
,
1008 String labelString
, String initialText
, boolean initialState
, int style
) {
1009 ToggleableTextElement element
= new ToggleableTextElement(this, parentElement
,
1010 labelString
, initialText
, initialState
, style
| orientation
);
1012 parentElement
.addElement(element
);
1017 * <p>createTimePeriodElement</p>
1019 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1020 * @param labelString a {@link java.lang.String} object.
1021 * @param timePeriod a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1022 * @param style a int.
1023 * @return a {@link eu.etaxonomy.taxeditor.forms.TimePeriodElement} object.
1025 public TimePeriodElement
createTimePeriodElement(
1026 ICdmFormElement parentElement
, String labelString
, TimePeriod timePeriod
, int style
) {
1027 TimePeriodElement element
= new TimePeriodElement(this, parentElement
, labelString
, timePeriod
, style
);
1029 parentElement
.addElement(element
);
1035 * <p>createPointElement</p>
1037 * @param style a int.
1038 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1039 * @param point a {@link eu.etaxonomy.cdm.model.location.Point} object.
1040 * @return a {@link eu.etaxonomy.taxeditor.forms.PointElement} object.
1042 public PointElement
createPointElement(ICdmFormElement parentElement
,
1043 Point point
, int style
) {
1044 PointElement element
= new PointElement(this, parentElement
, point
, style
);
1046 parentElement
.addElement(element
);
1051 * <p>createDateDetailSection</p>
1053 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1054 * @param style a int.
1055 * @return a {@link eu.etaxonomy.taxeditor.forms.DateDetailSection} object.
1057 public DateDetailSection
createDateDetailSection(ICdmFormElement parentElement
, int style
){
1058 DateDetailSection section
= new DateDetailSection(this, parentElement
, style
);
1059 parentElement
.addElement(section
);
1065 * <p>createPartialElement</p>
1067 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1068 * @param labelString a {@link java.lang.String} object.
1069 * @param partial a {@link org.joda.time.Partial} object.
1070 * @param style a int.
1071 * @return a {@link eu.etaxonomy.taxeditor.forms.PartialElement} object.
1073 public PartialElement
createPartialElement(ICdmFormElement parentElement
, String labelString
, Partial partial
, int style
){
1074 PartialElement element
= new PartialElement(this, parentElement
, labelString
, style
);
1076 parentElement
.addElement(element
);
1081 * <p>addSelectionListener</p>
1083 * @param listener a {@link org.eclipse.swt.events.SelectionListener} object.
1085 public void addSelectionListener(SelectionListener listener
){
1086 selectionListenerList
.add(listener
);
1090 * <p>removeSelectionListener</p>
1092 * @param listener a {@link org.eclipse.swt.events.SelectionListener} object.
1094 public void removeSelectionListener(SelectionListener listener
){
1095 if(listener
== null){
1096 EditorUtil
.error(this.getClass(), "Tried to remove a selection listener from this factories listeners but was null", null);
1098 selectionListenerList
.remove(listener
);
1103 * <p>addPropertyChangeListener</p>
1105 * @param listener a {@link org.eclipse.jface.util.IPropertyChangeListener} object.
1107 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
1108 propertyChangeListeners
.add(listener
);
1112 * <p>removePropertyChangeListener</p>
1114 * @param listener a {@link org.eclipse.jface.util.IPropertyChangeListener} object.
1116 public void removePropertyChangeListener(IPropertyChangeListener listener
){
1117 propertyChangeListeners
.remove(listener
);
1123 * <p>createHorizontalSeparator</p>
1125 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1126 * @param style a int.
1127 * @return a {@link org.eclipse.swt.widgets.Label} object.
1129 public Label
createHorizontalSeparator(ICdmFormElement parentElement
, int style
) {
1130 Label separator
= this.createSeparator(parentElement
.getLayoutComposite(), SWT
.HORIZONTAL
| style
);
1131 separator
.setLayoutData(FILL_HORIZONTALLY());
1136 * <p>createVersionElement</p>
1138 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1139 * @param entity a {@link eu.etaxonomy.cdm.model.common.VersionableEntity} object.
1140 * @param style a int.
1141 * @return a {@link eu.etaxonomy.taxeditor.section.supplemental.VersionElement} object.
1143 public VersionElement
createVersionElement(ICdmFormElement parentElement
, VersionableEntity entity
,
1145 VersionElement element
= new VersionElement(this, parentElement
, entity
, style
);
1147 parentElement
.addElement(element
);
1152 * <p>createVersionSection</p>
1154 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1155 * @param style a int.
1156 * @return a {@link eu.etaxonomy.taxeditor.section.supplemental.VersionSection} object.
1158 public VersionSection
createVersionSection(ICdmFormElement parentElement
, int style
) {
1159 VersionSection section
= new VersionSection(this, parentElement
, style
);
1160 parentElement
.addElement(section
);
1166 * <p>createEmptyElement</p>
1168 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1169 * @return a {@link eu.etaxonomy.taxeditor.section.EmptyElement} object.
1171 public EmptyElement
createEmptyElement(ICdmFormElement parentElement
) {
1172 EmptyElement element
= new EmptyElement(this, parentElement
, null, SWT
.NULL
);
1174 parentElement
.addElement(element
);
1179 * <p>createHeadlineSection</p>
1181 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1182 * @return a {@link eu.etaxonomy.taxeditor.section.supplemental.HeadlineSection} object.
1184 public HeadlineSection
createHeadlineSection(ICdmFormElement parentElement
) {
1185 HeadlineSection section
= new HeadlineSection(this, parentElement
, SWT
.NULL
);
1186 parentElement
.addElement(section
);
1193 * <p>createParsingMessageElement</p>
1195 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1196 * @param parserProblem a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem} object.
1197 * @param style a int.
1198 * @return a {@link eu.etaxonomy.taxeditor.section.taxon.ParsingMessageElement} object.
1200 public ParsingMessageElement
createParsingMessageElement(
1201 ICdmFormElement parentElement
, ParserProblem parserProblem
, int style
) {
1202 ParsingMessageElement element
= new ParsingMessageElement(this, parentElement
, parserProblem
, style
);
1204 parentElement
.addElement(element
);
1214 public static enum DetailType
{
1218 NOMENCLATURALREFERENCE
,
1230 DERIVED_UNIT_FACADE
,
1232 DERIVED_UNIT
, NATURAL_LANGUAGE
,
1233 FEATURE_DISTRIBUTION
,
1240 * <p>createCdmDetailSection</p>
1242 * @param detailType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.DetailType} object.
1243 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1244 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1245 * @param style a int.
1246 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1247 * @return a {@link eu.etaxonomy.taxeditor.forms.AbstractFormSection} object.
1249 public AbstractFormSection
createCdmDetailSection(DetailType detailType
, ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1250 AbstractFormSection section
= null;
1253 case SCIENTIFICNAME
:
1254 section
= new NameDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1257 section
= new ReferenceBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1259 case NOMENCLATURALREFERENCE
:
1260 section
= new NomenclaturalReferenceDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1263 section
= new TaxonBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1266 section
= new AuthorshipDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1268 case TEAMORPERSONBASE
:
1269 section
= new TeamOrPersonBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1272 section
= new TeamDetailSection(this, conversation
, parentElement
, null, style
);
1275 section
= new PersonDetailSection(this, conversation
, parentElement
, null, style
);
1278 section
= new DescriptionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1280 case DESCRIPTIONELEMENT
:
1281 section
= new DescriptionElementDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1283 case PARSINGMESSAGE
:
1284 section
= new ParsingMessagesSection(this, conversation
, parentElement
, selectionProvider
, style
);
1287 section
= new NonViralNameDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1290 section
= new eu
.etaxonomy
.taxeditor
.section
.description
.MediaDetailsSection(this, conversation
, parentElement
, selectionProvider
, style
);
1292 case DERIVED_UNIT_FACADE
:
1293 section
= new DerivedUnitFacadeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1295 case FIELD_OBSERVATION
:
1296 section
= new FieldObservationDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1298 case GATHERING_EVENT
:
1299 section
= new GatheringEventDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1302 section
= new DerivedUnitBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1304 case NATURAL_LANGUAGE
:
1305 section
= new NaturalLanguageSection(this, conversation
, parentElement
, selectionProvider
, style
);
1307 case FEATURE_DISTRIBUTION
:
1308 section
= new FeatureDistributionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1310 case CLASSIFICATION
:
1311 section
= new ClassificationDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1314 section
= new TaxonNodeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1317 parentElement
.addElement(section
);
1323 * <p>createCdmDetailElement</p>
1325 * @param detailType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.DetailType} object.
1326 * @param style a int.
1327 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1328 * @return a {@link eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement} object.
1330 public AbstractCdmDetailElement
createCdmDetailElement(DetailType detailType
, ICdmFormElement parentElement
, int style
){
1331 AbstractCdmDetailElement element
= null;
1334 case SCIENTIFICNAME
:
1335 element
= new NameDetailElement(this, parentElement
, style
);
1338 element
= new ReferenceBaseDetailElement(this, parentElement
, style
);
1340 case NOMENCLATURALREFERENCE
:
1341 element
= new NomenclaturalReferenceDetailElement(this, parentElement
, style
);
1344 element
= new TaxonBaseDetailElement(this, parentElement
, style
);
1347 element
= new AuthorshipDetailElement(this, parentElement
, style
);
1350 element
= new TeamDetailElement(this, parentElement
, style
);
1353 element
= new PersonDetailElement(this, parentElement
, style
);
1356 element
= new DescriptionDetailElement(this, parentElement
, style
);
1358 case DESCRIPTIONELEMENT
:
1359 element
= new DescriptionElementDetailElement(this, parentElement
, style
);
1362 element
= new NonViralNameDetailElement(this, parentElement
);
1364 case DERIVED_UNIT_FACADE
:
1365 element
= new DerivedUnitFacadeDetailElement(this, parentElement
);
1367 case FIELD_OBSERVATION
:
1368 element
= new FieldObservationDetailElement(this, parentElement
);
1370 case GATHERING_EVENT
:
1371 element
= new GatheringEventDetailElement(this, parentElement
);
1374 element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1376 case NATURAL_LANGUAGE
:
1377 element
= new NaturalLanguageDetailElement(this, parentElement
);
1379 case FEATURE_DISTRIBUTION
:
1380 element
= new FeatureDistributionDetailElement(this, parentElement
);
1382 case CLASSIFICATION
:
1383 element
= new ClassificationDetailElement(this, parentElement
);
1386 element
= new TaxonNodeDetailElement(this, parentElement
);
1389 element
= new CollectionDetailElement(this, parentElement
);
1393 if(element
== null){
1394 EditorUtil
.error(this.getClass(), "Detail element was not created. Seems like the case was not implemented for the requested detail type: " + detailType
, null);
1398 parentElement
.addElement(element
);
1404 * @author n.hoffmann
1405 * @created Mar 5, 2010
1408 public static enum EntityDetailType
{
1413 DESCRIPTIONELEMENTSOURCE
,
1417 DESCRIPTIONELEMENTMEDIA
,
1418 MEDIAREPRESENTATION
,
1419 MEDIAREPRESENTATIONPART
,
1421 NOMENCLATURALSTATUS
,
1430 STATISTICAL_MEASUREMENT_VALUE
,
1433 DETERMINATION_EVENT
,
1434 SPECIMEN_COLLECTION
,
1435 IDENTIFIABLE_SOURCE_COLLECTION
1439 * <p>createEntityDetailSection</p>
1441 * @param entityDetailType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.EntityDetailType} object.
1442 * @param style a int.
1443 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1444 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1445 * @return a {@link eu.etaxonomy.taxeditor.forms.AbstractFormSection} object.
1447 public AbstractFormSection
createEntityDetailSection(EntityDetailType entityDetailType
, ConversationHolder conversation
, ICdmFormElement parentElement
, int style
){
1448 AbstractFormSection section
= null;
1450 switch(entityDetailType
){
1452 section
= new TeamDetailSection(this, conversation
, parentElement
, null, style
);
1455 section
= new TeamMemberSection(this, conversation
, parentElement
, style
);
1458 section
= new AnnotationSection(this, conversation
, parentElement
, style
);
1461 section
= new CreditSection(this, conversation
, parentElement
, style
);
1463 case DESCRIPTIONELEMENTSOURCE
:
1464 section
= new DescriptionElementSourceSection(this, conversation
, parentElement
, style
);
1467 section
= new ExtensionSection(this, conversation
, parentElement
, style
);
1470 section
= new MarkerSection(this, conversation
, parentElement
, style
);
1473 section
= new MediaSection(this, conversation
, parentElement
, style
);
1475 case DESCRIPTIONELEMENTMEDIA
:
1476 section
= new DescriptionElementMediaSection(this, conversation
, parentElement
, style
);
1478 case MEDIAREPRESENTATION
:
1479 section
= new MediaRepresentationSection(this, conversation
, parentElement
, style
);
1481 case MEDIAREPRESENTATIONPART
:
1482 section
= new MediaRepresentationPartSection(this, conversation
, parentElement
, style
);
1485 section
= new ModifierSection(this, conversation
, parentElement
, style
);
1487 case NOMENCLATURALSTATUS
:
1488 section
= new NomenclaturalStatusSection(this, conversation
, parentElement
, style
);
1490 case NAME_RELATIONSHIP
:
1491 section
= new NameRelationshipDetailSection(this, conversation
, parentElement
, style
);
1494 section
= new ProtologueSection(this, conversation
, parentElement
, style
);
1497 section
= new RightsSection(this, conversation
, parentElement
, style
);
1500 section
= new SourceSection(this, conversation
, parentElement
, style
);
1503 section
= new ScopeSection(this, conversation
, parentElement
, style
);
1505 case DESCRIPTIONSOURCE
:
1506 section
= new DescriptionSourceSection(this, conversation
, parentElement
, style
);
1508 case TYPEDESIGNATION
:
1509 section
= new TypeDesignationSection(this, conversation
, parentElement
, style
);
1512 section
= new StateDataSection(this, conversation
, parentElement
, style
);
1514 case STATISTICAL_MEASUREMENT_VALUE
:
1515 section
= new StatisticalMeasurementValueSection(this, conversation
, parentElement
, style
);
1517 case DESCRIBED_SPECIMEN
:
1518 section
= new DescribedSpecimenSection(this, conversation
, parentElement
, style
);
1520 case COLLECTING_AREA
:
1521 section
= new CollectingAreasDetailSection(this, conversation
, parentElement
, style
);
1523 case DETERMINATION_EVENT
:
1524 section
= new DeterminationEventDetailSection(this, conversation
, parentElement
, style
);
1526 case SPECIMEN_COLLECTION
:
1527 section
= new SpecimenCollectionDetailSection(this, conversation
, parentElement
, style
);
1529 case IDENTIFIABLE_SOURCE_COLLECTION
:
1530 section
= new SourceCollectionDetailSection(this, conversation
, parentElement
, style
);
1534 parentElement
.addElement(section
);
1540 * <p>createEntityCollectionElement</p>
1542 * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
1543 * @param style a int.
1544 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.AbstractFormSection} object.
1545 * @param versionableEntity a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity} object.
1546 * @param backgroundColor a {@link org.eclipse.swt.graphics.Color} object.
1547 * @return a {@link eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement} object.
1549 public AbstractEntityCollectionElement
createEntityCollectionElement(AbstractFormSection parentElement
, IVersionableEntity versionableEntity
, SelectionListener removeListener
, Color backgroundColor
, int style
){
1550 AbstractEntityCollectionElement element
= null;
1552 VersionableEntity entity
= (VersionableEntity
) HibernateProxyHelper
.deproxy(versionableEntity
);
1554 if(entity
instanceof Annotation
){
1555 element
= new AnnotationElement(this, parentElement
, (Annotation
) entity
, removeListener
, style
);
1557 else if(entity
instanceof Person
){
1558 element
= new TeamMemberElement(this, parentElement
, (Person
) entity
, removeListener
, style
);
1560 else if(entity
instanceof Credit
){
1561 element
= new CreditElement(this, parentElement
, (Credit
) entity
, removeListener
, style
);
1563 else if(entity
instanceof Extension
){
1564 element
= new ExtensionElement(this, parentElement
, (Extension
) entity
, removeListener
, style
);
1566 else if(entity
instanceof Marker
){
1567 element
= new MarkerElement(this, parentElement
, (Marker
) entity
, removeListener
, style
);
1569 else if(entity
instanceof Media
){
1570 element
= new MediaElement(this, parentElement
, (Media
) entity
, removeListener
, style
);
1572 else if(entity
instanceof MediaRepresentation
){
1573 element
= new MediaRepresentationElement(this, parentElement
, (MediaRepresentation
) entity
, removeListener
, style
);
1575 else if(entity
instanceof ImageFile
){
1576 element
= new ImageFileElement(this, parentElement
, (ImageFile
) entity
, removeListener
, style
);
1578 else if(entity
instanceof NomenclaturalStatus
){
1579 element
= new NomenclaturalStatusElement(this, parentElement
, (NomenclaturalStatus
) entity
, removeListener
, style
);
1581 else if(entity
instanceof Rights
){
1582 element
= new RightsElement(this, parentElement
, (Rights
) entity
, removeListener
, style
);
1584 else if(entity
instanceof DescriptionElementSource
){
1585 element
= new DescriptionElementSourceElement(this, parentElement
, (DescriptionElementSource
) entity
, removeListener
, style
);
1587 else if(entity
instanceof IdentifiableSource
){
1588 element
= new IdentifiableSourceElement(this, parentElement
, (IdentifiableSource
) entity
, removeListener
, style
);
1590 else if(entity
instanceof Scope
){
1591 element
= new ScopeElement(this, parentElement
, (Scope
) entity
, removeListener
, style
);
1593 else if(entity
instanceof Modifier
){
1594 element
= new ModifierElement(this, parentElement
, (Modifier
) entity
, removeListener
, style
);
1596 else if(entity
instanceof Reference
){
1597 element
= new DescriptionSourceElement(this, parentElement
, (Reference
) entity
, removeListener
, style
);
1599 else if(entity
instanceof NameTypeDesignation
){
1600 element
= new NameTypeDesignationElement(this, parentElement
, (NameTypeDesignation
) entity
, removeListener
, style
);
1602 else if(entity
instanceof NameRelationship
){
1603 element
= new NameRelationshipDetailElement(this, parentElement
, (NameRelationship
) entity
, removeListener
, style
);
1605 else if(entity
instanceof SpecimenTypeDesignation
){
1606 element
= new SpecimenTypeDesignationElement(this, parentElement
, (SpecimenTypeDesignation
) entity
, removeListener
, style
);
1608 else if(entity
instanceof StateData
){
1609 element
= new StateDataElement(this, parentElement
, (StateData
) entity
, removeListener
, style
);
1611 else if(entity
instanceof StatisticalMeasurementValue
){
1612 element
= new StatisticalMeasurementValueElement(this, parentElement
, (StatisticalMeasurementValue
) entity
, removeListener
, style
);
1614 else if(entity
instanceof DerivedUnit
){
1615 element
= new DerivedUnitElement(this, parentElement
, (DerivedUnit
) entity
, removeListener
, style
);
1617 else if(entity
instanceof NamedArea
){
1618 element
= new CollectingAreasDetailElement(this, parentElement
, (NamedArea
) entity
, removeListener
, style
);
1620 else if(entity
instanceof DeterminationEvent
){
1621 element
= new DeterminationEventDetailElement(this, parentElement
, (DeterminationEvent
) entity
, removeListener
, style
);
1623 else if(entity
instanceof Specimen
){
1624 element
= new SpecimenCollectionDetailElement(this, parentElement
, (Specimen
) entity
, removeListener
, style
);
1627 else if(entity
instanceof DescriptionElementBase
){
1628 // this is the special case for protologs, maybe we can do this differently when API improves
1629 DescriptionElementBase descriptionElement
= (DescriptionElementBase
) entity
;
1630 if(descriptionElement
.getFeature().equals(Feature
.PROTOLOGUE())){
1631 element
= new ProtologueElement(this, parentElement
, descriptionElement
, removeListener
, style
);
1635 if(element
== null){
1636 EditorUtil
.errorDialog("No element for entity", this, "Could not generate element for entity. " +
1637 "Looks like the case is not handled already. Check implementation. Entity: " + entity
, null);
1640 if(backgroundColor
!= null && !backgroundColor
.isDisposed()){
1641 element
.setBackgroundColor(backgroundColor
);
1645 parentElement
.addElement(element
);
1650 * <p>createSelectionElement</p>
1652 * @param selectionType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.SelectionType} object.
1653 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1654 * @param labelString a {@link java.lang.String} object.
1655 * @param selectionType
1656 * @param selection a {@link eu.etaxonomy.cdm.model.common.IAnnotatableEntity} object.
1657 * @param style a int.
1658 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1659 * @return a {@link eu.etaxonomy.taxeditor.forms.selection.AbstractSelectionElement} object.
1661 public AbstractSelectionElement
createSelectionElement(SelectionType selectionType
, ConversationHolder conversation
, ICdmFormElement parentElement
, String labelString
, IAnnotatableEntity selection
, int style
){
1662 AbstractSelectionElement element
= null;
1664 IAnnotatableEntity entity
= (IAnnotatableEntity
) HibernateProxyHelper
.deproxy(selection
);
1666 switch (selectionType
) {
1668 element
= new AgentSelectionElement(this, conversation
, parentElement
, labelString
, (TeamOrPersonBase
) entity
, style
);
1671 element
= new PersonSelectionElement(this, conversation
, parentElement
, labelString
, (Person
) entity
, style
);
1674 element
= new TeamSelectionElement(this, conversation
, parentElement
, labelString
, (Team
) entity
, style
);
1677 element
= new NomenclaturalAuthorTeamSelectionElement(this, conversation
, parentElement
, labelString
, (Team
) entity
, style
);
1680 element
= new InstitutionSelectionElement(this, conversation
, parentElement
, labelString
, (Institution
) entity
, style
);
1683 element
= new NameSelectionElement(this, conversation
, parentElement
, labelString
, (TaxonNameBase
) entity
, style
);
1686 element
= new ReferenceSelectionElement(this, conversation
, parentElement
, labelString
, (Reference
) entity
, style
);
1689 element
= new TaxonBaseSelectionElement(this, conversation
, parentElement
, labelString
, (TaxonBase
) entity
, style
);
1692 element
= new DerivedUnitBaseSelectionElement(this, conversation
, parentElement
, labelString
, (DerivedUnitBase
) entity
, style
);
1694 case FIELD_OBSERVATION
:
1695 element
= new FieldObservationSelectionElement(this, conversation
, parentElement
, labelString
, (FieldObservation
) entity
, style
);
1698 element
= new FeatureTreeSelectionElement(this, conversation
, parentElement
, labelString
, (FeatureTree
) entity
, style
);
1700 case CLASSIFICATION
:
1701 element
= new ClassificationSelectionElement(this, conversation
, parentElement
, labelString
, (Classification
) entity
, style
);
1704 element
= new TaxonNodeSelectionElement(this, conversation
, parentElement
, labelString
, (TaxonNode
) entity
, style
);
1707 element
= new CollectionSelectionElement(this, conversation
, parentElement
, labelString
, (Collection
) entity
, style
);
1710 new RuntimeException("There is no selection composite for the desired selection type.");
1715 parentElement
.addElement(element
);
1720 * <p>createNamedAreaSelectionElement</p>
1722 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1723 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
1724 * @param labelString a {@link java.lang.String} object.
1725 * @param selection a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
1726 * @param style a int.
1727 * @return a {@link eu.etaxonomy.taxeditor.forms.selection.NamedAreaSelectionElement} object.
1729 public NamedAreaSelectionElement
createNamedAreaSelectionElement(ICdmFormElement parentElement
, ConversationHolder conversation
, String labelString
, NamedArea selection
, int style
){
1730 NamedAreaSelectionElement element
= new NamedAreaSelectionElement(this, conversation
, parentElement
, labelString
, selection
, style
);
1732 parentElement
.addElement(element
);
1736 /** {@inheritDoc} */
1737 public LabelElement
createLabel(ICdmFormElement parentElement
, String text
) {
1738 LabelElement labelElement
= new LabelElement(this, parentElement
, text
);
1739 adapt(labelElement
);
1740 parentElement
.addElement(labelElement
);
1741 return labelElement
;
1745 * <p>Getter for the field <code>selectionProvider</code>.</p>
1747 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1749 public ISelectionProvider
getSelectionProvider() {
1750 return selectionProvider
;
1754 * <p>createDetailedDescriptionDetailElement</p>
1756 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
1757 * @param entity a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
1758 * @param style a int.
1759 * @return a {@link eu.etaxonomy.taxeditor.section.description.detail.AbstractDetailedDescriptionDetailElement} object.
1761 public AbstractDetailedDescriptionDetailElement
createDetailedDescriptionDetailElement(
1762 ICdmFormElement parentElement
, DescriptionElementBase entity
, int style
) {
1763 AbstractDetailedDescriptionDetailElement detailedDescriptionElement
= null;
1766 if(entity
instanceof CategoricalData
){
1767 detailedDescriptionElement
= new CategoricalDataDetailElement(this, parentElement
, (CategoricalData
) entity
, style
);
1769 else if(entity
instanceof CommonTaxonName
){
1770 detailedDescriptionElement
= new CommonNameDetailElement(this, parentElement
, (CommonTaxonName
) entity
, style
);
1772 else if(entity
instanceof Distribution
){
1773 detailedDescriptionElement
= new DistributionDetailElement(this, parentElement
, (Distribution
) entity
, style
);
1775 else if(entity
instanceof IndividualsAssociation
){
1776 detailedDescriptionElement
= new IndividualsAssociationDetailElement(this, parentElement
, (IndividualsAssociation
) entity
, style
);
1778 else if(entity
instanceof QuantitativeData
){
1779 detailedDescriptionElement
= new QuantitativeDataDetailElement(this, parentElement
, (QuantitativeData
) entity
, style
);
1781 else if(entity
instanceof TaxonInteraction
){
1782 detailedDescriptionElement
= new TaxonInteractionDetailElement(this, parentElement
, (TaxonInteraction
) entity
, style
);
1784 else if(entity
instanceof TextData
){
1785 detailedDescriptionElement
= new TextDataDetailElement(this, parentElement
, (TextData
) entity
, style
);
1788 throw new IllegalStateException("There is no interface for the given description element");
1790 adapt(detailedDescriptionElement
);
1791 parentElement
.addElement(detailedDescriptionElement
);
1792 return detailedDescriptionElement
;
1798 * Creates a styled text as a part of the form.
1803 * the text initial value
1806 * @return the text widget
1808 public StyledText
createStyledText(Composite parent
, String value
, int style
) {
1809 StyledText text
= new StyledText(parent
, getBorderStyle() | style
| getOrientation());
1811 text
.setText(value
);
1812 text
.setForeground(getColors().getForeground());
1813 text
.setBackground(getColors().getBackground());
1814 // text.addFocusListener(visibilityHandler);