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