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
createIntegerTextWithLabelElement(
646 ICdmFormElement parentElement
, String labelString
,
647 Integer initialInteger
, int style
) {
648 NumberWithLabelElement element
= new NumberWithLabelElement(this,
649 parentElement
, labelString
, initialInteger
, style
);
651 parentElement
.addElement(element
);
657 * createFloatTextWithLabelElement
660 * @param parentElement
661 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
664 * a {@link java.lang.String} object.
665 * @param initialFloat
669 * @return a {@link eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement}
672 public NumberWithLabelElement
createFloatTextWithLabelElement(
673 ICdmFormElement parentElement
, String labelString
,
674 float initialFloat
, int style
) {
675 NumberWithLabelElement element
= new NumberWithLabelElement(this,
676 parentElement
, labelString
, initialFloat
, style
);
678 parentElement
.addElement(element
);
684 * createLanguageStringWithLabelElement
687 * @param parentElement
688 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
691 * a {@link java.lang.String} object.
692 * @param languageString
693 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
697 * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
700 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
701 ICdmFormElement parentElement
, String labelString
,
702 LanguageString languageString
, int style
) {
703 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
704 this, parentElement
, labelString
, languageString
, style
);
706 parentElement
.addElement(element
);
712 * createLanguageStringWithLabelElement
715 * @param parentElement
716 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
719 * a {@link java.lang.String} object.
720 * @param languageString
721 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
727 * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
730 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
731 ICdmFormElement parentElement
, String labelString
,
732 LanguageString languageString
, int height
, int style
) {
733 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
734 this, parentElement
, labelString
, languageString
, height
, style
);
736 parentElement
.addElement(element
);
745 * @param parentElement
746 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
749 * a {@link java.lang.String} object.
752 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
755 public TextWithLabelElement
createTextElement(
756 ICdmFormElement parentElement
, String initialText
, int style
) {
757 TextWithLabelElement element
= new TextWithLabelElement(this,
758 parentElement
, null, initialText
, null, style
);
760 parentElement
.addElement(element
);
766 * createKeyValueViewerElement
769 * @param parentElement
770 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
773 * a {@link java.lang.String} object.
774 * @param valueHeading
775 * a {@link java.lang.String} object.
777 * a {@link java.util.Map} object.
778 * @return a {@link eu.etaxonomy.taxeditor.ui.element.KeyValueViewerElement}
781 public KeyValueViewerElement
createKeyValueViewerElement(
782 ICdmFormElement parentElement
, String keyHeading
,
783 String valueHeading
, Map
<Object
, Object
> map
) {
784 KeyValueViewerElement element
= new KeyValueViewerElement(this,
785 parentElement
, keyHeading
, valueHeading
, map
);
787 parentElement
.addElement(element
);
793 * createTermComboElement
796 * @param termComboType
798 * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.TermComboType}
800 * @param parentElement
801 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
804 * a {@link java.lang.String} object.
806 * a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase}
810 * @return a {@link eu.etaxonomy.taxeditor.ui.combo.TermComboElement}
814 public <T
extends DefinedTermBase
> TermComboElement
<T
> createTermComboElement(
815 Class
<T
> termComboType
, ICdmFormElement parentElement
,
816 String labelString
, T selection
, int style
) {
817 TermComboElement
<T
> element
= new TermComboElement
<T
>(this, parentElement
, termComboType
, labelString
, selection
, style
);
819 parentElement
.addElement(element
);
825 * createEnumComboElement
828 * @param enumComboType
830 * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EnumComboType}
832 * @param parentElement
833 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
837 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
840 public <T
extends IDefinedTerm
> EnumComboElement
<T
> createEnumComboElement(
841 Class
<T
> enumComboType
, ICdmFormElement parentElement
,
843 EnumComboElement
<T
> element
= new EnumComboElement
<T
>(this, parentElement
, enumComboType
, style
);
845 parentElement
.addElement(element
);
851 * createBrowserElement
855 * a {@link java.net.URI} object.
858 * @param parentElement
859 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
861 * @return a {@link eu.etaxonomy.taxeditor.ui.element.BrowserElement} object.
863 public BrowserElement
createBrowserElement(ICdmFormElement parentElement
,
864 URI imageUri
, int style
) {
865 BrowserElement element
= new BrowserElement(this, parentElement
,
868 parentElement
.addElement(element
);
877 * @param parentElement
878 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
881 * a {@link java.net.URI} object.
884 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ImageElement} object.
886 public ImageElement
createImageElement(ICdmFormElement parentElement
,
887 URI imageUri
, int style
) {
888 ImageElement element
= new ImageElement(this, parentElement
, imageUri
,
891 parentElement
.addElement(element
);
897 * createTextActionElement
901 * a {@link java.lang.String} object.
903 * a {@link java.lang.String} object.
906 * @param parentElement
907 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
910 * a {@link java.lang.String} object.
911 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextActionElement}
914 public TextActionElement
createTextActionElement(
915 ICdmFormElement parentElement
, String labelString
,
916 String buttonLabel
, String initialText
, int style
) {
917 TextActionElement element
= new TextActionElement(this, parentElement
,
918 labelString
, buttonLabel
, initialText
, style
);
920 parentElement
.addElement(element
);
929 * @param parentElement
930 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
933 * a {@link java.lang.String} object.
934 * @param initialState
938 * @return a {@link eu.etaxonomy.taxeditor.ui.element.CheckboxElement} object.
940 public CheckboxElement
createCheckbox(ICdmFormElement parentElement
,
941 String label
, boolean initialState
, int style
) {
942 CheckboxElement element
= new CheckboxElement(this, parentElement
,
943 label
, initialState
, style
| orientation
);
945 parentElement
.addElement(element
);
950 * Creates a section as a part of the form.
952 * @return the section widget
954 * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
957 public Section
adapt(AbstractFormSection section
) {
958 section
.setMenu(section
.getLayoutComposite().getMenu());
959 adapt(section
, true, true);
961 // handle focus and property change events for cdm use
962 section
.addFocusListener(selectionFocusHandler
);
963 section
.setPropertyChangeListeners(propertyChangeListeners
);
965 if (section
.getToggle() != null) {
966 section
.getToggle().setHoverDecorationColor(
967 getColors().getColor(IFormColors
.TB_TOGGLE_HOVER
));
968 section
.getToggle().setDecorationColor(
969 getColors().getColor(IFormColors
.TB_TOGGLE
));
972 section
.setFont(boldFontHolder2
.getBoldFont(section
973 .getLayoutComposite().getFont()));
975 if ((section
.getStyle() & Section
.TITLE_BAR
) != 0
976 || (section
.getStyle() & Section
.SHORT_TITLE_BAR
) != 0) {
977 getColors().initializeSectionToolBarColors();
978 section
.setTitleBarBackground(getColors().getColor(
980 section
.setTitleBarBorderColor(getColors().getColor(
981 IFormColors
.TB_BORDER
));
983 // call setTitleBarForeground regardless as it also sets the label color
984 section
.setTitleBarForeground(getColors().getColor(
985 IFormColors
.TB_TOGGLE
));
989 private class BoldFontHolder2
{
990 private Font normalFont
;
992 private Font boldFont
;
994 public BoldFontHolder2() {
997 public Font
getBoldFont(Font font
) {
998 createBoldFont(font
);
1002 private void createBoldFont(Font font
) {
1003 if (normalFont
== null || !normalFont
.equals(font
)) {
1007 if (boldFont
== null) {
1008 boldFont
= FormFonts
.getInstance().getBoldFont(
1009 getColors().getDisplay(), normalFont
);
1013 public void dispose() {
1014 if (boldFont
!= null) {
1015 FormFonts
.getInstance().markFinished(boldFont
,
1016 getColors().getDisplay());
1024 * createToggleableTextField
1027 * @param parentElement
1028 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1030 * @param labelString
1031 * a {@link java.lang.String} object.
1032 * @param initialText
1033 * a {@link java.lang.String} object.
1034 * @param initialState
1038 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement}
1041 public ToggleableTextElement
createToggleableTextField(
1042 ICdmFormElement parentElement
, String labelString
,
1043 String initialText
, boolean initialState
, int style
) {
1044 ToggleableTextElement element
= new ToggleableTextElement(this,
1045 parentElement
, labelString
, initialText
, initialState
, style
1048 parentElement
.addElement(element
);
1054 * createTimePeriodElement
1057 * @param parentElement
1058 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1060 * @param labelString
1061 * a {@link java.lang.String} object.
1063 * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1066 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TimePeriodElement}
1069 public TimePeriodElement
createTimePeriodElement(
1070 ICdmFormElement parentElement
, String labelString
,
1071 TimePeriod timePeriod
, int style
) {
1072 TimePeriodElement element
= new TimePeriodElement(this, parentElement
,
1073 labelString
, timePeriod
, style
);
1075 parentElement
.addElement(element
);
1081 * createPointElement
1086 * @param parentElement
1087 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1090 * a {@link eu.etaxonomy.cdm.model.location.Point} object.
1091 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PointElement} object.
1093 public PointElement
createPointElement(ICdmFormElement parentElement
,
1094 Point point
, int style
) {
1095 PointElement element
= new PointElement(this, parentElement
, point
,
1098 parentElement
.addElement(element
);
1104 * createDateDetailSection
1107 * @param parentElement
1108 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1112 * @return a {@link eu.etaxonomy.taxeditor.ui.element.DateDetailSection}
1115 public DateDetailSection
createDateDetailSection(
1116 ICdmFormElement parentElement
, int style
) {
1117 DateDetailSection section
= new DateDetailSection(this, parentElement
,
1119 parentElement
.addElement(section
);
1126 * createPartialElement
1129 * @param parentElement
1130 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1132 * @param labelString
1133 * a {@link java.lang.String} object.
1135 * a {@link org.joda.time.Partial} object.
1138 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PartialElement} object.
1140 public PartialElement
createPartialElement(ICdmFormElement parentElement
,
1141 String labelString
, Partial partial
, int style
) {
1142 PartialElement element
= new PartialElement(this, parentElement
,
1143 labelString
, style
);
1145 parentElement
.addElement(element
);
1151 * addSelectionListener
1155 * a {@link org.eclipse.swt.events.SelectionListener} object.
1157 public void addSelectionListener(SelectionListener listener
) {
1158 selectionListenerList
.add(listener
);
1163 * removeSelectionListener
1167 * a {@link org.eclipse.swt.events.SelectionListener} object.
1169 public void removeSelectionListener(SelectionListener listener
) {
1170 if (listener
== null) {
1172 .error(this.getClass(),
1173 "Tried to remove a selection listener from this factories listeners but was null",
1176 selectionListenerList
.remove(listener
);
1182 * addPropertyChangeListener
1186 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1189 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
1190 if(propertyChangeListeners
.contains(listener
)){
1193 propertyChangeListeners
.add(0, listener
);
1198 * removePropertyChangeListener
1202 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1205 public void removePropertyChangeListener(IPropertyChangeListener listener
) {
1206 propertyChangeListeners
.remove(listener
);
1211 * createHorizontalSeparator
1214 * @param parentElement
1215 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1219 * @return a {@link org.eclipse.swt.widgets.Label} object.
1221 public Label
createHorizontalSeparator(ICdmFormElement parentElement
,
1223 Label separator
= this.createSeparator(
1224 parentElement
.getLayoutComposite(), SWT
.HORIZONTAL
| style
);
1225 separator
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY());
1231 * createVersionElement
1234 * @param parentElement
1235 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1238 * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
1243 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
1246 public VersionElement
createVersionElement(ICdmFormElement parentElement
,
1247 VersionableEntity entity
, int style
) {
1248 VersionElement element
= new VersionElement(this, parentElement
,
1251 parentElement
.addElement(element
);
1256 * @param cdmBaseSection
1261 public CdmBaseElement
createCdmBaseElement(ICdmFormElement parentElement
,
1262 CdmBase entity
, int style
) {
1263 CdmBaseElement element
= new CdmBaseElement(this, parentElement
,
1266 parentElement
.addElement(element
);
1273 * createVersionSection
1276 * @param parentElement
1277 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1282 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
1285 public VersionSection
createVersionSection(ICdmFormElement parentElement
,
1287 VersionSection section
= new VersionSection(this, parentElement
, style
);
1288 parentElement
.addElement(section
);
1298 public CdmBaseSection
createCdmBaseSection(ICdmFormElement parentElement
, int style
) {
1299 CdmBaseSection section
= new CdmBaseSection(this, parentElement
, style
);
1300 parentElement
.addElement(section
);
1307 * createEmptyElement
1310 * @param parentElement
1311 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1313 * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1315 public EmptyElement
createEmptyElement(ICdmFormElement parentElement
) {
1316 EmptyElement element
= new EmptyElement(this, parentElement
, null,
1319 parentElement
.addElement(element
);
1325 * createHeadlineSection
1328 * @param parentElement
1329 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1332 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
1335 public HeadlineSection
createHeadlineSection(ICdmFormElement parentElement
) {
1336 HeadlineSection section
= new HeadlineSection(this, parentElement
,
1338 parentElement
.addElement(section
);
1345 * createParsingMessageElement
1348 * @param parentElement
1349 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1351 * @param parserProblem
1352 * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
1357 * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
1360 public ParsingMessageElement
createParsingMessageElement(
1361 ICdmFormElement parentElement
, ParserProblem parserProblem
,
1363 ParsingMessageElement element
= new ParsingMessageElement(this,
1364 parentElement
, parserProblem
, style
);
1366 parentElement
.addElement(element
);
1375 public static enum DetailType
{
1380 DERIVED_UNIT_FACADE
,
1381 DERIVED_UNIT_GENERAL
,
1385 FEATURE_DISTRIBUTION
,
1397 NOMENCLATURALREFERENCE
,
1402 POLYTOMOUS_KEY_NODE
,
1416 public AbstractFormSection
createDefinedTermDetailSection(Class definedTermClass
,
1417 ConversationHolder conversation
, ICdmFormElement parentElement
,
1418 ISelectionProvider selectionProvider
, int style
) {
1420 AbstractFormSection section
= new DefinedTermDetailSection(this, definedTermClass
, conversation
, parentElement
, selectionProvider
, style
);
1422 parentElement
.addElement(section
);
1429 * @param definedTermClass
1430 * @param formElement
1434 public AbstractCdmDetailElement
createDefinedTermDetailElement(
1435 Class definedTermClass
, AbstractCdmDetailSection parentElement
,
1437 AbstractCdmDetailElement element
= null;
1439 if (NamedArea
.class.isAssignableFrom(definedTermClass
)){
1440 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1443 element
= new DefinedTermDetailElement(this, parentElement
);
1447 parentElement
.addElement(element
);
1453 * createCdmDetailSection
1458 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
1460 * @param parentElement
1461 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1463 * @param selectionProvider
1464 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1467 * @param conversation
1468 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1470 * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1473 public AbstractFormSection
createCdmDetailSection(DetailType detailType
,
1474 ConversationHolder conversation
, ICdmFormElement parentElement
,
1475 ISelectionProvider selectionProvider
, int style
) {
1476 AbstractFormSection section
= null;
1478 switch (detailType
) {
1479 case SCIENTIFICNAME
:
1480 section
= new NameDetailSection(this, conversation
, parentElement
,
1481 selectionProvider
, style
);
1484 section
= new ReferenceDetailSection(this, conversation
,
1485 parentElement
, selectionProvider
, style
);
1487 case NOMENCLATURALREFERENCE
:
1488 section
= new NomenclaturalReferenceDetailSection(this,
1489 conversation
, parentElement
, selectionProvider
, style
);
1492 section
= new TaxonBaseDetailSection(this, conversation
,
1493 parentElement
, selectionProvider
, style
);
1496 section
= new AuthorshipDetailSection(this, conversation
,
1497 parentElement
, selectionProvider
, style
);
1499 case TEAMORPERSONBASE
:
1500 section
= new TeamOrPersonBaseDetailSection(this, conversation
,
1501 parentElement
, selectionProvider
, style
);
1504 section
= new TeamDetailSection(this, conversation
, parentElement
,
1508 section
= new PersonDetailSection(this, conversation
,
1509 parentElement
, null, style
);
1512 section
= new DescriptionDetailSection(this, conversation
,
1513 parentElement
, selectionProvider
, style
);
1515 case DESCRIPTIONELEMENT
:
1516 section
= new DescriptionElementDetailSection(this, conversation
,
1517 parentElement
, selectionProvider
, style
);
1519 case PARSINGMESSAGE
:
1520 section
= new ParsingMessagesSection(this, conversation
,
1521 parentElement
, selectionProvider
, style
);
1524 section
= new NonViralNameDetailSection(this, conversation
,
1525 parentElement
, selectionProvider
, style
);
1528 section
= new eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection(
1529 this, conversation
, parentElement
, selectionProvider
, style
);
1531 case DERIVED_UNIT_FACADE
:
1532 section
= new DerivedUnitFacadeDetailSection(this, conversation
,
1533 parentElement
, selectionProvider
, style
);
1535 case FIELD_OBSERVATION
:
1536 section
= new FieldObservationDetailSection(this, conversation
,
1537 parentElement
, selectionProvider
, style
);
1539 case GATHERING_EVENT
:
1540 section
= new GatheringEventDetailSection(this, conversation
,
1541 parentElement
, selectionProvider
, style
);
1544 section
= new DerivedUnitBaseDetailSection(this, conversation
,
1545 parentElement
, selectionProvider
, style
);
1547 case NATURAL_LANGUAGE
:
1548 section
= new NaturalLanguageSection(this, conversation
,
1549 parentElement
, selectionProvider
, style
);
1551 case FEATURE_DISTRIBUTION
:
1552 section
= new FeatureDistributionDetailSection(this, conversation
,
1553 parentElement
, selectionProvider
, style
);
1555 case CLASSIFICATION
:
1556 section
= new ClassificationDetailSection(this, conversation
,
1557 parentElement
, selectionProvider
, style
);
1560 section
= new TaxonNodeDetailSection(this, conversation
,
1561 parentElement
, selectionProvider
, style
);
1563 case POLYTOMOUS_KEY
:
1564 section
= new PolytomousKeyDetailSection(this, conversation
,
1565 parentElement
, selectionProvider
, style
);
1567 case POLYTOMOUS_KEY_NODE
:
1568 section
= new PolytomousKeyNodeDetailSection(this, conversation
,
1569 parentElement
, selectionProvider
, style
);
1572 section
= new InstitutionDetailSection(this, conversation
,
1573 parentElement
, selectionProvider
, style
);
1575 case DERIVED_UNIT_GENERAL
:
1576 section
= new GeneralDetailSection(this, conversation
,
1577 parentElement
, selectionProvider
, style
);
1580 section
= new HybridDetailSection(this, conversation
,
1581 parentElement
, selectionProvider
, style
);
1584 section
= new UserDetailSection(this, conversation
, parentElement
,
1585 selectionProvider
, style
);
1588 section
= new GroupDetailSection(this, conversation
, parentElement
,
1589 selectionProvider
, style
);
1592 section
= new DeterminationDetailSection(this, conversation
, parentElement
,
1593 selectionProvider
, style
);
1595 case TAXON_RELATIONSHIP
:
1596 section
= new TaxonRelationshipDetailSection(this, conversation
, parentElement
,
1597 selectionProvider
, style
);
1599 case REFERENCED_ENTITY
:
1600 section
= new ReferencedEntityDetailSection(this, conversation
, parentElement
,
1601 selectionProvider
, style
);
1603 case TERM_VOCABULARY
:
1604 section
= new TermVocabularyDetailSection(this, conversation
, parentElement
,
1605 selectionProvider
, style
);
1608 section
= new NamedAreaDetailSection(this, conversation
, parentElement
,
1609 selectionProvider
, style
);
1612 section
= new UseRecordDetailSection(this, conversation
, parentElement
,
1613 selectionProvider
, style
);
1618 if (section
== null) {
1619 throw new RuntimeException(
1620 "You tried to create a cdm detail section that is not implemented yet.");
1623 parentElement
.addElement(section
);
1632 * createCdmDetailElement
1637 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
1641 * @param parentElement
1642 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1645 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
1648 public AbstractCdmDetailElement
createCdmDetailElement(
1649 DetailType detailType
, ICdmFormElement parentElement
, int style
) {
1650 AbstractCdmDetailElement element
= null;
1652 switch (detailType
) {
1653 case SCIENTIFICNAME
:
1654 element
= new NameDetailElement(this, parentElement
, style
);
1657 element
= new ReferenceDetailElement(this, parentElement
, style
);
1659 case NOMENCLATURALREFERENCE
:
1660 element
= new NomenclaturalReferenceDetailElement(this,
1661 parentElement
, style
);
1664 element
= new TaxonBaseDetailElement(this, parentElement
, style
);
1667 element
= new AuthorshipDetailElement(this, parentElement
, style
);
1670 element
= new TeamDetailElement(this, parentElement
, style
);
1673 element
= new PersonDetailElement(this, parentElement
, style
);
1676 element
= new DescriptionDetailElement(this, parentElement
, style
);
1678 case DESCRIPTIONELEMENT
:
1679 element
= new DescriptionElementDetailElement(this, parentElement
,
1683 element
= new NonViralNameDetailElement(this, parentElement
);
1685 case DERIVED_UNIT_FACADE
:
1686 element
= new DerivedUnitFacadeDetailElement(this, parentElement
);
1688 case FIELD_OBSERVATION
:
1689 element
= new FieldObservationDetailElement(this, parentElement
);
1691 case GATHERING_EVENT
:
1692 element
= new GatheringEventDetailElement(this, parentElement
);
1695 element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1697 case NATURAL_LANGUAGE
:
1698 element
= new NaturalLanguageDetailElement(this, parentElement
);
1700 case FEATURE_DISTRIBUTION
:
1701 element
= new FeatureDistributionDetailElement(this, parentElement
);
1703 case CLASSIFICATION
:
1704 element
= new ClassificationDetailElement(this, parentElement
);
1707 element
= new TaxonNodeDetailElement(this, parentElement
);
1710 element
= new CollectionDetailElement(this, parentElement
);
1712 case POLYTOMOUS_KEY
:
1713 element
= new PolytomousKeyDetailElement(this, parentElement
);
1715 case POLYTOMOUS_KEY_NODE
:
1716 element
= new PolytomousKeyNodeDetailElement(this, parentElement
);
1719 element
= new InstitutionDetailElement(this, parentElement
);
1721 case DERIVED_UNIT_GENERAL
:
1722 element
= new GeneralDetailElement(this, parentElement
);
1725 element
= new HybridDetailElement(this, parentElement
);
1728 element
= new UserDetailElement(this, parentElement
);
1731 element
= new GroupDetailElement(this, parentElement
);
1733 case GRANTEDAUTHORITY
:
1734 element
= new GrantedAuthorityDetailElement(this, parentElement
);
1737 element
= new DeterminationDetailElement(this, parentElement
);
1739 case TAXON_RELATIONSHIP
:
1740 element
= new TaxonRelationshipDetailElement(this, parentElement
);
1742 case REFERENCED_ENTITY
:
1743 element
= new RefereneEntityDetailElement(this, parentElement
);
1745 case TERM_VOCABULARY
:
1746 element
= new TermVocabularyDetailElement(this, parentElement
);
1749 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1751 case NAMED_AREA_LEVEL
:
1752 element
= new DefinedTermDetailElement
<NamedAreaLevel
>(this, parentElement
);
1755 //element = new UseRecordDetailElement(this, parentElement, style);
1756 element
= new UseRecordDetailElement(this, parentElement
);
1760 if (element
== null) {
1762 .error(this.getClass(),
1763 "Detail element was not created. Seems like the case was not implemented for the requested detail type: "
1764 + detailType
, null);
1768 parentElement
.addElement(element
);
1774 * @author n.hoffmann
1775 * @created Mar 5, 2010
1778 public static enum EntityDetailType
{
1783 DESCRIPTIONELEMENTSOURCE
,
1787 DESCRIPTIONELEMENTMEDIA
,
1788 MEDIAREPRESENTATION
,
1789 MEDIAREPRESENTATIONPART
,
1791 NOMENCLATURALSTATUS
,
1800 STATISTICAL_MEASUREMENT_VALUE
,
1803 DETERMINATION_EVENT
,
1804 SPECIMEN_COLLECTION
,
1805 IDENTIFIABLE_SOURCE_COLLECTION
,
1812 DETERMINATION_CURRENT
,
1813 DETERMINATION_HISTORY
1818 * createEntityDetailSection
1821 * @param entityDetailType
1823 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType}
1827 * @param conversation
1828 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1830 * @param parentElement
1831 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1833 * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1836 public AbstractFormSection
createEntityDetailSection(
1837 EntityDetailType entityDetailType
, ConversationHolder conversation
,
1838 ICdmFormElement parentElement
, int style
) {
1839 AbstractFormSection section
= null;
1841 switch (entityDetailType
) {
1843 section
= new TeamDetailSection(this, conversation
, parentElement
,
1847 section
= new TeamMemberSection(this, conversation
, parentElement
,
1851 section
= new AnnotationSection(this, conversation
, parentElement
,
1855 section
= new CreditSection(this, conversation
, parentElement
,
1858 case DESCRIPTIONELEMENTSOURCE
:
1859 section
= new DescriptionElementSourceSection(this, conversation
,
1860 parentElement
, style
);
1863 section
= new ExtensionSection(this, conversation
, parentElement
,
1867 section
= new MarkerSection(this, conversation
, parentElement
,
1871 section
= new MediaSection(this, conversation
, parentElement
, style
);
1873 case DESCRIPTIONELEMENTMEDIA
:
1874 section
= new DescriptionElementMediaSection(this, conversation
,
1875 parentElement
, style
);
1877 case MEDIAREPRESENTATION
:
1878 section
= new MediaRepresentationSection(this, conversation
,
1879 parentElement
, style
);
1881 case MEDIAREPRESENTATIONPART
:
1882 section
= new MediaRepresentationPartSection(this, conversation
,
1883 parentElement
, style
);
1886 section
= new ModifierSection(this, conversation
, parentElement
,
1889 case NOMENCLATURALSTATUS
:
1890 section
= new NomenclaturalStatusSection(this, conversation
,
1891 parentElement
, style
);
1893 case NAME_RELATIONSHIP
:
1894 section
= new NameRelationshipDetailSection(this, conversation
,
1895 parentElement
, style
);
1898 section
= new ProtologueSection(this, conversation
, parentElement
,
1902 section
= new RightsSection(this, conversation
, parentElement
,
1906 section
= new SourceSection(this, conversation
, parentElement
,
1910 section
= new ScopeSection(this, conversation
, parentElement
, style
);
1912 case DESCRIPTIONSOURCE
:
1913 section
= new DescriptionSourceSection(this, conversation
,
1914 parentElement
, style
);
1916 case TYPEDESIGNATION
:
1917 section
= new TypeDesignationSection(this, conversation
,
1918 parentElement
, style
);
1921 section
= new StateDataSection(this, conversation
, parentElement
,
1924 case STATISTICAL_MEASUREMENT_VALUE
:
1925 section
= new StatisticalMeasurementValueSection(this,
1926 conversation
, parentElement
, style
);
1928 case DESCRIBED_SPECIMEN
:
1929 section
= new DescribedSpecimenSection(this, conversation
,
1930 parentElement
, style
);
1932 case COLLECTING_AREA
:
1933 section
= new CollectingAreasDetailSection(this, conversation
,
1934 parentElement
, style
);
1936 case DETERMINATION_CURRENT
:
1937 section
= new CurrentDeterminationDetailSection(this, conversation
,
1938 parentElement
, style
);
1940 case DETERMINATION_HISTORY
:
1941 section
= new DeterminationHistoryDetailSection(this, conversation
,
1942 parentElement
, style
);
1944 case SPECIMEN_COLLECTION
:
1945 section
= new SpecimenCollectionDetailSection(this, conversation
,
1946 parentElement
, style
);
1948 case IDENTIFIABLE_SOURCE_COLLECTION
:
1949 section
= new SourceCollectionDetailSection(this, conversation
,
1950 parentElement
, style
);
1952 case GEOGRAPHICAL_SCOPE
:
1953 section
= new GeographicalScopeDetailSection(this, conversation
,
1954 parentElement
, style
);
1956 case SCOPE_RESTRICTION
:
1957 section
= new ScopeRestrictionSection(this, conversation
,
1958 parentElement
, style
);
1961 section
= new MemberDetailSection(this, conversation
,
1962 parentElement
, style
);
1964 case GRANTED_AUTHORITY
:
1965 section
= new GrantedAuthorityDetailSection(this, conversation
,
1966 parentElement
, style
);
1968 case GROUPS_BY_USER
:
1969 section
= new GroupsByUserDetailSection(this, conversation
,
1970 parentElement
, style
);
1972 case TAXONOMIC_SCOPE
:
1973 section
= new TaxonomicScopeSection(this, conversation
,
1974 parentElement
, style
);
1977 parentElement
.addElement(section
);
1984 * createEntityCollectionElement
1987 * @param removeListener
1988 * a {@link org.eclipse.swt.events.SelectionListener} object.
1991 * @param parentElement
1992 * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1994 * @param versionableEntity
1995 * a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity}
1997 * @param backgroundColor
1998 * a {@link org.eclipse.swt.graphics.Color} object.
2000 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement}
2003 public AbstractEntityCollectionElement
createEntityCollectionElement(
2004 AbstractFormSection parentElement
, Object versionableEntity
,
2005 SelectionListener removeListener
, Color backgroundColor
, int style
) {
2006 AbstractEntityCollectionElement element
= null;
2008 Object entity
= HibernateProxyHelper
.deproxy(versionableEntity
);
2010 if (entity
instanceof Annotation
) {
2011 element
= new AnnotationElement(this, parentElement
,
2012 (Annotation
) entity
, removeListener
, style
);
2013 } else if (entity
instanceof Person
) {
2014 element
= new TeamMemberElement(this, parentElement
,
2015 (Person
) entity
, removeListener
, style
);
2016 } else if (entity
instanceof Credit
) {
2017 element
= new CreditElement(this, parentElement
, (Credit
) entity
,
2018 removeListener
, style
);
2019 } else if (entity
instanceof Extension
) {
2020 element
= new ExtensionElement(this, parentElement
,
2021 (Extension
) entity
, removeListener
, style
);
2022 } else if (entity
instanceof Marker
) {
2023 element
= new MarkerElement(this, parentElement
, (Marker
) entity
,
2024 removeListener
, style
);
2025 } else if (entity
instanceof Media
) {
2026 element
= new MediaElement(this, parentElement
, (Media
) entity
,
2027 removeListener
, style
);
2028 } else if (entity
instanceof MediaRepresentation
) {
2029 element
= new MediaRepresentationElement(this, parentElement
,
2030 (MediaRepresentation
) entity
, removeListener
, style
);
2031 } else if (entity
instanceof ImageFile
) {
2032 element
= new ImageFileElement(this, parentElement
,
2033 (ImageFile
) entity
, removeListener
, style
);
2034 } else if (entity
instanceof MediaRepresentationPart
){
2035 element
= new MediaRepresentationPartElement(this, parentElement
,
2036 (MediaRepresentationPart
) entity
, removeListener
, style
);
2037 } else if (entity
instanceof NomenclaturalStatus
) {
2038 element
= new NomenclaturalStatusElement(this, parentElement
,
2039 (NomenclaturalStatus
) entity
, removeListener
, style
);
2040 } else if (entity
instanceof Rights
) {
2041 element
= new RightsElement(this, parentElement
, (Rights
) entity
,
2042 removeListener
, style
);
2043 } else if (entity
instanceof DescriptionElementSource
) {
2044 element
= new DescriptionElementSourceElement(this, parentElement
,
2045 (DescriptionElementSource
) entity
, removeListener
, style
);
2046 } else if (entity
instanceof IdentifiableSource
) {
2047 element
= new IdentifiableSourceElement(this, parentElement
,
2048 (IdentifiableSource
) entity
, removeListener
, style
);
2049 } else if (entity
instanceof DefinedTerm
) {
2051 element
= new ScopeElement(this, parentElement
, (DefinedTerm
) entity
,
2052 removeListener
, style
);
2053 } else if (entity
instanceof DefinedTerm
) {
2054 element
= new ModifierElement(this, parentElement
,
2055 (DefinedTerm
) entity
, removeListener
, style
);
2056 } else if (entity
instanceof Reference
) {
2057 element
= new DescriptionSourceElement(this, parentElement
,
2058 (Reference
) entity
, removeListener
, style
);
2059 } else if (entity
instanceof NameTypeDesignation
) {
2060 element
= new NameTypeDesignationElement(this, parentElement
,
2061 (NameTypeDesignation
) entity
, removeListener
, style
);
2062 } else if (entity
instanceof NameRelationship
) {
2063 element
= new NameRelationshipDetailElement(this, parentElement
,
2064 (NameRelationship
) entity
, removeListener
, style
);
2065 } else if (entity
instanceof SpecimenTypeDesignation
) {
2066 element
= new SpecimenTypeDesignationElement(this, parentElement
,
2067 (SpecimenTypeDesignation
) entity
, removeListener
, style
);
2068 } else if (entity
instanceof StateData
) {
2069 element
= new StateDataElement(this, parentElement
,
2070 (StateData
) entity
, removeListener
, style
);
2071 } else if (entity
instanceof StatisticalMeasurementValue
) {
2072 element
= new StatisticalMeasurementValueElement(this,
2073 parentElement
, (StatisticalMeasurementValue
) entity
,
2074 removeListener
, style
);
2075 } else if (entity
instanceof DerivedUnit
) {
2077 element
= new DerivedUnitElement(this, parentElement
,
2078 (DerivedUnit
) entity
, removeListener
, style
);
2079 } else if (entity
instanceof NamedArea
) {
2080 element
= new NamedAreaDetailElement(this, parentElement
,
2081 (NamedArea
) entity
, removeListener
, style
);
2082 } else if (entity
instanceof DeterminationEvent
) {
2083 element
= new DeterminationEventDetailElement(this, parentElement
,
2084 (DeterminationEvent
) entity
, removeListener
, style
);
2085 } else if (entity
instanceof DerivedUnit
) {
2087 element
= new SpecimenCollectionDetailElement(this, parentElement
,
2088 (DerivedUnit
) entity
, removeListener
, style
);
2089 } else if (entity
instanceof User
) {
2090 element
= new MemberDetailElement(this, parentElement
,
2091 (User
) entity
, removeListener
, style
);
2092 } else if (entity
instanceof GrantedAuthority
) {
2093 element
= new GrantedAuthorityCollectionElement(this, parentElement
,
2094 (GrantedAuthorityImpl
) entity
, removeListener
, style
);
2095 } else if (entity
instanceof Group
) {
2096 element
= new GroupsByUserDetailElement(this, parentElement
,
2097 (Group
) entity
, removeListener
, style
);
2098 } else if (entity
instanceof Taxon
) {
2099 element
= new TaxonDetailElement(this, parentElement
,
2100 (Taxon
) entity
, removeListener
, style
);
2101 } else if (entity
instanceof DescriptionElementBase
) {
2102 // this is the special case for protologs, maybe we can do this
2103 // differently when API improves
2104 DescriptionElementBase descriptionElement
= (DescriptionElementBase
) entity
;
2105 if (descriptionElement
.getFeature().equals(Feature
.PROTOLOGUE())) {
2106 element
= new ProtologueElement(this, parentElement
,
2107 descriptionElement
, removeListener
, style
);
2111 if (element
== null) {
2114 "No element for entity",
2116 "Could not generate element for entity. "
2117 + "Looks like the case is not handled already. Check implementation. Entity: "
2122 if (backgroundColor
!= null && !backgroundColor
.isDisposed()) {
2123 element
.setPersistentBackground(backgroundColor
);
2127 parentElement
.addElement(element
);
2133 * Creates a selection element for the given type T.
2136 * <strong>Selection elements not handled by this method:</strong>
2138 * <li>{@link TaxonNodeSelectionElement} see {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}</li>
2139 * <li>{@link NomenclaturalAuthorTeamSelectionElement} see {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}</li>
2144 * a {@link Class} object of the type that you want the selection element to handle
2145 * @param parentElement
2146 * a {@link ICdmFormElement}
2148 * @param labelString
2149 * a {@link String} object.
2150 * @param selectionType
2152 * a {@link ICdmBase} object.
2155 * @param conversation
2156 * a {@link ConversationHolder} object.
2158 * {@link EntitySelectionElement}
2161 public <T
extends ICdmBase
> EntitySelectionElement
<T
> createSelectionElement(
2162 Class
<T
> clazz
, ConversationHolder conversation
,
2163 ICdmFormElement parentElement
, String labelString
,
2164 T selection
, int mode
, int style
) {
2165 EntitySelectionElement
<T
> element
= new EntitySelectionElement
<T
>(this, conversation
, parentElement
, clazz
, labelString
, selection
, mode
, style
);
2167 parentElement
.addElement(element
);
2171 public TaxonNodeSelectionElement
createTaxonNodeSelectionElement(
2172 ConversationHolder conversation
,
2173 ICdmFormElement parentElement
, String labelString
,
2174 TaxonNode selection
, int mode
, int style
) {
2175 TaxonNodeSelectionElement element
= new TaxonNodeSelectionElement(this, conversation
, parentElement
, labelString
, selection
, mode
, style
);
2177 parentElement
.addElement(element
);
2181 public NomenclaturalAuthorTeamSelectionElement
createNomenclaturalAuthorTeamSelectionElement(
2182 ConversationHolder conversation
,
2183 ICdmFormElement parentElement
, String labelString
,
2184 Team selection
, int mode
, int style
) {
2185 NomenclaturalAuthorTeamSelectionElement element
= new NomenclaturalAuthorTeamSelectionElement(this, conversation
, parentElement
, labelString
, selection
, mode
, style
);
2187 parentElement
.addElement(element
);
2192 /** {@inheritDoc} */
2193 public LabelElement
createLabel(ICdmFormElement parentElement
, String text
) {
2194 LabelElement labelElement
= new LabelElement(this, parentElement
, text
);
2195 adapt(labelElement
);
2196 parentElement
.addElement(labelElement
);
2197 return labelElement
;
2202 * Getter for the field <code>selectionProvider</code>.
2205 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
2207 public ISelectionProvider
getSelectionProvider() {
2208 return selectionProvider
;
2213 * createDetailedDescriptionDetailElement
2216 * @param parentElement
2217 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
2221 * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
2226 * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
2229 public AbstractDetailedDescriptionDetailElement
createDetailedDescriptionDetailElement(
2230 ICdmFormElement parentElement
, DescriptionElementBase entity
,
2232 AbstractDetailedDescriptionDetailElement detailedDescriptionElement
= null;
2234 if (entity
instanceof CategoricalData
) {
2235 detailedDescriptionElement
= new CategoricalDataDetailElement(this,
2236 parentElement
, (CategoricalData
) entity
, style
);
2237 } else if (entity
instanceof CommonTaxonName
) {
2238 detailedDescriptionElement
= new CommonNameDetailElement(this,
2239 parentElement
, (CommonTaxonName
) entity
, style
);
2240 } else if (entity
instanceof Distribution
) {
2241 detailedDescriptionElement
= new DistributionDetailElement(this,
2242 parentElement
, (Distribution
) entity
, style
);
2243 } else if (entity
instanceof IndividualsAssociation
) {
2244 detailedDescriptionElement
= new IndividualsAssociationDetailElement(
2245 this, parentElement
, (IndividualsAssociation
) entity
, style
);
2246 } else if (entity
instanceof QuantitativeData
) {
2247 detailedDescriptionElement
= new QuantitativeDataDetailElement(
2248 this, parentElement
, (QuantitativeData
) entity
, style
);
2249 } else if (entity
instanceof TaxonInteraction
) {
2250 detailedDescriptionElement
= new TaxonInteractionDetailElement(
2251 this, parentElement
, (TaxonInteraction
) entity
, style
);
2252 } else if (entity
instanceof TextData
) {
2253 detailedDescriptionElement
= new TextDataDetailElement(this,
2254 parentElement
, (TextData
) entity
, style
);
2256 throw new IllegalStateException(
2257 "There is no interface for the given description element");
2259 adapt(detailedDescriptionElement
);
2260 parentElement
.addElement(detailedDescriptionElement
);
2261 return detailedDescriptionElement
;
2266 * Creates a styled text as a part of the form.
2271 * the text initial value
2274 * @return the text widget
2276 public StyledText
createStyledText(Composite parent
, String value
, int style
) {
2277 StyledText text
= new StyledText(parent
, getBorderStyle() | style
2278 | getOrientation());
2280 text
.setText(value
);
2281 text
.setForeground(getColors().getForeground());
2282 text
.setBackground(getColors().getBackground());
2283 // text.addFocusListener(visibilityHandler);