d0255238423d81458506fe3a027f3c8144f8e86d
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / element / CdmFormFactory.java
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.TermType;
66 import eu.etaxonomy.cdm.model.common.TermVocabulary;
67 import eu.etaxonomy.cdm.model.common.TimePeriod;
68 import eu.etaxonomy.cdm.model.common.User;
69 import eu.etaxonomy.cdm.model.common.VersionableEntity;
70 import eu.etaxonomy.cdm.model.description.CategoricalData;
71 import eu.etaxonomy.cdm.model.description.CommonTaxonName;
72 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
73 import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
74 import eu.etaxonomy.cdm.model.description.Distribution;
75 import eu.etaxonomy.cdm.model.description.Feature;
76 import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
77 import eu.etaxonomy.cdm.model.description.KeyStatement;
78 import eu.etaxonomy.cdm.model.description.MeasurementUnit;
79 import eu.etaxonomy.cdm.model.description.QuantitativeData;
80 import eu.etaxonomy.cdm.model.description.State;
81 import eu.etaxonomy.cdm.model.description.StateData;
82 import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
83 import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue;
84 import eu.etaxonomy.cdm.model.description.TaxonInteraction;
85 import eu.etaxonomy.cdm.model.description.TextData;
86 import eu.etaxonomy.cdm.model.location.NamedArea;
87 import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
88 import eu.etaxonomy.cdm.model.location.Point;
89 import eu.etaxonomy.cdm.model.media.ImageFile;
90 import eu.etaxonomy.cdm.model.media.Media;
91 import eu.etaxonomy.cdm.model.media.MediaRepresentation;
92 import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
93 import eu.etaxonomy.cdm.model.media.Rights;
94 import eu.etaxonomy.cdm.model.molecular.DnaSample;
95 import eu.etaxonomy.cdm.model.name.NameRelationship;
96 import eu.etaxonomy.cdm.model.name.NameTypeDesignation;
97 import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
98 import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
99 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
100 import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
101 import eu.etaxonomy.cdm.model.reference.Reference;
102 import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
103 import eu.etaxonomy.cdm.model.taxon.Taxon;
104 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
105 import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
106 import eu.etaxonomy.taxeditor.model.MessagingUtils;
107 import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
108 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
109 import eu.etaxonomy.taxeditor.ui.combo.VocabularyComboElement;
110 import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection.UnitType;
111 import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement;
112 import eu.etaxonomy.taxeditor.ui.openurl.IOpenUrlEnabled;
113 import eu.etaxonomy.taxeditor.ui.openurl.OpenUrlSelectorElement;
114 import eu.etaxonomy.taxeditor.ui.password.EditPasswordElement;
115 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
116 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
117 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
118 import eu.etaxonomy.taxeditor.ui.section.EmptyElement;
119 import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionDetailElement;
120 import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionDetailSection;
121 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailElement;
122 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
123 import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailElement;
124 import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
125 import eu.etaxonomy.taxeditor.ui.section.agent.TeamMemberElement;
126 import eu.etaxonomy.taxeditor.ui.section.agent.TeamMemberSection;
127 import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
128 import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationDetailElement;
129 import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationDetailSection;
130 import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailElement;
131 import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailSection;
132 import eu.etaxonomy.taxeditor.ui.section.common.ReferenceEntityDetailElement;
133 import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
134 import eu.etaxonomy.taxeditor.ui.section.description.DerivedUnitElement;
135 import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
136 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailElement;
137 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
138 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailElement;
139 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
140 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
141 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceElement;
142 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
143 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceElement;
144 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
145 import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
146 import eu.etaxonomy.taxeditor.ui.section.description.ModifierElement;
147 import eu.etaxonomy.taxeditor.ui.section.description.ModifierSection;
148 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageDetailElement;
149 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
150 import eu.etaxonomy.taxeditor.ui.section.description.ScopeElement;
151 import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
152 import eu.etaxonomy.taxeditor.ui.section.description.StateDataElement;
153 import eu.etaxonomy.taxeditor.ui.section.description.StateDataSection;
154 import eu.etaxonomy.taxeditor.ui.section.description.StatisticalMeasurementValueElement;
155 import eu.etaxonomy.taxeditor.ui.section.description.StatisticalMeasurementValueSection;
156 import eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement;
157 import eu.etaxonomy.taxeditor.ui.section.description.detail.CategoricalDataDetailElement;
158 import eu.etaxonomy.taxeditor.ui.section.description.detail.CommonNameDetailElement;
159 import eu.etaxonomy.taxeditor.ui.section.description.detail.DistributionDetailElement;
160 import eu.etaxonomy.taxeditor.ui.section.description.detail.IndividualsAssociationDetailElement;
161 import eu.etaxonomy.taxeditor.ui.section.description.detail.QuantitativeDataDetailElement;
162 import eu.etaxonomy.taxeditor.ui.section.description.detail.TaxonInteractionDetailElement;
163 import eu.etaxonomy.taxeditor.ui.section.description.detail.TextDataDetailElement;
164 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailElement;
165 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
166 import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityCollectionElement;
167 import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailElement;
168 import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
169 import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailElement;
170 import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
171 import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailElement;
172 import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
173 import eu.etaxonomy.taxeditor.ui.section.identifier.IdentifierDetailElement;
174 import eu.etaxonomy.taxeditor.ui.section.identifier.IdentifierDetailSection;
175 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailElement;
176 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
177 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailElement;
178 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
179 import eu.etaxonomy.taxeditor.ui.section.key.ScopeRestrictionSection;
180 import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
181 import eu.etaxonomy.taxeditor.ui.section.media.ImageFileElement;
182 import eu.etaxonomy.taxeditor.ui.section.media.MediaDetailElement;
183 import eu.etaxonomy.taxeditor.ui.section.media.MediaMetaElement;
184 import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationElement;
185 import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationPartElement;
186 import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationPartSection;
187 import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationSection;
188 import eu.etaxonomy.taxeditor.ui.section.media.MediaSection;
189 import eu.etaxonomy.taxeditor.ui.section.name.AuthorshipDetailElement;
190 import eu.etaxonomy.taxeditor.ui.section.name.AuthorshipDetailSection;
191 import eu.etaxonomy.taxeditor.ui.section.name.HybridDetailElement;
192 import eu.etaxonomy.taxeditor.ui.section.name.HybridDetailSection;
193 import eu.etaxonomy.taxeditor.ui.section.name.NameDetailElement;
194 import eu.etaxonomy.taxeditor.ui.section.name.NameDetailSection;
195 import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailElement;
196 import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
197 import eu.etaxonomy.taxeditor.ui.section.name.NameTypeDesignationElement;
198 import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusElement;
199 import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
200 import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailElement;
201 import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
202 import eu.etaxonomy.taxeditor.ui.section.name.ProtologueElement;
203 import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
204 import eu.etaxonomy.taxeditor.ui.section.name.SpecimenTypeDesignationElement;
205 import eu.etaxonomy.taxeditor.ui.section.name.SynonymRelationshipDetailElement;
206 import eu.etaxonomy.taxeditor.ui.section.name.SynonymRelationshipDetailSection;
207 import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
208 import eu.etaxonomy.taxeditor.ui.section.occurrence.CollectingAreasDetailSection;
209 import eu.etaxonomy.taxeditor.ui.section.occurrence.CollectionDetailElement;
210 import eu.etaxonomy.taxeditor.ui.section.occurrence.CurrentDeterminationDetailSection;
211 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailElement;
212 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
213 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailElement;
214 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailSection;
215 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailElement;
216 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
217 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationEventDetailElement;
218 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationHistoryDetailSection;
219 import eu.etaxonomy.taxeditor.ui.section.occurrence.EmptySection;
220 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailElement;
221 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
222 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailElement;
223 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
224 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailElement;
225 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
226 import eu.etaxonomy.taxeditor.ui.section.occurrence.GeoScopeDetailSection;
227 import eu.etaxonomy.taxeditor.ui.section.occurrence.GeoScopePolyKeyDetailSection;
228 import eu.etaxonomy.taxeditor.ui.section.occurrence.NamedAreaDetailElement;
229 import eu.etaxonomy.taxeditor.ui.section.occurrence.OriginalLabelDataSection;
230 import eu.etaxonomy.taxeditor.ui.section.occurrence.SourceCollectionDetailSection;
231 import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenCollectionDetailElement;
232 import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenCollectionDetailSection;
233 import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenHierarchyDetailElement;
234 import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenHierarchyDetailSection;
235 import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailElement;
236 import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
237 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenCurrentDeterminationDetailSection;
238 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailElement;
239 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailSection;
240 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDeterminationDetailElement;
241 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDeterminationDetailSection;
242 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDeterminationHistoryDetailSection;
243 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenGeneralDetailElement;
244 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenGeneralDetailSection;
245 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenSourceCollectionDetailSection;
246 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractSampleDesignationDetailSection;
247 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationCloningDetailElement;
248 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationCloningDetailSection;
249 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGelPhotoCollectionDetailSection;
250 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGelPhotoDetailElement;
251 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGeneralDetailElement;
252 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGeneralDetailSection;
253 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationPrimerDetailElement;
254 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationPrimerDetailSection;
255 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.CurrentSampleDesignationDetailSection;
256 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailElement;
257 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailSection;
258 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailElement;
259 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailSection;
260 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSamplePreparationPreservationDetailElement;
261 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSamplePreparationPreservationSection;
262 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.PrimerGeneralDetailElement;
263 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailElement;
264 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailSection;
265 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationHistoryDetailSection;
266 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationTextDetailElement;
267 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceContigFileCollectionDetailSection;
268 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailElement;
269 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailSection;
270 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollectionDetailElement;
271 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollectionDetailSection;
272 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailElement;
273 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailSection;
274 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
275 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailElement;
276 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
277 import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailElement;
278 import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
279 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailElement;
280 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
281 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailElement;
282 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
283 import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationElement;
284 import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
285 import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseElement;
286 import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseSection;
287 import eu.etaxonomy.taxeditor.ui.section.supplemental.CreditElement;
288 import eu.etaxonomy.taxeditor.ui.section.supplemental.CreditSection;
289 import eu.etaxonomy.taxeditor.ui.section.supplemental.ExtensionElement;
290 import eu.etaxonomy.taxeditor.ui.section.supplemental.ExtensionSection;
291 import eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection;
292 import eu.etaxonomy.taxeditor.ui.section.supplemental.IdentifiableSourceElement;
293 import eu.etaxonomy.taxeditor.ui.section.supplemental.MarkerElement;
294 import eu.etaxonomy.taxeditor.ui.section.supplemental.MarkerSection;
295 import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsElement;
296 import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection;
297 import eu.etaxonomy.taxeditor.ui.section.supplemental.SourceSection;
298 import eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement;
299 import eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection;
300 import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement;
301 import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
302 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailElement;
303 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
304 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonDetailElement;
305 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailElement;
306 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
307 import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailElement;
308 import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
309 import eu.etaxonomy.taxeditor.ui.section.user.UserDetailElement;
310 import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
311 import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailElement;
312 import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
313 import eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailElement;
314 import eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailSection;
315 import eu.etaxonomy.taxeditor.ui.section.vocabulary.FeatureDetailElement;
316 import eu.etaxonomy.taxeditor.ui.section.vocabulary.MeasurementUnitCollectionElement;
317 import eu.etaxonomy.taxeditor.ui.section.vocabulary.MeasurementUnitCollectionSection;
318 import eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailSection;
319 import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierVocabulariesCollectionSection;
320 import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierVocabulariesElement;
321 import eu.etaxonomy.taxeditor.ui.section.vocabulary.StateVocabularyCollectionElement;
322 import eu.etaxonomy.taxeditor.ui.section.vocabulary.StateVocabularyCollectionSection;
323 import eu.etaxonomy.taxeditor.ui.section.vocabulary.StatisticalMeasureCollectionElement;
324 import eu.etaxonomy.taxeditor.ui.section.vocabulary.StatisticalMeasureCollectionSection;
325 import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailElement;
326 import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
327 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
328 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElementWithAbbreviatedTitle;
329 import eu.etaxonomy.taxeditor.ui.selection.NomenclaturalAuthorTeamSelectionElement;
330 import eu.etaxonomy.taxeditor.ui.selection.TaxonNodeSelectionElement;
331
332 /**
333 * <p>
334 * CdmFormFactory class.
335 * </p>
336 *
337 * @author n.hoffmann
338 * @created Feb 24, 2010
339 * @version 1.0
340 */
341 public class CdmFormFactory extends FormToolkit {
342
343 private BoldFontHolder2 boldFontHolder2;
344 private MouseListener selectionMouseHandler;
345 private FocusListener selectionFocusHandler;
346
347 private final Set<SelectionListener> selectionListenerList = new HashSet<SelectionListener>();
348
349 private final List<IPropertyChangeListener> propertyChangeListeners = new ArrayList<IPropertyChangeListener>();
350
351 private final int orientation = Window.getDefaultOrientation();
352 private ISelectionProvider selectionProvider;
353
354 /** Constant <code>EMPTY_SELECTION</code> */
355 public static ISelection EMPTY_SELECTION = new ISelection() {
356 @Override
357 public boolean isEmpty() {
358 return true;
359 }
360 };
361
362 /**
363 *
364 * @author n.hoffmann
365 * @date Jan 25, 2010
366 *
367 */
368 private class SelectionMouseHandler extends MouseAdapter {
369 @Override
370 public void mouseDown(MouseEvent e) {
371 notifySelectionListeners(e);
372 }
373 }
374
375 /**
376 *
377 * @author n.hoffmann
378 * @date Jan 25, 2010
379 *
380 */
381 private class SelectionFocusHandler extends FocusAdapter {
382 @Override
383 public void focusGained(FocusEvent e) {
384 notifySelectionListeners(e);
385 }
386 }
387
388 private void notifySelectionListeners(TypedEvent e) {
389 Event event = new Event();
390 event.widget = e.widget;
391 SelectionEvent selectionEvent = new SelectionEvent(event);
392
393 for (SelectionListener listener : selectionListenerList) {
394 listener.widgetSelected(selectionEvent);
395 }
396 }
397
398 /**
399 * <p>
400 * Constructor for CdmFormFactory.
401 * </p>
402 *
403 * @param display
404 * a {@link org.eclipse.swt.widgets.Display} object.
405 * @param selectionProvider
406 * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
407 */
408 public CdmFormFactory(Display display, ISelectionProvider selectionProvider) {
409 super(display);
410 this.selectionProvider = selectionProvider;
411 init();
412 }
413
414 /**
415 * <p>
416 * Constructor for CdmFormFactory.
417 * </p>
418 *
419 * @param display
420 * a {@link org.eclipse.swt.widgets.Display} object.
421 */
422 public CdmFormFactory(Display display) {
423 super(display);
424 init();
425 }
426
427 /**
428 *
429 */
430 private void init() {
431 boldFontHolder2 = new BoldFontHolder2();
432 selectionMouseHandler = new SelectionMouseHandler();
433 selectionFocusHandler = new SelectionFocusHandler();
434 }
435
436 /**
437 * Creates an instance initialized with the correct selectionProvider
438 *
439 * Make sure to remove the instance when the entityComposite disposes via
440 * destroySelectionArbitrator(..)
441 *
442 * @param entityElement
443 * a {@link eu.etaxonomy.taxeditor.ui.element.IEntityElement}
444 * object.
445 * @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
446 * object.
447 */
448 public SelectionArbitrator createSelectionArbitrator(IEntityElement entityElement) {
449 SelectionArbitrator selectionArbitrator = new SelectionArbitrator(entityElement);
450 selectionArbitrator.addSelectionProvider(selectionProvider);
451 selectionProvider.addSelectionChangedListener(selectionArbitrator);
452 addSelectionListener(selectionArbitrator);
453 return selectionArbitrator;
454 }
455
456 /**
457 * <p>
458 * destroySelectionArbitrator
459 * </p>
460 *
461 * @param selectionArbitrator
462 * a
463 * {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
464 * object.
465 */
466 public void destroySelectionArbitrator(SelectionArbitrator selectionArbitrator) {
467 removeSelectionListener(selectionArbitrator);
468 if (selectionProvider != null) {
469 selectionProvider.removeSelectionChangedListener(selectionArbitrator);
470 } else {
471 MessagingUtils.error(this.getClass(),
472 "Tried to destroy a selection listener from this factories listeners but was null", null);
473 }
474 }
475
476 /**
477 * <p>
478 * Adapts the {@link AbstractCdmFormElement}:<br>
479 * - sets the {@link IPropertyChangeListener}s handled by this class
480 * </p>
481 *
482 * @param formElement
483 * a
484 * {@link eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement}
485 * object.
486 */
487 public void adapt(ICdmFormElement formElement) {
488 formElement.setPropertyChangeListeners(propertyChangeListeners);
489 }
490
491 /** {@inheritDoc} */
492 @Override
493 public void adapt(Control control, boolean trackFocus, boolean trackKeyboard) {
494 if (trackFocus) {
495 control.addFocusListener(selectionFocusHandler);
496 }
497 super.adapt(control, trackFocus, trackKeyboard);
498 }
499
500 /** {@inheritDoc} */
501 @Override
502 public void adapt(Composite composite) {
503 composite.addMouseListener(selectionMouseHandler);
504 super.adapt(composite);
505 }
506
507 /**
508 * <p>
509 * destroyElement
510 * </p>
511 *
512 * @param formElement
513 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
514 * object.
515 */
516 public void destroyElement(ICdmFormElement formElement) {
517 // return if element was not initialized
518 if (formElement == null) {
519 return;
520 }
521 // destroy selection arbitrator, if any
522 if (formElement instanceof ISelectableElement) {
523 destroySelectionArbitrator(((ISelectableElement) formElement).getSelectionArbitrator());
524 }
525 // remove this element form its parents list of elements
526 // ICdmFormElement parentElement = formElement.getParentElement();
527 // if(parentElement != null){
528 // parentElement.removeElement(formElement);
529 // }
530 // call destroy on child elements recursively
531 for (ICdmFormElement childElement : formElement.getElements()) {
532 destroyElement(childElement);
533 }
534 // dispose of the controls
535 for (Control control : formElement.getControls()) {
536 // we added the layoutComposite of the parental element as the
537 // layout composite to this formElement
538 // but we do not want to destroy it.
539 if (control.equals(formElement.getLayoutComposite())) {
540 continue;
541 } else {
542 control.dispose();
543 control = null;
544 }
545 }
546 }
547
548 /**
549 * <p>
550 * createEmptyCell
551 * </p>
552 *
553 * @param parent
554 * a {@link org.eclipse.swt.widgets.Composite} object.
555 * @return a {@link org.eclipse.swt.widgets.Label} object.
556 */
557 public Label createEmptyCell(Composite parent) {
558 return this.createLabel(parent, null);
559 }
560
561 /**
562 * <p>
563 * createMultiLanguageTextElement
564 * </p>
565 *
566 * @param parentElement
567 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
568 * object.
569 * @param labelString
570 * a {@link java.lang.String} object.
571 * @param multilanguageText
572 * a {@link java.util.Map} object.
573 * @param textHeight
574 * a int.
575 * @param style
576 * a int.
577 * @return a
578 * {@link eu.etaxonomy.taxeditor.ui.element.MultilanguageTextElement}
579 * object.
580 */
581 public MultilanguageTextElement createMultiLanguageTextElement(ICdmFormElement parentElement, String labelString,
582 Map<Language, LanguageString> multilanguageText, int textHeight, int style) {
583 MultilanguageTextElement element = new MultilanguageTextElement(this, parentElement, labelString,
584 multilanguageText, textHeight, style);
585 adapt(element);
586 parentElement.addElement(element);
587 return element;
588 }
589
590 public KeyStatementElement createKeyStatementElement(ICdmFormElement parentElement, String labelString,
591 KeyStatement keyStatement, int textHeight, int style) {
592 KeyStatementElement element = new KeyStatementElement(this, parentElement, labelString, keyStatement,
593 textHeight, style);
594 adapt(element);
595 parentElement.addElement(element);
596 return element;
597 }
598
599 /**
600 * Creates a text field with a label. The initial content will be the return value of the initalObject's {@link #toString()}
601 * method.<br>
602 * <b>Note</b>: if initialObject is <code>null</code> then an empty string is used.
603 * @param parentElement the parent container
604 * @param labelString the label name
605 * @param initialObject the object from which the <code>toString()</code> method is called
606 * @param style {@link SWT} style constant
607 * @return the created textfield with label
608 */
609 public TextWithLabelElement createTextWithLabelElement(ICdmFormElement parentElement, String labelString,
610 Object initialObject, int style) {
611 return createTextWithLabelElement(parentElement, labelString, initialObject==null?"":initialObject.toString(), style);
612 }
613
614 /**
615 * <p>
616 * createTextWithLabelElement
617 * </p>
618 *
619 * @param parentElement
620 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
621 * object.
622 * @param labelString
623 * a {@link java.lang.String} object.
624 * @param initialText
625 * a {@link java.lang.String} object.
626 * @param style
627 * a int.
628 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
629 * object.
630 */
631 public TextWithLabelElement createTextWithLabelElement(ICdmFormElement parentElement, String labelString,
632 String initialText, int style) {
633 return createTextWithLabelElement(parentElement, labelString, initialText, null, style);
634 }
635 /**
636 * <p>
637 * createTextWithLabelElement
638 * </p>
639 *
640 * @param parentElement
641 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
642 * object.
643 * @param labelString
644 * a {@link java.lang.String} object.
645 * @param initialText
646 * a {@link java.lang.String} object.
647 * @param textLimit maximal number of characters allowed
648 * @param style
649 * a int.
650 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
651 * object.
652 */
653 public TextWithLabelElement createTextWithLabelElement(ICdmFormElement parentElement, String labelString,
654 String initialText, Integer textLimit, int style) {
655 if(initialText==null){
656 initialText = "";
657 }
658
659 TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, initialText, null,
660 textLimit, style);
661 adapt(element);
662 parentElement.addElement(element);
663 return element;
664 }
665
666 public TextWithLabelElement createMultiLineTextWithLabel(ICdmFormElement parentElement, String labelString,
667 int textHeight, int style) {
668 TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, "", textHeight, true, style);
669 adapt(element);
670 parentElement.addElement(element);
671 return element;
672 }
673
674 public LsidWithExceptionLabelElement createLsidWithExceptionLabelElement(ICdmFormElement parentElement, String labelString,
675 LSID initialLsid, int style) {
676 LsidWithExceptionLabelElement element = new LsidWithExceptionLabelElement(this, parentElement, labelString, initialLsid, null, style);
677 adapt(element);
678 parentElement.addElement(element);
679 return element;
680 }
681
682 public UriWithLabelElement createUriWithLabelElement(ICdmFormElement parentElement, String labelString,
683 URI initialUri, int style) {
684 UriWithLabelElement element = new UriWithLabelElement(this, parentElement, labelString, initialUri, null, style);
685 adapt(element);
686 parentElement.addElement(element);
687 return element;
688 }
689
690 /**
691 * @param element
692 * @param string
693 * @param uri
694 * @param style
695 * @return
696 */
697 public OpenUrlSelectorElement createOpenUrlSelectorElement(ICdmFormElement parentElement, String labelString,
698 IOpenUrlEnabled openUrlEnabled, int style) {
699 OpenUrlSelectorElement element = new OpenUrlSelectorElement(this, parentElement, labelString, openUrlEnabled,
700 style);
701 adapt(element);
702 parentElement.addElement(element);
703 return element;
704 }
705
706 /**
707 *
708 * @param parentElement
709 * @param labelString
710 * @param conversationEnabled
711 * @param user
712 * @param style
713 * @return
714 */
715 public EditPasswordElement createEditPasswordElement(ICdmFormElement parentElement, String labelString,
716 ConversationHolder conversation, User user, int style) {
717 EditPasswordElement element = new EditPasswordElement(this, parentElement, labelString, user, conversation);
718 adapt(element);
719 parentElement.addElement(element);
720 return element;
721 }
722
723 /**
724 * <p>
725 * createIntegerTextWithLabelElement
726 * </p>
727 *
728 * @param parentElement
729 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
730 * object.
731 * @param labelString
732 * a {@link java.lang.String} object.
733 * @param initialInteger
734 * a {@link java.lang.Integer} object.
735 * @param style
736 * a int.
737 * @return a
738 * {@link eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement}
739 * object.
740 */
741 public NumberWithLabelElement createNumberTextWithLabelElement(
742 ICdmFormElement parentElement, String labelString,
743 Number initialNumber, int style) {
744 NumberWithLabelElement element = new NumberWithLabelElement(this,
745 parentElement, labelString, initialNumber, style);
746 adapt(element);
747 parentElement.addElement(element);
748 return element;
749 }
750
751 public LanguageStringWithLabelElement createLanguageStringWithLabelElement(ICdmFormElement parentElement,
752 String labelString, LanguageString languageString, int style) {
753 return createLanguageStringWithLabelElement(parentElement, labelString, languageString, null, false, style);
754 }
755
756 public LanguageStringWithLabelElement createLanguageStringWithLabelElement(ICdmFormElement parentElement,
757 String labelString, LanguageString languageString, Integer height, boolean isMultiLine, int style) {
758 LanguageStringWithLabelElement element = new LanguageStringWithLabelElement(this, parentElement, labelString,
759 languageString, height, isMultiLine, style);
760 adapt(element);
761 parentElement.addElement(element);
762 return element;
763 }
764
765 /**
766 * <p>
767 * createKeyValueViewerElement
768 * </p>
769 *
770 * @param parentElement
771 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
772 * object.
773 * @param keyHeading
774 * a {@link java.lang.String} object.
775 * @param valueHeading
776 * a {@link java.lang.String} object.
777 * @param map
778 * a {@link java.util.Map} object.
779 * @return a {@link eu.etaxonomy.taxeditor.ui.element.KeyValueViewerElement}
780 * object.
781 */
782 public KeyValueViewerElement createKeyValueViewerElement(ICdmFormElement parentElement, String keyHeading,
783 String valueHeading, Map<Object, Object> map) {
784 KeyValueViewerElement element = new KeyValueViewerElement(this, parentElement, keyHeading, valueHeading, map);
785 adapt(element);
786 parentElement.addElement(element);
787 return element;
788 }
789 /**
790 * @deprecated Use {@link #createDefinedTermComboElement(TermType, ICdmFormElement, String, DefinedTermBase, int)} instead
791 */
792 @Deprecated
793 public <T extends DefinedTermBase> TermComboElement<T> createTermComboElement(Class<T> termComboType,
794 ICdmFormElement parentElement, String labelString, T selection, int style) {
795 TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termComboType, labelString,
796 selection, true, style);
797 adapt(element);
798 parentElement.addElement(element);
799 return element;
800 }
801
802 public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
803 TermType termType,
804 ICdmFormElement parentElement,
805 String labelString,
806 T selection,
807 int style) {
808 TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termType, labelString, selection, true, style);
809 adapt(element);
810 parentElement.addElement(element);
811 return element;
812 }
813
814 public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
815 TermType termType,
816 ICdmFormElement parentElement,
817 String labelString,
818 T selection,
819 boolean addEmptyElement,
820 int style) {
821 TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termType, labelString, selection, addEmptyElement, style);
822 adapt(element);
823 parentElement.addElement(element);
824 return element;
825 }
826
827 public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
828 TermVocabulary<?> termVocabulary,
829 ICdmFormElement parentElement,
830 String labelString,
831 T selection,
832 int style) {
833 TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termVocabulary, labelString, selection, true, style);
834 adapt(element);
835 parentElement.addElement(element);
836 return element;
837 }
838
839 public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
840 TermVocabulary<?> termVocabulary,
841 ICdmFormElement parentElement,
842 String labelString,
843 T selection,
844 boolean addEmptyElement,
845 int style) {
846 TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termVocabulary, labelString, selection, addEmptyElement, style);
847 adapt(element);
848 parentElement.addElement(element);
849 return element;
850 }
851
852 /**
853 * <p>
854 * createEnumComboElement
855 * </p>
856 *
857 * @param enumComboType
858 * a
859 * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EnumComboType}
860 * object.
861 * @param parentElement
862 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
863 * object.
864 * @param style
865 * a int.
866 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
867 * object.
868 */
869 public <T extends IEnumTerm<T>> EnumComboElement<T> createEnumComboElement(
870 Class<T> enumComboType, ICdmFormElement parentElement,
871 int style) {
872 EnumComboElement<T> element = new EnumComboElement<T>(this, parentElement, enumComboType, style);
873 adapt(element);
874 parentElement.addElement(element);
875 return element;
876 }
877
878 public <TERM extends DefinedTermBase<TERM>, VOC extends TermVocabulary<TERM>> VocabularyComboElement<TERM, VOC> createVocabularyComboElement(
879 TermType termType, String label, VOC selection, ICdmFormElement parentElement, int style) {
880 VocabularyComboElement<TERM, VOC> element = new VocabularyComboElement<TERM, VOC>(this, parentElement, termType, label, selection, style);
881 adapt(element);
882 parentElement.addElement(element);
883 return element;
884 }
885
886 /**
887 * <p>
888 * createBrowserElement
889 * </p>
890 *
891 * @param imageUri
892 * a {@link java.net.URI} object.
893 * @param style
894 * a int.
895 * @param parentElement
896 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
897 * object.
898 * @return a {@link eu.etaxonomy.taxeditor.ui.element.BrowserElement}
899 * object.
900 */
901 public BrowserElement createBrowserElement(ICdmFormElement parentElement, URI imageUri, int style) {
902 BrowserElement element = new BrowserElement(this, parentElement, imageUri, style);
903 adapt(element);
904 parentElement.addElement(element);
905 return element;
906 }
907
908 /**
909 * <p>
910 * createImageElement
911 * </p>
912 *
913 * @param parentElement
914 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
915 * object.
916 * @param imageUri
917 * a {@link java.net.URI} object.
918 * @param style
919 * a int.
920 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ImageElement} object.
921 */
922 public ImageElement createImageElement(ICdmFormElement parentElement, URI imageUri, int style) {
923 ImageElement element = new ImageElement(this, parentElement, imageUri, style);
924 adapt(element);
925 parentElement.addElement(element);
926 return element;
927 }
928
929 /**
930 * <p>
931 * createTextActionElement
932 * </p>
933 *
934 * @param labelString
935 * a {@link java.lang.String} object.
936 * @param initialText
937 * a {@link java.lang.String} object.
938 * @param style
939 * a int.
940 * @param parentElement
941 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
942 * object.
943 * @param buttonLabel
944 * a {@link java.lang.String} object.
945 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextActionElement}
946 * object.
947 */
948 public TextActionElement createTextActionElement(ICdmFormElement parentElement, String labelString,
949 String buttonLabel, String initialText, int style) {
950 TextActionElement element = new TextActionElement(this, parentElement, labelString, buttonLabel, initialText,
951 style);
952 adapt(element);
953 parentElement.addElement(element);
954 return element;
955 }
956
957 /**
958 * <p>
959 * createCheckbox
960 * </p>
961 *
962 * @param parentElement
963 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
964 * object.
965 * @param label
966 * a {@link java.lang.String} object.
967 * @param initialState
968 * a boolean.
969 * @param style
970 * a int.
971 * @return a {@link eu.etaxonomy.taxeditor.ui.element.CheckboxElement}
972 * object.
973 */
974 public CheckboxElement createCheckbox(ICdmFormElement parentElement, String label, Boolean initialState, int style) {
975 if(initialState==null){
976 initialState = Boolean.FALSE;
977 }
978 CheckboxElement element = new CheckboxElement(this, parentElement, label, initialState, style | orientation);
979 adapt(element);
980 parentElement.addElement(element);
981 return element;
982 }
983
984 /**
985 * Creates a section as a part of the form.
986 *
987 * @return the section widget
988 * @param section
989 * a
990 * {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
991 * object.
992 */
993 public Section adapt(AbstractFormSection section) {
994 section.setMenu(section.getLayoutComposite().getMenu());
995 adapt(section, true, true);
996
997 // handle focus and property change events for cdm use
998 section.addFocusListener(selectionFocusHandler);
999 section.setPropertyChangeListeners(propertyChangeListeners);
1000
1001 if (section.getToggle() != null) {
1002 section.getToggle().setHoverDecorationColor(getColors().getColor(IFormColors.TB_TOGGLE_HOVER));
1003 section.getToggle().setDecorationColor(getColors().getColor(IFormColors.TB_TOGGLE));
1004 }
1005
1006 section.setFont(boldFontHolder2.getBoldFont(section.getLayoutComposite().getFont()));
1007
1008 if ((section.getStyle() & ExpandableComposite.TITLE_BAR) != 0
1009 || (section.getStyle() & ExpandableComposite.SHORT_TITLE_BAR) != 0) {
1010 getColors().initializeSectionToolBarColors();
1011 section.setTitleBarBackground(getColors().getColor(IFormColors.TB_BG));
1012 section.setTitleBarBorderColor(getColors().getColor(IFormColors.TB_BORDER));
1013 }
1014 // call setTitleBarForeground regardless as it also sets the label color
1015 section.setTitleBarForeground(getColors().getColor(IFormColors.TB_TOGGLE));
1016 return section;
1017 }
1018
1019 private class BoldFontHolder2 {
1020 private Font normalFont;
1021
1022 private Font boldFont;
1023
1024 public BoldFontHolder2() {
1025 }
1026
1027 public Font getBoldFont(Font font) {
1028 createBoldFont(font);
1029 return boldFont;
1030 }
1031
1032 private void createBoldFont(Font font) {
1033 if (normalFont == null || !normalFont.equals(font)) {
1034 normalFont = font;
1035 dispose();
1036 }
1037 if (boldFont == null) {
1038 boldFont = FormFonts.getInstance().getBoldFont(getColors().getDisplay(), normalFont);
1039 }
1040 }
1041
1042 public void dispose() {
1043 if (boldFont != null) {
1044 FormFonts.getInstance().markFinished(boldFont, getColors().getDisplay());
1045 boldFont = null;
1046 }
1047 }
1048 }
1049
1050 /**
1051 * <p>
1052 * createToggleableTextField
1053 * </p>
1054 *
1055 * @param parentElement
1056 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1057 * object.
1058 * @param labelString
1059 * a {@link java.lang.String} object.
1060 * @param initialText
1061 * a {@link java.lang.String} object.
1062 * @param initialState
1063 * a boolean.
1064 * @param style
1065 * a int.
1066 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement}
1067 * object.
1068 */
1069 public ToggleableTextElement createToggleableTextField(ICdmFormElement parentElement, String labelString,
1070 String initialText, boolean initialState, int style) {
1071 ToggleableTextElement element = new ToggleableTextElement(this, parentElement, labelString, initialText,
1072 initialState, style | orientation);
1073 adapt(element);
1074 parentElement.addElement(element);
1075 return element;
1076 }
1077
1078 /**
1079 * <p>
1080 * createTimePeriodElement
1081 * </p>
1082 *
1083 * @param parentElement
1084 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1085 * object.
1086 * @param labelString
1087 * a {@link java.lang.String} object.
1088 * @param timePeriod
1089 * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1090 * @param style
1091 * a int.
1092 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TimePeriodElement}
1093 * object.
1094 */
1095 public TimePeriodElement createTimePeriodElement(ICdmFormElement parentElement, String labelString,
1096 TimePeriod timePeriod, int style) {
1097 TimePeriodElement element = new TimePeriodElement(this, parentElement, labelString, timePeriod, style);
1098 adapt(element);
1099 parentElement.addElement(element);
1100 return element;
1101 }
1102
1103 /**
1104 * <p>
1105 * createGatheringEventUnitElement
1106 * </p>
1107 *
1108 * @param parentElement
1109 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1110 * object.
1111 * @param labelString
1112 * a {@link java.lang.String} object.
1113 * @param timePeriod
1114 * a {@link eu.etaxonomy.cdm.model.common.GatheringEvent} object.
1115 * @param style
1116 * a int.
1117 * @return a {@link eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement}
1118 * object.
1119 */
1120 public GatheringEventUnitElement createGatheringEventUnitElement(
1121 ICdmFormElement parentElement,
1122 String labelString,
1123 DerivedUnitFacade gatheringEvent,
1124 MinMaxTextSection.UnitType unitType,
1125 int style) {
1126 GatheringEventUnitElement element = new GatheringEventUnitElement(this,
1127 parentElement,
1128 labelString,
1129 gatheringEvent,
1130 unitType,
1131 style);
1132 adapt(element);
1133 parentElement.addElement(element);
1134 return element;
1135 }
1136
1137 /**
1138 * <p>
1139 * createPointElement
1140 * </p>
1141 *
1142 * @param style
1143 * a int.
1144 * @param parentElement
1145 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1146 * object.
1147 * @param point
1148 * a {@link eu.etaxonomy.cdm.model.location.Point} object.
1149 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PointElement} object.
1150 */
1151 public PointElement createPointElement(ICdmFormElement parentElement, Point point, int style) {
1152 PointElement element = new PointElement(this, parentElement, point, style);
1153 adapt(element);
1154 parentElement.addElement(element);
1155 return element;
1156 }
1157
1158
1159
1160 /**
1161 * @param conversationHolder
1162 * @param parent
1163 * @param detailsViewer
1164 * @param i
1165 * @return
1166 */
1167 public EmptySection createEmptySection(CdmFormFactory formFactory, ICdmFormElement parentElement, int style) {
1168 EmptySection section = new EmptySection(formFactory, parentElement, style);
1169 parentElement.addElement(section);
1170 adapt(section);
1171 return section;
1172 }
1173
1174 /**
1175 * <p>
1176 * createDateDetailSection
1177 * </p>
1178 *
1179 * @param parentElement
1180 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1181 * object.
1182 * @param style
1183 * a int.
1184 * @return a {@link eu.etaxonomy.taxeditor.ui.element.DateDetailSection}
1185 * object.
1186 */
1187 public DateDetailSection createDateDetailSection(ICdmFormElement parentElement, int style) {
1188 DateDetailSection section = new DateDetailSection(this, parentElement, style);
1189 parentElement.addElement(section);
1190 adapt(section);
1191 return section;
1192 }
1193
1194 /**
1195 * <p>
1196 * createDateDetailSection
1197 * </p>
1198 *
1199 * @param parentElement
1200 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1201 * object.
1202 * @param style
1203 * a int.
1204 * @return a {@link eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection}
1205 * object.
1206 */
1207 public MinMaxTextSection createMinMaxTextSection(ICdmFormElement parentElement, UnitType unitType, int style) {
1208 MinMaxTextSection section = new MinMaxTextSection(this, parentElement, unitType, style);
1209 parentElement.addElement(section);
1210 adapt(section);
1211 return section;
1212 }
1213
1214 /**
1215 * <p>
1216 * createPartialElement
1217 * </p>
1218 *
1219 * @param parentElement
1220 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1221 * object.
1222 * @param labelString
1223 * a {@link java.lang.String} object.
1224 * @param partial
1225 * a {@link org.joda.time.Partial} object.
1226 * @param style
1227 * a int.
1228 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PartialElement}
1229 * object.
1230 */
1231 public PartialElement createPartialElement(ICdmFormElement parentElement, String labelString, Partial partial,
1232 int style) {
1233 PartialElement element = new PartialElement(this, parentElement, labelString, style);
1234 adapt(element);
1235 parentElement.addElement(element);
1236 return element;
1237 }
1238
1239 /**
1240 * <p>
1241 * addSelectionListener
1242 * </p>
1243 *
1244 * @param listener
1245 * a {@link org.eclipse.swt.events.SelectionListener} object.
1246 */
1247 public void addSelectionListener(SelectionListener listener) {
1248 selectionListenerList.add(listener);
1249 }
1250
1251 /**
1252 * <p>
1253 * removeSelectionListener
1254 * </p>
1255 *
1256 * @param listener
1257 * a {@link org.eclipse.swt.events.SelectionListener} object.
1258 */
1259 public void removeSelectionListener(SelectionListener listener) {
1260 if (listener == null) {
1261 MessagingUtils.error(this.getClass(),
1262 "Tried to remove a selection listener from this factories listeners but was null", null);
1263 } else {
1264 selectionListenerList.remove(listener);
1265 }
1266 }
1267
1268 /**
1269 * <p>
1270 * addPropertyChangeListener
1271 * </p>
1272 *
1273 * @param listener
1274 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1275 * object.
1276 */
1277 public void addPropertyChangeListener(IPropertyChangeListener listener) {
1278 if (propertyChangeListeners.contains(listener)) {
1279 return;
1280 }
1281 propertyChangeListeners.add(0, listener);
1282 }
1283
1284 /**
1285 * <p>
1286 * removePropertyChangeListener
1287 * </p>
1288 *
1289 * @param listener
1290 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1291 * object.
1292 */
1293 public void removePropertyChangeListener(IPropertyChangeListener listener) {
1294 propertyChangeListeners.remove(listener);
1295 }
1296
1297 /**
1298 * @return the propertyChangeListeners
1299 */
1300 public List<IPropertyChangeListener> getPropertyChangeListeners() {
1301 return propertyChangeListeners;
1302 }
1303
1304 /**
1305 * <p>
1306 * createHorizontalSeparator
1307 * </p>
1308 *
1309 * @param parentElement
1310 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1311 * object.
1312 * @param style
1313 * a int.
1314 * @return a {@link org.eclipse.swt.widgets.Label} object.
1315 */
1316 public Label createHorizontalSeparator(ICdmFormElement parentElement, int style) {
1317 Label separator = this.createSeparator(parentElement.getLayoutComposite(), SWT.HORIZONTAL | style);
1318 separator.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
1319 return separator;
1320 }
1321
1322 /**
1323 * <p>
1324 * createVersionElement
1325 * </p>
1326 *
1327 * @param parentElement
1328 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1329 * object.
1330 * @param entity
1331 * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
1332 * object.
1333 * @param style
1334 * a int.
1335 * @return a
1336 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
1337 * object.
1338 */
1339 public VersionElement createVersionElement(ICdmFormElement parentElement, VersionableEntity entity, int style) {
1340 VersionElement element = new VersionElement(this, parentElement, entity, style);
1341 adapt(element);
1342 parentElement.addElement(element);
1343 return element;
1344 }
1345
1346 /**
1347 * @param cdmBaseSection
1348 * @param object
1349 * @param style
1350 * @return
1351 */
1352 public CdmBaseElement createCdmBaseElement(ICdmFormElement parentElement, CdmBase entity, int style) {
1353 CdmBaseElement element = new CdmBaseElement(this, parentElement, entity, style);
1354 adapt(element);
1355 parentElement.addElement(element);
1356 return element;
1357 }
1358
1359 /**
1360 * <p>
1361 * createVersionSection
1362 * </p>
1363 *
1364 * @param parentElement
1365 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1366 * object.
1367 * @param style
1368 * a int.
1369 * @return a
1370 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
1371 * object.
1372 */
1373 public VersionSection createVersionSection(ICdmFormElement parentElement, int style) {
1374 VersionSection section = new VersionSection(this, parentElement, style);
1375 parentElement.addElement(section);
1376 adapt(section);
1377 return section;
1378 }
1379
1380 /**
1381 * @param parent
1382 * @param i
1383 * @return
1384 */
1385 public CdmBaseSection createCdmBaseSection(ICdmFormElement parentElement, int style) {
1386 CdmBaseSection section = new CdmBaseSection(this, parentElement, style);
1387 parentElement.addElement(section);
1388 adapt(section);
1389 return section;
1390 }
1391
1392 /**
1393 * <p>
1394 * createEmptyElement
1395 * </p>
1396 *
1397 * @param parentElement
1398 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1399 * object.
1400 * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1401 */
1402 public EmptyElement createEmptyElement(ICdmFormElement parentElement, String emptyText) {
1403 EmptyElement element = new EmptyElement(this, parentElement, emptyText, SWT.NULL);
1404 adapt(element);
1405 parentElement.addElement(element);
1406 return element;
1407 }
1408
1409 /**
1410 * <p>
1411 * createHeadlineSection
1412 * </p>
1413 *
1414 * @param parentElement
1415 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1416 * object.
1417 * @return a
1418 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
1419 * object.
1420 */
1421 public HeadlineSection createHeadlineSection(ICdmFormElement parentElement) {
1422 HeadlineSection section = new HeadlineSection(this, parentElement, SWT.NULL);
1423 parentElement.addElement(section);
1424 adapt(section);
1425 return section;
1426 }
1427
1428 /**
1429 * <p>
1430 * createParsingMessageElement
1431 * </p>
1432 *
1433 * @param parentElement
1434 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1435 * object.
1436 * @param parserProblem
1437 * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
1438 * object.
1439 * @param style
1440 * a int.
1441 * @return a
1442 * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
1443 * object.
1444 */
1445 public ParsingMessageElement createParsingMessageElement(ICdmFormElement parentElement,
1446 ParserProblem parserProblem, int style) {
1447 ParsingMessageElement element = new ParsingMessageElement(this, parentElement, parserProblem, style);
1448 adapt(element);
1449 parentElement.addElement(element);
1450 return element;
1451 }
1452
1453 public AbstractFormSection createDefinedTermDetailSection(Class definedTermClass, ConversationHolder conversation,
1454 ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
1455
1456 AbstractFormSection section = new DefinedTermDetailSection(this, definedTermClass, conversation, parentElement,
1457 selectionProvider, style);
1458
1459 parentElement.addElement(section);
1460 adapt(section);
1461 return section;
1462
1463 }
1464
1465 /**
1466 * @param definedTermClass
1467 * @param formElement
1468 * @param style
1469 * @return
1470 */
1471 public AbstractCdmDetailElement createDefinedTermDetailElement(Class definedTermClass,
1472 AbstractCdmDetailSection parentElement, int style) {
1473 AbstractCdmDetailElement element = null;
1474
1475 if (NamedArea.class.isAssignableFrom(definedTermClass)) {
1476 element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
1477 } else if (definedTermClass.equals(Feature.class)) {
1478 element = new FeatureDetailElement(this, parentElement);
1479 } else {
1480 element = new DefinedTermDetailElement(this, parentElement);
1481 }
1482
1483 adapt(element);
1484 parentElement.addElement(element);
1485 return element;
1486 }
1487
1488
1489 //--------DetailSections---------
1490 public NameDetailSection createNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1491 NameDetailSection section = new NameDetailSection(this, conversation, parentElement, selectionProvider, style);
1492 addAndAdaptSection(parentElement, section);
1493 return section;
1494 }
1495
1496 public ReferenceDetailSection createReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1497 ReferenceDetailSection section = new ReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
1498 addAndAdaptSection(parentElement, section);
1499 return section;
1500 }
1501
1502 public NomenclaturalReferenceDetailSection createNomenclaturalReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1503 NomenclaturalReferenceDetailSection section = new NomenclaturalReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
1504 addAndAdaptSection(parentElement, section);
1505 return section;
1506 }
1507
1508 public TaxonBaseDetailSection createTaxonBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1509 TaxonBaseDetailSection section = new TaxonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1510 addAndAdaptSection(parentElement, section);
1511 return section;
1512 }
1513
1514 public AuthorshipDetailSection createAuthorshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1515 AuthorshipDetailSection section = new AuthorshipDetailSection(this, conversation, parentElement, selectionProvider, style);
1516 addAndAdaptSection(parentElement, section);
1517 return section;
1518 }
1519
1520 public TeamOrPersonBaseDetailSection createTeamOrPersonBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1521 TeamOrPersonBaseDetailSection section = new TeamOrPersonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1522 addAndAdaptSection(parentElement, section);
1523 return section;
1524 }
1525
1526 public TeamDetailSection createTeamDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1527 TeamDetailSection section = new TeamDetailSection(this, conversation, parentElement, null, style);
1528 addAndAdaptSection(parentElement, section);
1529 return section;
1530 }
1531
1532 public PersonDetailSection createPersonDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1533 PersonDetailSection section = new PersonDetailSection(this, conversation, parentElement, null, style);
1534 addAndAdaptSection(parentElement, section);
1535 return section;
1536 }
1537
1538 public DescriptionDetailSection createDescriptionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1539 DescriptionDetailSection section = new DescriptionDetailSection(this, conversation, parentElement, selectionProvider, style);
1540 addAndAdaptSection(parentElement, section);
1541 return section;
1542 }
1543
1544 public DescriptionElementDetailSection createDescriptionElementDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1545 DescriptionElementDetailSection section = new DescriptionElementDetailSection(this, conversation, parentElement, selectionProvider, style);
1546 addAndAdaptSection(parentElement, section);
1547 return section;
1548 }
1549
1550 public ParsingMessagesSection createParsingMessagesSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1551 ParsingMessagesSection section = new ParsingMessagesSection(this, conversation, parentElement, selectionProvider, style);
1552 addAndAdaptSection(parentElement, section);
1553 return section;
1554 }
1555
1556 public NonViralNameDetailSection createNonViralNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1557 NonViralNameDetailSection section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, style);
1558 addAndAdaptSection(parentElement, section);
1559 return section;
1560 }
1561
1562 public MediaDetailsSection createMediaDetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1563 MediaDetailsSection section = new MediaDetailsSection(this, conversation, parentElement, selectionProvider, style);
1564 addAndAdaptSection(parentElement, section);
1565 return section;
1566 }
1567
1568 public FieldUnitDetailSection createFieldUnitDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1569 FieldUnitDetailSection section = new FieldUnitDetailSection(this, conversation, parentElement, selectionProvider, style);
1570 addAndAdaptSection(parentElement, section);
1571 return section;
1572 }
1573
1574 public GatheringEventDetailSection createGatheringEventDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1575 GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
1576 addAndAdaptSection(parentElement, section);
1577 return section;
1578 }
1579
1580 public SpecimenHierarchyDetailSection createSpecimenHierarchyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1581 SpecimenHierarchyDetailSection section = new SpecimenHierarchyDetailSection(this, conversation, parentElement, selectionProvider, style);
1582 addAndAdaptSection(parentElement, section);
1583 return section;
1584 }
1585
1586 public DerivedUnitBaseDetailSection createDerivedUnitBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1587 DerivedUnitBaseDetailSection section = new DerivedUnitBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1588 addAndAdaptSection(parentElement, section);
1589 return section;
1590 }
1591
1592 public TaxonAssociationDetailSection createTaxonAssociationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1593 TaxonAssociationDetailSection section = new TaxonAssociationDetailSection(this, conversation, parentElement, selectionProvider, style);
1594 addAndAdaptSection(parentElement, section);
1595 return section;
1596 }
1597
1598 public OriginalLabelDataSection createOriginalLabelDataSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1599 OriginalLabelDataSection section = new OriginalLabelDataSection(this, conversation, parentElement, selectionProvider, style);
1600 addAndAdaptSection(parentElement, section);
1601 return section;
1602 }
1603
1604 public NaturalLanguageSection createNaturalLanguageSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1605 NaturalLanguageSection section = new NaturalLanguageSection(this, conversation, parentElement, selectionProvider, style);
1606 addAndAdaptSection(parentElement, section);
1607 return section;
1608 }
1609
1610 public FeatureDistributionDetailSection createFeatureDistributionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1611 FeatureDistributionDetailSection section = new FeatureDistributionDetailSection(this, conversation, parentElement, selectionProvider, style);
1612 addAndAdaptSection(parentElement, section);
1613 return section;
1614 }
1615
1616 public ClassificationDetailSection createClassificationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1617 ClassificationDetailSection section = new ClassificationDetailSection(this, conversation, parentElement, selectionProvider, style);
1618 addAndAdaptSection(parentElement, section);
1619 return section;
1620 }
1621
1622 public TaxonNodeDetailSection createTaxonNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1623 TaxonNodeDetailSection section = new TaxonNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
1624 addAndAdaptSection(parentElement, section);
1625 return section;
1626 }
1627
1628 public PolytomousKeyDetailSection createPolytomousKeyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1629 PolytomousKeyDetailSection section = new PolytomousKeyDetailSection(this, conversation, parentElement, selectionProvider, style);
1630 addAndAdaptSection(parentElement, section);
1631 return section;
1632 }
1633
1634 public PolytomousKeyNodeDetailSection createPolytomousKeyNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1635 PolytomousKeyNodeDetailSection section = new PolytomousKeyNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
1636 addAndAdaptSection(parentElement, section);
1637 return section;
1638 }
1639
1640 public InstitutionDetailSection createInstitutionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1641 InstitutionDetailSection section = new InstitutionDetailSection(this, conversation, parentElement, selectionProvider, style);
1642 addAndAdaptSection(parentElement, section);
1643 return section;
1644 }
1645
1646 public FieldUnitGeneralDetailSection createFieldUnitGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1647 FieldUnitGeneralDetailSection section = new FieldUnitGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1648 addAndAdaptSection(parentElement, section);
1649 return section;
1650 }
1651
1652 public DerivedUnitGeneralDetailSection createDerivedUnitGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1653 DerivedUnitGeneralDetailSection section = new DerivedUnitGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1654 addAndAdaptSection(parentElement, section);
1655 return section;
1656 }
1657
1658 public PreservedSpecimenGeneralDetailSection createPreservedSpecimenGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1659 PreservedSpecimenGeneralDetailSection section = new PreservedSpecimenGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1660 addAndAdaptSection(parentElement, section);
1661 return section;
1662 }
1663
1664 public TissueSampleGeneralDetailSection createTissueSampleGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1665 TissueSampleGeneralDetailSection section = new TissueSampleGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1666 addAndAdaptSection(parentElement, section);
1667 return section;
1668 }
1669
1670 public DnaSampleGeneralDetailSection createDnaSampleGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1671 DnaSampleGeneralDetailSection section = new DnaSampleGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1672 addAndAdaptSection(parentElement, section);
1673 return section;
1674 }
1675
1676 public DnaSamplePreparationPreservationSection createDnaSamplePreparationPreservationSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1677 DnaSamplePreparationPreservationSection section = new DnaSamplePreparationPreservationSection(this, conversation, parentElement, selectionProvider, style);
1678 addAndAdaptSection(parentElement, section);
1679 return section;
1680 }
1681
1682 public DnaQualityDetailSection createDnaQualityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1683 DnaQualityDetailSection section = new DnaQualityDetailSection(this, conversation, parentElement, selectionProvider, style);
1684 addAndAdaptSection(parentElement, section);
1685 return section;
1686 }
1687
1688 public SequenceGeneralDetailSection createSequenceGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1689 SequenceGeneralDetailSection section = new SequenceGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1690 addAndAdaptSection(parentElement, section);
1691 return section;
1692 }
1693
1694 public SequenceContigFileCollectionDetailSection createSequenceContigFileCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1695 SequenceContigFileCollectionDetailSection section = new SequenceContigFileCollectionDetailSection(this, conversation, parentElement, style);
1696 addAndAdaptSection(parentElement, section);
1697 return section;
1698 }
1699
1700 public SingleReadPherogramCollectionDetailSection createSingleReadPherogramCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1701 SingleReadPherogramCollectionDetailSection section = new SingleReadPherogramCollectionDetailSection(this, conversation, parentElement, style);
1702 addAndAdaptSection(parentElement, section);
1703 return section;
1704 }
1705
1706 public SequenceReferenceCollectionDetailSection createSequenceReferenceCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1707 SequenceReferenceCollectionDetailSection section = new SequenceReferenceCollectionDetailSection(this, conversation, parentElement, style);
1708 addAndAdaptSection(parentElement, section);
1709 return section;
1710 }
1711
1712 public SingleReadGeneralDetailSection createSingleReadGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1713 SingleReadGeneralDetailSection section = new SingleReadGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1714 addAndAdaptSection(parentElement, section);
1715 return section;
1716 }
1717
1718 public AmplificationGeneralDetailSection createAmplificationGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1719 AmplificationGeneralDetailSection section = new AmplificationGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1720 addAndAdaptSection(parentElement, section);
1721 return section;
1722 }
1723
1724 public AmplificationPrimerDetailSection createAmplificationPrimerDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1725 AmplificationPrimerDetailSection section = new AmplificationPrimerDetailSection(this, conversation, parentElement, selectionProvider, style);
1726 addAndAdaptSection(parentElement, section);
1727 return section;
1728 }
1729
1730 public AmplificationCloningDetailSection createAmplificationCloningDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1731 AmplificationCloningDetailSection section = new AmplificationCloningDetailSection(this, conversation, parentElement, selectionProvider, style);
1732 addAndAdaptSection(parentElement, section);
1733 return section;
1734 }
1735
1736 public AmplificationGelPhotoCollectionDetailSection createAmplificationGelPhotoCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1737 AmplificationGelPhotoCollectionDetailSection section = new AmplificationGelPhotoCollectionDetailSection(this, conversation, parentElement, style);
1738 addAndAdaptSection(parentElement, section);
1739 return section;
1740 }
1741
1742 public MediaSpecimenGeneralDetailSection createMediaSpecimenGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1743 MediaSpecimenGeneralDetailSection section = new MediaSpecimenGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1744 addAndAdaptSection(parentElement, section);
1745 return section;
1746 }
1747
1748 public HybridDetailSection createHybridDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1749 HybridDetailSection section = new HybridDetailSection(this, conversation, parentElement, selectionProvider, style);
1750 addAndAdaptSection(parentElement, section);
1751 return section;
1752 }
1753
1754 public UserDetailSection createUserDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1755 UserDetailSection section = new UserDetailSection(this, conversation, parentElement, selectionProvider, style);
1756 addAndAdaptSection(parentElement, section);
1757 return section;
1758 }
1759
1760 public GroupDetailSection createGroupDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1761 GroupDetailSection section = new GroupDetailSection(this, conversation, parentElement, selectionProvider, style);
1762 addAndAdaptSection(parentElement, section);
1763 return section;
1764 }
1765
1766 public DeterminationDetailSection createDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1767 DeterminationDetailSection section = new DeterminationDetailSection(this, conversation, parentElement, selectionProvider, style);
1768 addAndAdaptSection(parentElement, section);
1769 return section;
1770 }
1771
1772 public SampleDesignationDetailSection createSampleDesignationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1773 SampleDesignationDetailSection section = new SampleDesignationDetailSection(this, conversation, parentElement, selectionProvider, style);
1774 addAndAdaptSection(parentElement, section);
1775 return section;
1776 }
1777
1778 public PreservedSpecimenDeterminationDetailSection createPreservedSpecimenDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1779 PreservedSpecimenDeterminationDetailSection section = new PreservedSpecimenDeterminationDetailSection(this, conversation, parentElement, selectionProvider, style);
1780 addAndAdaptSection(parentElement, section);
1781 return section;
1782 }
1783
1784 public TaxonRelationshipDetailSection createTaxonRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1785 TaxonRelationshipDetailSection section = new TaxonRelationshipDetailSection(this, conversation, parentElement, selectionProvider, style);
1786 addAndAdaptSection(parentElement, section);
1787 return section;
1788 }
1789
1790 public ReferencedEntityDetailSection createReferencedEntityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1791 ReferencedEntityDetailSection section = new ReferencedEntityDetailSection(this, conversation, parentElement, selectionProvider, style);
1792 addAndAdaptSection(parentElement, section);
1793 return section;
1794 }
1795
1796 public TermVocabularyDetailSection createTermVocabularyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1797 TermVocabularyDetailSection section = new TermVocabularyDetailSection(this, conversation, parentElement, selectionProvider, style);
1798 addAndAdaptSection(parentElement, section);
1799 return section;
1800 }
1801
1802 public GatheringEventDetailSection createGatheringSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1803 GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
1804 addAndAdaptSection(parentElement, section);
1805 return section;
1806 }
1807
1808 public NamedAreaDetailSection createNamedAreaDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1809 NamedAreaDetailSection section = new NamedAreaDetailSection(this, conversation, parentElement, selectionProvider, style);
1810 addAndAdaptSection(parentElement, section);
1811 return section;
1812 }
1813
1814 public UseRecordDetailSection createUseRecordDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1815 UseRecordDetailSection section = new UseRecordDetailSection(this, conversation, parentElement, selectionProvider, style);
1816 addAndAdaptSection(parentElement, section);
1817 return section;
1818 }
1819
1820 private void addAndAdaptSection(ICdmFormElement parentElement, AbstractFormSection<?> section) {
1821 parentElement.addElement(section);
1822 adapt(section);
1823 }
1824
1825 //--------DetailElements------------
1826
1827 public UseRecordDetailElement createUseRecordDetailElement(ICdmFormElement parentElement){
1828 UseRecordDetailElement element = new UseRecordDetailElement(this, parentElement);
1829 addAndAdaptElement(parentElement, element);
1830 return element;
1831 }
1832
1833 public DefinedTermDetailElement<NamedAreaLevel> createNamedAreaLevelElement(ICdmFormElement parentElement){
1834 DefinedTermDetailElement<NamedAreaLevel> element = new DefinedTermDetailElement<NamedAreaLevel>(this, parentElement);
1835 addAndAdaptElement(parentElement, element);
1836 return element;
1837 }
1838
1839 public eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement createNamedAreaDetailElement(ICdmFormElement parentElement){
1840 eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
1841 addAndAdaptElement(parentElement, element);
1842 return element;
1843 }
1844
1845 public TermVocabularyDetailElement createTermVocabularyDetailElement(ICdmFormElement parentElement){
1846 TermVocabularyDetailElement element = new TermVocabularyDetailElement(this, parentElement);
1847 addAndAdaptElement(parentElement, element);
1848 return element;
1849 }
1850
1851 public ReferenceEntityDetailElement createReferenceEntityDetailElement(ICdmFormElement parentElement){
1852 ReferenceEntityDetailElement element = new ReferenceEntityDetailElement(this, parentElement);
1853 addAndAdaptElement(parentElement, element);
1854 return element;
1855 }
1856
1857 public TaxonRelationshipDetailElement createTaxonRelationshipDetailElement(ICdmFormElement parentElement){
1858 TaxonRelationshipDetailElement element = new TaxonRelationshipDetailElement(this, parentElement);
1859 addAndAdaptElement(parentElement, element);
1860 return element;
1861 }
1862
1863 public GrantedAuthorityDetailElement createGrantedAuthorityDetailElement(ICdmFormElement parentElement){
1864 GrantedAuthorityDetailElement element = new GrantedAuthorityDetailElement(this, parentElement);
1865 addAndAdaptElement(parentElement, element);
1866 return element;
1867 }
1868
1869 public GroupDetailElement createGroupDetailElement(ICdmFormElement parentElement){
1870 GroupDetailElement element = new GroupDetailElement(this, parentElement);
1871 addAndAdaptElement(parentElement, element);
1872 return element;
1873 }
1874
1875 public UserDetailElement createUserDetailElement(ICdmFormElement parentElement){
1876 UserDetailElement element = new UserDetailElement(this, parentElement);
1877 addAndAdaptElement(parentElement, element);
1878 return element;
1879 }
1880
1881 public HybridDetailElement createHybridDetailElement(ICdmFormElement parentElement){
1882 HybridDetailElement element = new HybridDetailElement(this, parentElement);
1883 addAndAdaptElement(parentElement, element);
1884 return element;
1885 }
1886
1887 public InstitutionDetailElement createInstitutionDetailElement(ICdmFormElement parentElement){
1888 InstitutionDetailElement element = new InstitutionDetailElement(this, parentElement);
1889 addAndAdaptElement(parentElement, element);
1890 return element;
1891 }
1892
1893 public PolytomousKeyNodeDetailElement createPolytomousKeyNodeDetailElement(ICdmFormElement parentElement){
1894 PolytomousKeyNodeDetailElement element = new PolytomousKeyNodeDetailElement(this, parentElement);
1895 addAndAdaptElement(parentElement, element);
1896 return element;
1897 }
1898
1899 public PolytomousKeyDetailElement createPolytomousKeyDetailElement(ICdmFormElement parentElement){
1900 PolytomousKeyDetailElement element = new PolytomousKeyDetailElement(this, parentElement);
1901 addAndAdaptElement(parentElement, element);
1902 return element;
1903 }
1904
1905 public CollectionDetailElement createCollectionDetailElement(ICdmFormElement parentElement){
1906 CollectionDetailElement element = new CollectionDetailElement(this, parentElement);
1907 addAndAdaptElement(parentElement, element);
1908 return element;
1909 }
1910
1911 public TaxonNodeDetailElement createTaxonNodeDetailElement(ICdmFormElement parentElement){
1912 TaxonNodeDetailElement element = new TaxonNodeDetailElement(this, parentElement);
1913 addAndAdaptElement(parentElement, element);
1914 return element;
1915 }
1916
1917 public ClassificationDetailElement createClassificationDetailElement(ICdmFormElement parentElement){
1918 ClassificationDetailElement element = new ClassificationDetailElement(this, parentElement);
1919 addAndAdaptElement(parentElement, element);
1920 return element;
1921 }
1922
1923 public FeatureDistributionDetailElement createFeatureDistributionDetailElement(ICdmFormElement parentElement){
1924 FeatureDistributionDetailElement element = new FeatureDistributionDetailElement(this, parentElement);
1925 addAndAdaptElement(parentElement, element);
1926 return element;
1927 }
1928
1929 public NaturalLanguageDetailElement createNaturalLanguageDetailElement(ICdmFormElement parentElement){
1930 NaturalLanguageDetailElement element = new NaturalLanguageDetailElement(this, parentElement);
1931 addAndAdaptElement(parentElement, element);
1932 return element;
1933 }
1934
1935 public NonViralNameDetailElement createNonViralNameDetailElement(ICdmFormElement parentElement){
1936 NonViralNameDetailElement element = new NonViralNameDetailElement(this, parentElement);
1937 addAndAdaptElement(parentElement, element);
1938 return element;
1939 }
1940
1941 public DescriptionElementDetailElement createDescriptionElementDetailElement(ICdmFormElement parentElement, int style){
1942 DescriptionElementDetailElement element = new DescriptionElementDetailElement(this, parentElement, style);
1943 addAndAdaptElement(parentElement, element);
1944 return element;
1945 }
1946
1947 public DescriptionDetailElement createDescriptionDetailElement(ICdmFormElement parentElement, int style){
1948 DescriptionDetailElement element = new DescriptionDetailElement(this, parentElement, style);
1949 addAndAdaptElement(parentElement, element);
1950 return element;
1951 }
1952
1953 public PersonDetailElement createPersonDetailElement(ICdmFormElement parentElement, int style){
1954 PersonDetailElement element = new PersonDetailElement(this, parentElement, style);
1955 addAndAdaptElement(parentElement, element);
1956 return element;
1957 }
1958
1959 public TeamDetailElement createTeamDetailElement(ICdmFormElement parentElement, int style){
1960 TeamDetailElement element = new TeamDetailElement(this, parentElement, style);
1961 addAndAdaptElement(parentElement, element);
1962 return element;
1963 }
1964
1965 public AuthorshipDetailElement createAuthorshipDetailElement(ICdmFormElement parentElement, int style){
1966 AuthorshipDetailElement element = new AuthorshipDetailElement(this, parentElement, style);
1967 addAndAdaptElement(parentElement, element);
1968 return element;
1969 }
1970
1971 public TaxonBaseDetailElement createTaxonBaseDetailElement(ICdmFormElement parentElement, int style){
1972 TaxonBaseDetailElement element = new TaxonBaseDetailElement(this, parentElement, style);
1973 addAndAdaptElement(parentElement, element);
1974 return element;
1975 }
1976
1977 public NameDetailElement createNameDetailElement(ICdmFormElement parentElement, int style){
1978 NameDetailElement element = new NameDetailElement(this, parentElement, style);
1979 addAndAdaptElement(parentElement, element);
1980 return element;
1981 }
1982
1983 public ReferenceDetailElement createReferenceDetailElement(ICdmFormElement parentElement, int style){
1984 ReferenceDetailElement element = new ReferenceDetailElement(this, parentElement, style);
1985 addAndAdaptElement(parentElement, element);
1986 return element;
1987 }
1988
1989 public NomenclaturalReferenceDetailElement createNomenclaturalReferenceDetailElement(ICdmFormElement parentElement, int style){
1990 NomenclaturalReferenceDetailElement element = new NomenclaturalReferenceDetailElement(this, parentElement, style);
1991 addAndAdaptElement(parentElement, element);
1992 return element;
1993 }
1994
1995
1996 public FieldUnitGeneralDetailElement createFieldUnitGeneralDetailElement(ICdmFormElement parentElement){
1997 FieldUnitGeneralDetailElement element = new FieldUnitGeneralDetailElement(this, parentElement);
1998 addAndAdaptElement(parentElement, element);
1999 return element;
2000 }
2001
2002 public DerivedUnitGeneralDetailElement createDerivedUnitGeneralDetailElement(ICdmFormElement parentElement){
2003 DerivedUnitGeneralDetailElement element = new DerivedUnitGeneralDetailElement(this, parentElement);
2004 addAndAdaptElement(parentElement, element);
2005 return element;
2006 }
2007
2008 public TaxonAssociationDetailElement createTaxonAssociationDetailElement(ICdmFormElement parentElement){
2009 TaxonAssociationDetailElement element = new TaxonAssociationDetailElement(this, parentElement);
2010 addAndAdaptElement(parentElement, element);
2011 return element;
2012 }
2013
2014 public PreservedSpecimenGeneralDetailElement createPreservedSpecimenGeneralDetailElement(ICdmFormElement parentElement){
2015 PreservedSpecimenGeneralDetailElement element = new PreservedSpecimenGeneralDetailElement(this, parentElement);
2016 addAndAdaptElement(parentElement, element);
2017 return element;
2018 }
2019
2020 public TissueSampleGeneralDetailElement createTissueSampleGeneralDetailElement(ICdmFormElement parentElement){
2021 TissueSampleGeneralDetailElement element = new TissueSampleGeneralDetailElement(this, parentElement);
2022 addAndAdaptElement(parentElement, element);
2023 return element;
2024 }
2025
2026 public DnaSampleGeneralDetailElement createDnaSampleGeneralDetailElement(ICdmFormElement parentElement){
2027 DnaSampleGeneralDetailElement element = new DnaSampleGeneralDetailElement(this, parentElement);
2028 addAndAdaptElement(parentElement, element);
2029 return element;
2030 }
2031
2032 public DnaSamplePreparationPreservationDetailElement createDnaSamplePreparationPreservationDetailElement(ICdmFormElement parentElement){
2033 DnaSamplePreparationPreservationDetailElement element = new DnaSamplePreparationPreservationDetailElement(this, parentElement);
2034 addAndAdaptElement(parentElement, element);
2035 return element;
2036 }
2037
2038 public DnaQualityDetailElement createDnaQualityDetailElement(ICdmFormElement parentElement){
2039 DnaQualityDetailElement element = new DnaQualityDetailElement(this, parentElement);
2040 addAndAdaptElement(parentElement, element);
2041 return element;
2042 }
2043
2044 public SequenceGeneralDetailElement createSequenceGeneralDetailElement(ICdmFormElement parentElement){
2045 SequenceGeneralDetailElement element = new SequenceGeneralDetailElement(this, parentElement);
2046 addAndAdaptElement(parentElement, element);
2047 return element;
2048 }
2049
2050 public SingleReadGeneralDetailElement createSingleReadGeneralDetailElement(ICdmFormElement parentElement){
2051 SingleReadGeneralDetailElement element = new SingleReadGeneralDetailElement(this, parentElement);
2052 addAndAdaptElement(parentElement, element);
2053 return element;
2054 }
2055
2056 public PrimerGeneralDetailElement createPrimerGeneralDetailElement(ICdmFormElement parentElement){
2057 PrimerGeneralDetailElement element = new PrimerGeneralDetailElement(this, parentElement);
2058 addAndAdaptElement(parentElement, element);
2059 return element;
2060 }
2061
2062 public AmplificationGeneralDetailElement createAmplificationGeneralDetailElement(ICdmFormElement parentElement){
2063 AmplificationGeneralDetailElement element = new AmplificationGeneralDetailElement(this, parentElement);
2064 addAndAdaptElement(parentElement, element);
2065 return element;
2066 }
2067
2068 public AmplificationPrimerDetailElement createAmplificationPrimerDetailElement(ICdmFormElement parentElement){
2069 AmplificationPrimerDetailElement element = new AmplificationPrimerDetailElement(this, parentElement);
2070 addAndAdaptElement(parentElement, element);
2071 return element;
2072 }
2073
2074 public AmplificationCloningDetailElement createAmplificationCloningDetailElement(ICdmFormElement parentElement){
2075 AmplificationCloningDetailElement element = new AmplificationCloningDetailElement(this, parentElement);
2076 addAndAdaptElement(parentElement, element);
2077 return element;
2078 }
2079
2080 public AmplificationGelPhotoDetailElement createAmplificationGelPhotoDetailElement(ICdmFormElement parentElement){
2081 AmplificationGelPhotoDetailElement element = new AmplificationGelPhotoDetailElement(this, parentElement);
2082 addAndAdaptElement(parentElement, element);
2083 return element;
2084 }
2085
2086 public MediaSpecimenGeneralDetailElement createMediaSpecimenGeneralDetailElement(ICdmFormElement parentElement){
2087 MediaSpecimenGeneralDetailElement element = new MediaSpecimenGeneralDetailElement(this, parentElement);
2088 addAndAdaptElement(parentElement, element);
2089 return element;
2090 }
2091
2092 public MediaDetailElement createMediaDetailElement(ICdmFormElement parentElement){
2093 MediaDetailElement mediaDetailElement = new MediaDetailElement(this, parentElement);
2094 addAndAdaptElement(parentElement, mediaDetailElement);
2095 return mediaDetailElement;
2096 }
2097
2098 public GatheringEventDetailElement createGatheringEventDetailElement(ICdmFormElement parentElement) {
2099 GatheringEventDetailElement element = new GatheringEventDetailElement(this, parentElement);
2100 addAndAdaptElement(parentElement, element);
2101 return element;
2102 }
2103
2104 public FieldUnitDetailElement createFieldUnitDetailElement(ICdmFormElement parentElement) {
2105 FieldUnitDetailElement element = new FieldUnitDetailElement(this, parentElement);
2106 addAndAdaptElement(parentElement, element);
2107 return element;
2108 }
2109
2110 public SpecimenHierarchyDetailElement createSpecimenHierarchyDetailElement(ICdmFormElement parentElement) {
2111 SpecimenHierarchyDetailElement element = new SpecimenHierarchyDetailElement(this, parentElement);
2112 addAndAdaptElement(parentElement, element);
2113 return element;
2114 }
2115
2116 public DerivedUnitBaseDetailElement createDerivedUnitBaseDetailElement(ICdmFormElement parentElement) {
2117 DerivedUnitBaseDetailElement element = new DerivedUnitBaseDetailElement(this, parentElement);
2118 addAndAdaptElement(parentElement, element);
2119 return element;
2120 }
2121
2122 public OriginalLabelDataElement createOriginalLabelDataElement(ICdmFormElement parentElement) {
2123 OriginalLabelDataElement element = new OriginalLabelDataElement(this, parentElement);
2124 addAndAdaptElement(parentElement, element);
2125 return element;
2126 }
2127
2128 public PreservedSpecimenDetailElement createPreservedSpecimenDetailElement(ICdmFormElement parentElement) {
2129 PreservedSpecimenDetailElement element = new PreservedSpecimenDetailElement(this, parentElement);
2130 addAndAdaptElement(parentElement, element);
2131 return element;
2132 }
2133
2134 public PreservedSpecimenDeterminationDetailElement createPreservedSpecimenDeterminationDetailElement(ICdmFormElement parentElement) {
2135 PreservedSpecimenDeterminationDetailElement element = new PreservedSpecimenDeterminationDetailElement(this, parentElement);
2136 addAndAdaptElement(parentElement, element);
2137 return element;
2138 }
2139
2140 public DeterminationDetailElement createDeterminationDetailElement(ICdmFormElement parentElement) {
2141 DeterminationDetailElement element = new DeterminationDetailElement(this, parentElement);
2142 addAndAdaptElement(parentElement, element);
2143 return element;
2144 }
2145
2146 public SampleDesignationDetailElement createSampleDesignationDetailElement(ICdmFormElement parentElement) {
2147 SampleDesignationDetailElement element = new SampleDesignationDetailElement(this, parentElement);
2148 addAndAdaptElement(parentElement, element);
2149 return element;
2150 }
2151
2152 /**
2153 * @param parentElement
2154 * @param element
2155 */
2156 private void addAndAdaptElement(ICdmFormElement parentElement, AbstractCdmDetailElement<?> element) {
2157 adapt(element);
2158 parentElement.addElement(element);
2159 }
2160
2161 //--------EntityCollectionSection----------
2162 public TeamMemberSection createTeamMemberSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2163 TeamMemberSection section = new TeamMemberSection(this, conversation, parentElement, style);
2164 addAndAdaptSection(parentElement, section);
2165 return section;
2166 }
2167
2168 public AnnotationSection createAnnotationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2169 AnnotationSection section = new AnnotationSection(this, conversation, parentElement, style);
2170 addAndAdaptSection(parentElement, section);
2171 return section;
2172 }
2173
2174 public CreditSection createCreditSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2175 CreditSection section = new CreditSection(this, conversation, parentElement, style);
2176 addAndAdaptSection(parentElement, section);
2177 return section;
2178 }
2179
2180 public DescriptionElementSourceSection createDescriptionElementSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2181 DescriptionElementSourceSection section = new DescriptionElementSourceSection(this, conversation, parentElement, style);
2182 addAndAdaptSection(parentElement, section);
2183 return section;
2184 }
2185
2186 public ExtensionSection createExtensionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2187 ExtensionSection section = new ExtensionSection(this, conversation, parentElement, style);
2188 addAndAdaptSection(parentElement, section);
2189 return section;
2190 }
2191
2192 public MarkerSection createMarkerSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2193 MarkerSection section = new MarkerSection(this, conversation, parentElement, style);
2194 addAndAdaptSection(parentElement, section);
2195 return section;
2196 }
2197
2198 public MediaSection createMediaSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2199 MediaSection section = new MediaSection(this, conversation, parentElement, style);
2200 addAndAdaptSection(parentElement, section);
2201 return section;
2202 }
2203
2204 public DescriptionElementMediaSection createDescriptionElementMediaSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2205 DescriptionElementMediaSection section = new DescriptionElementMediaSection(this, conversation, parentElement, style);
2206 addAndAdaptSection(parentElement, section);
2207 return section;
2208 }
2209
2210 public MediaRepresentationSection createMediaRepresentationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2211 MediaRepresentationSection section = new MediaRepresentationSection(this, conversation, parentElement, style);
2212 addAndAdaptSection(parentElement, section);
2213 return section;
2214 }
2215
2216 public MediaRepresentationPartSection createMediaRepresentationPartSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2217 MediaRepresentationPartSection section = new MediaRepresentationPartSection(this, conversation, parentElement, style);
2218 addAndAdaptSection(parentElement, section);
2219 return section;
2220 }
2221
2222 public ModifierSection createModifierSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2223 ModifierSection section = new ModifierSection(this, conversation, parentElement, style);
2224 addAndAdaptSection(parentElement, section);
2225 return section;
2226 }
2227
2228 public NomenclaturalStatusSection createNomenclaturalStatusSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2229 NomenclaturalStatusSection section = new NomenclaturalStatusSection(this, conversation, parentElement, style);
2230 addAndAdaptSection(parentElement, section);
2231 return section;
2232 }
2233
2234 public NameRelationshipDetailSection createNameRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2235 NameRelationshipDetailSection section = new NameRelationshipDetailSection(this, conversation, parentElement, style);
2236 addAndAdaptSection(parentElement, section);
2237 return section;
2238 }
2239
2240 public SynonymRelationshipDetailSection createSynonymRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2241 SynonymRelationshipDetailSection section = new SynonymRelationshipDetailSection(this, conversation, parentElement, style);
2242 addAndAdaptSection(parentElement, section);
2243 return section;
2244 }
2245
2246 public ProtologueSection createProtologueSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2247 ProtologueSection section = new ProtologueSection(this, conversation, parentElement, style);
2248 addAndAdaptSection(parentElement, section);
2249 return section;
2250 }
2251
2252 public RightsSection createRightsSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2253 RightsSection section = new RightsSection(this, conversation, parentElement, style);
2254 addAndAdaptSection(parentElement, section);
2255 return section;
2256 }
2257
2258 public SourceSection createSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2259 SourceSection section = new SourceSection(this, conversation, parentElement, style);
2260 addAndAdaptSection(parentElement, section);
2261 return section;
2262 }
2263
2264 public ScopeSection createScopeSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2265 ScopeSection section = new ScopeSection(this, conversation, parentElement, style);
2266 addAndAdaptSection(parentElement, section);
2267 return section;
2268 }
2269
2270 public DescriptionSourceSection createDescriptionSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2271 DescriptionSourceSection section = new DescriptionSourceSection(this, conversation, parentElement, style);
2272 addAndAdaptSection(parentElement, section);
2273 return section;
2274 }
2275
2276 public TypeDesignationSection createTypeDesignationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2277 TypeDesignationSection section = new TypeDesignationSection(this, conversation, parentElement, style);
2278 addAndAdaptSection(parentElement, section);
2279 return section;
2280 }
2281
2282 public StateDataSection createStateDataSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2283 StateDataSection section = new StateDataSection(this, conversation, parentElement, style);
2284 addAndAdaptSection(parentElement, section);
2285 return section;
2286 }
2287
2288 public StatisticalMeasurementValueSection createStatisticalMeasurementValueSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2289 StatisticalMeasurementValueSection section = new StatisticalMeasurementValueSection(this, conversation, parentElement, style);
2290 addAndAdaptSection(parentElement, section);
2291 return section;
2292 }
2293
2294 public DescribedSpecimenSection createDescribedSpecimenSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2295 DescribedSpecimenSection section = new DescribedSpecimenSection(this, conversation, parentElement, style);
2296 addAndAdaptSection(parentElement, section);
2297 return section;
2298 }
2299
2300 public StateVocabularyCollectionSection createStateVocabulariesSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2301 StateVocabularyCollectionSection section = new StateVocabularyCollectionSection(this, conversation, parentElement, style);
2302 addAndAdaptSection(parentElement, section);
2303 return section;
2304 }
2305
2306 public RecommendedModifierVocabulariesCollectionSection createRecommendedModifierVocabulariesCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2307 RecommendedModifierVocabulariesCollectionSection section = new RecommendedModifierVocabulariesCollectionSection(this, conversation, parentElement, style);
2308 addAndAdaptSection(parentElement, section);
2309 return section;
2310 }
2311
2312 public MeasurementUnitCollectionSection createMeasurementUnitCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2313 MeasurementUnitCollectionSection section = new MeasurementUnitCollectionSection(this, conversation, parentElement, style);
2314 addAndAdaptSection(parentElement, section);
2315 return section;
2316 }
2317
2318 public StatisticalMeasureCollectionSection createStatisticalMeasureCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2319 StatisticalMeasureCollectionSection section = new StatisticalMeasureCollectionSection(this, conversation, parentElement, style);
2320 addAndAdaptSection(parentElement, section);
2321 return section;
2322 }
2323
2324 public CollectingAreasDetailSection createCollectingAreasDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2325 CollectingAreasDetailSection section = new CollectingAreasDetailSection(this, conversation, parentElement, style);
2326 addAndAdaptSection(parentElement, section);
2327 return section;
2328 }
2329
2330 public GeoScopeDetailSection createGeoScopeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2331 GeoScopeDetailSection section = new GeoScopeDetailSection(this, conversation, parentElement, style);
2332 addAndAdaptSection(parentElement, section);
2333 return section;
2334 }
2335
2336 public GeoScopePolyKeyDetailSection createGeoScopePolyKeyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2337 GeoScopePolyKeyDetailSection section = new GeoScopePolyKeyDetailSection(this, conversation, parentElement, style);
2338 addAndAdaptSection(parentElement, section);
2339 return section;
2340 }
2341
2342 public IdentifierDetailSection createIdentifierDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2343 IdentifierDetailSection section = new IdentifierDetailSection(this, conversation, parentElement, style);
2344 addAndAdaptSection(parentElement, section);
2345 return section;
2346 }
2347
2348 public CurrentSampleDesignationDetailSection createCurrentSampleDesignationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2349 CurrentSampleDesignationDetailSection section = new CurrentSampleDesignationDetailSection(this, conversation, parentElement, style);
2350 addAndAdaptSection(parentElement, section);
2351 return section;
2352 }
2353
2354 public CurrentDeterminationDetailSection createCurrentDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2355 CurrentDeterminationDetailSection section = new CurrentDeterminationDetailSection(this, conversation, parentElement, style);
2356 addAndAdaptSection(parentElement, section);
2357 return section;
2358 }
2359
2360 public PreservedSpecimenCurrentDeterminationDetailSection createPreservedSpecimenCurrentDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2361 PreservedSpecimenCurrentDeterminationDetailSection section = new PreservedSpecimenCurrentDeterminationDetailSection(this, conversation, parentElement, style);
2362 addAndAdaptSection(parentElement, section);
2363 return section;
2364 }
2365
2366 public SampleDesignationHistoryDetailSection createSampleDesignationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2367 SampleDesignationHistoryDetailSection section = new SampleDesignationHistoryDetailSection(this, conversation, parentElement, style);
2368 addAndAdaptSection(parentElement, section);
2369 return section;
2370 }
2371
2372 public DeterminationHistoryDetailSection createDeterminationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2373 DeterminationHistoryDetailSection section = new DeterminationHistoryDetailSection(this, conversation, parentElement, style);
2374 addAndAdaptSection(parentElement, section);
2375 return section;
2376 }
2377
2378 public PreservedSpecimenDeterminationHistoryDetailSection createPreservedSpecimenDeterminationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2379 PreservedSpecimenDeterminationHistoryDetailSection section = new PreservedSpecimenDeterminationHistoryDetailSection(this, conversation, parentElement, style);
2380 addAndAdaptSection(parentElement, section);
2381 return section;
2382 }
2383
2384 public SpecimenCollectionDetailSection createSpecimenCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2385 SpecimenCollectionDetailSection section = new SpecimenCollectionDetailSection(this, conversation, parentElement, style);
2386 addAndAdaptSection(parentElement, section);
2387 return section;
2388 }
2389
2390 public PreservedSpecimenSourceCollectionDetailSection createPreservedSpecimenSourceCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2391 PreservedSpecimenSourceCollectionDetailSection section = new PreservedSpecimenSourceCollectionDetailSection(this, conversation, parentElement, style);
2392 addAndAdaptSection(parentElement, section);
2393 return section;
2394 }
2395
2396 public SourceCollectionDetailSection createSourceCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2397 SourceCollectionDetailSection section = new SourceCollectionDetailSection(this, conversation, parentElement, style);
2398 addAndAdaptSection(parentElement, section);
2399 return section;
2400 }
2401
2402 public ScopeRestrictionSection createScopeRestrictionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2403 ScopeRestrictionSection section = new ScopeRestrictionSection(this, conversation, parentElement, style);
2404 addAndAdaptSection(parentElement, section);
2405 return section;
2406 }
2407
2408 public MemberDetailSection createMemberDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2409 MemberDetailSection section = new MemberDetailSection(this, conversation, parentElement, style);
2410 addAndAdaptSection(parentElement, section);
2411 return section;
2412 }
2413
2414 public GrantedAuthorityDetailSection createGrantedAuthorityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2415 GrantedAuthorityDetailSection section = new GrantedAuthorityDetailSection(this, conversation, parentElement, style);
2416 addAndAdaptSection(parentElement, section);
2417 return section;
2418 }
2419
2420 public GroupsByUserDetailSection createGroupsByUserDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2421 GroupsByUserDetailSection section = new GroupsByUserDetailSection(this, conversation, parentElement, style);
2422 addAndAdaptSection(parentElement, section);
2423 return section;
2424 }
2425
2426 public TaxonomicScopeSection createTaxonomicScopeSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2427 TaxonomicScopeSection section = new TaxonomicScopeSection(this, conversation, parentElement, style);
2428 addAndAdaptSection(parentElement, section);
2429 return section;
2430 }
2431
2432 public AbstractEntityCollectionElement createEntityCollectionElement(AbstractFormSection parentElement,
2433 Object versionableEntity, SelectionListener removeListener, Color backgroundColor, int style) {
2434 AbstractEntityCollectionElement element = null;
2435
2436 Object entity = HibernateProxyHelper.deproxy(versionableEntity);
2437
2438 if (entity instanceof Annotation) {
2439 element = new AnnotationElement(this, parentElement, (Annotation) entity, removeListener, style);
2440 } else if (entity instanceof Person) {
2441 element = new TeamMemberElement(this, parentElement, (Person) entity, removeListener, style);
2442 } else if (entity instanceof Credit) {
2443 element = new CreditElement(this, parentElement, (Credit) entity, removeListener, style);
2444 } else if (entity instanceof Extension) {
2445 element = new ExtensionElement(this, parentElement, (Extension) entity, removeListener, style);
2446 } else if (entity instanceof Marker) {
2447 element = new MarkerElement(this, parentElement, (Marker) entity, removeListener, style);
2448 } else if (entity instanceof Media) {
2449 element = new MediaMetaElement(this, parentElement, (Media) entity, removeListener, true, style);
2450 } else if (entity instanceof MediaRepresentation) {
2451 element = new MediaRepresentationElement(this, parentElement, (MediaRepresentation) entity, removeListener,
2452 style);
2453 } else if (entity instanceof ImageFile) {
2454 element = new ImageFileElement(this, parentElement, (ImageFile) entity, removeListener, style);
2455 } else if (entity instanceof MediaRepresentationPart) {
2456 element = new MediaRepresentationPartElement(this, parentElement, (MediaRepresentationPart) entity,
2457 removeListener, style);
2458 } else if (entity instanceof NomenclaturalStatus) {
2459 element = new NomenclaturalStatusElement(this, parentElement, (NomenclaturalStatus) entity, removeListener,
2460 style);
2461 } else if (entity instanceof Rights) {
2462 element = new RightsElement(this, parentElement, (Rights) entity, removeListener, style);
2463 } else if (entity instanceof DescriptionElementSource) {
2464 element = new DescriptionElementSourceElement(this, parentElement, (DescriptionElementSource) entity,
2465 removeListener, style);
2466 } else if (entity instanceof IdentifiableSource) {
2467 element = new IdentifiableSourceElement(this, parentElement, (IdentifiableSource) entity, removeListener,
2468 style);
2469 } else if (entity instanceof DefinedTerm) {
2470 switch(((DefinedTerm)entity).getTermType()) {
2471 case Scope:
2472 element = new ScopeElement(this,
2473 parentElement,
2474 (DefinedTerm) entity,
2475 removeListener,
2476 style);
2477 break;
2478 case Modifier:
2479 element = new ModifierElement(this,
2480 parentElement,
2481 (DefinedTerm) entity,
2482 removeListener,
2483 style);
2484 break;
2485 default:
2486 break;
2487
2488 }
2489 } else if (entity instanceof Reference) {
2490 if(parentElement instanceof SequenceReferenceCollectionDetailSection){
2491 element = new SequenceReferenceCollectionDetailElement(this, parentElement, (Reference) entity, removeListener, style);
2492 }
2493 else{
2494 element = new DescriptionSourceElement(this, parentElement, (Reference) entity, removeListener, style);
2495 }
2496 } else if (entity instanceof NameTypeDesignation) {
2497 element = new NameTypeDesignationElement(this, parentElement, (NameTypeDesignation) entity, removeListener,
2498 style);
2499 } else if (entity instanceof NameRelationship) {
2500 element = new NameRelationshipDetailElement(this, parentElement, (NameRelationship) entity, removeListener,
2501 style);
2502 } else if (entity instanceof SynonymRelationship) {
2503 element = new SynonymRelationshipDetailElement(this, parentElement, (SynonymRelationship) entity, removeListener,
2504 style);
2505 } else if (entity instanceof SpecimenTypeDesignation) {
2506 element = new SpecimenTypeDesignationElement(this, parentElement, (SpecimenTypeDesignation) entity,
2507 removeListener, style);
2508 } else if (entity instanceof StateData) {
2509 element = new StateDataElement(this, parentElement, (StateData) entity, removeListener, style);
2510 } else if (entity instanceof StatisticalMeasurementValue) {
2511 element = new StatisticalMeasurementValueElement(this, parentElement, (StatisticalMeasurementValue) entity,
2512 removeListener, style);
2513 } else if (entity instanceof DerivedUnit) {
2514 switch(((DerivedUnit)entity).getRecordBasis()) {
2515 case LivingSpecimen:
2516 case PreservedSpecimen:
2517 case OtherSpecimen:
2518 element = new SpecimenCollectionDetailElement(this,
2519 parentElement,
2520 (DerivedUnit) entity,
2521 removeListener,
2522 style);
2523 break;
2524 default:
2525 element = new DerivedUnitElement(this,
2526 parentElement,
2527 (DerivedUnit) entity,
2528 removeListener,
2529 style);
2530 }
2531
2532 } else if (entity instanceof NamedArea) {
2533 element = new NamedAreaDetailElement(this, parentElement, (NamedArea) entity, removeListener, style);
2534 } else if (entity instanceof DeterminationEvent) {
2535 element = new DeterminationEventDetailElement(this, parentElement, (DeterminationEvent) entity, removeListener, style);
2536 } else if (entity instanceof User) {
2537 element = new MemberDetailElement(this, parentElement, (User) entity, removeListener, style);
2538 } else if (entity instanceof GrantedAuthority) {
2539 element = new GrantedAuthorityCollectionElement(this, parentElement, (GrantedAuthorityImpl) entity,
2540 removeListener, style);
2541 } else if (entity instanceof Group) {
2542 element = new GroupsByUserDetailElement(this, parentElement, (Group) entity, removeListener, style);
2543 } else if (entity instanceof Taxon) {
2544 element = new TaxonDetailElement(this, parentElement, (Taxon) entity, removeListener, style);
2545 } else if (entity instanceof DescriptionElementBase) {
2546 // this is the special case for protologs, maybe we can do this
2547 // differently when API improves
2548 DescriptionElementBase descriptionElement = (DescriptionElementBase) entity;
2549 if (descriptionElement.getFeature().equals(Feature.PROTOLOGUE())) {
2550 element = new ProtologueElement(this, parentElement, descriptionElement, removeListener, style);
2551 }
2552 } else if (entity instanceof Identifier) {
2553 if(parentElement instanceof AbstractSampleDesignationDetailSection){
2554 element = new SampleDesignationTextDetailElement(this, parentElement, (Identifier<DnaSample>) entity, removeListener, backgroundColor, style);
2555 }
2556 else{
2557 element = new IdentifierDetailElement(this, parentElement, (Identifier) entity, removeListener, style);
2558 }
2559 } else if (entity instanceof TermVocabulary) {
2560 TermVocabulary<?> termVocabulary = (TermVocabulary<?>)entity;
2561 switch (termVocabulary.getTermType()) {
2562 case State:
2563 element = new StateVocabularyCollectionElement(this, parentElement, (TermVocabulary<State>) entity, removeListener, backgroundColor, style);
2564 break;
2565 case Modifier:
2566 element = new RecommendedModifierVocabulariesElement(this, parentElement, (TermVocabulary<DefinedTerm>) entity, removeListener, backgroundColor, style);
2567 break;
2568 default:
2569 break;
2570 }
2571 } else if (entity instanceof MeasurementUnit) {
2572 element = new MeasurementUnitCollectionElement(this, parentElement, (MeasurementUnit) entity, removeListener, backgroundColor, style);
2573 } else if (entity instanceof StatisticalMeasure) {
2574 element = new StatisticalMeasureCollectionElement(this, parentElement, (StatisticalMeasure) entity, removeListener, backgroundColor, style);
2575 }
2576
2577 if (element == null) {
2578 MessagingUtils.messageDialog("No element for entity", this,
2579 "Could not generate element for entity. Looks like the case is not handled already. Check implementation. Entity: "
2580 + entity, null);
2581 }
2582
2583 else{
2584 if (backgroundColor != null && !backgroundColor.isDisposed()) {
2585 element.setPersistentBackground(backgroundColor);
2586 }
2587 adapt(element);
2588 parentElement.addElement(element);
2589 }
2590
2591 return element;
2592 }
2593
2594 /**
2595 * <p>
2596 * Creates a selection element for the given type T.
2597 * </p>
2598 * <p>
2599 * <strong>Selection elements not handled by this method:</strong>
2600 * <ul>
2601 * <li>{@link TaxonNodeSelectionElement} see
2602 * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
2603 * </li>
2604 * <li>{@link NomenclaturalAuthorTeamSelectionElement} see
2605 * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
2606 * </li>
2607 * </ul>
2608 * </p>
2609 *
2610 * @param clazz
2611 * a {@link Class} object of the type that you want the selection
2612 * element to handle
2613 * @param parentElement
2614 * a {@link ICdmFormElement} object.
2615 * @param labelString
2616 * a {@link String} object.
2617 * @param selectionType
2618 * @param selection
2619 * a {@link ICdmBase} object.
2620 * @param style
2621 * a int.
2622 * @param conversation
2623 * a {@link ConversationHolder} object.
2624 * @return a {@link EntitySelectionElement} object.
2625 */
2626 public <T extends ICdmBase> EntitySelectionElement<T> createSelectionElement(Class<T> clazz,
2627 ConversationHolder conversation, ICdmFormElement parentElement, String labelString, T selection, int mode,
2628 int style) {
2629 EntitySelectionElement<T> element = new EntitySelectionElement<T>(this, conversation, parentElement, clazz,
2630 labelString, selection, mode, style);
2631 adapt(element);
2632 parentElement.addElement(element);
2633 return element;
2634 }
2635
2636 /**
2637 * <p>
2638 * Creates a selection element for the given type T which shows only the <b>abbreviated</b> title as the label.
2639 * </p>
2640 * <p>
2641 * <strong>Selection elements not handled by this method:</strong>
2642 * <ul>
2643 * <li>{@link TaxonNodeSelectionElement} see
2644 * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
2645 * </li>
2646 * <li>{@link NomenclaturalAuthorTeamSelectionElement} see
2647 * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
2648 * </li>
2649 * </ul>
2650 * </p>
2651 *
2652 * @param clazz
2653 * a {@link Class} object of the type that you want the selection
2654 * element to handle
2655 * @param parentElement
2656 * a {@link ICdmFormElement} object.
2657 * @param labelString
2658 * a {@link String} object.
2659 * @param selectionType
2660 * @param selection
2661 * a {@link ICdmBase} object.
2662 * @param style
2663 * a int.
2664 * @param conversation
2665 * a {@link ConversationHolder} object.
2666 * @return a {@link EntitySelectionElement} object.
2667 */
2668 public <T extends ICdmBase> EntitySelectionElementWithAbbreviatedTitle<T> createSelectionElementWithAbbreviatedTitle(
2669 Class<T> clazz, ConversationHolder conversation, ICdmFormElement parentElement, String labelString,
2670 T selection, int mode, int style) {
2671 EntitySelectionElementWithAbbreviatedTitle<T> element = new EntitySelectionElementWithAbbreviatedTitle<T>(this, conversation, parentElement, clazz,
2672 labelString, selection, mode, style);
2673 adapt(element);
2674 parentElement.addElement(element);
2675 return element;
2676 }
2677
2678 public TaxonNodeSelectionElement createTaxonNodeSelectionElement(ConversationHolder conversation,
2679 ICdmFormElement parentElement, String labelString, TaxonNode selection, int mode, int style) {
2680 TaxonNodeSelectionElement element = new TaxonNodeSelectionElement(this, conversation, parentElement,
2681 labelString, selection, mode, style);
2682 adapt(element);
2683 parentElement.addElement(element);
2684 return element;
2685 }
2686
2687 public NomenclaturalAuthorTeamSelectionElement createNomenclaturalAuthorTeamSelectionElement(
2688 ConversationHolder conversation, ICdmFormElement parentElement, String labelString, Team selection,
2689 int mode, int style) {
2690 NomenclaturalAuthorTeamSelectionElement element = new NomenclaturalAuthorTeamSelectionElement(this,
2691 conversation, parentElement, labelString, selection, mode