Project

General

Profile

Download (136 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 *
3
 */
4
package eu.etaxonomy.taxeditor.ui.element;
5

    
6
import java.net.URI;
7
import java.util.ArrayList;
8
import java.util.HashSet;
9
import java.util.List;
10
import java.util.Map;
11
import java.util.Set;
12

    
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.DateTime;
41
import org.joda.time.Partial;
42
import org.springframework.security.core.GrantedAuthority;
43

    
44
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
45
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
46
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
47
import eu.etaxonomy.cdm.model.agent.Person;
48
import eu.etaxonomy.cdm.model.agent.Team;
49
import eu.etaxonomy.cdm.model.common.Annotation;
50
import eu.etaxonomy.cdm.model.common.CdmBase;
51
import eu.etaxonomy.cdm.model.common.Credit;
52
import eu.etaxonomy.cdm.model.common.DefinedTerm;
53
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
54
import eu.etaxonomy.cdm.model.common.Extension;
55
import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
56
import eu.etaxonomy.cdm.model.common.Group;
57
import eu.etaxonomy.cdm.model.common.ICdmBase;
58
import eu.etaxonomy.cdm.model.common.IEnumTerm;
59
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
60
import eu.etaxonomy.cdm.model.common.Identifier;
61
import eu.etaxonomy.cdm.model.common.LSID;
62
import eu.etaxonomy.cdm.model.common.Language;
63
import eu.etaxonomy.cdm.model.common.LanguageString;
64
import eu.etaxonomy.cdm.model.common.Marker;
65
import eu.etaxonomy.cdm.model.common.Representation;
66
import eu.etaxonomy.cdm.model.common.TermBase;
67
import eu.etaxonomy.cdm.model.common.TermType;
68
import eu.etaxonomy.cdm.model.common.TermVocabulary;
69
import eu.etaxonomy.cdm.model.common.TimePeriod;
70
import eu.etaxonomy.cdm.model.common.User;
71
import eu.etaxonomy.cdm.model.common.VersionableEntity;
72
import eu.etaxonomy.cdm.model.description.CategoricalData;
73
import eu.etaxonomy.cdm.model.description.CommonTaxonName;
74
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
75
import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
76
import eu.etaxonomy.cdm.model.description.Distribution;
77
import eu.etaxonomy.cdm.model.description.Feature;
78
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
79
import eu.etaxonomy.cdm.model.description.KeyStatement;
80
import eu.etaxonomy.cdm.model.description.MeasurementUnit;
81
import eu.etaxonomy.cdm.model.description.QuantitativeData;
82
import eu.etaxonomy.cdm.model.description.State;
83
import eu.etaxonomy.cdm.model.description.StateData;
84
import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
85
import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue;
86
import eu.etaxonomy.cdm.model.description.TaxonInteraction;
87
import eu.etaxonomy.cdm.model.description.TextData;
88
import eu.etaxonomy.cdm.model.location.NamedArea;
89
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
90
import eu.etaxonomy.cdm.model.location.Point;
91
import eu.etaxonomy.cdm.model.media.ImageFile;
92
import eu.etaxonomy.cdm.model.media.Media;
93
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
94
import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
95
import eu.etaxonomy.cdm.model.media.Rights;
96
import eu.etaxonomy.cdm.model.molecular.DnaSample;
97
import eu.etaxonomy.cdm.model.name.NameRelationship;
98
import eu.etaxonomy.cdm.model.name.NameTypeDesignation;
99
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
100
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
101
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
102
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
103
import eu.etaxonomy.cdm.model.reference.Reference;
104
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
105
import eu.etaxonomy.cdm.model.taxon.Taxon;
106
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
107
import eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation;
108
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
109
import eu.etaxonomy.taxeditor.model.MessagingUtils;
110
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
111
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
112
import eu.etaxonomy.taxeditor.ui.combo.VocabularyComboElement;
113
import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection.UnitType;
114
import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement;
115
import eu.etaxonomy.taxeditor.ui.openurl.IOpenUrlEnabled;
116
import eu.etaxonomy.taxeditor.ui.openurl.OpenUrlSelectorElement;
117
import eu.etaxonomy.taxeditor.ui.password.EditPasswordElement;
118
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
119
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
120
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
121
import eu.etaxonomy.taxeditor.ui.section.EmptyElement;
122
import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionDetailElement;
123
import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionDetailSection;
124
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailElement;
125
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
126
import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailElement;
127
import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
128
import eu.etaxonomy.taxeditor.ui.section.agent.TeamMemberElement;
129
import eu.etaxonomy.taxeditor.ui.section.agent.TeamMemberSection;
130
import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
131
import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationDetailElement;
132
import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationDetailSection;
133
import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeAgentRelationCollectionElement;
134
import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeAgentRelationCollectionSection;
135
import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailElement;
136
import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailSection;
137
import eu.etaxonomy.taxeditor.ui.section.common.ReferenceEntityDetailElement;
138
import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
139
import eu.etaxonomy.taxeditor.ui.section.description.DerivedUnitElement;
140
import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
141
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailElement;
142
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
143
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailElement;
144
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
145
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
146
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceElement;
147
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
148
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceElement;
149
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
150
import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
151
import eu.etaxonomy.taxeditor.ui.section.description.ModifierElement;
152
import eu.etaxonomy.taxeditor.ui.section.description.ModifierSection;
153
import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageDetailElement;
154
import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
155
import eu.etaxonomy.taxeditor.ui.section.description.ScopeElement;
156
import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
157
import eu.etaxonomy.taxeditor.ui.section.description.StateDataElement;
158
import eu.etaxonomy.taxeditor.ui.section.description.StateDataSection;
159
import eu.etaxonomy.taxeditor.ui.section.description.StatisticalMeasurementValueElement;
160
import eu.etaxonomy.taxeditor.ui.section.description.StatisticalMeasurementValueSection;
161
import eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement;
162
import eu.etaxonomy.taxeditor.ui.section.description.detail.CategoricalDataDetailElement;
163
import eu.etaxonomy.taxeditor.ui.section.description.detail.CommonNameDetailElement;
164
import eu.etaxonomy.taxeditor.ui.section.description.detail.DistributionDetailElement;
165
import eu.etaxonomy.taxeditor.ui.section.description.detail.IndividualsAssociationDetailElement;
166
import eu.etaxonomy.taxeditor.ui.section.description.detail.QuantitativeDataDetailElement;
167
import eu.etaxonomy.taxeditor.ui.section.description.detail.TaxonInteractionDetailElement;
168
import eu.etaxonomy.taxeditor.ui.section.description.detail.TextDataDetailElement;
169
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailElement;
170
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
171
import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityCollectionElement;
172
import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailElement;
173
import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
174
import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailElement;
175
import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
176
import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailElement;
177
import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
178
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailElement;
179
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
180
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailElement;
181
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
182
import eu.etaxonomy.taxeditor.ui.section.key.ScopeRestrictionSection;
183
import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
184
import eu.etaxonomy.taxeditor.ui.section.media.ImageFileElement;
185
import eu.etaxonomy.taxeditor.ui.section.media.MediaDetailElement;
186
import eu.etaxonomy.taxeditor.ui.section.media.MediaMetaElement;
187
import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationElement;
188
import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationPartElement;
189
import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationPartSection;
190
import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationSection;
191
import eu.etaxonomy.taxeditor.ui.section.media.MediaSection;
192
import eu.etaxonomy.taxeditor.ui.section.name.AuthorshipDetailElement;
193
import eu.etaxonomy.taxeditor.ui.section.name.AuthorshipDetailSection;
194
import eu.etaxonomy.taxeditor.ui.section.name.HybridDetailElement;
195
import eu.etaxonomy.taxeditor.ui.section.name.HybridDetailSection;
196
import eu.etaxonomy.taxeditor.ui.section.name.NameDetailElement;
197
import eu.etaxonomy.taxeditor.ui.section.name.NameDetailSection;
198
import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailElement;
199
import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
200
import eu.etaxonomy.taxeditor.ui.section.name.NameTypeDesignationElement;
201
import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusElement;
202
import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
203
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailElement;
204
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
205
import eu.etaxonomy.taxeditor.ui.section.name.ProtologueElement;
206
import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
207
import eu.etaxonomy.taxeditor.ui.section.name.SpecimenTypeDesignationElement;
208
import eu.etaxonomy.taxeditor.ui.section.name.SynonymRelationshipDetailElement;
209
import eu.etaxonomy.taxeditor.ui.section.name.SynonymRelationshipDetailSection;
210
import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
211
import eu.etaxonomy.taxeditor.ui.section.occurrence.CollectingAreasDetailSection;
212
import eu.etaxonomy.taxeditor.ui.section.occurrence.CollectionDetailElement;
213
import eu.etaxonomy.taxeditor.ui.section.occurrence.CurrentDeterminationDetailSection;
214
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailElement;
215
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
216
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailElement;
217
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailSection;
218
import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailElement;
219
import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
220
import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationEventDetailElement;
221
import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationHistoryDetailSection;
222
import eu.etaxonomy.taxeditor.ui.section.occurrence.EmptySection;
223
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailElement;
224
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
225
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailElement;
226
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
227
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailElement;
228
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
229
import eu.etaxonomy.taxeditor.ui.section.occurrence.GeoScopeDetailSection;
230
import eu.etaxonomy.taxeditor.ui.section.occurrence.GeoScopePolyKeyDetailSection;
231
import eu.etaxonomy.taxeditor.ui.section.occurrence.NamedAreaDetailElement;
232
import eu.etaxonomy.taxeditor.ui.section.occurrence.OriginalLabelDataSection;
233
import eu.etaxonomy.taxeditor.ui.section.occurrence.SourceCollectionDetailSection;
234
import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenCollectionDetailElement;
235
import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenCollectionDetailSection;
236
import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenHierarchyDetailElement;
237
import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenHierarchyDetailSection;
238
import eu.etaxonomy.taxeditor.ui.section.occurrence.association.DerivedUnitTypeDesignationElement;
239
import eu.etaxonomy.taxeditor.ui.section.occurrence.association.DerivedUnitTypeDesignationSection;
240
import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailElement;
241
import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
242
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenCurrentDeterminationDetailSection;
243
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailElement;
244
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailSection;
245
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenGeneralDetailElement;
246
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenGeneralDetailSection;
247
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenSourceCollectionDetailSection;
248
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractSampleDesignationDetailSection;
249
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationCloningDetailElement;
250
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationCloningDetailSection;
251
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGelPhotoCollectionDetailSection;
252
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGelPhotoDetailElement;
253
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGeneralDetailElement;
254
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGeneralDetailSection;
255
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationPrimerDetailElement;
256
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationPrimerDetailSection;
257
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.CurrentSampleDesignationDetailSection;
258
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailElement;
259
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailSection;
260
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailElement;
261
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailSection;
262
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSamplePreparationPreservationDetailElement;
263
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSamplePreparationPreservationSection;
264
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.PrimerGeneralDetailElement;
265
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailElement;
266
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailSection;
267
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationHistoryDetailSection;
268
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationTextDetailElement;
269
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceContigFileCollectionDetailSection;
270
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailElement;
271
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailSection;
272
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollectionDetailElement;
273
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollectionDetailSection;
274
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailElement;
275
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailSection;
276
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
277
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailElement;
278
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
279
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailElement;
280
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
281
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailElement;
282
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
283
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailElement;
284
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
285
import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationElement;
286
import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
287
import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseElement;
288
import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseSection;
289
import eu.etaxonomy.taxeditor.ui.section.supplemental.CreditElement;
290
import eu.etaxonomy.taxeditor.ui.section.supplemental.CreditSection;
291
import eu.etaxonomy.taxeditor.ui.section.supplemental.ExtensionElement;
292
import eu.etaxonomy.taxeditor.ui.section.supplemental.ExtensionSection;
293
import eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection;
294
import eu.etaxonomy.taxeditor.ui.section.supplemental.IdentifiableSourceElement;
295
import eu.etaxonomy.taxeditor.ui.section.supplemental.MarkerElement;
296
import eu.etaxonomy.taxeditor.ui.section.supplemental.MarkerSection;
297
import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsElement;
298
import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection;
299
import eu.etaxonomy.taxeditor.ui.section.supplemental.SourceSection;
300
import eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement;
301
import eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection;
302
import eu.etaxonomy.taxeditor.ui.section.supplemental.identifier.DerivedUnitFacadeIdentifierSection;
303
import eu.etaxonomy.taxeditor.ui.section.supplemental.identifier.IdentifierElement;
304
import eu.etaxonomy.taxeditor.ui.section.supplemental.identifier.IdentifierSection;
305
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement;
306
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
307
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailElement;
308
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
309
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonDetailElement;
310
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailElement;
311
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
312
import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailElement;
313
import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
314
import eu.etaxonomy.taxeditor.ui.section.user.UserDetailElement;
315
import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
316
import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailElement;
317
import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
318
import eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailElement;
319
import eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailSection;
320
import eu.etaxonomy.taxeditor.ui.section.vocabulary.FeatureDetailElement;
321
import eu.etaxonomy.taxeditor.ui.section.vocabulary.MeasurementUnitCollectionElement;
322
import eu.etaxonomy.taxeditor.ui.section.vocabulary.MeasurementUnitCollectionSection;
323
import eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailSection;
324
import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierVocabulariesCollectionSection;
325
import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierVocabulariesElement;
326
import eu.etaxonomy.taxeditor.ui.section.vocabulary.StateVocabularyCollectionElement;
327
import eu.etaxonomy.taxeditor.ui.section.vocabulary.StateVocabularyCollectionSection;
328
import eu.etaxonomy.taxeditor.ui.section.vocabulary.StatisticalMeasureCollectionElement;
329
import eu.etaxonomy.taxeditor.ui.section.vocabulary.StatisticalMeasureCollectionSection;
330
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailElement;
331
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
332
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
333
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElementWithAbbreviatedTitle;
334
import eu.etaxonomy.taxeditor.ui.selection.NomenclaturalAuthorTeamSelectionElement;
335
import eu.etaxonomy.taxeditor.ui.selection.TaxonNodeSelectionElement;
336

    
337
/**
338
 * <p>
339
 * CdmFormFactory class.
340
 * </p>
341
 *
342
 * @author n.hoffmann
343
 * @created Feb 24, 2010
344
 * @version 1.0
345
 */
346
public class CdmFormFactory extends FormToolkit {
347

    
348
    private BoldFontHolder2 boldFontHolder2;
349
    private MouseListener selectionMouseHandler;
350
    private FocusListener selectionFocusHandler;
351

    
352
    private final Set<SelectionListener> selectionListenerList = new HashSet<SelectionListener>();
353

    
354
    private final List<IPropertyChangeListener> propertyChangeListeners = new ArrayList<IPropertyChangeListener>();
355

    
356
    private final int orientation = Window.getDefaultOrientation();
357
    private ISelectionProvider selectionProvider;
358

    
359
    /** Constant <code>EMPTY_SELECTION</code> */
360
    public static ISelection EMPTY_SELECTION = new ISelection() {
361
        @Override
362
        public boolean isEmpty() {
363
            return true;
364
        }
365
    };
366

    
367
    /**
368
     *
369
     * @author n.hoffmann
370
     * @date Jan 25, 2010
371
     *
372
     */
373
    private class SelectionMouseHandler extends MouseAdapter {
374
        @Override
375
        public void mouseDown(MouseEvent e) {
376
            notifySelectionListeners(e);
377
        }
378
    }
379

    
380
    /**
381
     *
382
     * @author n.hoffmann
383
     * @date Jan 25, 2010
384
     *
385
     */
386
    private class SelectionFocusHandler extends FocusAdapter {
387
        @Override
388
        public void focusGained(FocusEvent e) {
389
            notifySelectionListeners(e);
390
        }
391
    }
392

    
393
    private void notifySelectionListeners(TypedEvent e) {
394
        Event event = new Event();
395
        event.widget = e.widget;
396
        SelectionEvent selectionEvent = new SelectionEvent(event);
397

    
398
        for (SelectionListener listener : selectionListenerList) {
399
            listener.widgetSelected(selectionEvent);
400
        }
401
    }
402

    
403
    /**
404
     * <p>
405
     * Constructor for CdmFormFactory.
406
     * </p>
407
     *
408
     * @param display
409
     *            a {@link org.eclipse.swt.widgets.Display} object.
410
     * @param selectionProvider
411
     *            a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
412
     */
413
    public CdmFormFactory(Display display, ISelectionProvider selectionProvider) {
414
        super(display);
415
        this.selectionProvider = selectionProvider;
416
        init();
417
    }
418

    
419
    /**
420
     * <p>
421
     * Constructor for CdmFormFactory.
422
     * </p>
423
     *
424
     * @param display
425
     *            a {@link org.eclipse.swt.widgets.Display} object.
426
     */
427
    public CdmFormFactory(Display display) {
428
        super(display);
429
        init();
430
    }
431

    
432
    /**
433
	 *
434
	 */
435
    private void init() {
436
        boldFontHolder2 = new BoldFontHolder2();
437
        selectionMouseHandler = new SelectionMouseHandler();
438
        selectionFocusHandler = new SelectionFocusHandler();
439
    }
440

    
441
    /**
442
     * Creates an instance initialized with the correct selectionProvider
443
     *
444
     * Make sure to remove the instance when the entityComposite disposes via
445
     * destroySelectionArbitrator(..)
446
     *
447
     * @param entityElement
448
     *            a {@link eu.etaxonomy.taxeditor.ui.element.IEntityElement}
449
     *            object.
450
     * @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
451
     *         object.
452
     */
453
    public SelectionArbitrator createSelectionArbitrator(IEntityElement entityElement) {
454
        SelectionArbitrator selectionArbitrator = new SelectionArbitrator(entityElement);
455
        selectionArbitrator.addSelectionProvider(selectionProvider);
456
        selectionProvider.addSelectionChangedListener(selectionArbitrator);
457
        addSelectionListener(selectionArbitrator);
458
        return selectionArbitrator;
459
    }
460

    
461
    /**
462
     * <p>
463
     * destroySelectionArbitrator
464
     * </p>
465
     *
466
     * @param selectionArbitrator
467
     *            a
468
     *            {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
469
     *            object.
470
     */
471
    public void destroySelectionArbitrator(SelectionArbitrator selectionArbitrator) {
472
        removeSelectionListener(selectionArbitrator);
473
        if (selectionProvider != null) {
474
            selectionProvider.removeSelectionChangedListener(selectionArbitrator);
475
        } else {
476
            MessagingUtils.error(this.getClass(),
477
                    "Tried to destroy a selection listener from this factories listeners but was null", null);
478
        }
479
    }
480

    
481
    /**
482
     * <p>
483
     * Adapts the {@link AbstractCdmFormElement}:<br>
484
     * - sets the {@link IPropertyChangeListener}s handled by this class
485
     * </p>
486
     *
487
     * @param formElement
488
     *            a
489
     *            {@link eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement}
490
     *            object.
491
     */
492
    public void adapt(ICdmFormElement formElement) {
493
        formElement.setPropertyChangeListeners(propertyChangeListeners);
494
    }
495

    
496
    /** {@inheritDoc} */
497
    @Override
498
    public void adapt(Control control, boolean trackFocus, boolean trackKeyboard) {
499
        if (trackFocus) {
500
            control.addFocusListener(selectionFocusHandler);
501
        }
502
        super.adapt(control, trackFocus, trackKeyboard);
503
    }
504

    
505
    /** {@inheritDoc} */
506
    @Override
507
    public void adapt(Composite composite) {
508
        composite.addMouseListener(selectionMouseHandler);
509
        super.adapt(composite);
510
    }
511

    
512
    /**
513
     * <p>
514
     * destroyElement
515
     * </p>
516
     *
517
     * @param formElement
518
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
519
     *            object.
520
     */
521
    public void destroyElement(ICdmFormElement formElement) {
522
        // return if element was not initialized
523
        if (formElement == null) {
524
            return;
525
        }
526
        // destroy selection arbitrator, if any
527
        if (formElement instanceof ISelectableElement) {
528
            destroySelectionArbitrator(((ISelectableElement) formElement).getSelectionArbitrator());
529
        }
530
        // remove this element form its parents list of elements
531
        // ICdmFormElement parentElement = formElement.getParentElement();
532
        // if(parentElement != null){
533
        // parentElement.removeElement(formElement);
534
        // }
535
        // call destroy on child elements recursively
536
        for (ICdmFormElement childElement : formElement.getElements()) {
537
            destroyElement(childElement);
538
        }
539
        // dispose of the controls
540
        for (Control control : formElement.getControls()) {
541
            // we added the layoutComposite of the parental element as the
542
            // layout composite to this formElement
543
            // but we do not want to destroy it.
544
            if (control.equals(formElement.getLayoutComposite())) {
545
                continue;
546
            } else {
547
                control.dispose();
548
                control = null;
549
            }
550
        }
551
    }
552

    
553
    /**
554
     * <p>
555
     * createEmptyCell
556
     * </p>
557
     *
558
     * @param parent
559
     *            a {@link org.eclipse.swt.widgets.Composite} object.
560
     * @return a {@link org.eclipse.swt.widgets.Label} object.
561
     */
562
    public Label createEmptyCell(Composite parent) {
563
        return this.createLabel(parent, null);
564
    }
565

    
566
    /**
567
     * <p>
568
     * createMultiLanguageTextElement
569
     * </p>
570
     *
571
     * @param parentElement
572
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
573
     *            object.
574
     * @param labelString
575
     *            a {@link java.lang.String} object.
576
     * @param multilanguageText
577
     *            a {@link java.util.Map} object.
578
     * @param textHeight
579
     *            a int.
580
     * @param style
581
     *            a int.
582
     * @return a
583
     *         {@link eu.etaxonomy.taxeditor.ui.element.MultilanguageTextElement}
584
     *         object.
585
     */
586
    public MultilanguageTextElement createMultiLanguageTextElement(ICdmFormElement parentElement, String labelString,
587
            Map<Language, LanguageString> multilanguageText, int textHeight, int style) {
588
        MultilanguageTextElement element = new MultilanguageTextElement(this, parentElement, labelString,
589
                multilanguageText, textHeight, style);
590
        adapt(element);
591
        parentElement.addElement(element);
592
        return element;
593
    }
594

    
595
    /**
596
     * <p>
597
     * createMultiLanguageTextElement
598
     * </p>
599
     *
600
     * @param parentElement
601
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
602
     *            object.
603
     *
604
     * @param Representation
605
     *            a {@link eu.etaxonomy.cdm.model.common.Representation} object.
606
     * @param textHeight
607
     *            a int.
608
     * @param style
609
     *            a int.
610
     * @return a
611
     *         {@link eu.etaxonomy.taxeditor.ui.element.RepresentationElement}
612
     *         object.
613
     */
614
    public RepresentationElement createRepresentationElement(ICdmFormElement parentElement, Representation representation, TermBase term,int textHeight, int style, boolean isTranslationWizard) {
615
        RepresentationElement element = new RepresentationElement(this, parentElement, representation, term, textHeight, style, isTranslationWizard);
616
        adapt(element);
617
        parentElement.addElement(element);
618
        return element;
619
    }
620

    
621
    /**
622
     * <p>
623
     * createMultiLanguageTextElement
624
     * </p>
625
     *
626
     * @param parentElement
627
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
628
     *            object.
629
     *
630
     * @param term
631
     *            a {@link eu.etaxonomy.cdm.model.common.Representation} object.
632
     * @param textHeight
633
     *            a int.
634
     * @param style
635
     *            a int.
636
     * @return a
637
     *         {@link eu.etaxonomy.taxeditor.ui.element.RepresentationElement}
638
     *         object.
639
     */
640
    public RepresentationElement createRepresentationElement(ICdmFormElement parentElement, TermBase term, int textHeight, int style, boolean isTranslationWizard) {
641
        RepresentationElement element = new RepresentationElement(this, parentElement, term, textHeight, style, isTranslationWizard);
642
        adapt(element);
643
        parentElement.addElement(element);
644
        return element;
645
    }
646

    
647
    public KeyStatementElement createKeyStatementElement(ICdmFormElement parentElement, String labelString,
648
            KeyStatement keyStatement, int textHeight, int style) {
649
        KeyStatementElement element = new KeyStatementElement(this, parentElement, labelString, keyStatement,
650
                textHeight, style);
651
        adapt(element);
652
        parentElement.addElement(element);
653
        return element;
654
    }
655

    
656
    /**
657
     * Creates a text field with a label. The initial content will be the return value of the initalObject's {@link #toString()}
658
     * method.<br>
659
     * <b>Note</b>: if initialObject is <code>null</code> then an empty string is used.
660
     * @param parentElement the parent container
661
     * @param labelString the label name
662
     * @param initialObject the object from which the <code>toString()</code> method is called
663
     * @param style {@link SWT} style constant
664
     * @return the created textfield with label
665
     */
666
    public TextWithLabelElement createTextWithLabelElement(ICdmFormElement parentElement, String labelString,
667
            Object initialObject, int style) {
668
        return createTextWithLabelElement(parentElement, labelString, initialObject==null?"":initialObject.toString(), style);
669
    }
670

    
671
    /**
672
     * <p>
673
     * createTextWithLabelElement
674
     * </p>
675
     *
676
     * @param parentElement
677
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
678
     *            object.
679
     * @param labelString
680
     *            a {@link java.lang.String} object.
681
     * @param initialText
682
     *            a {@link java.lang.String} object.
683
     * @param style
684
     *            a int.
685
     * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
686
     *         object.
687
     */
688
    public TextWithLabelElement createTextWithLabelElement(ICdmFormElement parentElement, String labelString,
689
            String initialText, int style) {
690
        return createTextWithLabelElement(parentElement, labelString, initialText, null, style);
691
    }
692
    /**
693
     * <p>
694
     * createTextWithLabelElement
695
     * </p>
696
     *
697
     * @param parentElement
698
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
699
     *            object.
700
     * @param labelString
701
     *            a {@link java.lang.String} object.
702
     * @param initialText
703
     *            a {@link java.lang.String} object.
704
     * @param textLimit maximal number of characters allowed
705
     * @param style
706
     *            a int.
707
     * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
708
     *         object.
709
     */
710
    public TextWithLabelElement createTextWithLabelElement(ICdmFormElement parentElement, String labelString,
711
            String initialText, Integer textLimit, int style) {
712
        if(initialText==null){
713
            initialText = "";
714
        }
715

    
716
        TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, initialText, null,
717
                textLimit, style);
718
        adapt(element);
719
        parentElement.addElement(element);
720
        return element;
721
    }
722

    
723
    public TextWithLabelElement createMultiLineTextWithLabel(ICdmFormElement parentElement, String labelString,
724
            int textHeight, int style) {
725
        TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, "", textHeight, true, style);
726
        adapt(element);
727
        parentElement.addElement(element);
728
        return element;
729
    }
730

    
731
    public LsidWithExceptionLabelElement createLsidWithExceptionLabelElement(ICdmFormElement parentElement, String labelString,
732
            LSID initialLsid, int style) {
733
        LsidWithExceptionLabelElement element = new LsidWithExceptionLabelElement(this, parentElement, labelString, initialLsid, null, style);
734
        adapt(element);
735
        parentElement.addElement(element);
736
        return element;
737
    }
738

    
739
    public UriWithLabelElement createUriWithLabelElement(ICdmFormElement parentElement, String labelString,
740
            URI initialUri, int style) {
741
        UriWithLabelElement element = new UriWithLabelElement(this, parentElement, labelString, initialUri, null, style);
742
        adapt(element);
743
        parentElement.addElement(element);
744
        return element;
745
    }
746

    
747
    /**
748
     * @param element
749
     * @param string
750
     * @param uri
751
     * @param style
752
     * @return
753
     */
754
    public OpenUrlSelectorElement createOpenUrlSelectorElement(ICdmFormElement parentElement, String labelString,
755
            IOpenUrlEnabled openUrlEnabled, int style) {
756
        OpenUrlSelectorElement element = new OpenUrlSelectorElement(this, parentElement, labelString, openUrlEnabled,
757
                style);
758
        adapt(element);
759
        parentElement.addElement(element);
760
        return element;
761
    }
762

    
763
    /**
764
     *
765
     * @param parentElement
766
     * @param labelString
767
     * @param conversationEnabled
768
     * @param user
769
     * @param style
770
     * @return
771
     */
772
    public EditPasswordElement createEditPasswordElement(ICdmFormElement parentElement, String labelString,
773
            ConversationHolder conversation, User user, int style) {
774
        EditPasswordElement element = new EditPasswordElement(this, parentElement, labelString, user, conversation);
775
        adapt(element);
776
        parentElement.addElement(element);
777
        return element;
778
    }
779

    
780
    /**
781
     * <p>
782
     * createIntegerTextWithLabelElement
783
     * </p>
784
     *
785
     * @param parentElement
786
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
787
     *            object.
788
     * @param labelString
789
     *            a {@link java.lang.String} object.
790
     * @param initialInteger
791
     *            a {@link java.lang.Integer} object.
792
     * @param style
793
     *            a int.
794
     * @return a
795
     *         {@link eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement}
796
     *         object.
797
     */
798
	public NumberWithLabelElement createNumberTextWithLabelElement(
799
			ICdmFormElement parentElement, String labelString,
800
			Number initialNumber, int style) {
801
		NumberWithLabelElement element = new NumberWithLabelElement(this,
802
				parentElement, labelString, initialNumber, style);
803
		adapt(element);
804
		parentElement.addElement(element);
805
		return element;
806
	}
807

    
808
    public LanguageStringWithLabelElement createLanguageStringWithLabelElement(ICdmFormElement parentElement,
809
            String labelString, LanguageString languageString, int style) {
810
        return createLanguageStringWithLabelElement(parentElement, labelString, languageString, null, false, style);
811
    }
812

    
813
    public LanguageStringWithLabelElement createLanguageStringWithLabelElement(ICdmFormElement parentElement,
814
            String labelString, LanguageString languageString, Integer height, boolean isMultiLine, int style) {
815
        LanguageStringWithLabelElement element = new LanguageStringWithLabelElement(this, parentElement, labelString,
816
                languageString, height, isMultiLine, style);
817
        adapt(element);
818
        parentElement.addElement(element);
819
        return element;
820
    }
821

    
822
    /**
823
     * <p>
824
     * createKeyValueViewerElement
825
     * </p>
826
     *
827
     * @param parentElement
828
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
829
     *            object.
830
     * @param keyHeading
831
     *            a {@link java.lang.String} object.
832
     * @param valueHeading
833
     *            a {@link java.lang.String} object.
834
     * @param map
835
     *            a {@link java.util.Map} object.
836
     * @return a {@link eu.etaxonomy.taxeditor.ui.element.KeyValueViewerElement}
837
     *         object.
838
     */
839
    public KeyValueViewerElement createKeyValueViewerElement(ICdmFormElement parentElement, String keyHeading,
840
            String valueHeading, Map<Object, Object> map) {
841
        KeyValueViewerElement element = new KeyValueViewerElement(this, parentElement, keyHeading, valueHeading, map);
842
        adapt(element);
843
        parentElement.addElement(element);
844
        return element;
845
    }
846
    /**
847
     * @deprecated Use {@link #createDefinedTermComboElement(TermType, ICdmFormElement, String, DefinedTermBase, int)} instead
848
     */
849
    @Deprecated
850
    public <T extends DefinedTermBase> TermComboElement<T> createTermComboElement(Class<T> termComboType,
851
            ICdmFormElement parentElement, String labelString, T selection, int style) {
852
        TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termComboType, labelString,
853
                selection, true,  style);
854
        adapt(element);
855
        parentElement.addElement(element);
856
        return element;
857
    }
858

    
859
    public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
860
            TermType termType,
861
            ICdmFormElement parentElement,
862
            String labelString,
863
            T selection,
864
            int style) {
865
        TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termType, labelString, selection, true, style);
866
        adapt(element);
867
        parentElement.addElement(element);
868
        return element;
869
    }
870

    
871
    public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
872
			TermType termType,
873
			ICdmFormElement parentElement,
874
			String labelString,
875
			T selection,
876
			boolean addEmptyElement,
877
			int style) {
878
		TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termType, labelString, selection, addEmptyElement, style);
879
		adapt(element);
880
		parentElement.addElement(element);
881
		return element;
882
	}
883

    
884
    public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
885
            TermVocabulary<?> termVocabulary,
886
            ICdmFormElement parentElement,
887
            String labelString,
888
            T selection,
889
            int style) {
890
        TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termVocabulary, labelString, selection, true, style);
891
        adapt(element);
892
        parentElement.addElement(element);
893
        return element;
894
    }
895

    
896
	public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
897
	        TermVocabulary<?> termVocabulary,
898
	        ICdmFormElement parentElement,
899
	        String labelString,
900
	        T selection,
901
	        boolean addEmptyElement,
902
	        int style) {
903
	    TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termVocabulary, labelString, selection, addEmptyElement, style);
904
	    adapt(element);
905
	    parentElement.addElement(element);
906
	    return element;
907
	}
908

    
909
    /**
910
     * <p>
911
     * createEnumComboElement
912
     * </p>
913
     *
914
     * @param enumComboType
915
     *            a
916
     *            {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EnumComboType}
917
     *            object.
918
     * @param parentElement
919
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
920
     *            object.
921
     * @param style
922
     *            a int.
923
     * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
924
     *         object.
925
     */
926
	public <T extends IEnumTerm<T>> EnumComboElement<T> createEnumComboElement(
927
			Class<T> enumComboType, ICdmFormElement parentElement,
928
			int style) {
929
        EnumComboElement<T> element = new EnumComboElement<T>(this, parentElement, enumComboType, style);
930
        adapt(element);
931
        parentElement.addElement(element);
932
        return element;
933
    }
934

    
935
	public <TERM extends DefinedTermBase<TERM>, VOC extends TermVocabulary<TERM>> VocabularyComboElement<TERM, VOC> createVocabularyComboElement(
936
	        TermType termType, String label, VOC selection, ICdmFormElement parentElement, int style) {
937
	    VocabularyComboElement<TERM, VOC> element = new VocabularyComboElement<TERM, VOC>(this, parentElement, termType, label, selection, style);
938
	    adapt(element);
939
	    parentElement.addElement(element);
940
	    return element;
941
	}
942

    
943
    /**
944
     * <p>
945
     * createBrowserElement
946
     * </p>
947
     *
948
     * @param imageUri
949
     *            a {@link java.net.URI} object.
950
     * @param style
951
     *            a int.
952
     * @param parentElement
953
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
954
     *            object.
955
     * @return a {@link eu.etaxonomy.taxeditor.ui.element.BrowserElement}
956
     *         object.
957
     */
958
    public BrowserElement createBrowserElement(ICdmFormElement parentElement, URI imageUri, int style) {
959
        BrowserElement element = new BrowserElement(this, parentElement, imageUri, style);
960
        adapt(element);
961
        parentElement.addElement(element);
962
        return element;
963
    }
964

    
965
    /**
966
     * <p>
967
     * createImageElement
968
     * </p>
969
     *
970
     * @param parentElement
971
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
972
     *            object.
973
     * @param imageUri
974
     *            a {@link java.net.URI} object.
975
     * @param style
976
     *            a int.
977
     * @return a {@link eu.etaxonomy.taxeditor.ui.element.ImageElement} object.
978
     */
979
    public ImageElement createImageElement(ICdmFormElement parentElement, URI imageUri, int style) {
980
        ImageElement element = new ImageElement(this, parentElement, imageUri, style);
981
        adapt(element);
982
        parentElement.addElement(element);
983
        return element;
984
    }
985

    
986
    /**
987
     * <p>
988
     * createTextActionElement
989
     * </p>
990
     *
991
     * @param labelString
992
     *            a {@link java.lang.String} object.
993
     * @param initialText
994
     *            a {@link java.lang.String} object.
995
     * @param style
996
     *            a int.
997
     * @param parentElement
998
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
999
     *            object.
1000
     * @param buttonLabel
1001
     *            a {@link java.lang.String} object.
1002
     * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextActionElement}
1003
     *         object.
1004
     */
1005
    public TextActionElement createTextActionElement(ICdmFormElement parentElement, String labelString,
1006
            String buttonLabel, String initialText, int style) {
1007
        TextActionElement element = new TextActionElement(this, parentElement, labelString, buttonLabel, initialText,
1008
                style);
1009
        adapt(element);
1010
        parentElement.addElement(element);
1011
        return element;
1012
    }
1013

    
1014
    /**
1015
     * <p>
1016
     * createCheckbox
1017
     * </p>
1018
     *
1019
     * @param parentElement
1020
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1021
     *            object.
1022
     * @param label
1023
     *            a {@link java.lang.String} object.
1024
     * @param initialState
1025
     *            a boolean.
1026
     * @param style
1027
     *            a int.
1028
     * @return a {@link eu.etaxonomy.taxeditor.ui.element.CheckboxElement}
1029
     *         object.
1030
     */
1031
    public CheckboxElement createCheckbox(ICdmFormElement parentElement, String label, Boolean initialState, int style) {
1032
        if(initialState==null){
1033
            initialState = Boolean.FALSE;
1034
        }
1035
        CheckboxElement element = new CheckboxElement(this, parentElement, label, initialState, style | orientation);
1036
        adapt(element);
1037
        parentElement.addElement(element);
1038
        return element;
1039
    }
1040

    
1041
    /**
1042
     * Creates a section as a part of the form.
1043
     *
1044
     * @return the section widget
1045
     * @param section
1046
     *            a
1047
     *            {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1048
     *            object.
1049
     */
1050
    public Section adapt(AbstractFormSection section) {
1051
        section.setMenu(section.getLayoutComposite().getMenu());
1052
        adapt(section, true, true);
1053

    
1054
        // handle focus and property change events for cdm use
1055
        section.addFocusListener(selectionFocusHandler);
1056
        section.setPropertyChangeListeners(propertyChangeListeners);
1057

    
1058
        if (section.getToggle() != null) {
1059
            section.getToggle().setHoverDecorationColor(getColors().getColor(IFormColors.TB_TOGGLE_HOVER));
1060
            section.getToggle().setDecorationColor(getColors().getColor(IFormColors.TB_TOGGLE));
1061
        }
1062

    
1063
        section.setFont(boldFontHolder2.getBoldFont(section.getLayoutComposite().getFont()));
1064

    
1065
        if ((section.getStyle() & ExpandableComposite.TITLE_BAR) != 0
1066
                || (section.getStyle() & ExpandableComposite.SHORT_TITLE_BAR) != 0) {
1067
            getColors().initializeSectionToolBarColors();
1068
            section.setTitleBarBackground(getColors().getColor(IFormColors.TB_BG));
1069
            section.setTitleBarBorderColor(getColors().getColor(IFormColors.TB_BORDER));
1070
        }
1071
        // call setTitleBarForeground regardless as it also sets the label color
1072
        section.setTitleBarForeground(getColors().getColor(IFormColors.TB_TOGGLE));
1073
        return section;
1074
    }
1075

    
1076
    private class BoldFontHolder2 {
1077
        private Font normalFont;
1078

    
1079
        private Font boldFont;
1080

    
1081
        public BoldFontHolder2() {
1082
        }
1083

    
1084
        public Font getBoldFont(Font font) {
1085
            createBoldFont(font);
1086
            return boldFont;
1087
        }
1088

    
1089
        private void createBoldFont(Font font) {
1090
            if (normalFont == null || !normalFont.equals(font)) {
1091
                normalFont = font;
1092
                dispose();
1093
            }
1094
            if (boldFont == null) {
1095
                boldFont = FormFonts.getInstance().getBoldFont(getColors().getDisplay(), normalFont);
1096
            }
1097
        }
1098

    
1099
        public void dispose() {
1100
            if (boldFont != null) {
1101
                FormFonts.getInstance().markFinished(boldFont, getColors().getDisplay());
1102
                boldFont = null;
1103
            }
1104
        }
1105
    }
1106

    
1107
    /**
1108
     * <p>
1109
     * createToggleableTextField
1110
     * </p>
1111
     *
1112
     * @param parentElement
1113
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1114
     *            object.
1115
     * @param labelString
1116
     *            a {@link java.lang.String} object.
1117
     * @param initialText
1118
     *            a {@link java.lang.String} object.
1119
     * @param initialState
1120
     *            a boolean.
1121
     * @param style
1122
     *            a int.
1123
     * @return a {@link eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement}
1124
     *         object.
1125
     */
1126
    public ToggleableTextElement createToggleableTextField(ICdmFormElement parentElement, String labelString,
1127
            String initialText, boolean initialState, int style) {
1128
        ToggleableTextElement element = new ToggleableTextElement(this, parentElement, labelString, initialText,
1129
                initialState, style | orientation);
1130
        adapt(element);
1131
        parentElement.addElement(element);
1132
        return element;
1133
    }
1134

    
1135
    /**
1136
     * <p>
1137
     * createTimePeriodElement
1138
     * </p>
1139
     *
1140
     * @param parentElement
1141
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1142
     *            object.
1143
     * @param labelString
1144
     *            a {@link java.lang.String} object.
1145
     * @param timePeriod
1146
     *            a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1147
     * @param style
1148
     *            a int.
1149
     * @return a {@link eu.etaxonomy.taxeditor.ui.element.TimePeriodElement}
1150
     *         object.
1151
     */
1152
    public TimePeriodElement createTimePeriodElement(ICdmFormElement parentElement, String labelString,
1153
            TimePeriod timePeriod, int style) {
1154
        TimePeriodElement element = new TimePeriodElement(this, parentElement, labelString, timePeriod, style);
1155
        adapt(element);
1156
        parentElement.addElement(element);
1157
        return element;
1158
    }
1159

    
1160
	/**
1161
	 * <p>
1162
	 * createGatheringEventUnitElement
1163
	 * </p>
1164
	 *
1165
	 * @param parentElement
1166
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1167
	 *            object.
1168
	 * @param labelString
1169
	 *            a {@link java.lang.String} object.
1170
	 * @param timePeriod
1171
	 *            a {@link eu.etaxonomy.cdm.model.common.GatheringEvent} object.
1172
	 * @param style
1173
	 *            a int.
1174
	 * @return a {@link eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement}
1175
	 *         object.
1176
	 */
1177
	public GatheringEventUnitElement createGatheringEventUnitElement(
1178
			ICdmFormElement parentElement,
1179
			String labelString,
1180
			DerivedUnitFacade gatheringEvent,
1181
			MinMaxTextSection.UnitType unitType,
1182
			int style) {
1183
		GatheringEventUnitElement element = new GatheringEventUnitElement(this,
1184
				parentElement,
1185
				labelString,
1186
				gatheringEvent,
1187
				unitType,
1188
				style);
1189
		adapt(element);
1190
		parentElement.addElement(element);
1191
		return element;
1192
	}
1193

    
1194
    /**
1195
     * <p>
1196
     * createPointElement
1197
     * </p>
1198
     *
1199
     * @param style
1200
     *            a int.
1201
     * @param parentElement
1202
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1203
     *            object.
1204
     * @param point
1205
     *            a {@link eu.etaxonomy.cdm.model.location.Point} object.
1206
     * @return a {@link eu.etaxonomy.taxeditor.ui.element.PointElement} object.
1207
     */
1208
    public PointElement createPointElement(ICdmFormElement parentElement, Point point, int style) {
1209
        PointElement element = new PointElement(this, parentElement, point, style);
1210
        adapt(element);
1211
        parentElement.addElement(element);
1212
        return element;
1213
    }
1214

    
1215

    
1216

    
1217
    /**
1218
     * @param conversationHolder
1219
     * @param parent
1220
     * @param detailsViewer
1221
     * @param i
1222
     * @return
1223
     */
1224
    public EmptySection createEmptySection(CdmFormFactory formFactory, ICdmFormElement parentElement, int style) {
1225
        EmptySection section = new EmptySection(formFactory, parentElement, style);
1226
        parentElement.addElement(section);
1227
        adapt(section);
1228
        return section;
1229
    }
1230

    
1231
    /**
1232
     * <p>
1233
     * createDateDetailSection
1234
     * </p>
1235
     *
1236
     * @param parentElement
1237
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1238
     *            object.
1239
     * @param style
1240
     *            a int.
1241
     * @return a {@link eu.etaxonomy.taxeditor.ui.element.DateDetailSection}
1242
     *         object.
1243
     */
1244
    public DateDetailSection createDateDetailSection(ICdmFormElement parentElement, int style) {
1245
        DateDetailSection section = new DateDetailSection(this, parentElement, style);
1246
        parentElement.addElement(section);
1247
        adapt(section);
1248
        return section;
1249
    }
1250

    
1251
	/**
1252
	 * <p>
1253
	 * createDateDetailSection
1254
	 * </p>
1255
	 *
1256
	 * @param parentElement
1257
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1258
	 *            object.
1259
	 * @param style
1260
	 *            a int.
1261
	 * @return a {@link eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection}
1262
	 *         object.
1263
	 */
1264
	public MinMaxTextSection createMinMaxTextSection(ICdmFormElement parentElement, UnitType unitType, int style) {
1265
		MinMaxTextSection section = new MinMaxTextSection(this, parentElement, unitType, style);
1266
		parentElement.addElement(section);
1267
		adapt(section);
1268
		return section;
1269
	}
1270

    
1271
    /**
1272
     * <p>
1273
     * createPartialElement
1274
     * </p>
1275
     *
1276
     * @param parentElement
1277
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1278
     *            object.
1279
     * @param labelString
1280
     *            a {@link java.lang.String} object.
1281
     * @param partial
1282
     *            a {@link org.joda.time.Partial} object.
1283
     * @param style
1284
     *            a int.
1285
     * @return a {@link eu.etaxonomy.taxeditor.ui.element.PartialElement}
1286
     *         object.
1287
     */
1288
    public PartialElement createPartialElement(ICdmFormElement parentElement, String labelString, Partial partial,
1289
            int style) {
1290
        PartialElement element = new PartialElement(this, parentElement, labelString, style);
1291
        adapt(element);
1292
        parentElement.addElement(element);
1293
        return element;
1294
    }
1295

    
1296
    /**
1297
     * <p>
1298
     * addSelectionListener
1299
     * </p>
1300
     *
1301
     * @param listener
1302
     *            a {@link org.eclipse.swt.events.SelectionListener} object.
1303
     */
1304
    public void addSelectionListener(SelectionListener listener) {
1305
        selectionListenerList.add(listener);
1306
    }
1307

    
1308
    /**
1309
     * <p>
1310
     * removeSelectionListener
1311
     * </p>
1312
     *
1313
     * @param listener
1314
     *            a {@link org.eclipse.swt.events.SelectionListener} object.
1315
     */
1316
    public void removeSelectionListener(SelectionListener listener) {
1317
        if (listener == null) {
1318
            MessagingUtils.error(this.getClass(),
1319
                    "Tried to remove a selection listener from this factories listeners but was null", null);
1320
        } else {
1321
            selectionListenerList.remove(listener);
1322
        }
1323
    }
1324

    
1325
    /**
1326
     * <p>
1327
     * addPropertyChangeListener
1328
     * </p>
1329
     *
1330
     * @param listener
1331
     *            a {@link org.eclipse.jface.util.IPropertyChangeListener}
1332
     *            object.
1333
     */
1334
    public void addPropertyChangeListener(IPropertyChangeListener listener) {
1335
        if (propertyChangeListeners.contains(listener)) {
1336
            return;
1337
        }
1338
        propertyChangeListeners.add(0, listener);
1339
    }
1340

    
1341
    /**
1342
     * <p>
1343
     * removePropertyChangeListener
1344
     * </p>
1345
     *
1346
     * @param listener
1347
     *            a {@link org.eclipse.jface.util.IPropertyChangeListener}
1348
     *            object.
1349
     */
1350
    public void removePropertyChangeListener(IPropertyChangeListener listener) {
1351
        propertyChangeListeners.remove(listener);
1352
    }
1353

    
1354
    /**
1355
     * @return the propertyChangeListeners
1356
     */
1357
    public List<IPropertyChangeListener> getPropertyChangeListeners() {
1358
        return propertyChangeListeners;
1359
    }
1360

    
1361
    /**
1362
     * <p>
1363
     * createHorizontalSeparator
1364
     * </p>
1365
     *
1366
     * @param parentElement
1367
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1368
     *            object.
1369
     * @param style
1370
     *            a int.
1371
     * @return a {@link org.eclipse.swt.widgets.Label} object.
1372
     */
1373
    public Label createHorizontalSeparator(ICdmFormElement parentElement, int style) {
1374
        Label separator = this.createSeparator(parentElement.getLayoutComposite(), SWT.HORIZONTAL | style);
1375
        separator.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
1376
        return separator;
1377
    }
1378

    
1379
    /**
1380
     * <p>
1381
     * createVersionElement
1382
     * </p>
1383
     *
1384
     * @param parentElement
1385
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1386
     *            object.
1387
     * @param entity
1388
     *            a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
1389
     *            object.
1390
     * @param style
1391
     *            a int.
1392
     * @return a
1393
     *         {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
1394
     *         object.
1395
     */
1396
    public VersionElement createVersionElement(ICdmFormElement parentElement, VersionableEntity entity, int style) {
1397
        VersionElement element = new VersionElement(this, parentElement, entity, style);
1398
        adapt(element);
1399
        parentElement.addElement(element);
1400
        return element;
1401
    }
1402

    
1403
    /**
1404
     * @param cdmBaseSection
1405
     * @param object
1406
     * @param style
1407
     * @return
1408
     */
1409
    public CdmBaseElement createCdmBaseElement(ICdmFormElement parentElement, CdmBase entity, int style) {
1410
        CdmBaseElement element = new CdmBaseElement(this, parentElement, entity, style);
1411
        adapt(element);
1412
        parentElement.addElement(element);
1413
        return element;
1414
    }
1415

    
1416
    /**
1417
     * <p>
1418
     * createVersionSection
1419
     * </p>
1420
     *
1421
     * @param parentElement
1422
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1423
     *            object.
1424
     * @param style
1425
     *            a int.
1426
     * @return a
1427
     *         {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
1428
     *         object.
1429
     */
1430
    public VersionSection createVersionSection(ICdmFormElement parentElement, int style) {
1431
        VersionSection section = new VersionSection(this, parentElement, style);
1432
        parentElement.addElement(section);
1433
        adapt(section);
1434
        return section;
1435
    }
1436

    
1437
    /**
1438
     * @param parent
1439
     * @param i
1440
     * @return
1441
     */
1442
    public CdmBaseSection createCdmBaseSection(ICdmFormElement parentElement, int style) {
1443
        CdmBaseSection section = new CdmBaseSection(this, parentElement, style);
1444
        parentElement.addElement(section);
1445
        adapt(section);
1446
        return section;
1447
    }
1448

    
1449
    /**
1450
     * <p>
1451
     * createEmptyElement
1452
     * </p>
1453
     *
1454
     * @param parentElement
1455
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1456
     *            object.
1457
     * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1458
     */
1459
    public EmptyElement createEmptyElement(ICdmFormElement parentElement, String emptyText) {
1460
        EmptyElement element = new EmptyElement(this, parentElement, emptyText, SWT.NULL);
1461
        adapt(element);
1462
        parentElement.addElement(element);
1463
        return element;
1464
    }
1465

    
1466
    /**
1467
     * <p>
1468
     * createHeadlineSection
1469
     * </p>
1470
     *
1471
     * @param parentElement
1472
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1473
     *            object.
1474
     * @return a
1475
     *         {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
1476
     *         object.
1477
     */
1478
    public HeadlineSection createHeadlineSection(ICdmFormElement parentElement) {
1479
        HeadlineSection section = new HeadlineSection(this, parentElement, SWT.NULL);
1480
        parentElement.addElement(section);
1481
        adapt(section);
1482
        return section;
1483
    }
1484

    
1485
    /**
1486
     * <p>
1487
     * createParsingMessageElement
1488
     * </p>
1489
     *
1490
     * @param parentElement
1491
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1492
     *            object.
1493
     * @param parserProblem
1494
     *            a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
1495
     *            object.
1496
     * @param style
1497
     *            a int.
1498
     * @return a
1499
     *         {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
1500
     *         object.
1501
     */
1502
    public ParsingMessageElement createParsingMessageElement(ICdmFormElement parentElement,
1503
            ParserProblem parserProblem, int style) {
1504
        ParsingMessageElement element = new ParsingMessageElement(this, parentElement, parserProblem, style);
1505
        adapt(element);
1506
        parentElement.addElement(element);
1507
        return element;
1508
    }
1509

    
1510
    public AbstractFormSection createDefinedTermDetailSection(Class definedTermClass, ConversationHolder conversation,
1511
            ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
1512

    
1513
        AbstractFormSection section = new DefinedTermDetailSection(this, definedTermClass, conversation, parentElement,
1514
                selectionProvider, style);
1515

    
1516
        parentElement.addElement(section);
1517
        adapt(section);
1518
        return section;
1519

    
1520
    }
1521

    
1522
    /**
1523
     * @param definedTermClass
1524
     * @param formElement
1525
     * @param style
1526
     * @return
1527
     */
1528
    public AbstractCdmDetailElement createDefinedTermDetailElement(Class definedTermClass,
1529
            AbstractCdmDetailSection parentElement, int style) {
1530
        AbstractCdmDetailElement element = null;
1531

    
1532
        if (NamedArea.class.isAssignableFrom(definedTermClass)) {
1533
            element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
1534
        } else if (definedTermClass.equals(Feature.class)) {
1535
            element = new FeatureDetailElement(this, parentElement);
1536
        } else {
1537
            element = new DefinedTermDetailElement(this, parentElement);
1538
        }
1539

    
1540
        adapt(element);
1541
        parentElement.addElement(element);
1542
        return element;
1543
    }
1544

    
1545

    
1546
    //--------DetailSections---------
1547
    public NameDetailSection createNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1548
        NameDetailSection section = new NameDetailSection(this, conversation, parentElement, selectionProvider, style);
1549
        addAndAdaptSection(parentElement, section);
1550
        return section;
1551
    }
1552

    
1553
    public ReferenceDetailSection createReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1554
        ReferenceDetailSection section = new ReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
1555
        addAndAdaptSection(parentElement, section);
1556
        return section;
1557
    }
1558

    
1559
    public NomenclaturalReferenceDetailSection createNomenclaturalReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1560
        NomenclaturalReferenceDetailSection section = new NomenclaturalReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
1561
        addAndAdaptSection(parentElement, section);
1562
        return section;
1563
    }
1564

    
1565
    public TaxonBaseDetailSection createTaxonBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1566
        TaxonBaseDetailSection section = new TaxonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1567
        addAndAdaptSection(parentElement, section);
1568
        return section;
1569
    }
1570

    
1571
    public AuthorshipDetailSection createAuthorshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1572
        AuthorshipDetailSection section = new AuthorshipDetailSection(this, conversation, parentElement, selectionProvider, style);
1573
        addAndAdaptSection(parentElement, section);
1574
        return section;
1575
    }
1576

    
1577
    public TeamOrPersonBaseDetailSection createTeamOrPersonBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1578
        TeamOrPersonBaseDetailSection section = new TeamOrPersonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1579
        addAndAdaptSection(parentElement, section);
1580
        return section;
1581
    }
1582

    
1583
    public TeamDetailSection createTeamDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1584
        TeamDetailSection section = new TeamDetailSection(this, conversation, parentElement, null, style);
1585
        addAndAdaptSection(parentElement, section);
1586
        return section;
1587
    }
1588

    
1589
    public PersonDetailSection createPersonDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1590
        PersonDetailSection section = new PersonDetailSection(this, conversation, parentElement, null, style);
1591
        addAndAdaptSection(parentElement, section);
1592
        return section;
1593
    }
1594

    
1595
    public DescriptionDetailSection createDescriptionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1596
        DescriptionDetailSection section = new DescriptionDetailSection(this, conversation, parentElement, selectionProvider, style);
1597
        addAndAdaptSection(parentElement, section);
1598
        return section;
1599
    }
1600

    
1601
    public DescriptionElementDetailSection createDescriptionElementDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1602
        DescriptionElementDetailSection section = new DescriptionElementDetailSection(this, conversation, parentElement, selectionProvider, style);
1603
        addAndAdaptSection(parentElement, section);
1604
        return section;
1605
    }
1606

    
1607
    public ParsingMessagesSection createParsingMessagesSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1608
        ParsingMessagesSection section = new ParsingMessagesSection(this, conversation, parentElement, selectionProvider, style);
1609
        addAndAdaptSection(parentElement, section);
1610
        return section;
1611
    }
1612

    
1613
    public NonViralNameDetailSection createNonViralNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, boolean nameChoosable, int style){
1614
        NonViralNameDetailSection section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, nameChoosable, style);
1615
        addAndAdaptSection(parentElement, section);
1616
        return section;
1617
    }
1618

    
1619
    public MediaDetailsSection createMediaDetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1620
        MediaDetailsSection section = new MediaDetailsSection(this, conversation, parentElement, selectionProvider, style);
1621
        addAndAdaptSection(parentElement, section);
1622
        return section;
1623
    }
1624

    
1625
    public FieldUnitDetailSection createFieldUnitDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1626
        FieldUnitDetailSection section = new FieldUnitDetailSection(this, conversation, parentElement, selectionProvider, style);
1627
        addAndAdaptSection(parentElement, section);
1628
        return section;
1629
    }
1630

    
1631
    public GatheringEventDetailSection createGatheringEventDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1632
        GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
1633
        addAndAdaptSection(parentElement, section);
1634
        return section;
1635
    }
1636

    
1637
    public SpecimenHierarchyDetailSection createSpecimenHierarchyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1638
        SpecimenHierarchyDetailSection section = new SpecimenHierarchyDetailSection(this, conversation, parentElement, selectionProvider, style);
1639
        addAndAdaptSection(parentElement, section);
1640
        return section;
1641
    }
1642

    
1643
    public DerivedUnitBaseDetailSection createDerivedUnitBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1644
        DerivedUnitBaseDetailSection section = new DerivedUnitBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1645
        addAndAdaptSection(parentElement, section);
1646
        return section;
1647
    }
1648

    
1649
    public DerivedUnitTypeDesignationSection createDerivedUnitTypeDesignationSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1650
        DerivedUnitTypeDesignationSection section = new DerivedUnitTypeDesignationSection(this, conversation, parentElement, style);
1651
        addAndAdaptSection(parentElement, section);
1652
        return section;
1653
    }
1654

    
1655
    public TaxonAssociationDetailSection createTaxonAssociationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1656
        TaxonAssociationDetailSection section = new TaxonAssociationDetailSection(this, conversation, parentElement, selectionProvider, style);
1657
        addAndAdaptSection(parentElement, section);
1658
        return section;
1659
    }
1660

    
1661
    public OriginalLabelDataSection createOriginalLabelDataSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1662
        OriginalLabelDataSection section = new OriginalLabelDataSection(this, conversation, parentElement, selectionProvider, style);
1663
        addAndAdaptSection(parentElement, section);
1664
        return section;
1665
    }
1666

    
1667
    public NaturalLanguageSection createNaturalLanguageSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1668
        NaturalLanguageSection section = new NaturalLanguageSection(this, conversation, parentElement, selectionProvider, style);
1669
        addAndAdaptSection(parentElement, section);
1670
        return section;
1671
    }
1672

    
1673
    public FeatureDistributionDetailSection createFeatureDistributionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1674
        FeatureDistributionDetailSection section = new FeatureDistributionDetailSection(this, conversation, parentElement, selectionProvider, style);
1675
        addAndAdaptSection(parentElement, section);
1676
        return section;
1677
    }
1678

    
1679
    public ClassificationDetailSection createClassificationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1680
        ClassificationDetailSection section = new ClassificationDetailSection(this, conversation, parentElement, selectionProvider, style);
1681
        addAndAdaptSection(parentElement, section);
1682
        return section;
1683
    }
1684

    
1685
    public TaxonNodeDetailSection createTaxonNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1686
        TaxonNodeDetailSection section = new TaxonNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
1687
        addAndAdaptSection(parentElement, section);
1688
        return section;
1689
    }
1690

    
1691
    public PolytomousKeyDetailSection createPolytomousKeyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1692
        PolytomousKeyDetailSection section = new PolytomousKeyDetailSection(this, conversation, parentElement, selectionProvider, style);
1693
        addAndAdaptSection(parentElement, section);
1694
        return section;
1695
    }
1696

    
1697
    public PolytomousKeyNodeDetailSection createPolytomousKeyNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1698
        PolytomousKeyNodeDetailSection section = new PolytomousKeyNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
1699
        addAndAdaptSection(parentElement, section);
1700
        return section;
1701
    }
1702

    
1703
    public InstitutionDetailSection createInstitutionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1704
        InstitutionDetailSection section = new InstitutionDetailSection(this, conversation, parentElement, selectionProvider, style);
1705
        addAndAdaptSection(parentElement, section);
1706
        return section;
1707
    }
1708

    
1709
    public FieldUnitGeneralDetailSection createFieldUnitGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1710
        FieldUnitGeneralDetailSection section = new FieldUnitGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1711
        addAndAdaptSection(parentElement, section);
1712
        return section;
1713
    }
1714

    
1715
    public DerivedUnitGeneralDetailSection createDerivedUnitGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1716
        DerivedUnitGeneralDetailSection section = new DerivedUnitGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1717
        addAndAdaptSection(parentElement, section);
1718
        return section;
1719
    }
1720

    
1721
    public PreservedSpecimenGeneralDetailSection createPreservedSpecimenGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1722
        PreservedSpecimenGeneralDetailSection section = new PreservedSpecimenGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1723
        addAndAdaptSection(parentElement, section);
1724
        return section;
1725
    }
1726

    
1727
    public TissueSampleGeneralDetailSection createTissueSampleGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1728
        TissueSampleGeneralDetailSection section = new TissueSampleGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1729
        addAndAdaptSection(parentElement, section);
1730
        return section;
1731
    }
1732

    
1733
    public DnaSampleGeneralDetailSection createDnaSampleGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1734
        DnaSampleGeneralDetailSection section = new DnaSampleGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1735
        addAndAdaptSection(parentElement, section);
1736
        return section;
1737
    }
1738

    
1739
    public DnaSamplePreparationPreservationSection createDnaSamplePreparationPreservationSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1740
        DnaSamplePreparationPreservationSection section = new DnaSamplePreparationPreservationSection(this, conversation, parentElement, selectionProvider, style);
1741
        addAndAdaptSection(parentElement, section);
1742
        return section;
1743
    }
1744

    
1745
    public DnaQualityDetailSection createDnaQualityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1746
        DnaQualityDetailSection section = new DnaQualityDetailSection(this, conversation, parentElement, selectionProvider, style);
1747
        addAndAdaptSection(parentElement, section);
1748
        return section;
1749
    }
1750

    
1751
    public SequenceGeneralDetailSection createSequenceGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1752
        SequenceGeneralDetailSection section = new SequenceGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1753
        addAndAdaptSection(parentElement, section);
1754
        return section;
1755
    }
1756

    
1757
    public SequenceContigFileCollectionDetailSection createSequenceContigFileCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1758
        SequenceContigFileCollectionDetailSection section = new SequenceContigFileCollectionDetailSection(this, conversation, parentElement, style);
1759
        addAndAdaptSection(parentElement, section);
1760
        return section;
1761
    }
1762

    
1763
    public SingleReadPherogramCollectionDetailSection createSingleReadPherogramCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1764
        SingleReadPherogramCollectionDetailSection section = new SingleReadPherogramCollectionDetailSection(this, conversation, parentElement, style);
1765
        addAndAdaptSection(parentElement, section);
1766
        return section;
1767
    }
1768

    
1769
    public SequenceReferenceCollectionDetailSection createSequenceReferenceCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1770
        SequenceReferenceCollectionDetailSection section = new SequenceReferenceCollectionDetailSection(this, conversation, parentElement, style);
1771
        addAndAdaptSection(parentElement, section);
1772
        return section;
1773
    }
1774

    
1775
    public SingleReadGeneralDetailSection createSingleReadGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1776
        SingleReadGeneralDetailSection section = new SingleReadGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1777
        addAndAdaptSection(parentElement, section);
1778
        return section;
1779
    }
1780

    
1781
    public AmplificationGeneralDetailSection createAmplificationGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1782
        AmplificationGeneralDetailSection section = new AmplificationGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1783
        addAndAdaptSection(parentElement, section);
1784
        return section;
1785
    }
1786

    
1787
    public AmplificationPrimerDetailSection createAmplificationPrimerDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1788
        AmplificationPrimerDetailSection section = new AmplificationPrimerDetailSection(this, conversation, parentElement, selectionProvider, style);
1789
        addAndAdaptSection(parentElement, section);
1790
        return section;
1791
    }
1792

    
1793
    public AmplificationCloningDetailSection createAmplificationCloningDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1794
        AmplificationCloningDetailSection section = new AmplificationCloningDetailSection(this, conversation, parentElement, selectionProvider, style);
1795
        addAndAdaptSection(parentElement, section);
1796
        return section;
1797
    }
1798

    
1799
    public AmplificationGelPhotoCollectionDetailSection createAmplificationGelPhotoCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1800
        AmplificationGelPhotoCollectionDetailSection section = new AmplificationGelPhotoCollectionDetailSection(this, conversation, parentElement, style);
1801
        addAndAdaptSection(parentElement, section);
1802
        return section;
1803
    }
1804

    
1805
    public MediaSpecimenGeneralDetailSection createMediaSpecimenGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1806
        MediaSpecimenGeneralDetailSection section = new MediaSpecimenGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1807
        addAndAdaptSection(parentElement, section);
1808
        return section;
1809
    }
1810

    
1811
    public HybridDetailSection createHybridDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1812
        HybridDetailSection section = new HybridDetailSection(this, conversation, parentElement, selectionProvider, style);
1813
        addAndAdaptSection(parentElement, section);
1814
        return section;
1815
    }
1816

    
1817
    public UserDetailSection createUserDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1818
        UserDetailSection section = new UserDetailSection(this, conversation, parentElement, selectionProvider, style);
1819
        addAndAdaptSection(parentElement, section);
1820
        return section;
1821
    }
1822

    
1823
    public GroupDetailSection createGroupDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1824
        GroupDetailSection section = new GroupDetailSection(this, conversation, parentElement, selectionProvider, style);
1825
        addAndAdaptSection(parentElement, section);
1826
        return section;
1827
    }
1828

    
1829
    public DeterminationDetailSection createDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1830
        DeterminationDetailSection section = new DeterminationDetailSection(this, conversation, parentElement, selectionProvider, style);
1831
        addAndAdaptSection(parentElement, section);
1832
        return section;
1833
    }
1834

    
1835
    public SampleDesignationDetailSection createSampleDesignationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1836
        SampleDesignationDetailSection section = new SampleDesignationDetailSection(this, conversation, parentElement, selectionProvider, style);
1837
        addAndAdaptSection(parentElement, section);
1838
        return section;
1839
    }
1840

    
1841
    public TaxonRelationshipDetailSection createTaxonRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1842
        TaxonRelationshipDetailSection section = new TaxonRelationshipDetailSection(this, conversation, parentElement, selectionProvider, style);
1843
        addAndAdaptSection(parentElement, section);
1844
        return section;
1845
    }
1846

    
1847
    public ReferencedEntityDetailSection createReferencedEntityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1848
        ReferencedEntityDetailSection section = new ReferencedEntityDetailSection(this, conversation, parentElement, selectionProvider, style);
1849
        addAndAdaptSection(parentElement, section);
1850
        return section;
1851
    }
1852

    
1853
    public TermVocabularyDetailSection createTermVocabularyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1854
        TermVocabularyDetailSection section = new TermVocabularyDetailSection(this, conversation, parentElement, selectionProvider, style);
1855
        addAndAdaptSection(parentElement, section);
1856
        return section;
1857
    }
1858

    
1859
    public GatheringEventDetailSection createGatheringSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1860
        GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
1861
        addAndAdaptSection(parentElement, section);
1862
        return section;
1863
    }
1864

    
1865
    public NamedAreaDetailSection createNamedAreaDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1866
        NamedAreaDetailSection section = new NamedAreaDetailSection(this, conversation, parentElement, selectionProvider, style);
1867
        addAndAdaptSection(parentElement, section);
1868
        return section;
1869
    }
1870

    
1871
    public UseRecordDetailSection createUseRecordDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1872
        UseRecordDetailSection section = new UseRecordDetailSection(this, conversation, parentElement, selectionProvider, style);
1873
        addAndAdaptSection(parentElement, section);
1874
        return section;
1875
    }
1876

    
1877
    private void addAndAdaptSection(ICdmFormElement parentElement, AbstractFormSection<?> section) {
1878
        parentElement.addElement(section);
1879
        adapt(section);
1880
    }
1881

    
1882
    //--------DetailElements------------
1883

    
1884
    public UseRecordDetailElement createUseRecordDetailElement(ICdmFormElement parentElement){
1885
        UseRecordDetailElement element = new UseRecordDetailElement(this, parentElement);
1886
        addAndAdaptElement(parentElement, element);
1887
        return element;
1888
    }
1889

    
1890
    public DefinedTermDetailElement<NamedAreaLevel> createNamedAreaLevelElement(ICdmFormElement parentElement){
1891
        DefinedTermDetailElement<NamedAreaLevel> element = new DefinedTermDetailElement<NamedAreaLevel>(this, parentElement);
1892
        addAndAdaptElement(parentElement, element);
1893
        return element;
1894
    }
1895

    
1896
    public eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement createNamedAreaDetailElement(ICdmFormElement parentElement){
1897
        eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
1898
        addAndAdaptElement(parentElement, element);
1899
        return element;
1900
    }
1901

    
1902
    public TermVocabularyDetailElement createTermVocabularyDetailElement(ICdmFormElement parentElement){
1903
        TermVocabularyDetailElement element = new TermVocabularyDetailElement(this, parentElement);
1904
        addAndAdaptElement(parentElement, element);
1905
        return element;
1906
    }
1907

    
1908
    public ReferenceEntityDetailElement createReferenceEntityDetailElement(ICdmFormElement parentElement){
1909
        ReferenceEntityDetailElement element = new ReferenceEntityDetailElement(this, parentElement);
1910
        addAndAdaptElement(parentElement, element);
1911
        return element;
1912
    }
1913

    
1914
    public TaxonRelationshipDetailElement createTaxonRelationshipDetailElement(ICdmFormElement parentElement){
1915
        TaxonRelationshipDetailElement element = new TaxonRelationshipDetailElement(this, parentElement);
1916
        addAndAdaptElement(parentElement, element);
1917
        return element;
1918
    }
1919

    
1920
    public GrantedAuthorityDetailElement createGrantedAuthorityDetailElement(ICdmFormElement parentElement){
1921
        GrantedAuthorityDetailElement element = new GrantedAuthorityDetailElement(this, parentElement);
1922
        addAndAdaptElement(parentElement, element);
1923
        return element;
1924
    }
1925

    
1926
    public GroupDetailElement createGroupDetailElement(ICdmFormElement parentElement){
1927
        GroupDetailElement element = new GroupDetailElement(this, parentElement);
1928
        addAndAdaptElement(parentElement, element);
1929
        return element;
1930
    }
1931

    
1932
    public UserDetailElement createUserDetailElement(ICdmFormElement parentElement){
1933
        UserDetailElement element = new UserDetailElement(this, parentElement);
1934
        addAndAdaptElement(parentElement, element);
1935
        return element;
1936
    }
1937

    
1938
    public HybridDetailElement createHybridDetailElement(ICdmFormElement parentElement){
1939
        HybridDetailElement element = new HybridDetailElement(this, parentElement);
1940
        addAndAdaptElement(parentElement, element);
1941
        return element;
1942
    }
1943

    
1944
    public InstitutionDetailElement createInstitutionDetailElement(ICdmFormElement parentElement){
1945
        InstitutionDetailElement element = new InstitutionDetailElement(this, parentElement);
1946
        addAndAdaptElement(parentElement, element);
1947
        return element;
1948
    }
1949

    
1950
    public PolytomousKeyNodeDetailElement createPolytomousKeyNodeDetailElement(ICdmFormElement parentElement){
1951
        PolytomousKeyNodeDetailElement element = new PolytomousKeyNodeDetailElement(this, parentElement);
1952
        addAndAdaptElement(parentElement, element);
1953
        return element;
1954
    }
1955

    
1956
    public PolytomousKeyDetailElement createPolytomousKeyDetailElement(ICdmFormElement parentElement){
1957
        PolytomousKeyDetailElement element = new PolytomousKeyDetailElement(this, parentElement);
1958
        addAndAdaptElement(parentElement, element);
1959
        return element;
1960
    }
1961

    
1962
    public CollectionDetailElement createCollectionDetailElement(ICdmFormElement parentElement){
1963
        CollectionDetailElement element = new CollectionDetailElement(this, parentElement);
1964
        addAndAdaptElement(parentElement, element);
1965
        return element;
1966
    }
1967

    
1968
    public TaxonNodeAgentRelationCollectionSection createTaxonNodeAgentRelationCollectionElement(ICdmFormElement parentElement, ConversationHolder conversation, int style){
1969
        TaxonNodeAgentRelationCollectionSection element = new TaxonNodeAgentRelationCollectionSection(this, conversation, parentElement, style);
1970
        adapt(element);
1971
        parentElement.addElement(element);
1972

    
1973
        return element;
1974
    }
1975

    
1976
    public TaxonNodeDetailElement createTaxonNodeDetailElement(ICdmFormElement parentElement, boolean createNew){
1977
        TaxonNodeDetailElement element = new TaxonNodeDetailElement(this, parentElement, createNew);
1978
        addAndAdaptElement(parentElement, element);
1979
        return element;
1980
    }
1981

    
1982
    public ClassificationDetailElement createClassificationDetailElement(ICdmFormElement parentElement){
1983
        ClassificationDetailElement element = new ClassificationDetailElement(this, parentElement);
1984
        addAndAdaptElement(parentElement, element);
1985
        return element;
1986
    }
1987

    
1988
    public FeatureDistributionDetailElement createFeatureDistributionDetailElement(ICdmFormElement parentElement){
1989
        FeatureDistributionDetailElement element = new FeatureDistributionDetailElement(this, parentElement);
1990
        addAndAdaptElement(parentElement, element);
1991
        return element;
1992
    }
1993

    
1994
    public NaturalLanguageDetailElement createNaturalLanguageDetailElement(ICdmFormElement parentElement){
1995
        NaturalLanguageDetailElement element = new NaturalLanguageDetailElement(this, parentElement);
1996
        addAndAdaptElement(parentElement, element);
1997
        return element;
1998
    }
1999

    
2000
    public NonViralNameDetailElement createNonViralNameDetailElement(ICdmFormElement parentElement){
2001
        NonViralNameDetailElement element = new NonViralNameDetailElement(this, parentElement);
2002
        addAndAdaptElement(parentElement, element);
2003
        return element;
2004
    }
2005

    
2006
    public DescriptionElementDetailElement createDescriptionElementDetailElement(ICdmFormElement parentElement, int style){
2007
        DescriptionElementDetailElement element = new DescriptionElementDetailElement(this, parentElement, style);
2008
        addAndAdaptElement(parentElement, element);
2009
        return element;
2010
    }
2011

    
2012
    public DescriptionDetailElement createDescriptionDetailElement(ICdmFormElement parentElement, int style){
2013
        DescriptionDetailElement element = new DescriptionDetailElement(this, parentElement, style);
2014
        addAndAdaptElement(parentElement, element);
2015
        return element;
2016
    }
2017

    
2018
    public PersonDetailElement createPersonDetailElement(ICdmFormElement parentElement, int style){
2019
        PersonDetailElement element = new PersonDetailElement(this, parentElement, style);
2020
        addAndAdaptElement(parentElement, element);
2021
        return element;
2022
    }
2023

    
2024
    public TeamDetailElement createTeamDetailElement(ICdmFormElement parentElement, int style, boolean isNomenclatural){
2025
        TeamDetailElement element = new TeamDetailElement(this, parentElement, style, isNomenclatural);
2026
        addAndAdaptElement(parentElement, element);
2027
        return element;
2028
    }
2029

    
2030
    public AuthorshipDetailElement createAuthorshipDetailElement(ICdmFormElement parentElement, int style){
2031
        AuthorshipDetailElement element = new AuthorshipDetailElement(this, parentElement, style);
2032
        addAndAdaptElement(parentElement, element);
2033
        return element;
2034
    }
2035

    
2036
    public TaxonBaseDetailElement createTaxonBaseDetailElement(ICdmFormElement parentElement, int style){
2037
        TaxonBaseDetailElement element = new TaxonBaseDetailElement(this, parentElement, style);
2038
        addAndAdaptElement(parentElement, element);
2039
        return element;
2040
    }
2041

    
2042
    public NameDetailElement createNameDetailElement(ICdmFormElement parentElement, int style){
2043
        NameDetailElement element = new NameDetailElement(this, parentElement, style);
2044
        addAndAdaptElement(parentElement, element);
2045
        return element;
2046
    }
2047

    
2048
    public ReferenceDetailElement createReferenceDetailElement(ICdmFormElement parentElement, int style){
2049
        ReferenceDetailElement element = new ReferenceDetailElement(this, parentElement, style);
2050
        addAndAdaptElement(parentElement, element);
2051
        return element;
2052
    }
2053

    
2054
    public NomenclaturalReferenceDetailElement createNomenclaturalReferenceDetailElement(ICdmFormElement parentElement, int style){
2055
        NomenclaturalReferenceDetailElement element = new NomenclaturalReferenceDetailElement(this, parentElement, style);
2056
        addAndAdaptElement(parentElement, element);
2057
        return element;
2058
    }
2059

    
2060

    
2061
    public FieldUnitGeneralDetailElement createFieldUnitGeneralDetailElement(ICdmFormElement parentElement){
2062
        FieldUnitGeneralDetailElement element = new FieldUnitGeneralDetailElement(this, parentElement);
2063
        addAndAdaptElement(parentElement, element);
2064
        return element;
2065
    }
2066

    
2067
    public DerivedUnitGeneralDetailElement createDerivedUnitGeneralDetailElement(ICdmFormElement parentElement){
2068
        DerivedUnitGeneralDetailElement element = new DerivedUnitGeneralDetailElement(this, parentElement);
2069
        addAndAdaptElement(parentElement, element);
2070
        return element;
2071
    }
2072

    
2073
    public TaxonAssociationDetailElement createTaxonAssociationDetailElement(ICdmFormElement parentElement){
2074
        TaxonAssociationDetailElement element = new TaxonAssociationDetailElement(this, parentElement);
2075
        addAndAdaptElement(parentElement, element);
2076
        return element;
2077
    }
2078

    
2079
    public PreservedSpecimenGeneralDetailElement createPreservedSpecimenGeneralDetailElement(ICdmFormElement parentElement){
2080
        PreservedSpecimenGeneralDetailElement element = new PreservedSpecimenGeneralDetailElement(this, parentElement);
2081
        addAndAdaptElement(parentElement, element);
2082
        return element;
2083
    }
2084

    
2085
    public TissueSampleGeneralDetailElement createTissueSampleGeneralDetailElement(ICdmFormElement parentElement){
2086
        TissueSampleGeneralDetailElement element = new TissueSampleGeneralDetailElement(this, parentElement);
2087
        addAndAdaptElement(parentElement, element);
2088
        return element;
2089
    }
2090

    
2091
    public DnaSampleGeneralDetailElement createDnaSampleGeneralDetailElement(ICdmFormElement parentElement){
2092
        DnaSampleGeneralDetailElement element = new DnaSampleGeneralDetailElement(this, parentElement);
2093
        addAndAdaptElement(parentElement, element);
2094
        return element;
2095
    }
2096

    
2097
    public DnaSamplePreparationPreservationDetailElement createDnaSamplePreparationPreservationDetailElement(ICdmFormElement parentElement){
2098
        DnaSamplePreparationPreservationDetailElement element = new DnaSamplePreparationPreservationDetailElement(this, parentElement);
2099
        addAndAdaptElement(parentElement, element);
2100
        return element;
2101
    }
2102

    
2103
    public DnaQualityDetailElement createDnaQualityDetailElement(ICdmFormElement parentElement){
2104
        DnaQualityDetailElement element = new DnaQualityDetailElement(this, parentElement);
2105
        addAndAdaptElement(parentElement, element);
2106
        return element;
2107
    }
2108

    
2109
    public SequenceGeneralDetailElement createSequenceGeneralDetailElement(ICdmFormElement parentElement){
2110
        SequenceGeneralDetailElement element = new SequenceGeneralDetailElement(this, parentElement);
2111
        addAndAdaptElement(parentElement, element);
2112
        return element;
2113
    }
2114

    
2115
    public SingleReadGeneralDetailElement createSingleReadGeneralDetailElement(ICdmFormElement parentElement){
2116
        SingleReadGeneralDetailElement element = new SingleReadGeneralDetailElement(this, parentElement);
2117
        addAndAdaptElement(parentElement, element);
2118
        return element;
2119
    }
2120

    
2121
    public PrimerGeneralDetailElement createPrimerGeneralDetailElement(ICdmFormElement parentElement){
2122
        PrimerGeneralDetailElement element = new PrimerGeneralDetailElement(this, parentElement);
2123
        addAndAdaptElement(parentElement, element);
2124
        return element;
2125
    }
2126

    
2127
    public AmplificationGeneralDetailElement createAmplificationGeneralDetailElement(ICdmFormElement parentElement){
2128
        AmplificationGeneralDetailElement element = new AmplificationGeneralDetailElement(this, parentElement);
2129
        addAndAdaptElement(parentElement, element);
2130
        return element;
2131
    }
2132

    
2133
    public AmplificationPrimerDetailElement createAmplificationPrimerDetailElement(ICdmFormElement parentElement){
2134
        AmplificationPrimerDetailElement element = new AmplificationPrimerDetailElement(this, parentElement);
2135
        addAndAdaptElement(parentElement, element);
2136
        return element;
2137
    }
2138

    
2139
    public AmplificationCloningDetailElement createAmplificationCloningDetailElement(ICdmFormElement parentElement){
2140
        AmplificationCloningDetailElement element = new AmplificationCloningDetailElement(this, parentElement);
2141
        addAndAdaptElement(parentElement, element);
2142
        return element;
2143
    }
2144

    
2145
    public AmplificationGelPhotoDetailElement createAmplificationGelPhotoDetailElement(ICdmFormElement parentElement){
2146
        AmplificationGelPhotoDetailElement element = new AmplificationGelPhotoDetailElement(this, parentElement);
2147
        addAndAdaptElement(parentElement, element);
2148
        return element;
2149
    }
2150

    
2151
    public MediaSpecimenGeneralDetailElement createMediaSpecimenGeneralDetailElement(ICdmFormElement parentElement){
2152
        MediaSpecimenGeneralDetailElement element = new MediaSpecimenGeneralDetailElement(this, parentElement);
2153
        addAndAdaptElement(parentElement, element);
2154
        return element;
2155
    }
2156

    
2157
    public MediaDetailElement createMediaDetailElement(ICdmFormElement parentElement){
2158
        MediaDetailElement mediaDetailElement = new MediaDetailElement(this, parentElement);
2159
        addAndAdaptElement(parentElement, mediaDetailElement);
2160
        return mediaDetailElement;
2161
    }
2162

    
2163
    public GatheringEventDetailElement createGatheringEventDetailElement(ICdmFormElement parentElement) {
2164
        GatheringEventDetailElement element = new GatheringEventDetailElement(this, parentElement);
2165
        addAndAdaptElement(parentElement, element);
2166
        return element;
2167
    }
2168

    
2169
    public FieldUnitDetailElement createFieldUnitDetailElement(ICdmFormElement parentElement) {
2170
        FieldUnitDetailElement element = new FieldUnitDetailElement(this, parentElement);
2171
        addAndAdaptElement(parentElement, element);
2172
        return element;
2173
    }
2174

    
2175
    public SpecimenHierarchyDetailElement createSpecimenHierarchyDetailElement(ICdmFormElement parentElement) {
2176
        SpecimenHierarchyDetailElement element = new SpecimenHierarchyDetailElement(this, parentElement);
2177
        addAndAdaptElement(parentElement, element);
2178
        return element;
2179
    }
2180

    
2181
    public DerivedUnitBaseDetailElement createDerivedUnitBaseDetailElement(ICdmFormElement parentElement) {
2182
        DerivedUnitBaseDetailElement element = new DerivedUnitBaseDetailElement(this, parentElement);
2183
        addAndAdaptElement(parentElement, element);
2184
        return element;
2185
    }
2186

    
2187
    public OriginalLabelDataElement createOriginalLabelDataElement(ICdmFormElement parentElement) {
2188
        OriginalLabelDataElement element = new OriginalLabelDataElement(this, parentElement);
2189
        addAndAdaptElement(parentElement, element);
2190
        return element;
2191
    }
2192

    
2193
    public PreservedSpecimenDetailElement createPreservedSpecimenDetailElement(ICdmFormElement parentElement) {
2194
        PreservedSpecimenDetailElement element = new PreservedSpecimenDetailElement(this, parentElement);
2195
        addAndAdaptElement(parentElement, element);
2196
        return element;
2197
    }
2198

    
2199
    public DeterminationDetailElement createDeterminationDetailElement(ICdmFormElement parentElement) {
2200
        DeterminationDetailElement element = new DeterminationDetailElement(this, parentElement);
2201
        addAndAdaptElement(parentElement, element);
2202
        return element;
2203
    }
2204

    
2205
    public SampleDesignationDetailElement createSampleDesignationDetailElement(ICdmFormElement parentElement) {
2206
        SampleDesignationDetailElement element = new SampleDesignationDetailElement(this, parentElement);
2207
        addAndAdaptElement(parentElement, element);
2208
        return element;
2209
    }
2210

    
2211
    /**
2212
     * @param parentElement
2213
     * @param element
2214
     */
2215
    private void addAndAdaptElement(ICdmFormElement parentElement, AbstractCdmDetailElement<?> element) {
2216
        adapt(element);
2217
        parentElement.addElement(element);
2218
    }
2219

    
2220
    //--------EntityCollectionSection----------
2221
    public TeamMemberSection createTeamMemberSection(ConversationHolder conversation, ICdmFormElement parentElement, int style, boolean isNomenclatural){
2222
        TeamMemberSection section = new TeamMemberSection(this, conversation, parentElement, style, isNomenclatural);
2223
        addAndAdaptSection(parentElement, section);
2224
        return section;
2225
    }
2226

    
2227
    public AnnotationSection createAnnotationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2228
        AnnotationSection section = new AnnotationSection(this, conversation, parentElement, style);
2229
        addAndAdaptSection(parentElement, section);
2230
        return section;
2231
    }
2232

    
2233
    public CreditSection createCreditSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2234
        CreditSection section = new CreditSection(this, conversation, parentElement, style);
2235
        addAndAdaptSection(parentElement, section);
2236
        return section;
2237
    }
2238

    
2239
    public DescriptionElementSourceSection createDescriptionElementSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2240
        DescriptionElementSourceSection section = new DescriptionElementSourceSection(this, conversation, parentElement, style);
2241
        addAndAdaptSection(parentElement, section);
2242
        return section;
2243
    }
2244

    
2245
    public ExtensionSection createExtensionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2246
        ExtensionSection section = new ExtensionSection(this, conversation, parentElement, style);
2247
        addAndAdaptSection(parentElement, section);
2248
        return section;
2249
    }
2250

    
2251
    public MarkerSection createMarkerSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2252
        MarkerSection section = new MarkerSection(this, conversation, parentElement, style);
2253
        addAndAdaptSection(parentElement, section);
2254
        return section;
2255
    }
2256

    
2257
    public MediaSection createMediaSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2258
        MediaSection section = new MediaSection(this, conversation, parentElement, style);
2259
        addAndAdaptSection(parentElement, section);
2260
        return section;
2261
    }
2262

    
2263
    public DescriptionElementMediaSection createDescriptionElementMediaSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2264
        DescriptionElementMediaSection section = new DescriptionElementMediaSection(this, conversation, parentElement, style);
2265
        addAndAdaptSection(parentElement, section);
2266
        return section;
2267
    }
2268

    
2269
    public MediaRepresentationSection createMediaRepresentationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2270
        MediaRepresentationSection section = new MediaRepresentationSection(this, conversation, parentElement, style);
2271
        addAndAdaptSection(parentElement, section);
2272
        return section;
2273
    }
2274

    
2275
    public MediaRepresentationPartSection createMediaRepresentationPartSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2276
        MediaRepresentationPartSection section = new MediaRepresentationPartSection(this, conversation, parentElement, style);
2277
        addAndAdaptSection(parentElement, section);
2278
        return section;
2279
    }
2280

    
2281
    public ModifierSection createModifierSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2282
        ModifierSection section = new ModifierSection(this, conversation, parentElement, style);
2283
        addAndAdaptSection(parentElement, section);
2284
        return section;
2285
    }
2286

    
2287
    public NomenclaturalStatusSection createNomenclaturalStatusSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2288
        NomenclaturalStatusSection section = new NomenclaturalStatusSection(this, conversation, parentElement, style);
2289
        addAndAdaptSection(parentElement, section);
2290
        return section;
2291
    }
2292

    
2293
    public NameRelationshipDetailSection createNameRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2294
        NameRelationshipDetailSection section = new NameRelationshipDetailSection(this, conversation, parentElement, style);
2295
        addAndAdaptSection(parentElement, section);
2296
        return section;
2297
    }
2298

    
2299
    public SynonymRelationshipDetailSection createSynonymRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2300
        SynonymRelationshipDetailSection section = new SynonymRelationshipDetailSection(this, conversation, parentElement, style);
2301
        addAndAdaptSection(parentElement, section);
2302
        return section;
2303
    }
2304

    
2305
    public ProtologueSection createProtologueSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2306
        ProtologueSection section = new ProtologueSection(this, conversation, parentElement, style);
2307
        addAndAdaptSection(parentElement, section);
2308
        return section;
2309
    }
2310

    
2311
    public RightsSection createRightsSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2312
        RightsSection section = new RightsSection(this, conversation, parentElement, style);
2313
        addAndAdaptSection(parentElement, section);
2314
        return section;
2315
    }
2316

    
2317
    public SourceSection createSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2318
        SourceSection section = new SourceSection(this, conversation, parentElement, style);
2319
        addAndAdaptSection(parentElement, section);
2320
        return section;
2321
    }
2322

    
2323
    public ScopeSection createScopeSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2324
        ScopeSection section = new ScopeSection(this, conversation, parentElement, style);
2325
        addAndAdaptSection(parentElement, section);
2326
        return section;
2327
    }
2328

    
2329
    public DescriptionSourceSection createDescriptionSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2330
        DescriptionSourceSection section = new DescriptionSourceSection(this, conversation, parentElement, style);
2331
        addAndAdaptSection(parentElement, section);
2332
        return section;
2333
    }
2334

    
2335
    public TypeDesignationSection createTypeDesignationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2336
        TypeDesignationSection section = new TypeDesignationSection(this, conversation, parentElement, style);
2337
        addAndAdaptSection(parentElement, section);
2338
        return section;
2339
    }
2340

    
2341
    public StateDataSection createStateDataSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2342
        StateDataSection section = new StateDataSection(this, conversation, parentElement, style);
2343
        addAndAdaptSection(parentElement, section);
2344
        return section;
2345
    }
2346

    
2347
    public StatisticalMeasurementValueSection createStatisticalMeasurementValueSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2348
        StatisticalMeasurementValueSection section = new StatisticalMeasurementValueSection(this, conversation, parentElement, style);
2349
        addAndAdaptSection(parentElement, section);
2350
        return section;
2351
    }
2352

    
2353
    public DescribedSpecimenSection createDescribedSpecimenSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2354
        DescribedSpecimenSection section = new DescribedSpecimenSection(this, conversation, parentElement, style);
2355
        addAndAdaptSection(parentElement, section);
2356
        return section;
2357
    }
2358

    
2359
    public StateVocabularyCollectionSection createStateVocabulariesSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2360
        StateVocabularyCollectionSection section = new StateVocabularyCollectionSection(this, conversation, parentElement, style);
2361
        addAndAdaptSection(parentElement, section);
2362
        return section;
2363
    }
2364

    
2365
    public RecommendedModifierVocabulariesCollectionSection createRecommendedModifierVocabulariesCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2366
        RecommendedModifierVocabulariesCollectionSection section = new RecommendedModifierVocabulariesCollectionSection(this, conversation, parentElement, style);
2367
        addAndAdaptSection(parentElement, section);
2368
        return section;
2369
    }
2370

    
2371
    public MeasurementUnitCollectionSection createMeasurementUnitCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2372
        MeasurementUnitCollectionSection section = new MeasurementUnitCollectionSection(this, conversation, parentElement, style);
2373
        addAndAdaptSection(parentElement, section);
2374
        return section;
2375
    }
2376

    
2377
    public StatisticalMeasureCollectionSection createStatisticalMeasureCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2378
        StatisticalMeasureCollectionSection section = new StatisticalMeasureCollectionSection(this, conversation, parentElement, style);
2379
        addAndAdaptSection(parentElement, section);
2380
        return section;
2381
    }
2382

    
2383
    public CollectingAreasDetailSection createCollectingAreasDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2384
        CollectingAreasDetailSection section = new CollectingAreasDetailSection(this, conversation, parentElement, style);
2385
        addAndAdaptSection(parentElement, section);
2386
        return section;
2387
    }
2388

    
2389
    public GeoScopeDetailSection createGeoScopeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2390
        GeoScopeDetailSection section = new GeoScopeDetailSection(this, conversation, parentElement, style);
2391
        addAndAdaptSection(parentElement, section);
2392
        return section;
2393
    }
2394

    
2395
    public GeoScopePolyKeyDetailSection createGeoScopePolyKeyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2396
        GeoScopePolyKeyDetailSection section = new GeoScopePolyKeyDetailSection(this, conversation, parentElement, style);
2397
        addAndAdaptSection(parentElement, section);
2398
        return section;
2399
    }
2400

    
2401
    public IdentifierSection createIdentifierDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2402
        IdentifierSection section = new IdentifierSection(this, conversation, parentElement, style);
2403
        addAndAdaptSection(parentElement, section);
2404
        return section;
2405
    }
2406

    
2407
    public DerivedUnitFacadeIdentifierSection createDerivedUnitFacadeIdentifierSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2408
    	DerivedUnitFacadeIdentifierSection section = new DerivedUnitFacadeIdentifierSection(this, conversation, parentElement, style);
2409
    	addAndAdaptSection(parentElement, section);
2410
    	return section;
2411
    }
2412

    
2413
    public CurrentSampleDesignationDetailSection createCurrentSampleDesignationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2414
        CurrentSampleDesignationDetailSection section = new CurrentSampleDesignationDetailSection(this, conversation, parentElement, style);
2415
        addAndAdaptSection(parentElement, section);
2416
        return section;
2417
    }
2418

    
2419
    public CurrentDeterminationDetailSection createCurrentDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2420
        CurrentDeterminationDetailSection section = new CurrentDeterminationDetailSection(this, conversation, parentElement, style);
2421
        addAndAdaptSection(parentElement, section);
2422
        return section;
2423
    }
2424

    
2425
    public PreservedSpecimenCurrentDeterminationDetailSection createPreservedSpecimenCurrentDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2426
        PreservedSpecimenCurrentDeterminationDetailSection section = new PreservedSpecimenCurrentDeterminationDetailSection(this, conversation, parentElement, style);
2427
        addAndAdaptSection(parentElement, section);
2428
        return section;
2429
    }
2430

    
2431
    public SampleDesignationHistoryDetailSection createSampleDesignationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2432
        SampleDesignationHistoryDetailSection section = new SampleDesignationHistoryDetailSection(this, conversation, parentElement, style);
2433
        addAndAdaptSection(parentElement, section);
2434
        return section;
2435
    }
2436

    
2437
    public DeterminationHistoryDetailSection createDeterminationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2438
        DeterminationHistoryDetailSection section = new DeterminationHistoryDetailSection(this, conversation, parentElement, style);
2439
        addAndAdaptSection(parentElement, section);
2440
        return section;
2441
    }
2442

    
2443
    public SpecimenCollectionDetailSection createSpecimenCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2444
        SpecimenCollectionDetailSection section = new SpecimenCollectionDetailSection(this, conversation, parentElement, style);
2445
        addAndAdaptSection(parentElement, section);
2446
        return section;
2447
    }
2448

    
2449
    public PreservedSpecimenSourceCollectionDetailSection createPreservedSpecimenSourceCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2450
        PreservedSpecimenSourceCollectionDetailSection section = new PreservedSpecimenSourceCollectionDetailSection(this, conversation, parentElement, style);
2451
        addAndAdaptSection(parentElement, section);
2452
        return section;
2453
    }
2454

    
2455
    public SourceCollectionDetailSection createSourceCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2456
        SourceCollectionDetailSection section = new SourceCollectionDetailSection(this, conversation, parentElement, style);
2457
        addAndAdaptSection(parentElement, section);
2458
        return section;
2459
    }
2460

    
2461
    public ScopeRestrictionSection createScopeRestrictionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2462
        ScopeRestrictionSection section = new ScopeRestrictionSection(this, conversation, parentElement, style);
2463
        addAndAdaptSection(parentElement, section);
2464
        return section;
2465
    }
2466

    
2467
    public MemberDetailSection createMemberDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2468
        MemberDetailSection section = new MemberDetailSection(this, conversation, parentElement, style);
2469
        addAndAdaptSection(parentElement, section);
2470
        return section;
2471
    }
2472

    
2473
    public GrantedAuthorityDetailSection createGrantedAuthorityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2474
        GrantedAuthorityDetailSection section = new GrantedAuthorityDetailSection(this, conversation, parentElement, style);
2475
        addAndAdaptSection(parentElement, section);
2476
        return section;
2477
    }
2478

    
2479
    public GroupsByUserDetailSection createGroupsByUserDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2480
        GroupsByUserDetailSection section = new GroupsByUserDetailSection(this, conversation, parentElement, style);
2481
        addAndAdaptSection(parentElement, section);
2482
        return section;
2483
    }
2484

    
2485
    public TaxonomicScopeSection createTaxonomicScopeSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2486
        TaxonomicScopeSection section = new TaxonomicScopeSection(this, conversation, parentElement, style);
2487
        addAndAdaptSection(parentElement, section);
2488
        return section;
2489
    }
2490

    
2491

    
2492
    public AbstractEntityCollectionElement createEntityCollectionElement(AbstractFormSection parentElement,
2493
            Object versionableEntity, SelectionListener removeListener, Color backgroundColor, int style) {
2494
        AbstractEntityCollectionElement element = null;
2495

    
2496
        Object entity = HibernateProxyHelper.deproxy(versionableEntity);
2497

    
2498
        if (entity instanceof Annotation) {
2499
            element = new AnnotationElement(this, parentElement, (Annotation) entity, removeListener, style);
2500
        }else if (entity instanceof Person ) {
2501
            boolean isNomenclatural = false;
2502
            if (parentElement instanceof TeamMemberSection){
2503
                isNomenclatural = ((TeamMemberSection) parentElement).isNomenclaturalTeam();
2504
            }
2505
            element = new TeamMemberElement(this, parentElement, (Person) entity, removeListener, style, isNomenclatural);
2506
        } else if (entity instanceof Credit) {
2507
            element = new CreditElement(this, parentElement, (Credit) entity, removeListener, style);
2508
        } else if (entity instanceof Extension) {
2509
            element = new ExtensionElement(this, parentElement, (Extension) entity, removeListener, style);
2510
        } else if (entity instanceof Marker) {
2511
            element = new MarkerElement(this, parentElement, (Marker) entity, removeListener, style);
2512
        } else if (entity instanceof TaxonNodeAgentRelation) {
2513
            element = new TaxonNodeAgentRelationCollectionElement(this, parentElement, (TaxonNodeAgentRelation) entity, removeListener, backgroundColor, style);
2514
        }else if (entity instanceof Media) {
2515
            element = new MediaMetaElement(this, parentElement, (Media) entity, removeListener, true, style);
2516
        } else if (entity instanceof MediaRepresentation) {
2517
            element = new MediaRepresentationElement(this, parentElement, (MediaRepresentation) entity, removeListener,
2518
                    style);
2519
        } else if (entity instanceof ImageFile) {
2520
            element = new ImageFileElement(this, parentElement, (ImageFile) entity, removeListener, style);
2521
        } else if (entity instanceof MediaRepresentationPart) {
2522
            element = new MediaRepresentationPartElement(this, parentElement, (MediaRepresentationPart) entity,
2523
                    removeListener, style);
2524
        } else if (entity instanceof NomenclaturalStatus) {
2525
            element = new NomenclaturalStatusElement(this, parentElement, (NomenclaturalStatus) entity, removeListener,
2526
                    style);
2527
        } else if (entity instanceof Rights) {
2528
            element = new RightsElement(this, parentElement, (Rights) entity, removeListener, style);
2529
        } else if (entity instanceof DescriptionElementSource) {
2530
            element = new DescriptionElementSourceElement(this, parentElement, (DescriptionElementSource) entity,
2531
                    removeListener, style);
2532
        } else if (entity instanceof TaxonNodeAgentRelation) {
2533
            element = new TaxonNodeAgentRelationCollectionElement(this, parentElement, (TaxonNodeAgentRelation) entity,
2534
                    removeListener,backgroundColor, style);
2535
        }
2536
        else if (entity instanceof IdentifiableSource) {
2537
            element = new IdentifiableSourceElement(this, parentElement, (IdentifiableSource) entity, removeListener,
2538
                    style);
2539
        } else if (entity instanceof DefinedTerm) {
2540
            switch(((DefinedTerm)entity).getTermType()) {
2541
            case Scope:
2542
                element = new ScopeElement(this,
2543
                        parentElement,
2544
                        (DefinedTerm) entity,
2545
                        removeListener,
2546
                        style);
2547
                break;
2548
            case Modifier:
2549
                element = new ModifierElement(this,
2550
                        parentElement,
2551
                        (DefinedTerm) entity,
2552
                        removeListener,
2553
                        style);
2554
                break;
2555
            default:
2556
                break;
2557

    
2558
            }
2559
        } else if (entity instanceof Reference) {
2560
            if(parentElement instanceof SequenceReferenceCollectionDetailSection){
2561
                element = new SequenceReferenceCollectionDetailElement(this, parentElement, (Reference) entity, removeListener, style);
2562
            }
2563
            else{
2564
                element = new DescriptionSourceElement(this, parentElement, (Reference) entity, removeListener, style);
2565
            }
2566
        } else if (entity instanceof NameTypeDesignation) {
2567
            element = new NameTypeDesignationElement(this, parentElement, (NameTypeDesignation) entity, removeListener,
2568
                    style);
2569
        } else if (entity instanceof NameRelationship) {
2570
            element = new NameRelationshipDetailElement(this, parentElement, (NameRelationship) entity, removeListener,
2571
                    style);
2572
        } else if (entity instanceof SynonymRelationship) {
2573
            element = new SynonymRelationshipDetailElement(this, parentElement, (SynonymRelationship) entity, removeListener,
2574
                    style);
2575
        } else if (entity instanceof SpecimenTypeDesignation) {
2576
            if(parentElement instanceof DerivedUnitTypeDesignationSection){
2577
                element = new DerivedUnitTypeDesignationElement(this, parentElement, (SpecimenTypeDesignation) entity,
2578
                        removeListener, style);
2579
            }
2580
            else{
2581
                element = new SpecimenTypeDesignationElement(this, parentElement, (SpecimenTypeDesignation) entity,
2582
                        removeListener, style);
2583
            }
2584
        } else if (entity instanceof StateData) {
2585
            element = new StateDataElement(this, parentElement, (StateData) entity, removeListener, style);
2586
        } else if (entity instanceof StatisticalMeasurementValue) {
2587
            element = new StatisticalMeasurementValueElement(this, parentElement, (StatisticalMeasurementValue) entity,
2588
                    removeListener, style);
2589
        } else if (entity instanceof DerivedUnit) {
2590
            switch(((DerivedUnit)entity).getRecordBasis()) {
2591
            case LivingSpecimen:
2592
            case PreservedSpecimen:
2593
            case OtherSpecimen:
2594
                element = new SpecimenCollectionDetailElement(this,
2595
                        parentElement,
2596
                        (DerivedUnit) entity,
2597
                        removeListener,
2598
                        style);
2599
                break;
2600
            default:
2601
                element = new DerivedUnitElement(this,
2602
                        parentElement,
2603
                        (DerivedUnit) entity,
2604
                        removeListener,
2605
                        style);
2606
            }
2607

    
2608
        } else if (entity instanceof NamedArea) {
2609
            element = new NamedAreaDetailElement(this, parentElement, (NamedArea) entity, removeListener, style);
2610
        } else if (entity instanceof DeterminationEvent) {
2611
            element = new DeterminationEventDetailElement(this, parentElement, (DeterminationEvent) entity, removeListener, style);
2612
        } else if (entity instanceof User) {
2613
            element = new MemberDetailElement(this, parentElement, (User) entity, removeListener, style);
2614
        } else if (entity instanceof GrantedAuthority) {
2615
            element = new GrantedAuthorityCollectionElement(this, parentElement, (GrantedAuthorityImpl) entity,
2616
                    removeListener, style);
2617
        } else if (entity instanceof Group) {
2618
            element = new GroupsByUserDetailElement(this, parentElement, (Group) entity, removeListener, style);
2619
        } else if (entity instanceof Taxon) {
2620
            element = new TaxonDetailElement(this, parentElement, (Taxon) entity, removeListener, style);
2621
        } else if (entity instanceof DescriptionElementBase) {
2622
            // this is the special case for protologs, maybe we can do this
2623
            // differently when API improves
2624
            DescriptionElementBase descriptionElement = (DescriptionElementBase) entity;
2625
            if (descriptionElement.getFeature().equals(Feature.PROTOLOGUE())) {
2626
                element = new ProtologueElement(this, parentElement, descriptionElement, removeListener, style);
2627
            }
2628
        } else if (entity instanceof Identifier) {
2629
            if(parentElement instanceof AbstractSampleDesignationDetailSection){
2630
                element = new SampleDesignationTextDetailElement(this, parentElement, (Identifier<DnaSample>) entity, removeListener, backgroundColor, style);
2631
            }
2632
            else{
2633
                element = new IdentifierElement(this, parentElement, (Identifier) entity, removeListener, style);
2634
            }
2635
        } else if (entity instanceof TermVocabulary) {
2636
            TermVocabulary<?> termVocabulary = (TermVocabulary<?>)entity;
2637
            switch (termVocabulary.getTermType()) {
2638
            case State:
2639
                element = new StateVocabularyCollectionElement(this, parentElement, (TermVocabulary<State>) entity, removeListener, backgroundColor, style);
2640
                break;
2641
            case Modifier:
2642
                element = new RecommendedModifierVocabulariesElement(this, parentElement, (TermVocabulary<DefinedTerm>) entity, removeListener, backgroundColor, style);
2643
                break;
2644
            default:
2645
                break;
2646
            }
2647
        } else if (entity instanceof MeasurementUnit) {
2648
            element = new MeasurementUnitCollectionElement(this, parentElement, (MeasurementUnit) entity, removeListener, backgroundColor, style);
2649
        } else if (entity instanceof StatisticalMeasure) {
2650
            element = new StatisticalMeasureCollectionElement(this, parentElement, (StatisticalMeasure) entity, removeListener, backgroundColor, style);
2651
        }
2652

    
2653

    
2654
        if (element == null) {
2655
            MessagingUtils.messageDialog("No element for entity", this,
2656
                    "Could not generate element for entity. Looks like the case is not handled already. Check implementation. Entity: "
2657
                            + entity, null);
2658
        }
2659

    
2660
        else{
2661
            if (backgroundColor != null && !backgroundColor.isDisposed()) {
2662
                element.setPersistentBackground(backgroundColor);
2663
            }
2664
            adapt(element);
2665
            parentElement.addElement(element);
2666
        }
2667

    
2668
        return element;
2669
    }
2670

    
2671
    /**
2672
     * <p>
2673
     * Creates a selection element for the given type T.
2674
     * </p>
2675
     * <p>
2676
     * <strong>Selection elements not handled by this method:</strong>
2677
     * <ul>
2678
     * <li>{@link TaxonNodeSelectionElement} see
2679
     * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
2680
     * </li>
2681
     * <li>{@link NomenclaturalAuthorTeamSelectionElement} see
2682
     * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
2683
     * </li>
2684
     * </ul>
2685
     * </p>
2686
     *
2687
     * @param clazz
2688
     *            a {@link Class} object of the type that you want the selection
2689
     *            element to handle
2690
     * @param parentElement
2691
     *            a {@link ICdmFormElement} object.
2692
     * @param labelString
2693
     *            a {@link String} object.
2694
     * @param selectionType
2695
     * @param selection
2696
     *            a {@link ICdmBase} object.
2697
     * @param style
2698
     *            a int.
2699
     * @param conversation
2700
     *            a {@link ConversationHolder} object.
2701
     * @return a {@link EntitySelectionElement} object.
2702
     */
2703
    public <T extends CdmBase> EntitySelectionElement<T> createSelectionElement(Class<T> clazz,
2704
            ConversationHolder conversation, ICdmFormElement parentElement, String labelString, T selection, int mode,
2705
            int style) {
2706
        EntitySelectionElement<T> element = new EntitySelectionElement<T>(this, conversation, parentElement, clazz,
2707
                labelString, selection, mode, style);
2708
        adapt(element);
2709
        parentElement.addElement(element);
2710
        return element;
2711
    }
2712

    
2713
    /**
2714
     * <p>
2715
     * Creates a selection element for the given type T which shows only the <b>abbreviated</b> title as the label.
2716
     * </p>
2717
     * <p>
2718
     * <strong>Selection elements not handled by this method:</strong>
2719
     * <ul>
2720
     * <li>{@link TaxonNodeSelectionElement} see
2721
     * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
2722
     * </li>
2723
     * <li>{@link NomenclaturalAuthorTeamSelectionElement} see
2724
     * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
2725
     * </li>
2726
     * </ul>
2727
     * </p>
2728
     *
2729
     * @param clazz
2730
     *            a {@link Class} object of the type that you want the selection
2731
     *            element to handle
2732
     * @param parentElement
2733
     *            a {@link ICdmFormElement} object.
2734
     * @param labelString
2735
     *            a {@link String} object.
2736
     * @param selectionType
2737
     * @param selection
2738
     *            a {@link ICdmBase} object.
2739
     * @param style
2740
     *            a int.
2741
     * @param conversation
2742
     *            a {@link ConversationHolder} object.
2743
     * @return a {@link EntitySelectionElement} object.
2744
     */
2745
    public <T extends CdmBase> EntitySelectionElementWithAbbreviatedTitle<T> createSelectionElementWithAbbreviatedTitle(
2746
            Class<T> clazz, ConversationHolder conversation, ICdmFormElement parentElement, String labelString,
2747
            T selection, int mode, int style) {
2748
        EntitySelectionElementWithAbbreviatedTitle<T> element = new EntitySelectionElementWithAbbreviatedTitle<T>(this, conversation, parentElement, clazz,
2749
                labelString, selection, mode, style);
2750
        adapt(element);
2751
        parentElement.addElement(element);
2752
        return element;
2753
    }
2754

    
2755
    public TaxonNodeSelectionElement createTaxonNodeSelectionElement(ConversationHolder conversation,
2756
            ICdmFormElement parentElement, String labelString, TaxonNode selection, int mode, int style) {
2757
        TaxonNodeSelectionElement element = new TaxonNodeSelectionElement(this, conversation, parentElement,
2758
                labelString, selection, mode, style);
2759
        adapt(element);
2760
        parentElement.addElement(element);
2761
        return element;
2762
    }
2763

    
2764
//    public NomenclaturalAuthorTeamSelectionElement createNomenclaturalAuthorTeamSelectionElement(
2765
//            ConversationHolder conversation, ICdmFormElement parentElement, String labelString, Team selection,
2766
//            int mode, int style) {
2767
//        NomenclaturalAuthorTeamSelectionElement element = new NomenclaturalAuthorTeamSelectionElement(this,
2768
//                conversation, parentElement, labelString, selection, mode, style);
2769
//        adapt(element);
2770
//        parentElement.addElement(element);
2771
//        return element;
2772
//    }
2773

    
2774
    /** {@inheritDoc} */
2775
    public LabelElement createLabel(ICdmFormElement parentElement, String text) {
2776
        LabelElement labelElement = new LabelElement(this, parentElement, text);
2777
        adapt(labelElement);
2778
        parentElement.addElement(labelElement);
2779
        return labelElement;
2780
    }
2781

    
2782
    public DateElement createDateElement(ICdmFormElement formElement, String labelText, DateTime dateTime, int style){
2783
        Label label = new Label(formElement.getLayoutComposite(), style);
2784
        label.setText(labelText+" (yyyy-MM-dd)");
2785
        DateElement dateElement = new DateElement(formElement.getLayoutComposite(), dateTime, style);
2786
        dateElement.initController(this, formElement);
2787
        return dateElement;
2788
    }
2789

    
2790
    /**
2791
     * <p>
2792
     * Getter for the field <code>selectionProvider</code>.
2793
     * </p>
2794
     *
2795
     * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
2796
     */
2797
    public ISelectionProvider getSelectionProvider() {
2798
        return selectionProvider;
2799
    }
2800

    
2801
    /**
2802
     * <p>
2803
     * createDetailedDescriptionDetailElement
2804
     * </p>
2805
     *
2806
     * @param parentElement
2807
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
2808
     *            object.
2809
     * @param entity
2810
     *            a
2811
     *            {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
2812
     *            object.
2813
     * @param style
2814
     *            a int.
2815
     * @return a
2816
     *         {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
2817
     *         object.
2818
     */
2819
    public AbstractDetailedDescriptionDetailElement createDetailedDescriptionDetailElement(
2820
            ICdmFormElement parentElement, DescriptionElementBase entity, int style) {
2821
        AbstractDetailedDescriptionDetailElement detailedDescriptionElement = null;
2822

    
2823
        if (entity instanceof CategoricalData) {
2824
            detailedDescriptionElement = new CategoricalDataDetailElement(this, parentElement,
2825
                    (CategoricalData) entity, style);
2826
        } else if (entity instanceof CommonTaxonName) {
2827
            detailedDescriptionElement = new CommonNameDetailElement(this, parentElement, (CommonTaxonName) entity,
2828
                    style);
2829
        } else if (entity instanceof Distribution) {
2830
            detailedDescriptionElement = new DistributionDetailElement(this, parentElement, (Distribution) entity,
2831
                    style);
2832
        } else if (entity instanceof IndividualsAssociation) {
2833
            detailedDescriptionElement = new IndividualsAssociationDetailElement(this, parentElement,
2834
                    (IndividualsAssociation) entity, style);
2835
        } else if (entity instanceof QuantitativeData) {
2836
            detailedDescriptionElement = new QuantitativeDataDetailElement(this, parentElement,
2837
                    (QuantitativeData) entity, style);
2838
        } else if (entity instanceof TaxonInteraction) {
2839
            detailedDescriptionElement = new TaxonInteractionDetailElement(this, parentElement,
2840
                    (TaxonInteraction) entity, style);
2841
        } else if (entity instanceof TextData) {
2842
            detailedDescriptionElement = new TextDataDetailElement(this, parentElement, (TextData) entity, style);
2843
        } else {
2844
            throw new IllegalStateException("There is no interface for the given description element");
2845
        }
2846
        adapt(detailedDescriptionElement);
2847
        parentElement.addElement(detailedDescriptionElement);
2848
        return detailedDescriptionElement;
2849

    
2850
    }
2851

    
2852
    /**
2853
     * Creates a styled text as a part of the form.
2854
     *
2855
     * @param parent
2856
     *            the text parent
2857
     * @param value
2858
     *            the text initial value
2859
     * @param style
2860
     *            the text style
2861
     * @return the text widget
2862
     */
2863
    public StyledText createStyledText(Composite parent, String value, int style) {
2864
        StyledText text = new StyledText(parent, getBorderStyle() | style | getOrientation());
2865
        if (value != null) {
2866
            text.setText(value);
2867
        }
2868
        text.setForeground(getColors().getForeground());
2869
        text.setBackground(getColors().getBackground());
2870
        // text.addFocusListener(visibilityHandler);
2871
        return text;
2872
    }
2873

    
2874
    public PreservedSpecimenDetailSection createPreservedSpecimenDetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
2875
        PreservedSpecimenDetailSection section = new PreservedSpecimenDetailSection(this, conversation, parentElement, selectionProvider, style);
2876
        addAndAdaptSection(parentElement, section);
2877
        return section;
2878
    }
2879

    
2880
    /**
2881
     * @param formElement
2882
     * @param conversationHolder
2883
     * @param style
2884
     * @return
2885
     */
2886
    public TaxonNodeAgentRelationCollectionSection createTaxonNodeAgentRelationCollectionSection(
2887
            ICdmFormElement formElement, ConversationHolder conversationHolder, int style) {
2888
        TaxonNodeAgentRelationCollectionSection section = new TaxonNodeAgentRelationCollectionSection(this, conversationHolder, formElement, style);
2889
        addAndAdaptSection(formElement, section);
2890
        return section;
2891
    }
2892

    
2893
    /**
2894
     * @param conversationHolder
2895
     * @param formElement
2896
     * @param expanded
2897
     * @return
2898
     */
2899
    public TeamMemberSection createNomenclaturalTeamMemberSection(ConversationHolder conversationHolder,
2900
            ICdmFormElement formElement, int expanded) {
2901
        // TODO Auto-generated method stub
2902
        return null;
2903
    }
2904

    
2905
}
(7-7/42)