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
.ExpandableComposite
;
37 import org
.eclipse
.ui
.forms
.widgets
.FormToolkit
;
38 import org
.eclipse
.ui
.forms
.widgets
.Section
;
39 import org
.eclipse
.ui
.internal
.forms
.widgets
.FormFonts
;
40 import org
.joda
.time
.Partial
;
41 import org
.springframework
.security
.core
.GrantedAuthority
;
43 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
44 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
45 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
46 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
47 import eu
.etaxonomy
.cdm
.model
.common
.Annotation
;
48 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
49 import eu
.etaxonomy
.cdm
.model
.common
.Credit
;
50 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
51 import eu
.etaxonomy
.cdm
.model
.common
.DescriptionElementSource
;
52 import eu
.etaxonomy
.cdm
.model
.common
.Extension
;
53 import eu
.etaxonomy
.cdm
.model
.common
.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
.Modifier
;
72 import eu
.etaxonomy
.cdm
.model
.description
.QuantitativeData
;
73 import eu
.etaxonomy
.cdm
.model
.description
.Scope
;
74 import eu
.etaxonomy
.cdm
.model
.description
.StateData
;
75 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasurementValue
;
76 import eu
.etaxonomy
.cdm
.model
.description
.TaxonInteraction
;
77 import eu
.etaxonomy
.cdm
.model
.description
.TextData
;
78 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
79 import eu
.etaxonomy
.cdm
.model
.location
.NamedAreaLevel
;
80 import eu
.etaxonomy
.cdm
.model
.location
.Point
;
81 import eu
.etaxonomy
.cdm
.model
.media
.ImageFile
;
82 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
83 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
84 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentationPart
;
85 import eu
.etaxonomy
.cdm
.model
.media
.Rights
;
86 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationship
;
87 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignation
;
88 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
89 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignation
;
90 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
91 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationEvent
;
92 import eu
.etaxonomy
.cdm
.model
.occurrence
.Specimen
;
93 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
94 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
95 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
96 import eu
.etaxonomy
.cdm
.strategy
.parser
.ParserProblem
;
97 import eu
.etaxonomy
.taxeditor
.model
.AbstractUtility
;
98 import eu
.etaxonomy
.taxeditor
.ui
.combo
.EnumComboElement
;
99 import eu
.etaxonomy
.taxeditor
.ui
.combo
.TermComboElement
;
100 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.IOpenUrlEnabled
;
101 import eu
.etaxonomy
.taxeditor
.ui
.openurl
.OpenUrlSelectorElement
;
102 import eu
.etaxonomy
.taxeditor
.ui
.password
.EditPasswordElement
;
103 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
104 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailSection
;
105 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
106 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionSection
;
107 import eu
.etaxonomy
.taxeditor
.ui
.section
.EmptyElement
;
108 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailElement
;
109 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.InstitutionDetailSection
;
110 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailElement
;
111 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailSection
;
112 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailElement
;
113 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailSection
;
114 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberElement
;
115 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamMemberSection
;
116 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamOrPersonBaseDetailSection
;
117 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailElement
;
118 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.ClassificationDetailSection
;
119 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailElement
;
120 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.TaxonNodeDetailSection
;
121 import eu
.etaxonomy
.taxeditor
.ui
.section
.common
.ReferencedEntityDetailSection
;
122 import eu
.etaxonomy
.taxeditor
.ui
.section
.common
.RefereneEntityDetailElement
;
123 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DerivedUnitElement
;
124 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescribedSpecimenSection
;
125 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailElement
;
126 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailSection
;
127 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailElement
;
128 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailSection
;
129 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementMediaSection
;
130 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceElement
;
131 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceSection
;
132 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceElement
;
133 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceSection
;
134 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection
;
135 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierElement
;
136 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierSection
;
137 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageDetailElement
;
138 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageSection
;
139 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeElement
;
140 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeSection
;
141 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataElement
;
142 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StateDataSection
;
143 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueElement
;
144 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.StatisticalMeasurementValueSection
;
145 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.AbstractDetailedDescriptionDetailElement
;
146 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CategoricalDataDetailElement
;
147 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.CommonNameDetailElement
;
148 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.DistributionDetailElement
;
149 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.IndividualsAssociationDetailElement
;
150 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.QuantitativeDataDetailElement
;
151 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TaxonInteractionDetailElement
;
152 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.TextDataDetailElement
;
153 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailElement
;
154 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailSection
;
155 import eu
.etaxonomy
.taxeditor
.ui
.section
.grantedAuthority
.GrantedAuthorityCollectionElement
;
156 import eu
.etaxonomy
.taxeditor
.ui
.section
.grantedAuthority
.GrantedAuthorityDetailElement
;
157 import eu
.etaxonomy
.taxeditor
.ui
.section
.grantedAuthority
.GrantedAuthorityDetailSection
;
158 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailElement
;
159 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailSection
;
160 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailElement
;
161 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailSection
;
162 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.GeographicalScopeDetailSection
;
163 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailElement
;
164 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailSection
;
165 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailElement
;
166 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailSection
;
167 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.ScopeRestrictionSection
;
168 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.TaxonomicScopeSection
;
169 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.ImageFileElement
;
170 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaElement
;
171 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationElement
;
172 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationPartElement
;
173 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationPartSection
;
174 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaRepresentationSection
;
175 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaSection
;
176 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailElement
;
177 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.AuthorshipDetailSection
;
178 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailElement
;
179 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.HybridDetailSection
;
180 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailElement
;
181 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameDetailSection
;
182 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailElement
;
183 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailSection
;
184 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameTypeDesignationElement
;
185 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusElement
;
186 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusSection
;
187 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailElement
;
188 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailSection
;
189 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueElement
;
190 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.ProtologueSection
;
191 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.SpecimenTypeDesignationElement
;
192 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.TypeDesignationSection
;
193 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectingAreasDetailSection
;
194 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CollectionDetailElement
;
195 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.CurrentDeterminationDetailSection
;
196 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailElement
;
197 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailSection
;
198 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailElement
;
199 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitFacadeDetailSection
;
200 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailElement
;
201 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailSection
;
202 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationEventDetailElement
;
203 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationHistoryDetailSection
;
204 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailElement
;
205 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationDetailSection
;
206 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailElement
;
207 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailSection
;
208 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailElement
;
209 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralDetailSection
;
210 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.NamedAreaDetailElement
;
211 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SourceCollectionDetailSection
;
212 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailElement
;
213 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.SpecimenCollectionDetailSection
;
214 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailElement
;
215 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalReferenceDetailSection
;
216 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailElement
;
217 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailSection
;
218 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationElement
;
219 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationSection
;
220 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CdmBaseElement
;
221 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CdmBaseSection
;
222 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditElement
;
223 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditSection
;
224 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionElement
;
225 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionSection
;
226 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.HeadlineSection
;
227 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.IdentifiableSourceElement
;
228 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerElement
;
229 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerSection
;
230 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsElement
;
231 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
232 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.SourceSection
;
233 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionElement
;
234 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionSection
;
235 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessageElement
;
236 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
237 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailElement
;
238 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
239 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonDetailElement
;
240 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailElement
;
241 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailSection
;
242 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailElement
;
243 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailSection
;
244 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailElement
;
245 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailSection
;
246 import eu
.etaxonomy
.taxeditor
.ui
.section
.userecords
.UseRecordDetailElement
;
247 import eu
.etaxonomy
.taxeditor
.ui
.section
.userecords
.UseRecordDetailSection
;
248 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.DefinedTermDetailElement
;
249 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.DefinedTermDetailSection
;
250 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailSection
;
251 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailElement
;
252 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailSection
;
253 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
254 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NomenclaturalAuthorTeamSelectionElement
;
255 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonNodeSelectionElement
;
259 * CdmFormFactory class.
263 * @created Feb 24, 2010
266 public class CdmFormFactory
extends FormToolkit
{
268 private BoldFontHolder2 boldFontHolder2
;
269 private MouseListener selectionMouseHandler
;
270 private FocusListener selectionFocusHandler
;
272 private final Set
<SelectionListener
> selectionListenerList
= new HashSet
<SelectionListener
>();
274 private final List
<IPropertyChangeListener
> propertyChangeListeners
= new ArrayList
<IPropertyChangeListener
>();
276 private final int orientation
= Window
.getDefaultOrientation();
277 private ISelectionProvider selectionProvider
;
279 /** Constant <code>EMPTY_SELECTION</code> */
280 public static ISelection EMPTY_SELECTION
= new ISelection() {
282 public boolean isEmpty() {
293 private class SelectionMouseHandler
extends MouseAdapter
{
295 public void mouseDown(MouseEvent e
) {
296 notifySelectionListeners(e
);
306 private class SelectionFocusHandler
extends FocusAdapter
{
308 public void focusGained(FocusEvent e
) {
309 notifySelectionListeners(e
);
313 private void notifySelectionListeners(TypedEvent e
) {
314 Event event
= new Event();
315 event
.widget
= e
.widget
;
316 SelectionEvent selectionEvent
= new SelectionEvent(event
);
318 for (SelectionListener listener
: selectionListenerList
) {
319 listener
.widgetSelected(selectionEvent
);
325 * Constructor for CdmFormFactory.
329 * a {@link org.eclipse.swt.widgets.Display} object.
330 * @param selectionProvider
331 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
333 public CdmFormFactory(Display display
, ISelectionProvider selectionProvider
) {
335 this.selectionProvider
= selectionProvider
;
341 * Constructor for CdmFormFactory.
345 * a {@link org.eclipse.swt.widgets.Display} object.
347 public CdmFormFactory(Display display
) {
355 private void init() {
356 boldFontHolder2
= new BoldFontHolder2();
357 selectionMouseHandler
= new SelectionMouseHandler();
358 selectionFocusHandler
= new SelectionFocusHandler();
362 * Creates an instance initialized with the correct selectionProvider
364 * Make sure to remove the instance when the entityComposite disposes via
365 * destroySelectionArbitrator(..)
367 * @param entityElement
368 * a {@link eu.etaxonomy.taxeditor.ui.element.IEntityElement}
370 * @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
373 public SelectionArbitrator
createSelectionArbitrator(IEntityElement entityElement
) {
374 SelectionArbitrator selectionArbitrator
= new SelectionArbitrator(entityElement
);
375 selectionArbitrator
.addSelectionProvider(selectionProvider
);
376 selectionProvider
.addSelectionChangedListener(selectionArbitrator
);
377 addSelectionListener(selectionArbitrator
);
378 return selectionArbitrator
;
383 * destroySelectionArbitrator
386 * @param selectionArbitrator
388 * {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
391 public void destroySelectionArbitrator(SelectionArbitrator selectionArbitrator
) {
392 removeSelectionListener(selectionArbitrator
);
393 if (selectionProvider
!= null) {
394 selectionProvider
.removeSelectionChangedListener(selectionArbitrator
);
396 AbstractUtility
.error(this.getClass(),
397 "Tried to destroy a selection listener from this factories listeners but was null", null);
403 public void adapt(Composite composite
) {
404 composite
.addMouseListener(selectionMouseHandler
);
405 super.adapt(composite
);
410 * Adapts the {@link AbstractCdmFormElement}:<br>
411 * - sets the {@link IPropertyChangeListener}s handled by this class
416 * {@link eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement}
419 public void adapt(AbstractCdmFormElement formElement
) {
420 formElement
.setPropertyChangeListeners(propertyChangeListeners
);
425 public void adapt(Control control
, boolean trackFocus
, boolean trackKeyboard
) {
427 control
.addFocusListener(selectionFocusHandler
);
429 super.adapt(control
, trackFocus
, trackKeyboard
);
438 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
441 public void destroyElement(ICdmFormElement formElement
) {
442 // return if element was not initialized
443 if (formElement
== null) {
446 // destroy selection arbitrator, if any
447 if (formElement
instanceof ISelectableElement
) {
448 destroySelectionArbitrator(((ISelectableElement
) formElement
).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(ICdmFormElement parentElement
, String labelString
,
504 int textHeight
, int style
) {
505 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, labelString
, "", textHeight
, style
);
507 parentElement
.addElement(element
);
513 * createMultiLanguageTextElement
516 * @param parentElement
517 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
520 * a {@link java.lang.String} object.
521 * @param multilanguageText
522 * a {@link java.util.Map} object.
528 * {@link eu.etaxonomy.taxeditor.ui.element.MultilanguageTextElement}
531 public MultilanguageTextElement
createMultiLanguageTextElement(ICdmFormElement parentElement
, String labelString
,
532 Map
<Language
, LanguageString
> multilanguageText
, int textHeight
, int style
) {
533 MultilanguageTextElement element
= new MultilanguageTextElement(this, parentElement
, labelString
,
534 multilanguageText
, textHeight
, style
);
536 parentElement
.addElement(element
);
540 public KeyStatementElement
createKeyStatementElement(ICdmFormElement parentElement
, String labelString
,
541 KeyStatement keyStatement
, int textHeight
, int style
) {
542 KeyStatementElement element
= new KeyStatementElement(this, parentElement
, labelString
, keyStatement
,
545 parentElement
.addElement(element
);
551 * createTextWithLabelElement
555 * a {@link java.lang.String} object.
557 * a {@link java.lang.String} object.
560 * @param parentElement
561 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
563 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
566 public TextWithLabelElement
createTextWithLabelElement(ICdmFormElement parentElement
, String labelString
,
567 String initialText
, int style
) {
568 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, labelString
, initialText
, null,
571 parentElement
.addElement(element
);
575 public UriWithLabelElement
createUriWithLabelElement(ICdmFormElement parentElement
, String labelString
,
576 URI initialUri
, int style
) {
577 UriWithLabelElement element
= new UriWithLabelElement(this, parentElement
, labelString
, initialUri
, null, style
);
579 parentElement
.addElement(element
);
590 public OpenUrlSelectorElement
createOpenUrlSelectorElement(ICdmFormElement parentElement
, String labelString
,
591 IOpenUrlEnabled openUrlEnabled
, int style
) {
592 OpenUrlSelectorElement element
= new OpenUrlSelectorElement(this, parentElement
, labelString
, openUrlEnabled
,
595 parentElement
.addElement(element
);
601 * @param parentElement
603 * @param conversationEnabled
608 public EditPasswordElement
createEditPasswordElement(ICdmFormElement parentElement
, String labelString
,
609 ConversationHolder conversation
, User user
, int style
) {
610 EditPasswordElement element
= new EditPasswordElement(this, parentElement
, labelString
, user
, conversation
);
612 parentElement
.addElement(element
);
618 * createIntegerTextWithLabelElement
621 * @param parentElement
622 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
625 * a {@link java.lang.String} object.
626 * @param initialInteger
627 * a {@link java.lang.Integer} object.
631 * {@link eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement}
634 public NumberWithLabelElement
createIntegerTextWithLabelElement(ICdmFormElement parentElement
, String labelString
,
635 Integer initialInteger
, int style
) {
636 NumberWithLabelElement element
= new NumberWithLabelElement(this, parentElement
, labelString
, initialInteger
,
639 parentElement
.addElement(element
);
645 * createFloatTextWithLabelElement
648 * @param parentElement
649 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
652 * a {@link java.lang.String} object.
653 * @param initialFloat
658 * {@link eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement}
661 public NumberWithLabelElement
createFloatTextWithLabelElement(ICdmFormElement parentElement
, String labelString
,
662 float initialFloat
, int style
) {
663 NumberWithLabelElement element
= new NumberWithLabelElement(this, parentElement
, labelString
, initialFloat
,
666 parentElement
.addElement(element
);
672 * createLanguageStringWithLabelElement
675 * @param parentElement
676 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
679 * a {@link java.lang.String} object.
680 * @param languageString
681 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
685 * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
688 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(ICdmFormElement parentElement
,
689 String labelString
, LanguageString languageString
, int style
) {
690 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(this, parentElement
, labelString
,
691 languageString
, style
);
693 parentElement
.addElement(element
);
699 * createLanguageStringWithLabelElement
702 * @param parentElement
703 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
706 * a {@link java.lang.String} object.
707 * @param languageString
708 * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
714 * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
717 public LanguageStringWithLabelElement
createLanguageStringWithLabelElement(ICdmFormElement parentElement
,
718 String labelString
, LanguageString languageString
, int height
, int style
) {
719 LanguageStringWithLabelElement element
= new LanguageStringWithLabelElement(this, parentElement
, labelString
,
720 languageString
, height
, style
);
722 parentElement
.addElement(element
);
731 * @param parentElement
732 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
735 * a {@link java.lang.String} object.
738 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
741 public TextWithLabelElement
createTextElement(ICdmFormElement parentElement
, String initialText
, int style
) {
742 TextWithLabelElement element
= new TextWithLabelElement(this, parentElement
, null, initialText
, null, style
);
744 parentElement
.addElement(element
);
750 * createKeyValueViewerElement
753 * @param parentElement
754 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
757 * a {@link java.lang.String} object.
758 * @param valueHeading
759 * a {@link java.lang.String} object.
761 * a {@link java.util.Map} object.
762 * @return a {@link eu.etaxonomy.taxeditor.ui.element.KeyValueViewerElement}
765 public KeyValueViewerElement
createKeyValueViewerElement(ICdmFormElement parentElement
, String keyHeading
,
766 String valueHeading
, Map
<Object
, Object
> map
) {
767 KeyValueViewerElement element
= new KeyValueViewerElement(this, parentElement
, keyHeading
, valueHeading
, map
);
769 parentElement
.addElement(element
);
775 * createTermComboElement
778 * @param termComboType
780 * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.TermComboType}
782 * @param parentElement
783 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
786 * a {@link java.lang.String} object.
788 * a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase}
792 * @return a {@link eu.etaxonomy.taxeditor.ui.combo.TermComboElement}
796 public <T
extends DefinedTermBase
> TermComboElement
<T
> createTermComboElement(Class
<T
> termComboType
,
797 ICdmFormElement parentElement
, String labelString
, T selection
, int style
) {
798 TermComboElement
<T
> element
= new TermComboElement
<T
>(this, parentElement
, termComboType
, labelString
,
801 parentElement
.addElement(element
);
807 * createEnumComboElement
810 * @param enumComboType
812 * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EnumComboType}
814 * @param parentElement
815 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
819 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
822 public <T
extends IDefinedTerm
> EnumComboElement
<T
> createEnumComboElement(Class
<T
> enumComboType
,
823 ICdmFormElement parentElement
, int style
) {
824 EnumComboElement
<T
> element
= new EnumComboElement
<T
>(this, parentElement
, enumComboType
, style
);
826 parentElement
.addElement(element
);
832 * createBrowserElement
836 * a {@link java.net.URI} object.
839 * @param parentElement
840 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
842 * @return a {@link eu.etaxonomy.taxeditor.ui.element.BrowserElement}
845 public BrowserElement
createBrowserElement(ICdmFormElement parentElement
, URI imageUri
, int style
) {
846 BrowserElement element
= new BrowserElement(this, parentElement
, imageUri
, style
);
848 parentElement
.addElement(element
);
857 * @param parentElement
858 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
861 * a {@link java.net.URI} object.
864 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ImageElement} object.
866 public ImageElement
createImageElement(ICdmFormElement parentElement
, URI imageUri
, int style
) {
867 ImageElement element
= new ImageElement(this, parentElement
, imageUri
, style
);
869 parentElement
.addElement(element
);
875 * createTextActionElement
879 * a {@link java.lang.String} object.
881 * a {@link java.lang.String} object.
884 * @param parentElement
885 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
888 * a {@link java.lang.String} object.
889 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextActionElement}
892 public TextActionElement
createTextActionElement(ICdmFormElement parentElement
, String labelString
,
893 String buttonLabel
, String initialText
, int style
) {
894 TextActionElement element
= new TextActionElement(this, parentElement
, labelString
, buttonLabel
, initialText
,
897 parentElement
.addElement(element
);
906 * @param parentElement
907 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
910 * a {@link java.lang.String} object.
911 * @param initialState
915 * @return a {@link eu.etaxonomy.taxeditor.ui.element.CheckboxElement}
918 public CheckboxElement
createCheckbox(ICdmFormElement parentElement
, String label
, boolean initialState
, int style
) {
919 CheckboxElement element
= new CheckboxElement(this, parentElement
, label
, initialState
, style
| orientation
);
921 parentElement
.addElement(element
);
926 * Creates a section as a part of the form.
928 * @return the section widget
931 * {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
934 public Section
adapt(AbstractFormSection section
) {
935 section
.setMenu(section
.getLayoutComposite().getMenu());
936 adapt(section
, true, true);
938 // handle focus and property change events for cdm use
939 section
.addFocusListener(selectionFocusHandler
);
940 section
.setPropertyChangeListeners(propertyChangeListeners
);
942 if (section
.getToggle() != null) {
943 section
.getToggle().setHoverDecorationColor(getColors().getColor(IFormColors
.TB_TOGGLE_HOVER
));
944 section
.getToggle().setDecorationColor(getColors().getColor(IFormColors
.TB_TOGGLE
));
947 section
.setFont(boldFontHolder2
.getBoldFont(section
.getLayoutComposite().getFont()));
949 if ((section
.getStyle() & ExpandableComposite
.TITLE_BAR
) != 0
950 || (section
.getStyle() & ExpandableComposite
.SHORT_TITLE_BAR
) != 0) {
951 getColors().initializeSectionToolBarColors();
952 section
.setTitleBarBackground(getColors().getColor(IFormColors
.TB_BG
));
953 section
.setTitleBarBorderColor(getColors().getColor(IFormColors
.TB_BORDER
));
955 // call setTitleBarForeground regardless as it also sets the label color
956 section
.setTitleBarForeground(getColors().getColor(IFormColors
.TB_TOGGLE
));
960 private class BoldFontHolder2
{
961 private Font normalFont
;
963 private Font boldFont
;
965 public BoldFontHolder2() {
968 public Font
getBoldFont(Font font
) {
969 createBoldFont(font
);
973 private void createBoldFont(Font font
) {
974 if (normalFont
== null || !normalFont
.equals(font
)) {
978 if (boldFont
== null) {
979 boldFont
= FormFonts
.getInstance().getBoldFont(getColors().getDisplay(), normalFont
);
983 public void dispose() {
984 if (boldFont
!= null) {
985 FormFonts
.getInstance().markFinished(boldFont
, getColors().getDisplay());
993 * createToggleableTextField
996 * @param parentElement
997 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1000 * a {@link java.lang.String} object.
1001 * @param initialText
1002 * a {@link java.lang.String} object.
1003 * @param initialState
1007 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement}
1010 public ToggleableTextElement
createToggleableTextField(ICdmFormElement parentElement
, String labelString
,
1011 String initialText
, boolean initialState
, int style
) {
1012 ToggleableTextElement element
= new ToggleableTextElement(this, parentElement
, labelString
, initialText
,
1013 initialState
, style
| orientation
);
1015 parentElement
.addElement(element
);
1021 * createTimePeriodElement
1024 * @param parentElement
1025 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1027 * @param labelString
1028 * a {@link java.lang.String} object.
1030 * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1033 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TimePeriodElement}
1036 public TimePeriodElement
createTimePeriodElement(ICdmFormElement parentElement
, String labelString
,
1037 TimePeriod timePeriod
, int style
) {
1038 TimePeriodElement element
= new TimePeriodElement(this, parentElement
, labelString
, timePeriod
, style
);
1040 parentElement
.addElement(element
);
1046 * createPointElement
1051 * @param parentElement
1052 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1055 * a {@link eu.etaxonomy.cdm.model.location.Point} object.
1056 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PointElement} object.
1058 public PointElement
createPointElement(ICdmFormElement parentElement
, Point point
, int style
) {
1059 PointElement element
= new PointElement(this, parentElement
, point
, style
);
1061 parentElement
.addElement(element
);
1067 * createDateDetailSection
1070 * @param parentElement
1071 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1075 * @return a {@link eu.etaxonomy.taxeditor.ui.element.DateDetailSection}
1078 public DateDetailSection
createDateDetailSection(ICdmFormElement parentElement
, int style
) {
1079 DateDetailSection section
= new DateDetailSection(this, parentElement
, style
);
1080 parentElement
.addElement(section
);
1087 * createPartialElement
1090 * @param parentElement
1091 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1093 * @param labelString
1094 * a {@link java.lang.String} object.
1096 * a {@link org.joda.time.Partial} object.
1099 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PartialElement}
1102 public PartialElement
createPartialElement(ICdmFormElement parentElement
, String labelString
, Partial partial
,
1104 PartialElement element
= new PartialElement(this, parentElement
, labelString
, style
);
1106 parentElement
.addElement(element
);
1112 * addSelectionListener
1116 * a {@link org.eclipse.swt.events.SelectionListener} object.
1118 public void addSelectionListener(SelectionListener listener
) {
1119 selectionListenerList
.add(listener
);
1124 * removeSelectionListener
1128 * a {@link org.eclipse.swt.events.SelectionListener} object.
1130 public void removeSelectionListener(SelectionListener listener
) {
1131 if (listener
== null) {
1132 AbstractUtility
.error(this.getClass(),
1133 "Tried to remove a selection listener from this factories listeners but was null", null);
1135 selectionListenerList
.remove(listener
);
1141 * addPropertyChangeListener
1145 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1148 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
1149 if (propertyChangeListeners
.contains(listener
)) {
1152 propertyChangeListeners
.add(0, listener
);
1157 * removePropertyChangeListener
1161 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1164 public void removePropertyChangeListener(IPropertyChangeListener listener
) {
1165 propertyChangeListeners
.remove(listener
);
1170 * createHorizontalSeparator
1173 * @param parentElement
1174 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1178 * @return a {@link org.eclipse.swt.widgets.Label} object.
1180 public Label
createHorizontalSeparator(ICdmFormElement parentElement
, int style
) {
1181 Label separator
= this.createSeparator(parentElement
.getLayoutComposite(), SWT
.HORIZONTAL
| style
);
1182 separator
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY());
1188 * createVersionElement
1191 * @param parentElement
1192 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1195 * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
1200 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
1203 public VersionElement
createVersionElement(ICdmFormElement parentElement
, VersionableEntity entity
, int style
) {
1204 VersionElement element
= new VersionElement(this, parentElement
, entity
, style
);
1206 parentElement
.addElement(element
);
1211 * @param cdmBaseSection
1216 public CdmBaseElement
createCdmBaseElement(ICdmFormElement parentElement
, CdmBase entity
, int style
) {
1217 CdmBaseElement element
= new CdmBaseElement(this, parentElement
, entity
, style
);
1219 parentElement
.addElement(element
);
1225 * createVersionSection
1228 * @param parentElement
1229 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1234 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
1237 public VersionSection
createVersionSection(ICdmFormElement parentElement
, int style
) {
1238 VersionSection section
= new VersionSection(this, parentElement
, style
);
1239 parentElement
.addElement(section
);
1249 public CdmBaseSection
createCdmBaseSection(ICdmFormElement parentElement
, int style
) {
1250 CdmBaseSection section
= new CdmBaseSection(this, parentElement
, style
);
1251 parentElement
.addElement(section
);
1258 * createEmptyElement
1261 * @param parentElement
1262 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1264 * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1266 public EmptyElement
createEmptyElement(ICdmFormElement parentElement
) {
1267 EmptyElement element
= new EmptyElement(this, parentElement
, null, SWT
.NULL
);
1269 parentElement
.addElement(element
);
1275 * createHeadlineSection
1278 * @param parentElement
1279 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1282 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
1285 public HeadlineSection
createHeadlineSection(ICdmFormElement parentElement
) {
1286 HeadlineSection section
= new HeadlineSection(this, parentElement
, SWT
.NULL
);
1287 parentElement
.addElement(section
);
1294 * createParsingMessageElement
1297 * @param parentElement
1298 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1300 * @param parserProblem
1301 * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
1306 * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
1309 public ParsingMessageElement
createParsingMessageElement(ICdmFormElement parentElement
,
1310 ParserProblem parserProblem
, int style
) {
1311 ParsingMessageElement element
= new ParsingMessageElement(this, parentElement
, parserProblem
, style
);
1313 parentElement
.addElement(element
);
1320 * Used to define which {@link AbstractCdmDetailSection} or
1321 * {@link AbstractCdmDetailElement} should be created with
1322 * {@link CdmFormFactory#createCdmDetailSection(DetailType, ConversationHolder, ICdmFormElement, ISelectionProvider, int)}
1324 * {@link CdmFormFactory#createCdmDetailElement(DetailType, ICdmFormElement, int)}
1326 public static enum DetailType
{
1331 DERIVED_UNIT_FACADE
,
1332 DERIVED_UNIT_GENERAL
,
1336 FEATURE_DISTRIBUTION
,
1346 NAMERELATIONSHIP
,//never used
1348 NOMENCLATURALREFERENCE
,
1353 POLYTOMOUS_KEY_NODE
,
1367 public AbstractFormSection
createDefinedTermDetailSection(Class definedTermClass
, ConversationHolder conversation
,
1368 ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
) {
1370 AbstractFormSection section
= new DefinedTermDetailSection(this, definedTermClass
, conversation
, parentElement
,
1371 selectionProvider
, style
);
1373 parentElement
.addElement(section
);
1380 * @param definedTermClass
1381 * @param formElement
1385 public AbstractCdmDetailElement
createDefinedTermDetailElement(Class definedTermClass
,
1386 AbstractCdmDetailSection parentElement
, int style
) {
1387 AbstractCdmDetailElement element
= null;
1389 if (NamedArea
.class.isAssignableFrom(definedTermClass
)) {
1390 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1392 element
= new DefinedTermDetailElement(this, parentElement
);
1396 parentElement
.addElement(element
);
1402 * createCdmDetailSection
1407 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
1409 * @param parentElement
1410 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1412 * @param selectionProvider
1413 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1416 * @param conversation
1417 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1419 * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1422 public AbstractFormSection
createCdmDetailSection(DetailType detailType
, ConversationHolder conversation
,
1423 ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
) {
1424 AbstractFormSection section
= null;
1426 switch (detailType
) {
1427 case SCIENTIFICNAME
:
1428 section
= new NameDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1431 section
= new ReferenceDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1433 case NOMENCLATURALREFERENCE
:
1434 section
= new NomenclaturalReferenceDetailSection(this, conversation
, parentElement
, selectionProvider
,
1438 section
= new TaxonBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1441 section
= new AuthorshipDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1443 case TEAMORPERSONBASE
:
1444 section
= new TeamOrPersonBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1447 section
= new TeamDetailSection(this, conversation
, parentElement
, null, style
);
1450 section
= new PersonDetailSection(this, conversation
, parentElement
, null, style
);
1453 section
= new DescriptionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1455 case DESCRIPTIONELEMENT
:
1456 section
= new DescriptionElementDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1458 case PARSINGMESSAGE
:
1459 section
= new ParsingMessagesSection(this, conversation
, parentElement
, selectionProvider
, style
);
1462 section
= new NonViralNameDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1465 section
= new eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection(this, conversation
,
1466 parentElement
, selectionProvider
, style
);
1468 case DERIVED_UNIT_FACADE
:
1469 section
= new DerivedUnitFacadeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1471 case FIELD_OBSERVATION
:
1472 section
= new FieldObservationDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1474 case GATHERING_EVENT
:
1475 section
= new GatheringEventDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1478 section
= new DerivedUnitBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1480 case NATURAL_LANGUAGE
:
1481 section
= new NaturalLanguageSection(this, conversation
, parentElement
, selectionProvider
, style
);
1483 case FEATURE_DISTRIBUTION
:
1484 section
= new FeatureDistributionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1486 case CLASSIFICATION
:
1487 section
= new ClassificationDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1490 section
= new TaxonNodeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1492 case POLYTOMOUS_KEY
:
1493 section
= new PolytomousKeyDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1495 case POLYTOMOUS_KEY_NODE
:
1496 section
= new PolytomousKeyNodeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1499 section
= new InstitutionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1501 case DERIVED_UNIT_GENERAL
:
1502 section
= new GeneralDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1505 section
= new HybridDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1508 section
= new UserDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1511 section
= new GroupDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1514 section
= new DeterminationDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1516 case TAXON_RELATIONSHIP
:
1517 section
= new TaxonRelationshipDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1519 case REFERENCED_ENTITY
:
1520 section
= new ReferencedEntityDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1522 case TERM_VOCABULARY
:
1523 section
= new TermVocabularyDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1526 section
= new NamedAreaDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1529 section
= new UseRecordDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1533 if (section
== null) {
1534 throw new RuntimeException("You tried to create a cdm detail section that is not implemented yet.");
1537 parentElement
.addElement(section
);
1542 public NameDetailSection
createNameDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1543 NameDetailSection section
= new NameDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1544 addAndAdapt(parentElement
, section
);
1548 public ReferenceDetailSection
createReferenceDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1549 ReferenceDetailSection section
= new ReferenceDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1550 addAndAdapt(parentElement
, section
);
1554 public NomenclaturalReferenceDetailSection
createNomenclaturalReferenceDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1555 NomenclaturalReferenceDetailSection section
= new NomenclaturalReferenceDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1556 addAndAdapt(parentElement
, section
);
1560 public TaxonBaseDetailSection
createTaxonBaseDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1561 TaxonBaseDetailSection section
= new TaxonBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1562 addAndAdapt(parentElement
, section
);
1566 public AuthorshipDetailSection
createAuthorshipDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1567 AuthorshipDetailSection section
= new AuthorshipDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1568 addAndAdapt(parentElement
, section
);
1572 public TeamOrPersonBaseDetailSection
createTeamOrPersonBaseDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1573 TeamOrPersonBaseDetailSection section
= new TeamOrPersonBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1574 addAndAdapt(parentElement
, section
);
1578 public TeamDetailSection
createTeamDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, int style
){
1579 TeamDetailSection section
= new TeamDetailSection(this, conversation
, parentElement
, null, style
);
1580 addAndAdapt(parentElement
, section
);
1584 public PersonDetailSection
createPersonDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, int style
){
1585 PersonDetailSection section
= new PersonDetailSection(this, conversation
, parentElement
, null, style
);
1586 addAndAdapt(parentElement
, section
);
1590 public DescriptionDetailSection
createDescriptionDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1591 DescriptionDetailSection section
= new DescriptionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1592 addAndAdapt(parentElement
, section
);
1596 public DescriptionElementDetailSection
createDescriptionElementDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1597 DescriptionElementDetailSection section
= new DescriptionElementDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1598 addAndAdapt(parentElement
, section
);
1602 public ParsingMessagesSection
createParsingMessagesSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1603 ParsingMessagesSection section
= new ParsingMessagesSection(this, conversation
, parentElement
, selectionProvider
, style
);
1604 addAndAdapt(parentElement
, section
);
1608 public NonViralNameDetailSection
createNonViralNameDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1609 NonViralNameDetailSection section
= new NonViralNameDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1610 addAndAdapt(parentElement
, section
);
1614 public MediaDetailsSection
createMediaDetailsSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1615 MediaDetailsSection section
= new MediaDetailsSection(this, conversation
, parentElement
, selectionProvider
, style
);
1616 addAndAdapt(parentElement
, section
);
1620 public DerivedUnitFacadeDetailSection
createDerivedUnitFacadeDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1621 DerivedUnitFacadeDetailSection section
= new DerivedUnitFacadeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1622 addAndAdapt(parentElement
, section
);
1626 public FieldObservationDetailSection
createFieldObservationDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1627 FieldObservationDetailSection section
= new FieldObservationDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1628 addAndAdapt(parentElement
, section
);
1632 public GatheringEventDetailSection
createGatheringEventDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1633 GatheringEventDetailSection section
= new GatheringEventDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1634 addAndAdapt(parentElement
, section
);
1638 public DerivedUnitBaseDetailSection
createDerivedUnitBaseDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1639 DerivedUnitBaseDetailSection section
= new DerivedUnitBaseDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1640 addAndAdapt(parentElement
, section
);
1644 public NaturalLanguageSection
createNaturalLanguageSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1645 NaturalLanguageSection section
= new NaturalLanguageSection(this, conversation
, parentElement
, selectionProvider
, style
);
1646 addAndAdapt(parentElement
, section
);
1650 public FeatureDistributionDetailSection
createFeatureDistributionDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1651 FeatureDistributionDetailSection section
= new FeatureDistributionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1652 addAndAdapt(parentElement
, section
);
1656 public ClassificationDetailSection
createClassificationDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1657 ClassificationDetailSection section
= new ClassificationDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1658 addAndAdapt(parentElement
, section
);
1662 public TaxonNodeDetailSection
createTaxonNodeDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1663 TaxonNodeDetailSection section
= new TaxonNodeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1664 addAndAdapt(parentElement
, section
);
1668 public PolytomousKeyDetailSection
createPolytomousKeyDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1669 PolytomousKeyDetailSection section
= new PolytomousKeyDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1670 addAndAdapt(parentElement
, section
);
1674 public PolytomousKeyNodeDetailSection
createPolytomousKeyNodeDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1675 PolytomousKeyNodeDetailSection section
= new PolytomousKeyNodeDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1676 addAndAdapt(parentElement
, section
);
1680 public InstitutionDetailSection
createInstitutionDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1681 InstitutionDetailSection section
= new InstitutionDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1682 addAndAdapt(parentElement
, section
);
1686 public GeneralDetailSection
createGeneralDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1687 GeneralDetailSection section
= new GeneralDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1688 addAndAdapt(parentElement
, section
);
1692 public HybridDetailSection
createHybridDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1693 HybridDetailSection section
= new HybridDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1694 addAndAdapt(parentElement
, section
);
1698 public UserDetailSection
createUserDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1699 UserDetailSection section
= new UserDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1700 addAndAdapt(parentElement
, section
);
1704 public GroupDetailSection
createGroupDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1705 GroupDetailSection section
= new GroupDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1706 addAndAdapt(parentElement
, section
);
1710 public DeterminationDetailSection
createDeterminationDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1711 DeterminationDetailSection section
= new DeterminationDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1712 addAndAdapt(parentElement
, section
);
1716 public TaxonRelationshipDetailSection
createTaxonRelationshipDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1717 TaxonRelationshipDetailSection section
= new TaxonRelationshipDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1718 addAndAdapt(parentElement
, section
);
1722 public ReferencedEntityDetailSection
createReferencedEntityDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1723 ReferencedEntityDetailSection section
= new ReferencedEntityDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1724 addAndAdapt(parentElement
, section
);
1728 public TermVocabularyDetailSection
createTermVocabularyDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1729 TermVocabularyDetailSection section
= new TermVocabularyDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1730 addAndAdapt(parentElement
, section
);
1735 public NamedAreaDetailSection
createNamedAreaDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1736 NamedAreaDetailSection section
= new NamedAreaDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1737 addAndAdapt(parentElement
, section
);
1741 public UseRecordDetailSection
createUseRecordDetailSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1742 UseRecordDetailSection section
= new UseRecordDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1743 addAndAdapt(parentElement
, section
);
1747 public GeneralDetailSection
createFOSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1748 GeneralDetailSection section
= new GeneralDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1749 addAndAdapt(parentElement
, section
);
1753 public GatheringEventDetailSection
createGatheringSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1754 GatheringEventDetailSection section
= new GatheringEventDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1755 addAndAdapt(parentElement
, section
);
1759 public FieldObservationDetailSection
createFODetailsSection(ConversationHolder conversation
, ICdmFormElement parentElement
, ISelectionProvider selectionProvider
, int style
){
1760 FieldObservationDetailSection foDetailsSection
= new FieldObservationDetailSection(this, conversation
, parentElement
, selectionProvider
, style
);
1761 parentElement
.addElement(foDetailsSection
);
1762 adapt(foDetailsSection
);
1763 return foDetailsSection
;
1766 private void addAndAdapt(ICdmFormElement parentElement
, AbstractFormSection
<?
> section
) {
1767 parentElement
.addElement(section
);
1774 * createCdmDetailElement
1779 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
1783 * @param parentElement
1784 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1787 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
1790 public AbstractCdmDetailElement
createCdmDetailElement(DetailType detailType
, ICdmFormElement parentElement
, int style
) {
1791 AbstractCdmDetailElement element
= null;
1793 switch (detailType
) {
1794 case SCIENTIFICNAME
:
1795 element
= new NameDetailElement(this, parentElement
, style
);
1798 element
= new ReferenceDetailElement(this, parentElement
, style
);
1800 case NOMENCLATURALREFERENCE
:
1801 element
= new NomenclaturalReferenceDetailElement(this, parentElement
, style
);
1804 element
= new TaxonBaseDetailElement(this, parentElement
, style
);
1807 element
= new AuthorshipDetailElement(this, parentElement
, style
);
1810 element
= new TeamDetailElement(this, parentElement
, style
);
1813 element
= new PersonDetailElement(this, parentElement
, style
);
1816 element
= new DescriptionDetailElement(this, parentElement
, style
);
1818 case DESCRIPTIONELEMENT
:
1819 element
= new DescriptionElementDetailElement(this, parentElement
, style
);
1822 element
= new NonViralNameDetailElement(this, parentElement
);
1824 case DERIVED_UNIT_FACADE
:
1825 element
= new DerivedUnitFacadeDetailElement(this, parentElement
);
1827 case FIELD_OBSERVATION
:
1828 element
= new FieldObservationDetailElement(this, parentElement
);
1830 case GATHERING_EVENT
:
1831 element
= new GatheringEventDetailElement(this, parentElement
);
1834 element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1836 case NATURAL_LANGUAGE
:
1837 element
= new NaturalLanguageDetailElement(this, parentElement
);
1839 case FEATURE_DISTRIBUTION
:
1840 element
= new FeatureDistributionDetailElement(this, parentElement
);
1842 case CLASSIFICATION
:
1843 element
= new ClassificationDetailElement(this, parentElement
);
1846 element
= new TaxonNodeDetailElement(this, parentElement
);
1849 element
= new CollectionDetailElement(this, parentElement
);
1851 case POLYTOMOUS_KEY
:
1852 element
= new PolytomousKeyDetailElement(this, parentElement
);
1854 case POLYTOMOUS_KEY_NODE
:
1855 element
= new PolytomousKeyNodeDetailElement(this, parentElement
);
1858 element
= new InstitutionDetailElement(this, parentElement
);
1860 case DERIVED_UNIT_GENERAL
:
1861 element
= new GeneralDetailElement(this, parentElement
);
1864 element
= new HybridDetailElement(this, parentElement
);
1867 element
= new UserDetailElement(this, parentElement
);
1870 element
= new GroupDetailElement(this, parentElement
);
1872 case GRANTEDAUTHORITY
:
1873 element
= new GrantedAuthorityDetailElement(this, parentElement
);
1876 element
= new DeterminationDetailElement(this, parentElement
);
1878 case TAXON_RELATIONSHIP
:
1879 element
= new TaxonRelationshipDetailElement(this, parentElement
);
1881 case REFERENCED_ENTITY
:
1882 element
= new RefereneEntityDetailElement(this, parentElement
);
1884 case TERM_VOCABULARY
:
1885 element
= new TermVocabularyDetailElement(this, parentElement
);
1888 element
= new eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.NamedAreaDetailElement(this, parentElement
);
1890 case NAMED_AREA_LEVEL
:
1891 element
= new DefinedTermDetailElement
<NamedAreaLevel
>(this, parentElement
);
1894 // element = new UseRecordDetailElement(this, parentElement, style);
1895 element
= new UseRecordDetailElement(this, parentElement
);
1899 if (element
== null) {
1900 AbstractUtility
.error(this.getClass(),
1901 "Detail element was not created. Seems like the case was not implemented for the requested detail type: "
1902 + detailType
, null);
1906 parentElement
.addElement(element
);
1910 public GeneralDetailElement
createGeneralDetailElement(ICdmFormElement parentElement
){
1911 GeneralDetailElement element
= new GeneralDetailElement(this, parentElement
);
1912 addAndAdapt(parentElement
, element
);
1916 public GatheringEventDetailElement
createGatheringEventDetailElement(ICdmFormElement parentElement
) {
1917 GatheringEventDetailElement element
= new GatheringEventDetailElement(this, parentElement
);
1918 addAndAdapt(parentElement
, element
);
1922 public FieldObservationDetailElement
createFieldObservationDetailElement(ICdmFormElement parentElement
) {
1923 FieldObservationDetailElement element
= new FieldObservationDetailElement(this, parentElement
);
1924 addAndAdapt(parentElement
, element
);
1928 public DerivedUnitBaseDetailElement
createDerivedUnitBaseDetailElement(ICdmFormElement parentElement
) {
1929 DerivedUnitBaseDetailElement element
= new DerivedUnitBaseDetailElement(this, parentElement
);
1930 addAndAdapt(parentElement
, element
);
1934 public DeterminationDetailElement
createDeterminationDetailElement(ICdmFormElement parentElement
) {
1935 DeterminationDetailElement element
= new DeterminationDetailElement(this, parentElement
);
1936 addAndAdapt(parentElement
, element
);
1941 * @param parentElement
1944 private void addAndAdapt(ICdmFormElement parentElement
, AbstractCdmDetailElement
<?
> element
) {
1946 parentElement
.addElement(element
);
1951 * Used to define which {@link AbstractEntityCollectionSection} should be
1953 * {@link CdmFormFactory#createEntityDetailSection(EntityDetailType, ConversationHolder, ICdmFormElement, int)}
1955 * @author n.hoffmann
1956 * @created Mar 5, 2010
1959 public static enum EntityDetailType
{
1964 DESCRIPTIONELEMENTSOURCE
,
1968 DESCRIPTIONELEMENTMEDIA
,
1969 MEDIAREPRESENTATION
,
1970 MEDIAREPRESENTATIONPART
,
1972 NOMENCLATURALSTATUS
,
1981 STATISTICAL_MEASUREMENT_VALUE
,
1983 COLLECTING_AREA
, DETERMINATION_EVENT
, // never used
1984 SPECIMEN_COLLECTION
,
1985 IDENTIFIABLE_SOURCE_COLLECTION
,
1986 GEOGRAPHICAL_SCOPE
, // never used
1992 DETERMINATION_CURRENT
,
1993 DETERMINATION_HISTORY
1998 * createEntityDetailSection
2001 * @param entityDetailType
2003 * {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType}
2007 * @param conversation
2008 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
2010 * @param parentElement
2011 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
2013 * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
2016 public AbstractFormSection
createEntityDetailSection(EntityDetailType entityDetailType
,
2017 ConversationHolder conversation
, ICdmFormElement parentElement
, int style
) {
2018 AbstractFormSection section
= null;
2020 // System.out.println("EntityDetailSection: " + entityDetailType);
2021 switch (entityDetailType
) {
2023 // TODO this is not an AbstractEntityCollectionSection
2024 section
= new TeamDetailSection(this, conversation
, parentElement
, null, style
);
2027 section
= new TeamMemberSection(this, conversation
, parentElement
, style
);
2030 section
= new AnnotationSection(this, conversation
, parentElement
, style
);
2033 section
= new CreditSection(this, conversation
, parentElement
, style
);
2035 case DESCRIPTIONELEMENTSOURCE
:
2036 section
= new DescriptionElementSourceSection(this, conversation
, parentElement
, style
);
2039 section
= new ExtensionSection(this, conversation
, parentElement
, style
);
2042 section
= new MarkerSection(this, conversation
, parentElement
, style
);
2045 section
= new MediaSection(this, conversation
, parentElement
, style
);
2047 case DESCRIPTIONELEMENTMEDIA
:
2048 section
= new DescriptionElementMediaSection(this, conversation
, parentElement
, style
);
2050 case MEDIAREPRESENTATION
:
2051 section
= new MediaRepresentationSection(this, conversation
, parentElement
, style
);
2053 case MEDIAREPRESENTATIONPART
:
2054 section
= new MediaRepresentationPartSection(this, conversation
, parentElement
, style
);
2057 section
= new ModifierSection(this, conversation
, parentElement
, style
);
2059 case NOMENCLATURALSTATUS
:
2060 section
= new NomenclaturalStatusSection(this, conversation
, parentElement
, style
);
2062 case NAME_RELATIONSHIP
:
2063 section
= new NameRelationshipDetailSection(this, conversation
, parentElement
, style
);
2066 section
= new ProtologueSection(this, conversation
, parentElement
, style
);
2069 section
= new RightsSection(this, conversation
, parentElement
, style
);
2072 section
= new SourceSection(this, conversation
, parentElement
, style
);
2075 section
= new ScopeSection(this, conversation
, parentElement
, style
);
2077 case DESCRIPTIONSOURCE
:
2078 section
= new DescriptionSourceSection(this, conversation
, parentElement
, style
);
2080 case TYPEDESIGNATION
:
2081 section
= new TypeDesignationSection(this, conversation
, parentElement
, style
);
2084 section
= new StateDataSection(this, conversation
, parentElement
, style
);
2086 case STATISTICAL_MEASUREMENT_VALUE
:
2087 section
= new StatisticalMeasurementValueSection(this, conversation
, parentElement
, style
);
2089 case DESCRIBED_SPECIMEN
:
2090 section
= new DescribedSpecimenSection(this, conversation
, parentElement
, style
);
2092 case COLLECTING_AREA
:
2093 section
= new CollectingAreasDetailSection(this, conversation
, parentElement
, style
);
2095 case DETERMINATION_CURRENT
:
2096 section
= new CurrentDeterminationDetailSection(this, conversation
, parentElement
, style
);
2098 case DETERMINATION_HISTORY
:
2099 section
= new DeterminationHistoryDetailSection(this, conversation
, parentElement
, style
);
2101 case SPECIMEN_COLLECTION
:
2102 section
= new SpecimenCollectionDetailSection(this, conversation
, parentElement
, style
);
2104 case IDENTIFIABLE_SOURCE_COLLECTION
:
2105 section
= new SourceCollectionDetailSection(this, conversation
, parentElement
, style
);
2107 case GEOGRAPHICAL_SCOPE
:
2108 section
= new GeographicalScopeDetailSection(this, conversation
, parentElement
, style
);
2110 case SCOPE_RESTRICTION
:
2111 section
= new ScopeRestrictionSection(this, conversation
, parentElement
, style
);
2114 section
= new MemberDetailSection(this, conversation
, parentElement
, style
);
2116 case GRANTED_AUTHORITY
:
2117 section
= new GrantedAuthorityDetailSection(this, conversation
, parentElement
, style
);
2119 case GROUPS_BY_USER
:
2120 section
= new GroupsByUserDetailSection(this, conversation
, parentElement
, style
);
2122 case TAXONOMIC_SCOPE
:
2123 section
= new TaxonomicScopeSection(this, conversation
, parentElement
, style
);
2126 parentElement
.addElement(section
);
2133 * createEntityCollectionElement
2136 * @param removeListener
2137 * a {@link org.eclipse.swt.events.SelectionListener} object.
2140 * @param parentElement
2142 * {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
2144 * @param versionableEntity
2145 * a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity}
2147 * @param backgroundColor
2148 * a {@link org.eclipse.swt.graphics.Color} object.
2150 * {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement}
2153 public AbstractEntityCollectionElement
createEntityCollectionElement(AbstractFormSection parentElement
,
2154 Object versionableEntity
, SelectionListener removeListener
, Color backgroundColor
, int style
) {
2155 AbstractEntityCollectionElement element
= null;
2157 Object entity
= HibernateProxyHelper
.deproxy(versionableEntity
);
2159 if (entity
instanceof Annotation
) {
2160 element
= new AnnotationElement(this, parentElement
, (Annotation
) entity
, removeListener
, style
);
2161 } else if (entity
instanceof Person
) {
2162 element
= new TeamMemberElement(this, parentElement
, (Person
) entity
, removeListener
, style
);
2163 } else if (entity
instanceof Credit
) {
2164 element
= new CreditElement(this, parentElement
, (Credit
) entity
, removeListener
, style
);
2165 } else if (entity
instanceof Extension
) {
2166 element
= new ExtensionElement(this, parentElement
, (Extension
) entity
, removeListener
, style
);
2167 } else if (entity
instanceof Marker
) {
2168 element
= new MarkerElement(this, parentElement
, (Marker
) entity
, removeListener
, style
);
2169 } else if (entity
instanceof Media
) {
2170 element
= new MediaElement(this, parentElement
, (Media
) entity
, removeListener
, style
);
2171 } else if (entity
instanceof MediaRepresentation
) {
2172 element
= new MediaRepresentationElement(this, parentElement
, (MediaRepresentation
) entity
, removeListener
,
2174 } else if (entity
instanceof ImageFile
) {
2175 element
= new ImageFileElement(this, parentElement
, (ImageFile
) entity
, removeListener
, style
);
2176 } else if (entity
instanceof MediaRepresentationPart
) {
2177 element
= new MediaRepresentationPartElement(this, parentElement
, (MediaRepresentationPart
) entity
,
2178 removeListener
, style
);
2179 } else if (entity
instanceof NomenclaturalStatus
) {
2180 element
= new NomenclaturalStatusElement(this, parentElement
, (NomenclaturalStatus
) entity
, removeListener
,
2182 } else if (entity
instanceof Rights
) {
2183 element
= new RightsElement(this, parentElement
, (Rights
) entity
, removeListener
, style
);
2184 } else if (entity
instanceof DescriptionElementSource
) {
2185 element
= new DescriptionElementSourceElement(this, parentElement
, (DescriptionElementSource
) entity
,
2186 removeListener
, style
);
2187 } else if (entity
instanceof IdentifiableSource
) {
2188 element
= new IdentifiableSourceElement(this, parentElement
, (IdentifiableSource
) entity
, removeListener
,
2190 } else if (entity
instanceof Scope
) {
2191 element
= new ScopeElement(this, parentElement
, (Scope
) entity
, removeListener
, style
);
2192 } else if (entity
instanceof Modifier
) {
2193 element
= new ModifierElement(this, parentElement
, (Modifier
) entity
, removeListener
, style
);
2194 } else if (entity
instanceof Reference
) {
2195 element
= new DescriptionSourceElement(this, parentElement
, (Reference
) entity
, removeListener
, style
);
2196 } else if (entity
instanceof NameTypeDesignation
) {
2197 element
= new NameTypeDesignationElement(this, parentElement
, (NameTypeDesignation
) entity
, removeListener
,
2199 } else if (entity
instanceof NameRelationship
) {
2200 element
= new NameRelationshipDetailElement(this, parentElement
, (NameRelationship
) entity
, removeListener
,
2202 } else if (entity
instanceof SpecimenTypeDesignation
) {
2203 element
= new SpecimenTypeDesignationElement(this, parentElement
, (SpecimenTypeDesignation
) entity
,
2204 removeListener
, style
);
2205 } else if (entity
instanceof StateData
) {
2206 element
= new StateDataElement(this, parentElement
, (StateData
) entity
, removeListener
, style
);
2207 } else if (entity
instanceof StatisticalMeasurementValue
) {
2208 element
= new StatisticalMeasurementValueElement(this, parentElement
, (StatisticalMeasurementValue
) entity
,
2209 removeListener
, style
);
2210 } else if (entity
instanceof DerivedUnit
) {
2211 element
= new DerivedUnitElement(this, parentElement
, (DerivedUnit
) entity
, removeListener
, style
);
2212 } else if (entity
instanceof NamedArea
) {
2213 element
= new NamedAreaDetailElement(this, parentElement
, (NamedArea
) entity
, removeListener
, style
);
2214 } else if (entity
instanceof DeterminationEvent
) {
2215 element
= new DeterminationEventDetailElement(this, parentElement
, (DeterminationEvent
) entity
,
2216 removeListener
, style
);
2217 } else if (entity
instanceof Specimen
) {
2218 element
= new SpecimenCollectionDetailElement(this, parentElement
, (Specimen
) entity
, removeListener
, style
);
2219 } else if (entity
instanceof User
) {
2220 element
= new MemberDetailElement(this, parentElement
, (User
) entity
, removeListener
, style
);
2221 } else if (entity
instanceof GrantedAuthority
) {
2222 element
= new GrantedAuthorityCollectionElement(this, parentElement
, (GrantedAuthorityImpl
) entity
,
2223 removeListener
, style
);
2224 } else if (entity
instanceof Group
) {
2225 element
= new GroupsByUserDetailElement(this, parentElement
, (Group
) entity
, removeListener
, style
);
2226 } else if (entity
instanceof Taxon
) {
2227 element
= new TaxonDetailElement(this, parentElement
, (Taxon
) entity
, removeListener
, style
);
2228 } else if (entity
instanceof DescriptionElementBase
) {
2229 // this is the special case for protologs, maybe we can do this
2230 // differently when API improves
2231 DescriptionElementBase descriptionElement
= (DescriptionElementBase
) entity
;
2232 if (descriptionElement
.getFeature().equals(Feature
.PROTOLOGUE())) {
2233 element
= new ProtologueElement(this, parentElement
, descriptionElement
, removeListener
, style
);
2237 if (element
== null) {
2238 AbstractUtility
.errorDialog("No element for entity", this,
2239 "Could not generate element for entity. Looks like the case is not handled already. Check implementation. Entity: "
2243 else if (backgroundColor
!= null && !backgroundColor
.isDisposed()) {
2244 element
.setPersistentBackground(backgroundColor
);
2248 parentElement
.addElement(element
);
2254 * Creates a selection element for the given type T.
2257 * <strong>Selection elements not handled by this method:</strong>
2259 * <li>{@link TaxonNodeSelectionElement} see
2260 * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
2262 * <li>{@link NomenclaturalAuthorTeamSelectionElement} see
2263 * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
2269 * a {@link Class} object of the type that you want the selection
2271 * @param parentElement
2272 * a {@link ICdmFormElement} object.
2273 * @param labelString
2274 * a {@link String} object.
2275 * @param selectionType
2277 * a {@link ICdmBase} object.
2280 * @param conversation
2281 * a {@link ConversationHolder} object.
2282 * @return a {@link EntitySelectionElement} object.
2284 public <T
extends ICdmBase
> EntitySelectionElement
<T
> createSelectionElement(Class
<T
> clazz
,
2285 ConversationHolder conversation
, ICdmFormElement parentElement
, String labelString
, T selection
, int mode
,
2287 EntitySelectionElement
<T
> element
= new EntitySelectionElement
<T
>(this, conversation
, parentElement
, clazz
,
2288 labelString
, selection
, mode
, style
);
2290 parentElement
.addElement(element
);
2294 public TaxonNodeSelectionElement
createTaxonNodeSelectionElement(ConversationHolder conversation
,
2295 ICdmFormElement parentElement
, String labelString
, TaxonNode selection
, int mode
, int style
) {
2296 TaxonNodeSelectionElement element
= new TaxonNodeSelectionElement(this, conversation
, parentElement
,
2297 labelString
, selection
, mode
, style
);
2299 parentElement
.addElement(element
);
2303 public NomenclaturalAuthorTeamSelectionElement
createNomenclaturalAuthorTeamSelectionElement(
2304 ConversationHolder conversation
, ICdmFormElement parentElement
, String labelString
, Team selection
,
2305 int mode
, int style
) {
2306 NomenclaturalAuthorTeamSelectionElement element
= new NomenclaturalAuthorTeamSelectionElement(this,
2307 conversation
, parentElement
, labelString
, selection
, mode
, style
);
2309 parentElement
.addElement(element
);
2313 /** {@inheritDoc} */
2314 public LabelElement
createLabel(ICdmFormElement parentElement
, String text
) {
2315 LabelElement labelElement
= new LabelElement(this, parentElement
, text
);
2316 adapt(labelElement
);
2317 parentElement
.addElement(labelElement
);
2318 return labelElement
;
2323 * Getter for the field <code>selectionProvider</code>.
2326 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
2328 public ISelectionProvider
getSelectionProvider() {
2329 return selectionProvider
;
2334 * createDetailedDescriptionDetailElement
2337 * @param parentElement
2338 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
2342 * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
2347 * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
2350 public AbstractDetailedDescriptionDetailElement
createDetailedDescriptionDetailElement(
2351 ICdmFormElement parentElement
, DescriptionElementBase entity
, int style
) {
2352 AbstractDetailedDescriptionDetailElement detailedDescriptionElement
= null;
2354 if (entity
instanceof CategoricalData
) {
2355 detailedDescriptionElement
= new CategoricalDataDetailElement(this, parentElement
,
2356 (CategoricalData
) entity
, style
);
2357 } else if (entity
instanceof CommonTaxonName
) {
2358 detailedDescriptionElement
= new CommonNameDetailElement(this, parentElement
, (CommonTaxonName
) entity
,
2360 } else if (entity
instanceof Distribution
) {
2361 detailedDescriptionElement
= new DistributionDetailElement(this, parentElement
, (Distribution
) entity
,
2363 } else if (entity
instanceof IndividualsAssociation
) {
2364 detailedDescriptionElement
= new IndividualsAssociationDetailElement(this, parentElement
,
2365 (IndividualsAssociation
) entity
, style
);
2366 } else if (entity
instanceof QuantitativeData
) {
2367 detailedDescriptionElement
= new QuantitativeDataDetailElement(this, parentElement
,
2368 (QuantitativeData
) entity
, style
);
2369 } else if (entity
instanceof TaxonInteraction
) {
2370 detailedDescriptionElement
= new TaxonInteractionDetailElement(this, parentElement
,
2371 (TaxonInteraction
) entity
, style
);
2372 } else if (entity
instanceof TextData
) {
2373 detailedDescriptionElement
= new TextDataDetailElement(this, parentElement
, (TextData
) entity
, style
);
2375 throw new IllegalStateException("There is no interface for the given description element");
2377 adapt(detailedDescriptionElement
);
2378 parentElement
.addElement(detailedDescriptionElement
);
2379 return detailedDescriptionElement
;
2384 * Creates a styled text as a part of the form.
2389 * the text initial value
2392 * @return the text widget
2394 public StyledText
createStyledText(Composite parent
, String value
, int style
) {
2395 StyledText text
= new StyledText(parent
, getBorderStyle() | style
| getOrientation());
2396 if (value
!= null) {
2397 text
.setText(value
);
2399 text
.setForeground(getColors().getForeground());
2400 text
.setBackground(getColors().getBackground());
2401 // text.addFocusListener(visibilityHandler);