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