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
.DefinedTermBase
;
50 import eu
.etaxonomy
.cdm
.model
.common
.DescriptionElementSource
;
51 import eu
.etaxonomy
.cdm
.model
.common
.Extension
;
52 import eu
.etaxonomy
.cdm
.model
.common
.GrantedAuthorityImpl
;
53 import eu
.etaxonomy
.cdm
.model
.common
.Group
;
54 import eu
.etaxonomy
.cdm
.model
.common
.ICdmBase
;
55 import eu
.etaxonomy
.cdm
.model
.common
.IDefinedTerm
;
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
.TimePeriod
;
61 import eu
.etaxonomy
.cdm
.model
.common
.User
;
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
.IndividualsAssociation
;
69 import eu
.etaxonomy
.cdm
.model
.description
.KeyStatement
;
70 import eu
.etaxonomy
.cdm
.model
.description
.Modifier
;
71 import eu
.etaxonomy
.cdm
.model
.description
.QuantitativeData
;
72 import eu
.etaxonomy
.cdm
.model
.description
.Scope
;
73 import eu
.etaxonomy
.cdm
.model
.description
.StateData
;
74 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasurementValue
;
75 import eu
.etaxonomy
.cdm
.model
.description
.TaxonInteraction
;
76 import eu
.etaxonomy
.cdm
.model
.description
.TextData
;
77 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
78 import eu
.etaxonomy
.cdm
.model
.location
.NamedAreaLevel
;
79 import eu
.etaxonomy
.cdm
.model
.location
.Point
;
80 import eu
.etaxonomy
.cdm
.model
.media
.ImageFile
;
81 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
82 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
83 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentationPart
;
84 import eu
.etaxonomy
.cdm
.model
.media
.Rights
;
85 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationship
;
86 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignation
;
87 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
88 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignation
;
89 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
90 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationEvent
;
91 import eu
.etaxonomy
.cdm
.model
.occurrence
.Specimen
;
92 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
93 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
94 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
95 import eu
.etaxonomy
.cdm
.strategy
.parser
.ParserProblem
;
96 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
97 import eu
.etaxonomy
.taxeditor
.ui
.combo
.EnumComboElement
;
98 import eu
.etaxonomy
.taxeditor
.ui
.combo
.TermComboElement
;
99 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.IOpenUrlEnabled
;
100 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.OpenUrlSelectorElement
;
101 import eu
.etaxonomy
.taxeditor
.ui
.password
.EditPasswordElement
;
102 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
103 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailSection
;
104 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
105 import eu
.etaxonomy
.taxeditor
.ui
.section
.EmptyElement
;
106 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailElement
;
107 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailSection
;
108 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailElement
;
109 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailSection
;
110 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailElement
;
111 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailSection
;
112 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberElement
;
113 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberSection
;
114 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamOrPersonBaseDetailSection
;
115 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailElement
;
116 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailSection
;
117 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailElement
;
118 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailSection
;
119 import eu
.etaxonomy
.taxeditor
.ui
.section
.common
.ReferencedEntityDetailSection
;
120 import eu
.etaxonomy
.taxeditor
.ui
.section
.common
.RefereneEntityDetailElement
;
121 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DerivedUnitElement
;
122 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescribedSpecimenSection
;
123 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailElement
;
124 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailSection
;
125 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailElement
;
126 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailSection
;
127 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementMediaSection
;
128 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceElement
;
129 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceSection
;
130 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceElement
;
131 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceSection
;
132 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierElement
;
133 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierSection
;
134 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageDetailElement
;
135 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageSection
;
136 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeElement
;
137 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeSection
;
138 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataElement
;
139 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataSection
;
140 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueElement
;
141 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueSection
;
142 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.AbstractDetailedDescriptionDetailElement
;
143 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CategoricalDataDetailElement
;
144 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CommonNameDetailElement
;
145 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.DistributionDetailElement
;
146 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.IndividualsAssociationDetailElement
;
147 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.QuantitativeDataDetailElement
;
148 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TaxonInteractionDetailElement
;
149 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TextDataDetailElement
;
150 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailElement
;
151 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailSection
;
152 import eu
.etaxonomy
.taxeditor
.ui
.section
.grantedAuthority
.GrantedAuthorityCollectionElement
;
153 import eu
.etaxonomy
.taxeditor
.ui
.section
.grantedAuthority
.GrantedAuthorityDetailElement
;
154 import eu
.etaxonomy
.taxeditor
.ui
.section
.grantedAuthority
.GrantedAuthorityDetailSection
;
155 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailElement
;
156 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailSection
;
157 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailElement
;
158 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailSection
;
159 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.GeographicalScopeDetailSection
;
160 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailElement
;
161 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailSection
;
162 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailElement
;
163 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailSection
;
164 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.ScopeRestrictionSection
;
165 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.TaxonomicScopeSection
;
166 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.ImageFileElement
;
167 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaElement
;
168 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationElement
;
169 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationPartElement
;
170 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationPartSection
;
171 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationSection
;
172 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaSection
;
173 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailElement
;
174 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailSection
;
175 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailElement
;
176 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailSection
;
177 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailElement
;
178 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailSection
;
179 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailElement
;
180 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailSection
;
181 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameTypeDesignationElement
;
182 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusElement
;
183 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusSection
;
184 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailElement
;
185 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailSection
;
186 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueElement
;
187 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueSection
;
188 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.SpecimenTypeDesignationElement
;
189 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.TypeDesignationSection
;
190 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectingAreasDetailSection
;
191 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectionDetailElement
;
192 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CurrentDeterminationDetailSection
;
193 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailElement
;
194 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailSection
;
195 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailElement
;
196 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailSection
;
197 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailElement
;
198 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailSection
;
199 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationEventDetailElement
;
200 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationHistoryDetailSection
;
201 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailElement
;
202 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailSection
;
203 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailElement
;
204 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailSection
;
205 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailElement
;
206 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailSection
;
207 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.NamedAreaDetailElement
;
208 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SourceCollectionDetailSection
;
209 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailElement
;
210 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailSection
;
211 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailElement
;
212 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailSection
;
213 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailElement
;
214 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailSection
;
215 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationElement
;
216 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationSection
;
217 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CdmBaseElement
;
218 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CdmBaseSection
;
219 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditElement
;
220 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditSection
;
221 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionElement
;
222 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionSection
;
223 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.HeadlineSection
;
224 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.IdentifiableSourceElement
;
225 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerElement
;
226 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerSection
;
227 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsElement
;
228 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
229 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.SourceSection
;
230 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionElement
;
231 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionSection
;
232 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessageElement
;
233 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
234 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailElement
;
235 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
236 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonDetailElement
;
237 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailElement
;
238 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailSection
;
239 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailElement
;
240 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailSection
;
241 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailElement
;
242 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailSection
;
243 import eu
.etaxonomy
.taxeditor
.ui
.section
.userecords
.UseRecordDetailElement
;
244 import eu
.etaxonomy
.taxeditor
.ui
.section
.userecords
.UseRecordDetailSection
;
245 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.DefinedTermDetailElement
;
246 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.DefinedTermDetailSection
;
247 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailSection
;
248 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailElement
;
249 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailSection
;
250 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
251 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NomenclaturalAuthorTeamSelectionElement
;
252 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonNodeSelectionElement
;
256 * CdmFormFactory class.
260 * @created Feb 24, 2010
263 public class CdmFormFactory
extends FormToolkit
{
265 private BoldFontHolder2 boldFontHolder2
;
266 private MouseListener selectionMouseHandler
;
267 private FocusListener selectionFocusHandler
;
269 private final Set selectionListenerList
= new HashSet();
271 private final List
<IPropertyChangeListener
> propertyChangeListeners
= new ArrayList
<IPropertyChangeListener
>();
273 private final int orientation
= Window
.getDefaultOrientation();
274 private ISelectionProvider selectionProvider
;
276 /** Constant <code>EMPTY_SELECTION</code> */
277 public static ISelection EMPTY_SELECTION
= new ISelection() {
279 public boolean isEmpty() {
290 private class SelectionMouseHandler
extends MouseAdapter
{
292 public void mouseDown(MouseEvent e
) {
293 notifySelectionListeners(e
);
303 private class SelectionFocusHandler
extends FocusAdapter
{
305 public void focusGained(FocusEvent e
) {
306 notifySelectionListeners(e
);
310 private void notifySelectionListeners(TypedEvent e
) {
311 Event event
= new Event();
312 event
.widget
= e
.widget
;
313 SelectionEvent selectionEvent
= new SelectionEvent(event
);
315 for (Object listener
: selectionListenerList
) {
316 ((SelectionListener
) listener
).widgetSelected(selectionEvent
);
322 * Constructor for CdmFormFactory.
326 * a {@link org.eclipse.swt.widgets.Display} object.
327 * @param selectionProvider
328 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
330 public CdmFormFactory(Display display
, ISelectionProvider selectionProvider
) {
332 this.selectionProvider
= selectionProvider
;
338 * Constructor for CdmFormFactory.
342 * a {@link org.eclipse.swt.widgets.Display} object.
344 public CdmFormFactory(Display display
) {
352 private void init() {
353 boldFontHolder2
= new BoldFontHolder2();
354 selectionMouseHandler
= new SelectionMouseHandler();
355 selectionFocusHandler
= new SelectionFocusHandler();
359 * Creates an instance initialized with the correct selectionProvider
361 * Make sure to remove the instance when the entityComposite disposes via
362 * destroySelectionArbitrator(..)
364 * @param entityElement
365 * a {@link eu.etaxonomy.taxeditor.ui.element.IEntityElement}
367 * @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
370 public SelectionArbitrator
createSelectionArbitrator(
371 IEntityElement entityElement
) {
372 SelectionArbitrator selectionArbitrator
= new SelectionArbitrator(
374 selectionArbitrator
.addSelectionProvider(selectionProvider
);
375 selectionProvider
.addSelectionChangedListener(selectionArbitrator
);
376 addSelectionListener(selectionArbitrator
);
377 return selectionArbitrator
;
382 * destroySelectionArbitrator
385 * @param selectionArbitrator
386 * a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
389 public void destroySelectionArbitrator(
390 SelectionArbitrator selectionArbitrator
) {
391 removeSelectionListener(selectionArbitrator
);
392 if (selectionProvider
!= null) {
394 .removeSelectionChangedListener(selectionArbitrator
);
397 .error(this.getClass(),
398 "Tried to destroy a selection listener from this factories listeners but was null",
405 public void adapt(Composite composite
) {
406 composite
.addMouseListener(selectionMouseHandler
);
407 super.adapt(composite
);
417 * {@link eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement}
420 public void adapt(AbstractCdmFormElement formElement
) {
421 formElement
.setPropertyChangeListeners(propertyChangeListeners
);
426 public void adapt(Control control
, boolean trackFocus
, boolean trackKeyboard
) {
428 control
.addFocusListener(selectionFocusHandler
);
430 super.adapt(control
, trackFocus
, trackKeyboard
);
439 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
442 public void destroyElement(ICdmFormElement formElement
) {
443 // return if element was not initialized
444 if (formElement
== null) {
447 // destroy selection arbitrator, if any
448 if (formElement
instanceof ISelectableElement
) {
449 destroySelectionArbitrator(((ISelectableElement
) formElement
)
450 .getSelectionArbitrator());
452 // remove this element form its parents list of elements
453 // ICdmFormElement parentElement = formElement.getParentElement();
454 // if(parentElement != null){
455 // parentElement.removeElement(formElement);
457 // call destroy on child elements recursively
458 for (ICdmFormElement childElement
: formElement
.getElements()) {
459 destroyElement(childElement
);
461 // dispose of the controls
462 for (Control control
: formElement
.getControls()) {
463 // we added the layoutComposite of the parental element as the
464 // layout composite to this formElement
465 // but we do not want to destroy it.
466 if (control
.equals(formElement
.getLayoutComposite())) {
481 * a {@link org.eclipse.swt.widgets.Composite} object.
482 * @return a {@link org.eclipse.swt.widgets.Label} object.
484 public Label
createEmptyCell(Composite parent
) {
485 return this.createLabel(parent
, null);
490 * createMultilineTextWithLabel
494 * a {@link java.lang.String} object.
499 * @param parentElement
500 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
502 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
505 public TextWithLabelElement
createMultilineTextWithLabel(
506 ICdmFormElement parentElement
, String labelString
, int textHeight
,
508 TextWithLabelElement element
= new TextWithLabelElement(this,
509 parentElement
, labelString
, "", textHeight
, style
);
511 parentElement
.addElement(element
);
517 * createMultiLanguageTextElement
520 * @param parentElement
521 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
524 * a {@link java.lang.String} object.
525 * @param multilanguageText
526 * a {@link java.util.Map} object.
532 * {@link eu.etaxonomy.taxeditor.ui.element.MultilanguageTextElement}
535 public MultilanguageTextElement
createMultiLanguageTextElement(
536 ICdmFormElement parentElement
, String labelString
,
537 Map
<Language
, LanguageString
> multilanguageText
, int textHeight
,
539 MultilanguageTextElement element
= new MultilanguageTextElement(this,
540 parentElement
, labelString
, multilanguageText
, textHeight
,
543 parentElement
.addElement(element
);
547 public KeyStatementElement
createKeyStatementElement(
548 ICdmFormElement parentElement
, String labelString
,
549 KeyStatement keyStatement
, int textHeight
, int style
) {
550 KeyStatementElement element
= new KeyStatementElement(this,
551 parentElement
, labelString
, keyStatement
, textHeight
, style
);
553 parentElement
.addElement(element
);
559 * createTextWithLabelElement
563 * a {@link java.lang.String} object.
565 * a {@link java.lang.String} object.
568 * @param parentElement
569 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
571 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
574 public TextWithLabelElement
createTextWithLabelElement(
575 ICdmFormElement parentElement
, String labelString
,
576 String initialText
, int style
) {
577 TextWithLabelElement element
= new TextWithLabelElement(this,
578 parentElement
, labelString
, initialText
, null, style
);
580 parentElement
.addElement(element
);
584 public UriWithLabelElement
createUriWithLabelElement(
585 ICdmFormElement parentElement
, String labelString
, URI initialUri
,
587 UriWithLabelElement element
= new UriWithLabelElement(this,
588 parentElement
, labelString
, initialUri
, null, style
);
590 parentElement
.addElement(element
);
601 public OpenUrlSelectorElement
createOpenUrlSelectorElement(
602 ICdmFormElement parentElement
, String labelString
,
603 IOpenUrlEnabled openUrlEnabled
, int style
) {
604 OpenUrlSelectorElement element
= new OpenUrlSelectorElement(this,
605 parentElement
, labelString
, openUrlEnabled
, style
);
607 parentElement
.addElement(element
);
613 * @param parentElement
615 * @param conversationEnabled
620 public EditPasswordElement
createEditPasswordElement(
621 ICdmFormElement parentElement
, String labelString
,
622 ConversationHolder conversation
, User user
, int style
) {
623 EditPasswordElement element
= new EditPasswordElement(this,
624 parentElement
, labelString
, user
, conversation
);
626 parentElement
.addElement(element
);
632 * createIntegerTextWithLabelElement
635 * @param parentElement
636 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
639 * a {@link java.lang.String} object.
640 * @param initialInteger
641 * a {@link java.lang.Integer} object.
644 * @return a {@link eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement}
647 public NumberWithLabelElement
createIntegerTextWithLabelElement(
648 ICdmFormElement parentElement
, String labelString
,
649 Integer initialInteger
, int style
) {
650 NumberWithLabelElement element
= new NumberWithLabelElement(this,
651 parentElement
, labelString
, initialInteger
, style
);
653 parentElement
.addElement(element
);
659 * createFloatTextWithLabelElement
662 * @param parentElement
663 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
666 * a {@link java.lang.String} object.
667 * @param initialFloat
671 * @return a {@link eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement}
674 public NumberWithLabelElement
createFloatTextWithLabelElement(
675 ICdmFormElement parentElement
, String labelString
,
676 float initialFloat
, int style
) {
677 NumberWithLabelElement element
= new NumberWithLabelElement(this,
678 parentElement
, labelString
, initialFloat
, style
);
680 parentElement
.addElement(element
);
686 * createLanguageStringWithLabelElement
689 * @param parentElement
690 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
693 * a {@link java.lang.String} object.
694 * @param languageString
695 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
699 * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
702 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
703 ICdmFormElement parentElement
, String labelString
,
704 LanguageString languageString
, int style
) {
705 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
706 this, parentElement
, labelString
, languageString
, style
);
708 parentElement
.addElement(element
);
714 * createLanguageStringWithLabelElement
717 * @param parentElement
718 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
721 * a {@link java.lang.String} object.
722 * @param languageString
723 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
729 * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
732 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(
733 ICdmFormElement parentElement
, String labelString
,
734 LanguageString languageString
, int height
, int style
) {
735 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(
736 this, parentElement
, labelString
, languageString
, height
, style
);
738 parentElement
.addElement(element
);
747 * @param parentElement
748 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
751 * a {@link java.lang.String} object.
754 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
757 public TextWithLabelElement
createTextElement(
758 ICdmFormElement parentElement
, String initialText
, int style
) {
759 TextWithLabelElement element
= new TextWithLabelElement(this,
760 parentElement
, null, initialText
, null, style
);
762 parentElement
.addElement(element
);
768 * createKeyValueViewerElement
771 * @param parentElement
772 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
775 * a {@link java.lang.String} object.
776 * @param valueHeading
777 * a {@link java.lang.String} object.
779 * a {@link java.util.Map} object.
780 * @return a {@link eu.etaxonomy.taxeditor.ui.element.KeyValueViewerElement}
783 public KeyValueViewerElement
createKeyValueViewerElement(
784 ICdmFormElement parentElement
, String keyHeading
,
785 String valueHeading
, Map
<Object
, Object
> map
) {
786 KeyValueViewerElement element
= new KeyValueViewerElement(this,
787 parentElement
, keyHeading
, valueHeading
, map
);
789 parentElement
.addElement(element
);
795 * createTermComboElement
798 * @param termComboType
800 * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.TermComboType}
802 * @param parentElement
803 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
806 * a {@link java.lang.String} object.
808 * a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase}
812 * @return a {@link eu.etaxonomy.taxeditor.ui.combo.TermComboElement}
816 public <T
extends DefinedTermBase
> TermComboElement
<T
> createTermComboElement(
817 Class
<T
> termComboType
, ICdmFormElement parentElement
,
818 String labelString
, T selection
, int style
) {
819 TermComboElement
<T
> element
= new TermComboElement
<T
>(this, parentElement
, termComboType
, labelString
, selection
, style
);
821 parentElement
.addElement(element
);
827 * createEnumComboElement
830 * @param enumComboType
832 * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EnumComboType}
834 * @param parentElement
835 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
839 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
842 public <T
extends IDefinedTerm
> EnumComboElement
<T
> createEnumComboElement(
843 Class
<T
> enumComboType
, ICdmFormElement parentElement
,
845 EnumComboElement
<T
> element
= new EnumComboElement
<T
>(this, parentElement
, enumComboType
, style
);
847 parentElement
.addElement(element
);
853 * createBrowserElement
857 * a {@link java.net.URI} object.
860 * @param parentElement
861 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
863 * @return a {@link eu.etaxonomy.taxeditor.ui.element.BrowserElement} object.
865 public BrowserElement
createBrowserElement(ICdmFormElement parentElement
,
866 URI imageUri
, int style
) {
867 BrowserElement element
= new BrowserElement(this, parentElement
,
870 parentElement
.addElement(element
);
879 * @param parentElement
880 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
883 * a {@link java.net.URI} object.
886 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ImageElement} object.
888 public ImageElement
createImageElement(ICdmFormElement parentElement
,
889 URI imageUri
, int style
) {
890 ImageElement element
= new ImageElement(this, parentElement
, imageUri
,
893 parentElement
.addElement(element
);
899 * createTextActionElement
903 * a {@link java.lang.String} object.
905 * a {@link java.lang.String} object.
908 * @param parentElement
909 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
912 * a {@link java.lang.String} object.
913 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextActionElement}
916 public TextActionElement
createTextActionElement(
917 ICdmFormElement parentElement
, String labelString
,
918 String buttonLabel
, String initialText
, int style
) {
919 TextActionElement element
= new TextActionElement(this, parentElement
,
920 labelString
, buttonLabel
, initialText
, style
);
922 parentElement
.addElement(element
);
931 * @param parentElement
932 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
935 * a {@link java.lang.String} object.
936 * @param initialState
940 * @return a {@link eu.etaxonomy.taxeditor.ui.element.CheckboxElement} object.
942 public CheckboxElement
createCheckbox(ICdmFormElement parentElement
,
943 String label
, boolean initialState
, int style
) {
944 CheckboxElement element
= new CheckboxElement(this, parentElement
,
945 label
, initialState
, style
| orientation
);
947 parentElement
.addElement(element
);
952 * Creates a section as a part of the form.
954 * @return the section widget
956 * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
959 public Section
adapt(AbstractFormSection section
) {
960 section
.setMenu(section
.getLayoutComposite().getMenu());
961 adapt(section
, true, true);
963 // handle focus and property change events for cdm use
964 section
.addFocusListener(selectionFocusHandler
);
965 section
.setPropertyChangeListeners(propertyChangeListeners
);
967 if (section
.getToggle() != null) {
968 section
.getToggle().setHoverDecorationColor(
969 getColors().getColor(IFormColors
.TB_TOGGLE_HOVER
));
970 section
.getToggle().setDecorationColor(
971 getColors().getColor(IFormColors
.TB_TOGGLE
));
974 section
.setFont(boldFontHolder2
.getBoldFont(section
975 .getLayoutComposite().getFont()));
977 if ((section
.getStyle() & Section
.TITLE_BAR
) != 0
978 || (section
.getStyle() & Section
.SHORT_TITLE_BAR
) != 0) {
979 getColors().initializeSectionToolBarColors();
980 section
.setTitleBarBackground(getColors().getColor(
982 section
.setTitleBarBorderColor(getColors().getColor(
983 IFormColors
.TB_BORDER
));
985 // call setTitleBarForeground regardless as it also sets the label color
986 section
.setTitleBarForeground(getColors().getColor(
987 IFormColors
.TB_TOGGLE
));
991 private class BoldFontHolder2
{
992 private Font normalFont
;
994 private Font boldFont
;
996 public BoldFontHolder2() {
999 public Font
getBoldFont(Font font
) {
1000 createBoldFont(font
);
1004 private void createBoldFont(Font font
) {
1005 if (normalFont
== null || !normalFont
.equals(font
)) {
1009 if (boldFont
== null) {
1010 boldFont
= FormFonts
.getInstance().getBoldFont(
1011 getColors().getDisplay(), normalFont
);
1015 public void dispose() {
1016 if (boldFont
!= null) {
1017 FormFonts
.getInstance().markFinished(boldFont
,
1018 getColors().getDisplay());
1026 * createToggleableTextField
1029 * @param parentElement
1030 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1032 * @param labelString
1033 * a {@link java.lang.String} object.
1034 * @param initialText
1035 * a {@link java.lang.String} object.
1036 * @param initialState
1040 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement}
1043 public ToggleableTextElement
createToggleableTextField(
1044 ICdmFormElement parentElement
, String labelString
,
1045 String initialText
, boolean initialState
, int style
) {
1046 ToggleableTextElement element
= new ToggleableTextElement(this,
1047 parentElement
, labelString
, initialText
, initialState
, style
1050 parentElement
.addElement(element
);
1056 * createTimePeriodElement
1059 * @param parentElement
1060 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1062 * @param labelString
1063 * a {@link java.lang.String} object.
1065 * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1068 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TimePeriodElement}
1071 public TimePeriodElement
createTimePeriodElement(
1072 ICdmFormElement parentElement
, String labelString
,
1073 TimePeriod timePeriod
, int style
) {
1074 TimePeriodElement element
= new TimePeriodElement(this, parentElement
,
1075 labelString
, timePeriod
, style
);
1077 parentElement
.addElement(element
);
1083 * createPointElement
1088 * @param parentElement
1089 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1092 * a {@link eu.etaxonomy.cdm.model.location.Point} object.
1093 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PointElement} object.
1095 public PointElement
createPointElement(ICdmFormElement parentElement
,
1096 Point point
, int style
) {
1097 PointElement element
= new PointElement(this, parentElement
, point
,
1100 parentElement
.addElement(element
);
1106 * createDateDetailSection
1109 * @param parentElement
1110 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1114 * @return a {@link eu.etaxonomy.taxeditor.ui.element.DateDetailSection}
1117 public DateDetailSection
createDateDetailSection(
1118 ICdmFormElement parentElement
, int style
) {
1119 DateDetailSection section
= new DateDetailSection(this, parentElement
,
1121 parentElement
.addElement(section
);
1128 * createPartialElement
1131 * @param parentElement
1132 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1134 * @param labelString
1135 * a {@link java.lang.String} object.
1137 * a {@link org.joda.time.Partial} object.
1140 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PartialElement} object.
1142 public PartialElement
createPartialElement(ICdmFormElement parentElement
,
1143 String labelString
, Partial partial
, int style
) {
1144 PartialElement element
= new PartialElement(this, parentElement
,
1145 labelString
, style
);
1147 parentElement
.addElement(element
);
1153 * addSelectionListener
1157 * a {@link org.eclipse.swt.events.SelectionListener} object.
1159 public void addSelectionListener(SelectionListener listener
) {
1160 selectionListenerList
.add(listener
);
1165 * removeSelectionListener
1169 * a {@link org.eclipse.swt.events.SelectionListener} object.
1171 public void removeSelectionListener(SelectionListener listener
) {
1172 if (listener
== null) {
1174 .error(this.getClass(),
1175 "Tried to remove a selection listener from this factories listeners but was null",
1178 selectionListenerList
.remove(listener
);
1184 * addPropertyChangeListener
1188 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1191 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
1192 if(propertyChangeListeners
.contains(listener
)){
1195 propertyChangeListeners
.add(0, listener
);
1200 * removePropertyChangeListener
1204 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1207 public void removePropertyChangeListener(IPropertyChangeListener listener
) {
1208 propertyChangeListeners
.remove(listener
);
1213 * createHorizontalSeparator
1216 * @param parentElement
1217 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1221 * @return a {@link org.eclipse.swt.widgets.Label} object.
1223 public Label
createHorizontalSeparator(ICdmFormElement parentElement
,
1225 Label separator
= this.createSeparator(
1226 parentElement
.getLayoutComposite(), SWT
.HORIZONTAL
| style
);
1227 separator
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY());
1233 * createVersionElement
1236 * @param parentElement
1237 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1240 * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
1245 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
1248 public VersionElement
createVersionElement(ICdmFormElement parentElement
,
1249 VersionableEntity entity
, int style
) {
1250 VersionElement element
= new VersionElement(this, parentElement
,
1253 parentElement
.addElement(element
);
1258 * @param cdmBaseSection
1263 public CdmBaseElement
createCdmBaseElement(ICdmFormElement parentElement
,
1264 CdmBase entity
, int style
) {
1265 CdmBaseElement element
= new CdmBaseElement(this, parentElement
,
1268 parentElement
.addElement(element
);
1275 * createVersionSection
1278 * @param parentElement
1279 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1284 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
1287 public VersionSection
createVersionSection(ICdmFormElement parentElement
,
1289 VersionSection section
= new VersionSection(this, parentElement
, style
);
1290 parentElement
.addElement(section
);
1300 public CdmBaseSection
createCdmBaseSection(ICdmFormElement parentElement
, int style
) {
1301 CdmBaseSection section
= new CdmBaseSection(this, parentElement
, style
);
1302 parentElement
.addElement(section
);
1309 * createEmptyElement
1312 * @param parentElement
1313 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1315 * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1317 public EmptyElement
createEmptyElement(ICdmFormElement parentElement
) {
1318 EmptyElement element
= new EmptyElement(this, parentElement
, null,
1321 parentElement
.addElement(element
);
1327 * createHeadlineSection
1330 * @param parentElement
1331 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1334 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
1337 public HeadlineSection
createHeadlineSection(ICdmFormElement parentElement
) {
1338 HeadlineSection section
= new HeadlineSection(this, parentElement
,
1340 parentElement
.addElement(section
);
1347 * createParsingMessageElement
1350 * @param parentElement
1351 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1353 * @param parserProblem
1354 * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
1359 * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
1362 public ParsingMessageElement
createParsingMessageElement(
1363 ICdmFormElement parentElement
, ParserProblem parserProblem
,
1365 ParsingMessageElement element
= new ParsingMessageElement(this,
1366 parentElement
, parserProblem
, style
);
1368 parentElement
.addElement(element
);
1377 public static enum DetailType
{
1382 DERIVED_UNIT_FACADE
,
1383 DERIVED_UNIT_GENERAL
,
1387 FEATURE_DISTRIBUTION
,
1399 NOMENCLATURALREFERENCE
,
1404 POLYTOMOUS_KEY_NODE
,
1418 public AbstractFormSection
createDefinedTermDetailSection(Class definedTermClass
,
1419 ConversationHolder conversation
, ICdmFormElement parentElement
,
1420 ISelectionProvider selectionProvider
, int style
) {
1422 AbstractFormSection section
= new DefinedTermDetailSection(this, definedTermClass
, conversation
, parentElement
, selectionProvider
, style
);
1424 parentElement
.addElement(section
);
1431 * @param definedTermClass
1432 * @param formElement
1436 public AbstractCdmDetailElement
createDefinedTermDetailElement(
1437 Class definedTermClass
, AbstractCdmDetailSection parentElement
,
1439 AbstractCdmDetailElement element
= null;
1441 if (NamedArea
.class.isAssignableFrom(definedTermClass
)){
1442 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1445 element
= new DefinedTermDetailElement(this, parentElement
);
1449 parentElement
.addElement(element
);
1455 * createCdmDetailSection
1460 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
1462 * @param parentElement
1463 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1465 * @param selectionProvider
1466 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1469 * @param conversation
1470 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1472 * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1475 public AbstractFormSection
createCdmDetailSection(DetailType detailType
,
1476 ConversationHolder conversation
, ICdmFormElement parentElement
,
1477 ISelectionProvider selectionProvider
, int style
) {
1478 AbstractFormSection section
= null;
1480 switch (detailType
) {
1481 case SCIENTIFICNAME
:
1482 section
= new NameDetailSection(this, conversation
, parentElement
,
1483 selectionProvider
, style
);
1486 section
= new ReferenceDetailSection(this, conversation
,
1487 parentElement
, selectionProvider
, style
);
1489 case NOMENCLATURALREFERENCE
:
1490 section
= new NomenclaturalReferenceDetailSection(this,
1491 conversation
, parentElement
, selectionProvider
, style
);
1494 section
= new TaxonBaseDetailSection(this, conversation
,
1495 parentElement
, selectionProvider
, style
);
1498 section
= new AuthorshipDetailSection(this, conversation
,
1499 parentElement
, selectionProvider
, style
);
1501 case TEAMORPERSONBASE
:
1502 section
= new TeamOrPersonBaseDetailSection(this, conversation
,
1503 parentElement
, selectionProvider
, style
);
1506 section
= new TeamDetailSection(this, conversation
, parentElement
,
1510 section
= new PersonDetailSection(this, conversation
,
1511 parentElement
, null, style
);
1514 section
= new DescriptionDetailSection(this, conversation
,
1515 parentElement
, selectionProvider
, style
);
1517 case DESCRIPTIONELEMENT
:
1518 section
= new DescriptionElementDetailSection(this, conversation
,
1519 parentElement
, selectionProvider
, style
);
1521 case PARSINGMESSAGE
:
1522 section
= new ParsingMessagesSection(this, conversation
,
1523 parentElement
, selectionProvider
, style
);
1526 section
= new NonViralNameDetailSection(this, conversation
,
1527 parentElement
, selectionProvider
, style
);
1530 section
= new eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection(
1531 this, conversation
, parentElement
, selectionProvider
, style
);
1533 case DERIVED_UNIT_FACADE
:
1534 section
= new DerivedUnitFacadeDetailSection(this, conversation
,
1535 parentElement
, selectionProvider
, style
);
1537 case FIELD_OBSERVATION
:
1538 section
= new FieldObservationDetailSection(this, conversation
,
1539 parentElement
, selectionProvider
, style
);
1541 case GATHERING_EVENT
:
1542 section
= new GatheringEventDetailSection(this, conversation
,
1543 parentElement
, selectionProvider
, style
);
1546 section
= new DerivedUnitBaseDetailSection(this, conversation
,
1547 parentElement
, selectionProvider
, style
);
1549 case NATURAL_LANGUAGE
:
1550 section
= new NaturalLanguageSection(this, conversation
,
1551 parentElement
, selectionProvider
, style
);
1553 case FEATURE_DISTRIBUTION
:
1554 section
= new FeatureDistributionDetailSection(this, conversation
,
1555 parentElement
, selectionProvider
, style
);
1557 case CLASSIFICATION
:
1558 section
= new ClassificationDetailSection(this, conversation
,
1559 parentElement
, selectionProvider
, style
);
1562 section
= new TaxonNodeDetailSection(this, conversation
,
1563 parentElement
, selectionProvider
, style
);
1565 case POLYTOMOUS_KEY
:
1566 section
= new PolytomousKeyDetailSection(this, conversation
,
1567 parentElement
, selectionProvider
, style
);
1569 case POLYTOMOUS_KEY_NODE
:
1570 section
= new PolytomousKeyNodeDetailSection(this, conversation
,
1571 parentElement
, selectionProvider
, style
);
1574 section
= new InstitutionDetailSection(this, conversation
,
1575 parentElement
, selectionProvider
, style
);
1577 case DERIVED_UNIT_GENERAL
:
1578 section
= new GeneralDetailSection(this, conversation
,
1579 parentElement
, selectionProvider
, style
);
1582 section
= new HybridDetailSection(this, conversation
,
1583 parentElement
, selectionProvider
, style
);
1586 section
= new UserDetailSection(this, conversation
, parentElement
,
1587 selectionProvider
, style
);
1590 section
= new GroupDetailSection(this, conversation
, parentElement
,
1591 selectionProvider
, style
);
1594 section
= new DeterminationDetailSection(this, conversation
, parentElement
,
1595 selectionProvider
, style
);
1597 case TAXON_RELATIONSHIP
:
1598 section
= new TaxonRelationshipDetailSection(this, conversation
, parentElement
,
1599 selectionProvider
, style
);
1601 case REFERENCED_ENTITY
:
1602 section
= new ReferencedEntityDetailSection(this, conversation
, parentElement
,
1603 selectionProvider
, style
);
1605 case TERM_VOCABULARY
:
1606 section
= new TermVocabularyDetailSection(this, conversation
, parentElement
,
1607 selectionProvider
, style
);
1610 section
= new NamedAreaDetailSection(this, conversation
, parentElement
,
1611 selectionProvider
, style
);
1614 section
= new UseRecordDetailSection(this, conversation
, parentElement
,
1615 selectionProvider
, style
);
1620 if (section
== null) {
1621 throw new RuntimeException(
1622 "You tried to create a cdm detail section that is not implemented yet.");
1625 parentElement
.addElement(section
);
1634 * createCdmDetailElement
1639 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
1643 * @param parentElement
1644 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1647 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
1650 public AbstractCdmDetailElement
createCdmDetailElement(
1651 DetailType detailType
, ICdmFormElement parentElement
, int style
) {
1652 AbstractCdmDetailElement element
= null;
1654 switch (detailType
) {
1655 case SCIENTIFICNAME
:
1656 element
= new NameDetailElement(this, parentElement
, style
);
1659 element
= new ReferenceDetailElement(this, parentElement
, style
);
1661 case NOMENCLATURALREFERENCE
:
1662 element
= new NomenclaturalReferenceDetailElement(this,
1663 parentElement
, style
);
1666 element
= new TaxonBaseDetailElement(this, parentElement
, style
);
1669 element
= new AuthorshipDetailElement(this, parentElement
, style
);
1672 element
= new TeamDetailElement(this, parentElement
, style
);
1675 element
= new PersonDetailElement(this, parentElement
, style
);
1678 element
= new DescriptionDetailElement(this, parentElement
, style
);
1680 case DESCRIPTIONELEMENT
:
1681 element
= new DescriptionElementDetailElement(this, parentElement
,
1685 element
= new NonViralNameDetailElement(this, parentElement
);
1687 case DERIVED_UNIT_FACADE
:
1688 element
= new DerivedUnitFacadeDetailElement(this, parentElement
);
1690 case FIELD_OBSERVATION
:
1691 element
= new FieldObservationDetailElement(this, parentElement
);
1693 case GATHERING_EVENT
:
1694 element
= new GatheringEventDetailElement(this, parentElement
);
1697 element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1699 case NATURAL_LANGUAGE
:
1700 element
= new NaturalLanguageDetailElement(this, parentElement
);
1702 case FEATURE_DISTRIBUTION
:
1703 element
= new FeatureDistributionDetailElement(this, parentElement
);
1705 case CLASSIFICATION
:
1706 element
= new ClassificationDetailElement(this, parentElement
);
1709 element
= new TaxonNodeDetailElement(this, parentElement
);
1712 element
= new CollectionDetailElement(this, parentElement
);
1714 case POLYTOMOUS_KEY
:
1715 element
= new PolytomousKeyDetailElement(this, parentElement
);
1717 case POLYTOMOUS_KEY_NODE
:
1718 element
= new PolytomousKeyNodeDetailElement(this, parentElement
);
1721 element
= new InstitutionDetailElement(this, parentElement
);
1723 case DERIVED_UNIT_GENERAL
:
1724 element
= new GeneralDetailElement(this, parentElement
);
1727 element
= new HybridDetailElement(this, parentElement
);
1730 element
= new UserDetailElement(this, parentElement
);
1733 element
= new GroupDetailElement(this, parentElement
);
1735 case GRANTEDAUTHORITY
:
1736 element
= new GrantedAuthorityDetailElement(this, parentElement
);
1739 element
= new DeterminationDetailElement(this, parentElement
);
1741 case TAXON_RELATIONSHIP
:
1742 element
= new TaxonRelationshipDetailElement(this, parentElement
);
1744 case REFERENCED_ENTITY
:
1745 element
= new RefereneEntityDetailElement(this, parentElement
);
1747 case TERM_VOCABULARY
:
1748 element
= new TermVocabularyDetailElement(this, parentElement
);
1751 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1753 case NAMED_AREA_LEVEL
:
1754 element
= new DefinedTermDetailElement
<NamedAreaLevel
>(this, parentElement
);
1757 //element = new UseRecordDetailElement(this, parentElement, style);
1758 element
= new UseRecordDetailElement(this, parentElement
);
1762 if (element
== null) {
1764 .error(this.getClass(),
1765 "Detail element was not created. Seems like the case was not implemented for the requested detail type: "
1766 + detailType
, null);
1770 parentElement
.addElement(element
);
1776 * @author n.hoffmann
1777 * @created Mar 5, 2010
1780 public static enum EntityDetailType
{
1785 DESCRIPTIONELEMENTSOURCE
,
1789 DESCRIPTIONELEMENTMEDIA
,
1790 MEDIAREPRESENTATION
,
1791 MEDIAREPRESENTATIONPART
,
1793 NOMENCLATURALSTATUS
,
1802 STATISTICAL_MEASUREMENT_VALUE
,
1805 DETERMINATION_EVENT
,
1806 SPECIMEN_COLLECTION
,
1807 IDENTIFIABLE_SOURCE_COLLECTION
,
1814 DETERMINATION_CURRENT
,
1815 DETERMINATION_HISTORY
1820 * createEntityDetailSection
1823 * @param entityDetailType
1825 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType}
1829 * @param conversation
1830 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1832 * @param parentElement
1833 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1835 * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1838 public AbstractFormSection
createEntityDetailSection(
1839 EntityDetailType entityDetailType
, ConversationHolder conversation
,
1840 ICdmFormElement parentElement
, int style
) {
1841 AbstractFormSection section
= null;
1843 switch (entityDetailType
) {
1845 section
= new TeamDetailSection(this, conversation
, parentElement
,
1849 section
= new TeamMemberSection(this, conversation
, parentElement
,
1853 section
= new AnnotationSection(this, conversation
, parentElement
,
1857 section
= new CreditSection(this, conversation
, parentElement
,
1860 case DESCRIPTIONELEMENTSOURCE
:
1861 section
= new DescriptionElementSourceSection(this, conversation
,
1862 parentElement
, style
);
1865 section
= new ExtensionSection(this, conversation
, parentElement
,
1869 section
= new MarkerSection(this, conversation
, parentElement
,
1873 section
= new MediaSection(this, conversation
, parentElement
, style
);
1875 case DESCRIPTIONELEMENTMEDIA
:
1876 section
= new DescriptionElementMediaSection(this, conversation
,
1877 parentElement
, style
);
1879 case MEDIAREPRESENTATION
:
1880 section
= new MediaRepresentationSection(this, conversation
,
1881 parentElement
, style
);
1883 case MEDIAREPRESENTATIONPART
:
1884 section
= new MediaRepresentationPartSection(this, conversation
,
1885 parentElement
, style
);
1888 section
= new ModifierSection(this, conversation
, parentElement
,
1891 case NOMENCLATURALSTATUS
:
1892 section
= new NomenclaturalStatusSection(this, conversation
,
1893 parentElement
, style
);
1895 case NAME_RELATIONSHIP
:
1896 section
= new NameRelationshipDetailSection(this, conversation
,
1897 parentElement
, style
);
1900 section
= new ProtologueSection(this, conversation
, parentElement
,
1904 section
= new RightsSection(this, conversation
, parentElement
,
1908 section
= new SourceSection(this, conversation
, parentElement
,
1912 section
= new ScopeSection(this, conversation
, parentElement
, style
);
1914 case DESCRIPTIONSOURCE
:
1915 section
= new DescriptionSourceSection(this, conversation
,
1916 parentElement
, style
);
1918 case TYPEDESIGNATION
:
1919 section
= new TypeDesignationSection(this, conversation
,
1920 parentElement
, style
);
1923 section
= new StateDataSection(this, conversation
, parentElement
,
1926 case STATISTICAL_MEASUREMENT_VALUE
:
1927 section
= new StatisticalMeasurementValueSection(this,
1928 conversation
, parentElement
, style
);
1930 case DESCRIBED_SPECIMEN
:
1931 section
= new DescribedSpecimenSection(this, conversation
,
1932 parentElement
, style
);
1934 case COLLECTING_AREA
:
1935 section
= new CollectingAreasDetailSection(this, conversation
,
1936 parentElement
, style
);
1938 case DETERMINATION_CURRENT
:
1939 section
= new CurrentDeterminationDetailSection(this, conversation
,
1940 parentElement
, style
);
1942 case DETERMINATION_HISTORY
:
1943 section
= new DeterminationHistoryDetailSection(this, conversation
,
1944 parentElement
, style
);
1946 case SPECIMEN_COLLECTION
:
1947 section
= new SpecimenCollectionDetailSection(this, conversation
,
1948 parentElement
, style
);
1950 case IDENTIFIABLE_SOURCE_COLLECTION
:
1951 section
= new SourceCollectionDetailSection(this, conversation
,
1952 parentElement
, style
);
1954 case GEOGRAPHICAL_SCOPE
:
1955 section
= new GeographicalScopeDetailSection(this, conversation
,
1956 parentElement
, style
);
1958 case SCOPE_RESTRICTION
:
1959 section
= new ScopeRestrictionSection(this, conversation
,
1960 parentElement
, style
);
1963 section
= new MemberDetailSection(this, conversation
,
1964 parentElement
, style
);
1966 case GRANTED_AUTHORITY
:
1967 section
= new GrantedAuthorityDetailSection(this, conversation
,
1968 parentElement
, style
);
1970 case GROUPS_BY_USER
:
1971 section
= new GroupsByUserDetailSection(this, conversation
,
1972 parentElement
, style
);
1974 case TAXONOMIC_SCOPE
:
1975 section
= new TaxonomicScopeSection(this, conversation
,
1976 parentElement
, style
);
1979 parentElement
.addElement(section
);
1986 * createEntityCollectionElement
1989 * @param removeListener
1990 * a {@link org.eclipse.swt.events.SelectionListener} object.
1993 * @param parentElement
1994 * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1996 * @param versionableEntity
1997 * a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity}
1999 * @param backgroundColor
2000 * a {@link org.eclipse.swt.graphics.Color} object.
2002 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement}
2005 public AbstractEntityCollectionElement
createEntityCollectionElement(
2006 AbstractFormSection parentElement
, Object versionableEntity
,
2007 SelectionListener removeListener
, Color backgroundColor
, int style
) {
2008 AbstractEntityCollectionElement element
= null;
2010 Object entity
= HibernateProxyHelper
.deproxy(versionableEntity
);
2012 if (entity
instanceof Annotation
) {
2013 element
= new AnnotationElement(this, parentElement
,
2014 (Annotation
) entity
, removeListener
, style
);
2015 } else if (entity
instanceof Person
) {
2016 element
= new TeamMemberElement(this, parentElement
,
2017 (Person
) entity
, removeListener
, style
);
2018 } else if (entity
instanceof Credit
) {
2019 element
= new CreditElement(this, parentElement
, (Credit
) entity
,
2020 removeListener
, style
);
2021 } else if (entity
instanceof Extension
) {
2022 element
= new ExtensionElement(this, parentElement
,
2023 (Extension
) entity
, removeListener
, style
);
2024 } else if (entity
instanceof Marker
) {
2025 element
= new MarkerElement(this, parentElement
, (Marker
) entity
,
2026 removeListener
, style
);
2027 } else if (entity
instanceof Media
) {
2028 element
= new MediaElement(this, parentElement
, (Media
) entity
,
2029 removeListener
, style
);
2030 } else if (entity
instanceof MediaRepresentation
) {
2031 element
= new MediaRepresentationElement(this, parentElement
,
2032 (MediaRepresentation
) entity
, removeListener
, style
);
2033 } else if (entity
instanceof ImageFile
) {
2034 element
= new ImageFileElement(this, parentElement
,
2035 (ImageFile
) entity
, removeListener
, style
);
2036 } else if (entity
instanceof MediaRepresentationPart
){
2037 element
= new MediaRepresentationPartElement(this, parentElement
,
2038 (MediaRepresentationPart
) entity
, removeListener
, style
);
2039 } else if (entity
instanceof NomenclaturalStatus
) {
2040 element
= new NomenclaturalStatusElement(this, parentElement
,
2041 (NomenclaturalStatus
) entity
, removeListener
, style
);
2042 } else if (entity
instanceof Rights
) {
2043 element
= new RightsElement(this, parentElement
, (Rights
) entity
,
2044 removeListener
, style
);
2045 } else if (entity
instanceof DescriptionElementSource
) {
2046 element
= new DescriptionElementSourceElement(this, parentElement
,
2047 (DescriptionElementSource
) entity
, removeListener
, style
);
2048 } else if (entity
instanceof IdentifiableSource
) {
2049 element
= new IdentifiableSourceElement(this, parentElement
,
2050 (IdentifiableSource
) entity
, removeListener
, style
);
2051 } else if (entity
instanceof Scope
) {
2052 element
= new ScopeElement(this, parentElement
, (Scope
) entity
,
2053 removeListener
, style
);
2054 } else if (entity
instanceof Modifier
) {
2055 element
= new ModifierElement(this, parentElement
,
2056 (Modifier
) entity
, removeListener
, style
);
2057 } else if (entity
instanceof Reference
) {
2058 element
= new DescriptionSourceElement(this, parentElement
,
2059 (Reference
) entity
, removeListener
, style
);
2060 } else if (entity
instanceof NameTypeDesignation
) {
2061 element
= new NameTypeDesignationElement(this, parentElement
,
2062 (NameTypeDesignation
) entity
, removeListener
, style
);
2063 } else if (entity
instanceof NameRelationship
) {
2064 element
= new NameRelationshipDetailElement(this, parentElement
,
2065 (NameRelationship
) entity
, removeListener
, style
);
2066 } else if (entity
instanceof SpecimenTypeDesignation
) {
2067 element
= new SpecimenTypeDesignationElement(this, parentElement
,
2068 (SpecimenTypeDesignation
) entity
, removeListener
, style
);
2069 } else if (entity
instanceof StateData
) {
2070 element
= new StateDataElement(this, parentElement
,
2071 (StateData
) entity
, removeListener
, style
);
2072 } else if (entity
instanceof StatisticalMeasurementValue
) {
2073 element
= new StatisticalMeasurementValueElement(this,
2074 parentElement
, (StatisticalMeasurementValue
) entity
,
2075 removeListener
, style
);
2076 } 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 Specimen
) {
2086 element
= new SpecimenCollectionDetailElement(this, parentElement
,
2087 (Specimen
) entity
, removeListener
, style
);
2088 } else if (entity
instanceof User
) {
2089 element
= new MemberDetailElement(this, parentElement
,
2090 (User
) entity
, removeListener
, style
);
2091 } else if (entity
instanceof GrantedAuthority
) {
2092 element
= new GrantedAuthorityCollectionElement(this, parentElement
,
2093 (GrantedAuthorityImpl
) entity
, removeListener
, style
);
2094 } else if (entity
instanceof Group
) {
2095 element
= new GroupsByUserDetailElement(this, parentElement
,
2096 (Group
) entity
, removeListener
, style
);
2097 } else if (entity
instanceof Taxon
) {
2098 element
= new TaxonDetailElement(this, parentElement
,
2099 (Taxon
) entity
, removeListener
, style
);
2100 } else if (entity
instanceof DescriptionElementBase
) {
2101 // this is the special case for protologs, maybe we can do this
2102 // differently when API improves
2103 DescriptionElementBase descriptionElement
= (DescriptionElementBase
) entity
;
2104 if (descriptionElement
.getFeature().equals(Feature
.PROTOLOGUE())) {
2105 element
= new ProtologueElement(this, parentElement
,
2106 descriptionElement
, removeListener
, style
);
2110 if (element
== null) {
2113 "No element for entity",
2115 "Could not generate element for entity. "
2116 + "Looks like the case is not handled already. Check implementation. Entity: "
2121 if (backgroundColor
!= null && !backgroundColor
.isDisposed()) {
2122 element
.setPersistentBackground(backgroundColor
);
2126 parentElement
.addElement(element
);
2132 * Creates a selection element for the given type T.
2135 * <strong>Selection elements not handled by this method:</strong>
2137 * <li>{@link TaxonNodeSelectionElement} see {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}</li>
2138 * <li>{@link NomenclaturalAuthorTeamSelectionElement} see {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}</li>
2143 * a {@link Class} object of the type that you want the selection element to handle
2144 * @param parentElement
2145 * a {@link ICdmFormElement}
2147 * @param labelString
2148 * a {@link String} object.
2149 * @param selectionType
2151 * a {@link ICdmBase} object.
2154 * @param conversation
2155 * a {@link ConversationHolder} object.
2157 * {@link EntitySelectionElement}
2160 public <T
extends ICdmBase
> EntitySelectionElement
<T
> createSelectionElement(
2161 Class
<T
> clazz
, ConversationHolder conversation
,
2162 ICdmFormElement parentElement
, String labelString
,
2163 T selection
, int mode
, int style
) {
2164 EntitySelectionElement
<T
> element
= new EntitySelectionElement
<T
>(this, conversation
, parentElement
, clazz
, labelString
, selection
, mode
, style
);
2166 parentElement
.addElement(element
);
2170 public TaxonNodeSelectionElement
createTaxonNodeSelectionElement(
2171 ConversationHolder conversation
,
2172 ICdmFormElement parentElement
, String labelString
,
2173 TaxonNode selection
, int mode
, int style
) {
2174 TaxonNodeSelectionElement element
= new TaxonNodeSelectionElement(this, conversation
, parentElement
, labelString
, selection
, mode
, style
);
2176 parentElement
.addElement(element
);
2180 public NomenclaturalAuthorTeamSelectionElement
createNomenclaturalAuthorTeamSelectionElement(
2181 ConversationHolder conversation
,
2182 ICdmFormElement parentElement
, String labelString
,
2183 Team selection
, int mode
, int style
) {
2184 NomenclaturalAuthorTeamSelectionElement element
= new NomenclaturalAuthorTeamSelectionElement(this, conversation
, parentElement
, labelString
, selection
, mode
, style
);
2186 parentElement
.addElement(element
);
2191 /** {@inheritDoc} */
2192 public LabelElement
createLabel(ICdmFormElement parentElement
, String text
) {
2193 LabelElement labelElement
= new LabelElement(this, parentElement
, text
);
2194 adapt(labelElement
);
2195 parentElement
.addElement(labelElement
);
2196 return labelElement
;
2201 * Getter for the field <code>selectionProvider</code>.
2204 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
2206 public ISelectionProvider
getSelectionProvider() {
2207 return selectionProvider
;
2212 * createDetailedDescriptionDetailElement
2215 * @param parentElement
2216 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
2220 * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
2225 * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
2228 public AbstractDetailedDescriptionDetailElement
createDetailedDescriptionDetailElement(
2229 ICdmFormElement parentElement
, DescriptionElementBase entity
,
2231 AbstractDetailedDescriptionDetailElement detailedDescriptionElement
= null;
2233 if (entity
instanceof CategoricalData
) {
2234 detailedDescriptionElement
= new CategoricalDataDetailElement(this,
2235 parentElement
, (CategoricalData
) entity
, style
);
2236 } else if (entity
instanceof CommonTaxonName
) {
2237 detailedDescriptionElement
= new CommonNameDetailElement(this,
2238 parentElement
, (CommonTaxonName
) entity
, style
);
2239 } else if (entity
instanceof Distribution
) {
2240 detailedDescriptionElement
= new DistributionDetailElement(this,
2241 parentElement
, (Distribution
) entity
, style
);
2242 } else if (entity
instanceof IndividualsAssociation
) {
2243 detailedDescriptionElement
= new IndividualsAssociationDetailElement(
2244 this, parentElement
, (IndividualsAssociation
) entity
, style
);
2245 } else if (entity
instanceof QuantitativeData
) {
2246 detailedDescriptionElement
= new QuantitativeDataDetailElement(
2247 this, parentElement
, (QuantitativeData
) entity
, style
);
2248 } else if (entity
instanceof TaxonInteraction
) {
2249 detailedDescriptionElement
= new TaxonInteractionDetailElement(
2250 this, parentElement
, (TaxonInteraction
) entity
, style
);
2251 } else if (entity
instanceof TextData
) {
2252 detailedDescriptionElement
= new TextDataDetailElement(this,
2253 parentElement
, (TextData
) entity
, style
);
2255 throw new IllegalStateException(
2256 "There is no interface for the given description element");
2258 adapt(detailedDescriptionElement
);
2259 parentElement
.addElement(detailedDescriptionElement
);
2260 return detailedDescriptionElement
;
2265 * Creates a styled text as a part of the form.
2270 * the text initial value
2273 * @return the text widget
2275 public StyledText
createStyledText(Composite parent
, String value
, int style
) {
2276 StyledText text
= new StyledText(parent
, getBorderStyle() | style
2277 | getOrientation());
2279 text
.setText(value
);
2280 text
.setForeground(getColors().getForeground());
2281 text
.setBackground(getColors().getBackground());
2282 // text.addFocusListener(visibilityHandler);