Merge branch 'release/4.5.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,
906 selection, true, style);
907 adapt(element);
908 parentElement.addElement(element);
909 return element;
910 }
911
912 public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
913 TermType termType,
914 ICdmFormElement parentElement,
915 String labelString,
916 T selection,
917 int style) {
918 return this.createDefinedTermComboElement(termType, null, parentElement, labelString, selection, false, style, true);
919 }
920
921 public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
922 TermType termType,
923 ICdmFormElement parentElement,
924 String labelString,
925 T selection,
926 boolean addEmptyElement,
927 int style) {
928 return this.createDefinedTermComboElement(termType, null, parentElement, labelString, selection, addEmptyElement, style, true);
929 }
930 public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
931 TermType termType,
932 ICdmFormElement parentElement,
933 String labelString,
934 T selection,
935 boolean addEmptyElement,
936 int style,
937 boolean useAbbrevLabel) {
938 return createDefinedTermComboElement(termType, null, parentElement, labelString, selection, addEmptyElement, style, useAbbrevLabel);
939 }
940
941
942 public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
943 TermVocabulary<?> termVocabulary,
944 ICdmFormElement parentElement,
945 String labelString,
946 T selection,
947 int style) {
948 return this.createDefinedTermComboElement(null, termVocabulary, parentElement, labelString, selection, false, style, true);
949 }
950
951 public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
952 TermVocabulary<?> termVocabulary,
953 ICdmFormElement parentElement,
954 String labelString,
955 T selection,
956 boolean addEmptyElement,
957 int style,
958 boolean useAbbrevLabel) {
959 return createDefinedTermComboElement(null, termVocabulary, parentElement, labelString, selection, addEmptyElement, style, useAbbrevLabel);
960 }
961
962 private <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
963 TermType termType,
964 TermVocabulary<?> termVocabulary,
965 ICdmFormElement parentElement,
966 String labelString,
967 T selection,
968 boolean addEmptyElement,
969 int style,
970 boolean useAbbrevLabel) {
971 if(termType!=null){
972 TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termType, labelString, selection, addEmptyElement, style, useAbbrevLabel);
973 adapt(element);
974 parentElement.addElement(element);
975 return element;
976 }
977 else if(termVocabulary!=null){
978 TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termVocabulary, labelString, selection, addEmptyElement, style, useAbbrevLabel);
979 adapt(element);
980 parentElement.addElement(element);
981 return element;
982 }
983 else{
984 //this should never happen
985 return null;
986 }
987 }
988
989 public <T extends IEnumTerm<T>> EnumComboElement<T> createEnumComboElement(
990 Class<T> enumComboType, ICdmFormElement parentElement,
991 int style) {
992 return createEnumComboElement(enumComboType, parentElement, null, style);
993 }
994
995 public <T extends IEnumTerm<T>> EnumComboElement<T> createEnumComboElement(
996 Class<T> enumComboType, ICdmFormElement parentElement, Comparator<T> comparator,
997 int style) {
998 EnumComboElement<T> element = new EnumComboElement<T>(this, parentElement, enumComboType, comparator, style);
999 adapt(element);
1000 parentElement.addElement(element);
1001 return element;
1002 }
1003
1004 public <TERM extends DefinedTermBase<TERM>, VOC extends TermVocabulary<TERM>> VocabularyComboElement<TERM, VOC> createVocabularyComboElement(
1005 TermType termType, String label, VOC selection, ICdmFormElement parentElement, int style) {
1006 VocabularyComboElement<TERM, VOC> element = new VocabularyComboElement<TERM, VOC>(this, parentElement, termType, label, selection, style);
1007 adapt(element);
1008 parentElement.addElement(element);
1009 return element;
1010 }
1011
1012 /**
1013 * <p>
1014 * createBrowserElement
1015 * </p>
1016 *
1017 * @param imageUri
1018 * a {@link java.net.URI} object.
1019 * @param style
1020 * a int.
1021 * @param parentElement
1022 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1023 * object.
1024 * @return a {@link eu.etaxonomy.taxeditor.ui.element.BrowserElement}
1025 * object.
1026 */
1027 public BrowserElement createBrowserElement(ICdmFormElement parentElement, URI imageUri, int style) {
1028 BrowserElement element = new BrowserElement(this, parentElement, imageUri, style);
1029 adapt(element);
1030 parentElement.addElement(element);
1031 return element;
1032 }
1033
1034 /**
1035 * <p>
1036 * createImageElement
1037 * </p>
1038 *
1039 * @param parentElement
1040 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1041 * object.
1042 * @param imageUri
1043 * a {@link java.net.URI} object.
1044 * @param style
1045 * a int.
1046 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ImageElement} object.
1047 */
1048 public ImageElement createImageElement(ICdmFormElement parentElement, URI imageUri, int style) {
1049 ImageElement element = new ImageElement(this, parentElement, imageUri, style);
1050 adapt(element);
1051 parentElement.addElement(element);
1052 return element;
1053 }
1054
1055 /**
1056 * <p>
1057 * createTextActionElement
1058 * </p>
1059 *
1060 * @param labelString
1061 * a {@link java.lang.String} object.
1062 * @param initialText
1063 * a {@link java.lang.String} object.
1064 * @param style
1065 * a int.
1066 * @param parentElement
1067 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1068 * object.
1069 * @param buttonLabel
1070 * a {@link java.lang.String} object.
1071 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextActionElement}
1072 * object.
1073 */
1074 public TextActionElement createTextActionElement(ICdmFormElement parentElement, String labelString,
1075 String buttonLabel, String initialText, int style) {
1076 TextActionElement element = new TextActionElement(this, parentElement, labelString, buttonLabel, initialText,
1077 style);
1078 adapt(element);
1079 parentElement.addElement(element);
1080 return element;
1081 }
1082
1083 /**
1084 * <p>
1085 * createCheckbox
1086 * </p>
1087 *
1088 * @param parentElement
1089 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1090 * object.
1091 * @param label
1092 * a {@link java.lang.String} object.
1093 * @param initialState
1094 * a boolean.
1095 * @param style
1096 * a int.
1097 * @return a {@link eu.etaxonomy.taxeditor.ui.element.CheckboxElement}
1098 * object.
1099 */
1100 public CheckboxElement createCheckbox(ICdmFormElement parentElement, String label, Boolean initialState, int style) {
1101 if(initialState==null){
1102 initialState = Boolean.FALSE;
1103 }
1104 CheckboxElement element = new CheckboxElement(this, parentElement, label, initialState, style | orientation);
1105 adapt(element);
1106 parentElement.addElement(element);
1107 return element;
1108 }
1109
1110 /**
1111 * Creates a section as a part of the form.
1112 *
1113 * @return the section widget
1114 * @param section
1115 * a
1116 * {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1117 * object.
1118 */
1119 public Section adapt(AbstractFormSection section) {
1120 section.setMenu(section.getLayoutComposite().getMenu());
1121 adapt(section, true, true);
1122
1123 // handle focus and property change events for cdm use
1124 section.addFocusListener(selectionFocusHandler);
1125 section.setPropertyChangeListeners(propertyChangeListeners);
1126
1127 if (section.getToggle() != null) {
1128 section.getToggle().setHoverDecorationColor(getColors().getColor(IFormColors.TB_TOGGLE_HOVER));
1129 section.getToggle().setDecorationColor(getColors().getColor(IFormColors.TB_TOGGLE));
1130 }
1131
1132 section.setFont(boldFontHolder2.getBoldFont(section.getLayoutComposite().getFont()));
1133
1134 if ((section.getStyle() & ExpandableComposite.TITLE_BAR) != 0
1135 || (section.getStyle() & ExpandableComposite.SHORT_TITLE_BAR) != 0) {
1136 getColors().initializeSectionToolBarColors();
1137 section.setTitleBarBackground(getColors().getColor(IFormColors.TB_BG));
1138 section.setTitleBarBorderColor(getColors().getColor(IFormColors.TB_BORDER));
1139 }
1140 // call setTitleBarForeground regardless as it also sets the label color
1141 section.setTitleBarForeground(getColors().getColor(IFormColors.TB_TOGGLE));
1142 return section;
1143 }
1144
1145 private class BoldFontHolder2 {
1146 private Font normalFont;
1147
1148 private Font boldFont;
1149
1150 public BoldFontHolder2() {
1151 }
1152
1153 public Font getBoldFont(Font font) {
1154 createBoldFont(font);
1155 return boldFont;
1156 }
1157
1158 private void createBoldFont(Font font) {
1159 if (normalFont == null || !normalFont.equals(font)) {
1160 normalFont = font;
1161 dispose();
1162 }
1163 if (boldFont == null) {
1164 boldFont = FormFonts.getInstance().getBoldFont(getColors().getDisplay(), normalFont);
1165 }
1166 }
1167
1168 public void dispose() {
1169 if (boldFont != null) {
1170 FormFonts.getInstance().markFinished(boldFont, getColors().getDisplay());
1171 boldFont = null;
1172 }
1173 }
1174 }
1175
1176 /**
1177 * <p>
1178 * createToggleableTextField
1179 * </p>
1180 *
1181 * @param parentElement
1182 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1183 * object.
1184 * @param labelString
1185 * a {@link java.lang.String} object.
1186 * @param initialText
1187 * a {@link java.lang.String} object.
1188 * @param initialState
1189 * a boolean.
1190 * @param style
1191 * a int.
1192 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement}
1193 * object.
1194 */
1195 public ToggleableTextElement createToggleableTextField(ICdmFormElement parentElement, String labelString,
1196 String initialText, boolean initialState, int style) {
1197 ToggleableTextElement element = new ToggleableTextElement(this, parentElement, labelString, initialText,
1198 initialState, style | orientation);
1199 adapt(element);
1200 parentElement.addElement(element);
1201 return element;
1202 }
1203
1204 /**
1205 * <p>
1206 * createTimePeriodElement
1207 * </p>
1208 *
1209 * @param parentElement
1210 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1211 * object.
1212 * @param labelString
1213 * a {@link java.lang.String} object.
1214 * @param timePeriod
1215 * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1216 * @param style
1217 * a int.
1218 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TimePeriodElement}
1219 * object.
1220 */
1221 public TimePeriodElement createTimePeriodElement(ICdmFormElement parentElement, String labelString,
1222 TimePeriod timePeriod, int style) {
1223 TimePeriodElement element = new TimePeriodElement(this, parentElement, labelString, timePeriod, style);
1224 adapt(element);
1225 parentElement.addElement(element);
1226 return element;
1227 }
1228
1229 /**
1230 * <p>
1231 * createGatheringEventUnitElement
1232 * </p>
1233 *
1234 * @param parentElement
1235 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1236 * object.
1237 * @param labelString
1238 * a {@link java.lang.String} object.
1239 * @param timePeriod
1240 * a {@link eu.etaxonomy.cdm.model.common.GatheringEvent} object.
1241 * @param style
1242 * a int.
1243 * @return a {@link eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement}
1244 * object.
1245 */
1246 public GatheringEventUnitElement createGatheringEventUnitElement(
1247 ICdmFormElement parentElement,
1248 String labelString,
1249 DerivedUnitFacade gatheringEvent,
1250 MinMaxTextSection.UnitType unitType,
1251 int style) {
1252 GatheringEventUnitElement element = new GatheringEventUnitElement(this,
1253 parentElement,
1254 labelString,
1255 gatheringEvent,
1256 unitType,
1257 style);
1258 adapt(element);
1259 parentElement.addElement(element);
1260 return element;
1261 }
1262
1263 /**
1264 * <p>
1265 * createPointElement
1266 * </p>
1267 *
1268 * @param style
1269 * a int.
1270 * @param parentElement
1271 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1272 * object.
1273 * @param point
1274 * a {@link eu.etaxonomy.cdm.model.location.Point} object.
1275 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PointElement} object.
1276 */
1277 public PointElement createPointElement(ICdmFormElement parentElement, Point point, int style) {
1278 PointElement element = new PointElement(this, parentElement, point, style);
1279 adapt(element);
1280 parentElement.addElement(element);
1281 return element;
1282 }
1283
1284
1285
1286 /**
1287 * @param conversationHolder
1288 * @param parent
1289 * @param detailsViewer
1290 * @param i
1291 * @return
1292 */
1293 public EmptySection createEmptySection(CdmFormFactory formFactory, ICdmFormElement parentElement, int style) {
1294 EmptySection section = new EmptySection(formFactory, parentElement, style);
1295 parentElement.addElement(section);
1296 adapt(section);
1297 return section;
1298 }
1299
1300 /**
1301 * <p>
1302 * createDateDetailSection
1303 * </p>
1304 *
1305 * @param parentElement
1306 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1307 * object.
1308 * @param style
1309 * a int.
1310 * @return a {@link eu.etaxonomy.taxeditor.ui.element.DateDetailSection}
1311 * object.
1312 */
1313 public DateDetailSection createDateDetailSection(ICdmFormElement parentElement, int style) {
1314 DateDetailSection section = new DateDetailSection(this, parentElement, style);
1315 parentElement.addElement(section);
1316 adapt(section);
1317 return section;
1318 }
1319
1320 /**
1321 * <p>
1322 * createDateDetailSection
1323 * </p>
1324 *
1325 * @param parentElement
1326 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1327 * object.
1328 * @param style
1329 * a int.
1330 * @return a {@link eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection}
1331 * object.
1332 */
1333 public MinMaxTextSection createMinMaxTextSection(ICdmFormElement parentElement, UnitType unitType, int style) {
1334 MinMaxTextSection section = new MinMaxTextSection(this, parentElement, unitType, style);
1335 parentElement.addElement(section);
1336 adapt(section);
1337 return section;
1338 }
1339
1340 /**
1341 * <p>
1342 * createPartialElement
1343 * </p>
1344 *
1345 * @param parentElement
1346 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1347 * object.
1348 * @param labelString
1349 * a {@link java.lang.String} object.
1350 * @param partial
1351 * a {@link org.joda.time.Partial} object.
1352 * @param style
1353 * a int.
1354 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PartialElement}
1355 * object.
1356 */
1357 public PartialElement createPartialElement(ICdmFormElement parentElement, String labelString, Partial partial,
1358 int style) {
1359 PartialElement element = new PartialElement(this, parentElement, labelString, style);
1360 adapt(element);
1361 parentElement.addElement(element);
1362 return element;
1363 }
1364
1365 /**
1366 * <p>
1367 * addSelectionListener
1368 * </p>
1369 *
1370 * @param listener
1371 * a {@link org.eclipse.swt.events.SelectionListener} object.
1372 */
1373 public void addSelectionListener(SelectionListener listener) {
1374 selectionListenerList.add(listener);
1375 }
1376
1377 /**
1378 * <p>
1379 * removeSelectionListener
1380 * </p>
1381 *
1382 * @param listener
1383 * a {@link org.eclipse.swt.events.SelectionListener} object.
1384 */
1385 public void removeSelectionListener(SelectionListener listener) {
1386 if (listener == null) {
1387 MessagingUtils.error(this.getClass(),
1388 "Tried to remove a selection listener from this factories listeners but was null", null);
1389 } else {
1390 selectionListenerList.remove(listener);
1391 }
1392 }
1393
1394 /**
1395 * <p>
1396 * addPropertyChangeListener
1397 * </p>
1398 *
1399 * @param listener
1400 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1401 * object.
1402 */
1403 public void addPropertyChangeListener(IPropertyChangeListener listener) {
1404 if (propertyChangeListeners.contains(listener)) {
1405 return;
1406 }
1407 propertyChangeListeners.add(0, listener);
1408 }
1409
1410 /**
1411 * <p>
1412 * removePropertyChangeListener
1413 * </p>
1414 *
1415 * @param listener
1416 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1417 * object.
1418 */
1419 public void removePropertyChangeListener(IPropertyChangeListener listener) {
1420 propertyChangeListeners.remove(listener);
1421 }
1422
1423 /**
1424 * @return the propertyChangeListeners
1425 */
1426 public List<IPropertyChangeListener> getPropertyChangeListeners() {
1427 return propertyChangeListeners;
1428 }
1429
1430 /**
1431 * <p>
1432 * createHorizontalSeparator
1433 * </p>
1434 *
1435 * @param parentElement
1436 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1437 * object.
1438 * @param style
1439 * a int.
1440 * @return a {@link org.eclipse.swt.widgets.Label} object.
1441 */
1442 public Label createHorizontalSeparator(ICdmFormElement parentElement, int style) {
1443 Label separator = this.createSeparator(parentElement.getLayoutComposite(), SWT.HORIZONTAL | style);
1444 separator.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
1445 return separator;
1446 }
1447
1448 /**
1449 * <p>
1450 * createVersionElement
1451 * </p>
1452 *
1453 * @param parentElement
1454 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1455 * object.
1456 * @param entity
1457 * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
1458 * object.
1459 * @param style
1460 * a int.
1461 * @return a
1462 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
1463 * object.
1464 */
1465 public VersionElement createVersionElement(ICdmFormElement parentElement, VersionableEntity entity, int style) {
1466 VersionElement element = new VersionElement(this, parentElement, entity, style);
1467 adapt(element);
1468 parentElement.addElement(element);
1469 return element;
1470 }
1471
1472 /**
1473 * @param cdmBaseSection
1474 * @param object
1475 * @param style
1476 * @return
1477 */
1478 public CdmBaseElement createCdmBaseElement(ICdmFormElement parentElement, CdmBase entity, int style) {
1479 CdmBaseElement element = new CdmBaseElement(this, parentElement, entity, style);
1480 adapt(element);
1481 parentElement.addElement(element);
1482 return element;
1483 }
1484
1485 /**
1486 * <p>
1487 * createVersionSection
1488 * </p>
1489 *
1490 * @param parentElement
1491 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1492 * object.
1493 * @param style
1494 * a int.
1495 * @return a
1496 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
1497 * object.
1498 */
1499 public VersionSection createVersionSection(ICdmFormElement parentElement, int style) {
1500 VersionSection section = new VersionSection(this, parentElement, style);
1501 parentElement.addElement(section);
1502 adapt(section);
1503 return section;
1504 }
1505
1506 /**
1507 * @param parent
1508 * @param i
1509 * @return
1510 */
1511 public CdmBaseSection createCdmBaseSection(ICdmFormElement parentElement, int style) {
1512 CdmBaseSection section = new CdmBaseSection(this, parentElement, style);
1513 parentElement.addElement(section);
1514 adapt(section);
1515 return section;
1516 }
1517
1518 /**
1519 * <p>
1520 * createEmptyElement
1521 * </p>
1522 *
1523 * @param parentElement
1524 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1525 * object.
1526 * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1527 */
1528 public EmptyElement createEmptyElement(ICdmFormElement parentElement, String emptyText) {
1529 EmptyElement element = new EmptyElement(this, parentElement, emptyText, SWT.NULL);
1530 adapt(element);
1531 parentElement.addElement(element);
1532 return element;
1533 }
1534
1535 /**
1536 * <p>
1537 * createHeadlineSection
1538 * </p>
1539 *
1540 * @param parentElement
1541 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1542 * object.
1543 * @return a
1544 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
1545 * object.
1546 */
1547 public HeadlineSection createHeadlineSection(ICdmFormElement parentElement) {
1548 HeadlineSection section = new HeadlineSection(this, parentElement, SWT.NULL);
1549 parentElement.addElement(section);
1550 adapt(section);
1551 return section;
1552 }
1553
1554 /**
1555 * <p>
1556 * createParsingMessageElement
1557 * </p>
1558 *
1559 * @param parentElement
1560 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1561 * object.
1562 * @param parserProblem
1563 * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
1564 * object.
1565 * @param style
1566 * a int.
1567 * @return a
1568 * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
1569 * object.
1570 */
1571 public ParsingMessageElement createParsingMessageElement(ICdmFormElement parentElement,
1572 ParserProblem parserProblem, int style) {
1573 ParsingMessageElement element = new ParsingMessageElement(this, parentElement, parserProblem, style);
1574 adapt(element);
1575 parentElement.addElement(element);
1576 return element;
1577 }
1578
1579 public AbstractFormSection createDefinedTermDetailSection(Class definedTermClass, ConversationHolder conversation,
1580 ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
1581
1582 AbstractFormSection section = new DefinedTermDetailSection(this, definedTermClass, conversation, parentElement,
1583 selectionProvider, style);
1584
1585 parentElement.addElement(section);
1586 adapt(section);
1587 return section;
1588
1589 }
1590
1591 /**
1592 * @param definedTermClass
1593 * @param formElement
1594 * @param style
1595 * @return
1596 */
1597 public AbstractCdmDetailElement createDefinedTermDetailElement(Class definedTermClass,
1598 AbstractCdmDetailSection parentElement, int style) {
1599 AbstractCdmDetailElement element = null;
1600
1601 if (NamedArea.class.isAssignableFrom(definedTermClass)) {
1602 element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
1603 } else if (definedTermClass.equals(Feature.class)) {
1604 element = new FeatureDetailElement(this, parentElement);
1605 } else if(definedTermClass.equals(PresenceAbsenceTerm.class)){
1606 element = new PresenceAbsenceTermDetailElement(this, parentElement);
1607 } else {
1608 element = new DefinedTermDetailElement(this, parentElement);
1609 }
1610
1611
1612 adapt(element);
1613 parentElement.addElement(element);
1614 return element;
1615 }
1616
1617
1618 //--------DetailSections---------
1619 public NameDetailSection createNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1620 NameDetailSection section = new NameDetailSection(this, conversation, parentElement, selectionProvider, style);
1621 addAndAdaptSection(parentElement, section);
1622 return section;
1623 }
1624
1625 public ReferenceDetailSection createReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1626 ReferenceDetailSection section = new ReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
1627 addAndAdaptSection(parentElement, section);
1628 return section;
1629 }
1630
1631 public NomenclaturalReferenceDetailSection createNomenclaturalReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1632 NomenclaturalReferenceDetailSection section = new NomenclaturalReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
1633 addAndAdaptSection(parentElement, section);
1634 return section;
1635 }
1636
1637 public TaxonBaseDetailSection createTaxonBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1638 TaxonBaseDetailSection section = new TaxonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1639 addAndAdaptSection(parentElement, section);
1640 return section;
1641 }
1642
1643 public AuthorshipDetailSection createAuthorshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1644 AuthorshipDetailSection section = new AuthorshipDetailSection(this, conversation, parentElement, selectionProvider, style);
1645 addAndAdaptSection(parentElement, section);
1646 return section;
1647 }
1648
1649 public TeamOrPersonBaseDetailSection createTeamOrPersonBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1650 TeamOrPersonBaseDetailSection section = new TeamOrPersonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1651 addAndAdaptSection(parentElement, section);
1652 return section;
1653 }
1654
1655 public TeamDetailSection createTeamDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1656 TeamDetailSection section = new TeamDetailSection(this, conversation, parentElement, null, style);
1657 addAndAdaptSection(parentElement, section);
1658 return section;
1659 }
1660
1661 public PersonDetailSection createPersonDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1662 PersonDetailSection section = new PersonDetailSection(this, conversation, parentElement, null, style);
1663 addAndAdaptSection(parentElement, section);
1664 return section;
1665 }
1666
1667 public DescriptionDetailSection createDescriptionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1668 DescriptionDetailSection section = new DescriptionDetailSection(this, conversation, parentElement, selectionProvider, style);
1669 addAndAdaptSection(parentElement, section);
1670 return section;
1671 }
1672
1673 public DescriptionElementDetailSection createDescriptionElementDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1674 DescriptionElementDetailSection section = new DescriptionElementDetailSection(this, conversation, parentElement, selectionProvider, style);
1675 addAndAdaptSection(parentElement, section);
1676 return section;
1677 }
1678
1679 public ParsingMessagesSection createParsingMessagesSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1680 ParsingMessagesSection section = new ParsingMessagesSection(this, conversation, parentElement, selectionProvider, style);
1681 addAndAdaptSection(parentElement, section);
1682 return section;
1683 }
1684
1685 public NonViralNameDetailSection createNonViralNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, boolean nameChoosable, int style){
1686 NonViralNameDetailSection section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, nameChoosable, style);
1687 addAndAdaptSection(parentElement, section);
1688 return section;
1689 }
1690
1691 public MediaDetailsSection createMediaDetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1692 MediaDetailsSection section = new MediaDetailsSection(this, conversation, parentElement, selectionProvider, style);
1693 addAndAdaptSection(parentElement, section);
1694 return section;
1695 }
1696
1697 public FieldUnitDetailSection createFieldUnitDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1698 FieldUnitDetailSection section = new FieldUnitDetailSection(this, conversation, parentElement, selectionProvider, style);
1699 addAndAdaptSection(parentElement, section);
1700 return section;
1701 }
1702
1703 public GatheringEventDetailSection createGatheringEventDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1704 GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
1705 addAndAdaptSection(parentElement, section);
1706 return section;
1707 }
1708
1709 public SpecimenHierarchyDetailSection createSpecimenHierarchyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1710 SpecimenHierarchyDetailSection section = new SpecimenHierarchyDetailSection(this, conversation, parentElement, selectionProvider, style);
1711 addAndAdaptSection(parentElement, section);
1712 return section;
1713 }
1714
1715 public DerivedUnitBaseDetailSection createDerivedUnitBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1716 DerivedUnitBaseDetailSection section = new DerivedUnitBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1717 addAndAdaptSection(parentElement, section);
1718 return section;
1719 }
1720
1721 public DerivedUnitTypeDesignationSection createDerivedUnitTypeDesignationSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1722 DerivedUnitTypeDesignationSection section = new DerivedUnitTypeDesignationSection(this, conversation, parentElement, style);
1723 addAndAdaptSection(parentElement, section);
1724 return section;
1725 }
1726
1727 public TaxonAssociationDetailSection createTaxonAssociationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1728 TaxonAssociationDetailSection section = new TaxonAssociationDetailSection(this, conversation, parentElement, selectionProvider, style);
1729 addAndAdaptSection(parentElement, section);
1730 return section;
1731 }
1732
1733 public OriginalLabelDataSection createOriginalLabelDataSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1734 OriginalLabelDataSection section = new OriginalLabelDataSection(this, conversation, parentElement, selectionProvider, style);
1735 addAndAdaptSection(parentElement, section);
1736 return section;
1737 }
1738
1739 public NaturalLanguageSection createNaturalLanguageSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1740 NaturalLanguageSection section = new NaturalLanguageSection(this, conversation, parentElement, selectionProvider, style);
1741 addAndAdaptSection(parentElement, section);
1742 return section;
1743 }
1744
1745 public FeatureDistributionDetailSection createFeatureDistributionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1746 FeatureDistributionDetailSection section = new FeatureDistributionDetailSection(this, conversation, parentElement, selectionProvider, style);
1747 addAndAdaptSection(parentElement, section);
1748 return section;
1749 }
1750
1751 public ClassificationDetailSection createClassificationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1752 ClassificationDetailSection section = new ClassificationDetailSection(this, conversation, parentElement, selectionProvider, style);
1753 addAndAdaptSection(parentElement, section);
1754 return section;
1755 }
1756
1757 public TaxonNodeDetailSection createTaxonNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1758 TaxonNodeDetailSection section = new TaxonNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
1759 addAndAdaptSection(parentElement, section);
1760 return section;
1761 }
1762
1763 public PolytomousKeyDetailSection createPolytomousKeyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1764 PolytomousKeyDetailSection section = new PolytomousKeyDetailSection(this, conversation, parentElement, selectionProvider, style);
1765 addAndAdaptSection(parentElement, section);
1766 return section;
1767 }
1768
1769 public PolytomousKeyNodeDetailSection createPolytomousKeyNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1770 PolytomousKeyNodeDetailSection section = new PolytomousKeyNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
1771 addAndAdaptSection(parentElement, section);
1772 return section;
1773 }
1774
1775 public InstitutionDetailSection createInstitutionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1776 InstitutionDetailSection section = new InstitutionDetailSection(this, conversation, parentElement, selectionProvider, style);
1777 addAndAdaptSection(parentElement, section);
1778 return section;
1779 }
1780
1781 public FieldUnitGeneralDetailSection createFieldUnitGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1782 FieldUnitGeneralDetailSection section = new FieldUnitGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1783 addAndAdaptSection(parentElement, section);
1784 return section;
1785 }
1786
1787 public DerivedUnitGeneralDetailSection createDerivedUnitGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1788 DerivedUnitGeneralDetailSection section = new DerivedUnitGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1789 addAndAdaptSection(parentElement, section);
1790 return section;
1791 }
1792
1793 public PreservedSpecimenGeneralDetailSection createPreservedSpecimenGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1794 PreservedSpecimenGeneralDetailSection section = new PreservedSpecimenGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1795 addAndAdaptSection(parentElement, section);
1796 return section;
1797 }
1798
1799 public TissueSampleGeneralDetailSection createTissueSampleGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1800 TissueSampleGeneralDetailSection section = new TissueSampleGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1801 addAndAdaptSection(parentElement, section);
1802 return section;
1803 }
1804
1805 public DnaSampleGeneralDetailSection createDnaSampleGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1806 DnaSampleGeneralDetailSection section = new DnaSampleGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1807 addAndAdaptSection(parentElement, section);
1808 return section;
1809 }
1810
1811 public DnaSamplePreparationPreservationSection createDnaSamplePreparationPreservationSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1812 DnaSamplePreparationPreservationSection section = new DnaSamplePreparationPreservationSection(this, conversation, parentElement, selectionProvider, style);
1813 addAndAdaptSection(parentElement, section);
1814 return section;
1815 }
1816
1817 public DnaQualityDetailSection createDnaQualityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1818 DnaQualityDetailSection section = new DnaQualityDetailSection(this, conversation, parentElement, selectionProvider, style);
1819 addAndAdaptSection(parentElement, section);
1820 return section;
1821 }
1822
1823 public SequenceGeneralDetailSection createSequenceGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1824 SequenceGeneralDetailSection section = new SequenceGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1825 addAndAdaptSection(parentElement, section);
1826 return section;
1827 }
1828
1829 public SequenceContigFileCollectionDetailSection createSequenceContigFileCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1830 SequenceContigFileCollectionDetailSection section = new SequenceContigFileCollectionDetailSection(this, conversation, parentElement, style);
1831 addAndAdaptSection(parentElement, section);
1832 return section;
1833 }
1834
1835 public SingleReadPherogramCollectionDetailSection createSingleReadPherogramCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1836 SingleReadPherogramCollectionDetailSection section = new SingleReadPherogramCollectionDetailSection(this, conversation, parentElement, style);
1837 addAndAdaptSection(parentElement, section);
1838 return section;
1839 }
1840
1841 public SequenceReferenceCollectionDetailSection createSequenceReferenceCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1842 SequenceReferenceCollectionDetailSection section = new SequenceReferenceCollectionDetailSection(this, conversation, parentElement, style);
1843 addAndAdaptSection(parentElement, section);
1844 return section;
1845 }
1846
1847 public SingleReadGeneralDetailSection createSingleReadGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1848 SingleReadGeneralDetailSection section = new SingleReadGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1849 addAndAdaptSection(parentElement, section);
1850 return section;
1851 }
1852
1853 public AmplificationGeneralDetailSection createAmplificationGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1854 AmplificationGeneralDetailSection section = new AmplificationGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1855 addAndAdaptSection(parentElement, section);
1856 return section;
1857 }
1858
1859 public AmplificationPrimerDetailSection createAmplificationPrimerDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1860 AmplificationPrimerDetailSection section = new AmplificationPrimerDetailSection(this, conversation, parentElement, selectionProvider, style);
1861 addAndAdaptSection(parentElement, section);
1862 return section;
1863 }
1864
1865 public AmplificationCloningDetailSection createAmplificationCloningDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1866 AmplificationCloningDetailSection section = new AmplificationCloningDetailSection(this, conversation, parentElement, selectionProvider, style);
1867 addAndAdaptSection(parentElement, section);
1868 return section;
1869 }
1870
1871 public AmplificationGelPhotoCollectionDetailSection createAmplificationGelPhotoCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1872 AmplificationGelPhotoCollectionDetailSection section = new AmplificationGelPhotoCollectionDetailSection(this, conversation, parentElement, style);
1873 addAndAdaptSection(parentElement, section);
1874 return section;
1875 }
1876
1877 public MediaSpecimenGeneralDetailSection createMediaSpecimenGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1878 MediaSpecimenGeneralDetailSection section = new MediaSpecimenGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1879 addAndAdaptSection(parentElement, section);
1880 return section;
1881 }
1882
1883 public HybridDetailSection createHybridDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1884 HybridDetailSection section = new HybridDetailSection(this, conversation, parentElement, selectionProvider, style);
1885 addAndAdaptSection(parentElement, section);
1886 return section;
1887 }
1888
1889 public UserDetailSection createUserDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1890 UserDetailSection section = new UserDetailSection(this, conversation, parentElement, selectionProvider, style);
1891 addAndAdaptSection(parentElement, section);
1892 return section;
1893 }
1894
1895 public GroupDetailSection createGroupDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1896 GroupDetailSection section = new GroupDetailSection(this, conversation, parentElement, selectionProvider, style);
1897 addAndAdaptSection(parentElement, section);
1898 return section;
1899 }
1900
1901 public DeterminationDetailSection createDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1902 DeterminationDetailSection section = new DeterminationDetailSection(this, conversation, parentElement, selectionProvider, style);
1903 addAndAdaptSection(parentElement, section);
1904 return section;
1905 }
1906
1907 public SampleDesignationDetailSection createSampleDesignationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1908 SampleDesignationDetailSection section = new SampleDesignationDetailSection(this, conversation, parentElement, selectionProvider, style);
1909 addAndAdaptSection(parentElement, section);
1910 return section;
1911 }
1912
1913 public TaxonRelationshipDetailSection createTaxonRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1914 TaxonRelationshipDetailSection section = new TaxonRelationshipDetailSection(this, conversation, parentElement, selectionProvider, style);
1915 addAndAdaptSection(parentElement, section);
1916 return section;
1917 }
1918
1919 public ReferencedEntityDetailSection createReferencedEntityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1920 ReferencedEntityDetailSection section = new ReferencedEntityDetailSection(this, conversation, parentElement, selectionProvider, style);
1921 addAndAdaptSection(parentElement, section);
1922 return section;
1923 }
1924
1925 public TermVocabularyDetailSection createTermVocabularyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1926 TermVocabularyDetailSection section = new TermVocabularyDetailSection(this, conversation, parentElement, selectionProvider, style);
1927 addAndAdaptSection(parentElement, section);
1928 return section;
1929 }
1930
1931 public GatheringEventDetailSection createGatheringSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1932 GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
1933 addAndAdaptSection(parentElement, section);
1934 return section;
1935 }
1936
1937 public NamedAreaDetailSection createNamedAreaDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1938 NamedAreaDetailSection section = new NamedAreaDetailSection(this, conversation, parentElement, selectionProvider, style);
1939 addAndAdaptSection(parentElement, section);
1940 return section;
1941 }
1942
1943 public UseRecordDetailSection createUseRecordDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1944 UseRecordDetailSection section = new UseRecordDetailSection(this, conversation, parentElement, selectionProvider, style);
1945 addAndAdaptSection(parentElement, section);
1946 return section;
1947 }
1948
1949 private void addAndAdaptSection(ICdmFormElement parentElement, AbstractFormSection<?> section) {
1950 parentElement.addElement(section);
1951 adapt(section);
1952 }
1953
1954 //--------DetailElements------------
1955
1956 public UseRecordDetailElement createUseRecordDetailElement(ICdmFormElement parentElement){
1957 UseRecordDetailElement element = new UseRecordDetailElement(this, parentElement);
1958 addAndAdaptElement(parentElement, element);
1959 return element;
1960 }
1961
1962 public DefinedTermDetailElement<NamedAreaLevel> createNamedAreaLevelElement(ICdmFormElement parentElement){
1963 DefinedTermDetailElement<NamedAreaLevel> element = new DefinedTermDetailElement<NamedAreaLevel>(this, parentElement);
1964 addAndAdaptElement(parentElement, element);
1965 return element;
1966 }
1967
1968 public eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement createNamedAreaDetailElement(ICdmFormElement parentElement){
1969 eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
1970 addAndAdaptElement(parentElement, element);
1971 return element;
1972 }
1973
1974 public TermVocabularyDetailElement createTermVocabularyDetailElement(ICdmFormElement parentElement){
1975 TermVocabularyDetailElement element = new TermVocabularyDetailElement(this, parentElement);
1976 addAndAdaptElement(parentElement, element);
1977 return element;
1978 }
1979
1980 public ReferenceEntityDetailElement createReferenceEntityDetailElement(ICdmFormElement parentElement){
1981 ReferenceEntityDetailElement element = new ReferenceEntityDetailElement(this, parentElement);
1982 addAndAdaptElement(parentElement, element);
1983 return element;
1984 }
1985
1986 public TaxonRelationshipDetailElement createTaxonRelationshipDetailElement(ICdmFormElement parentElement){
1987 TaxonRelationshipDetailElement element = new TaxonRelationshipDetailElement(this, parentElement);
1988 addAndAdaptElement(parentElement, element);
1989 return element;
1990 }
1991
1992 public GrantedAuthorityDetailElement createGrantedAuthorityDetailElement(ICdmFormElement parentElement){
1993 GrantedAuthorityDetailElement element = new GrantedAuthorityDetailElement(this, parentElement);
1994 addAndAdaptElement(parentElement, element);
1995 return element;
1996 }
1997
1998 public GroupDetailElement createGroupDetailElement(ICdmFormElement parentElement){
1999 GroupDetailElement element = new GroupDetailElement(this, parentElement);
2000 addAndAdaptElement(parentElement, element);
2001 return element;
2002 }
2003
2004 public UserDetailElement createUserDetailElement(ICdmFormElement parentElement){
2005 UserDetailElement element = new UserDetailElement(this, parentElement);
2006 addAndAdaptElement(parentElement, element);
2007 return element;
2008 }
2009
2010 public HybridDetailElement createHybridDetailElement(ICdmFormElement parentElement){
2011 HybridDetailElement element = new HybridDetailElement(this, parentElement);
2012 addAndAdaptElement(parentElement, element);
2013 return element;
2014 }
2015
2016 public InstitutionDetailElement createInstitutionDetailElement(ICdmFormElement parentElement){
2017 InstitutionDetailElement element = new InstitutionDetailElement(this, parentElement);
2018 addAndAdaptElement(parentElement, element);
2019 return element;
2020 }
2021
2022 public PolytomousKeyNodeDetailElement createPolytomousKeyNodeDetailElement(ICdmFormElement parentElement){
2023 PolytomousKeyNodeDetailElement element = new PolytomousKeyNodeDetailElement(this, parentElement);
2024 addAndAdaptElement(parentElement, element);
2025 return element;
2026 }
2027
2028 public PolytomousKeyDetailElement createPolytomousKeyDetailElement(ICdmFormElement parentElement){
2029 PolytomousKeyDetailElement element = new PolytomousKeyDetailElement(this, parentElement);
2030 addAndAdaptElement(parentElement, element);
2031 return element;
2032 }
2033
2034 public CollectionDetailElement createCollectionDetailElement(ICdmFormElement parentElement){
2035 CollectionDetailElement element = new CollectionDetailElement(this, parentElement);
2036 addAndAdaptElement(parentElement, element);
2037 return element;
2038 }
2039
2040 public TaxonNodeAgentRelationCollectionSection createTaxonNodeAgentRelationCollectionElement(ICdmFormElement parentElement, ConversationHolder conversation, int style){
2041 TaxonNodeAgentRelationCollectionSection element = new TaxonNodeAgentRelationCollectionSection(this, conversation, parentElement, style);
2042 adapt(element);
2043 parentElement.addElement(element);
2044
2045 return element;
2046 }
2047
2048 public TaxonNodeDetailElement createTaxonNodeDetailElement(ICdmFormElement parentElement, boolean createNew){
2049 TaxonNodeDetailElement element = new TaxonNodeDetailElement(this, parentElement, createNew);
2050 addAndAdaptElement(parentElement, element);
2051 return element;
2052 }
2053
2054 public ClassificationDetailElement createClassificationDetailElement(ICdmFormElement parentElement){
2055 ClassificationDetailElement element = new ClassificationDetailElement(this, parentElement);
2056 addAndAdaptElement(parentElement, element);
2057 return element;
2058 }
2059
2060 public CloneClassificationDetailElement createCloneClassificationDetailElement(ICdmFormElement parentElement){
2061 CloneClassificationDetailElement element = new CloneClassificationDetailElement(this, parentElement);
2062 addAndAdaptElement(parentElement, element);
2063 return element;
2064 }
2065
2066 public FeatureDistributionDetailElement createFeatureDistributionDetailElement(ICdmFormElement parentElement){
2067 FeatureDistributionDetailElement element = new FeatureDistributionDetailElement(this, parentElement);
2068 addAndAdaptElement(parentElement, element);
2069 return element;
2070 }
2071
2072 public NaturalLanguageDetailElement createNaturalLanguageDetailElement(ICdmFormElement parentElement){
2073 NaturalLanguageDetailElement element = new NaturalLanguageDetailElement(this, parentElement);
2074 addAndAdaptElement(parentElement, element);
2075 return element;
2076 }
2077
2078 public NonViralNameDetailElement createNonViralNameDetailElement(ICdmFormElement parentElement){
2079 NonViralNameDetailElement element = new NonViralNameDetailElement(this, parentElement);
2080 addAndAdaptElement(parentElement, element);
2081 return element;
2082 }
2083
2084 public DescriptionElementDetailElement createDescriptionElementDetailElement(ICdmFormElement parentElement, int style){
2085 DescriptionElementDetailElement element = new DescriptionElementDetailElement(this, parentElement, style);
2086 addAndAdaptElement(parentElement, element);
2087 return element;
2088 }
2089
2090 public DescriptionDetailElement createDescriptionDetailElement(ICdmFormElement parentElement, int style){
2091 DescriptionDetailElement element = new DescriptionDetailElement(this, parentElement, style);
2092 addAndAdaptElement(parentElement, element);
2093 return element;
2094 }
2095
2096 public PersonDetailElement createPersonDetailElement(ICdmFormElement parentElement, int style){
2097 PersonDetailElement element = new PersonDetailElement(this, parentElement, style);
2098 addAndAdaptElement(parentElement, element);
2099 return element;
2100 }
2101
2102 public TeamDetailElement createTeamDetailElement(ICdmFormElement parentElement, int style, boolean isNomenclatural){
2103 TeamDetailElement element = new TeamDetailElement(this, parentElement, style, isNomenclatural);
2104 addAndAdaptElement(parentElement, element);
2105 return element;
2106 }
2107
2108 public AuthorshipDetailElement createAuthorshipDetailElement(ICdmFormElement parentElement, int style){
2109 AuthorshipDetailElement element = new AuthorshipDetailElement(this, parentElement, style);
2110 addAndAdaptElement(parentElement, element);
2111 return element;
2112 }
2113
2114 public TaxonBaseDetailElement createTaxonBaseDetailElement(ICdmFormElement parentElement, int style){
2115 TaxonBaseDetailElement element = new TaxonBaseDetailElement(this, parentElement, style);
2116 addAndAdaptElement(parentElement, element);
2117 return element;
2118 }
2119
2120 public NameDetailElement createNameDetailElement(ICdmFormElement parentElement, int style){
2121 NameDetailElement element = new NameDetailElement(this, parentElement, style);
2122 addAndAdaptElement(parentElement, element);
2123 return element;
2124 }
2125
2126 public ReferenceDetailElement createReferenceDetailElement(ICdmFormElement parentElement, int style, boolean isWizard){
2127 ReferenceDetailElement element = new ReferenceDetailElement(this, parentElement, style, isWizard);
2128 addAndAdaptElement(parentElement, element);
2129 return element;
2130 }
2131
2132 public NomenclaturalReferenceDetailElement createNomenclaturalReferenceDetailElement(ICdmFormElement parentElement, int style){
2133 NomenclaturalReferenceDetailElement element = new NomenclaturalReferenceDetailElement(this, parentElement, style);
2134 addAndAdaptElement(parentElement, element);
2135 return element;
2136 }
2137
2138
2139 public FieldUnitGeneralDetailElement createFieldUnitGeneralDetailElement(ICdmFormElement parentElement){
2140 FieldUnitGeneralDetailElement element = new FieldUnitGeneralDetailElement(this, parentElement);
2141 addAndAdaptElement(parentElement, element);
2142 return element;
2143 }
2144
2145 public DerivedUnitGeneralDetailElement createDerivedUnitGeneralDetailElement(ICdmFormElement parentElement){
2146 DerivedUnitGeneralDetailElement element = new DerivedUnitGeneralDetailElement(this, parentElement);
2147 addAndAdaptElement(parentElement, element);
2148 return element;
2149 }
2150
2151 public TaxonAssociationDetailElement createTaxonAssociationDetailElement(ICdmFormElement parentElement){
2152 TaxonAssociationDetailElement element = new TaxonAssociationDetailElement(this, parentElement);
2153 addAndAdaptElement(parentElement, element);
2154 return element;
2155 }
2156
2157 public PreservedSpecimenGeneralDetailElement createPreservedSpecimenGeneralDetailElement(ICdmFormElement parentElement){
2158 PreservedSpecimenGeneralDetailElement element = new PreservedSpecimenGeneralDetailElement(this, parentElement);
2159 addAndAdaptElement(parentElement, element);
2160 return element;
2161 }
2162
2163 public TissueSampleGeneralDetailElement createTissueSampleGeneralDetailElement(ICdmFormElement parentElement){
2164 TissueSampleGeneralDetailElement element = new TissueSampleGeneralDetailElement(this, parentElement);
2165 addAndAdaptElement(parentElement, element);
2166 return element;
2167 }
2168
2169 public DnaSampleGeneralDetailElement createDnaSampleGeneralDetailElement(ICdmFormElement parentElement){
2170 DnaSampleGeneralDetailElement element = new DnaSampleGeneralDetailElement(this, parentElement);
2171 addAndAdaptElement(parentElement, element);
2172 return element;
2173 }
2174
2175 public DnaSamplePreparationPreservationDetailElement createDnaSamplePreparationPreservationDetailElement(ICdmFormElement parentElement){
2176 DnaSamplePreparationPreservationDetailElement element = new DnaSamplePreparationPreservationDetailElement(this, parentElement);
2177 addAndAdaptElement(parentElement, element);
2178 return element;
2179 }
2180
2181 public DnaQualityDetailElement createDnaQualityDetailElement(ICdmFormElement parentElement){
2182 DnaQualityDetailElement element = new DnaQualityDetailElement(this, parentElement);
2183 addAndAdaptElement(parentElement, element);
2184 return element;
2185 }
2186
2187 public SequenceGeneralDetailElement createSequenceGeneralDetailElement(ICdmFormElement parentElement){
2188 SequenceGeneralDetailElement element = new SequenceGeneralDetailElement(this, parentElement);
2189 addAndAdaptElement(parentElement, element);
2190 return element;
2191 }
2192
2193 public SingleReadGeneralDetailElement createSingleReadGeneralDetailElement(ICdmFormElement parentElement){
2194 SingleReadGeneralDetailElement element = new SingleReadGeneralDetailElement(this, parentElement);
2195 addAndAdaptElement(parentElement, element);
2196 return element;
2197 }
2198
2199 public PrimerGeneralDetailElement createPrimerGeneralDetailElement(ICdmFormElement parentElement){
2200 PrimerGeneralDetailElement element = new PrimerGeneralDetailElement(this, parentElement);
2201 addAndAdaptElement(parentElement, element);
2202 return element;
2203 }
2204
2205 public AmplificationGeneralDetailElement createAmplificationGeneralDetailElement(ICdmFormElement parentElement){
2206 AmplificationGeneralDetailElement element = new AmplificationGeneralDetailElement(this, parentElement);
2207 addAndAdaptElement(parentElement, element);
2208 return element;
2209 }
2210
2211 public AmplificationPrimerDetailElement createAmplificationPrimerDetailElement(ICdmFormElement parentElement){
2212 AmplificationPrimerDetailElement element = new AmplificationPrimerDetailElement(this, parentElement);
2213 addAndAdaptElement(parentElement, element);
2214 return element;
2215 }
2216
2217 public AmplificationCloningDetailElement createAmplificationCloningDetailElement(ICdmFormElement parentElement){
2218 AmplificationCloningDetailElement element = new AmplificationCloningDetailElement(this, parentElement);
2219 addAndAdaptElement(parentElement, element);
2220 return element;
2221 }
2222
2223 public AmplificationGelPhotoDetailElement createAmplificationGelPhotoDetailElement(ICdmFormElement parentElement){
2224 AmplificationGelPhotoDetailElement element = new AmplificationGelPhotoDetailElement(this, parentElement);
2225 addAndAdaptElement(parentElement, element);
2226 return element;
2227 }
2228
2229 public MediaSpecimenGeneralDetailElement createMediaSpecimenGeneralDetailElement(ICdmFormElement parentElement){
2230 MediaSpecimenGeneralDetailElement element = new MediaSpecimenGeneralDetailElement(this, parentElement);
2231 addAndAdaptElement(parentElement, element);
2232 return element;
2233 }
2234
2235 public MediaDetailElement createMediaDetailElement(ICdmFormElement parentElement){
2236 MediaDetailElement mediaDetailElement = new MediaDetailElement(this, parentElement);
2237 addAndAdaptElement(parentElement, mediaDetailElement);
2238 return mediaDetailElement;
2239 }
2240
2241 public GatheringEventDetailElement createGatheringEventDetailElement(ICdmFormElement parentElement) {
2242 GatheringEventDetailElement element = new GatheringEventDetailElement(this, parentElement);
2243 addAndAdaptElement(parentElement, element);
2244 return element;
2245 }
2246
2247 public FieldUnitDetailElement createFieldUnitDetailElement(ICdmFormElement parentElement) {
2248 FieldUnitDetailElement element = new FieldUnitDetailElement(this, parentElement);
2249 addAndAdaptElement(parentElement, element);
2250 return element;
2251 }
2252
2253 public SpecimenHierarchyDetailElement createSpecimenHierarchyDetailElement(ICdmFormElement parentElement) {
2254 SpecimenHierarchyDetailElement element = new SpecimenHierarchyDetailElement(this, parentElement);
2255 addAndAdaptElement(parentElement, element);
2256 return element;
2257 }
2258
2259 public DerivedUnitBaseDetailElement createDerivedUnitBaseDetailElement(ICdmFormElement parentElement) {
2260 DerivedUnitBaseDetailElement element = new DerivedUnitBaseDetailElement(this, parentElement);
2261 addAndAdaptElement(parentElement, element);
2262 return element;
2263 }
2264
2265 public OriginalLabelDataElement createOriginalLabelDataElement(ICdmFormElement parentElement) {
2266 OriginalLabelDataElement element = new OriginalLabelDataElement(this, parentElement);
2267 addAndAdaptElement(parentElement, element);
2268 return element;
2269 }
2270
2271 public PreservedSpecimenDetailElement createPreservedSpecimenDetailElement(ICdmFormElement parentElement) {
2272 PreservedSpecimenDetailElement element = new PreservedSpecimenDetailElement(this, parentElement);
2273 addAndAdaptElement(parentElement, element);
2274 return element;
2275 }
2276
2277 public DeterminationDetailElement createDeterminationDetailElement(ICdmFormElement parentElement) {
2278 DeterminationDetailElement element = new DeterminationDetailElement(this, parentElement);
2279 addAndAdaptElement(parentElement, element);
2280 return element;
2281 }
2282
2283 public SampleDesignationDetailElement createSampleDesignationDetailElement(ICdmFormElement parentElement) {
2284 SampleDesignationDetailElement element = new SampleDesignationDetailElement(this, parentElement);
2285 addAndAdaptElement(parentElement, element);
2286 return element;
2287 }
2288
2289 /**
2290 * @param parentElement
2291 * @param element
2292 */
2293 private void addAndAdaptElement(ICdmFormElement parentElement, AbstractCdmDetailElement<?> element) {
2294 adapt(element);
2295 parentElement.addElement(element);
2296 }
2297
2298 //--------EntityCollectionSection----------
2299 public TeamMemberSection createTeamMemberSection(ConversationHolder conversation, ICdmFormElement parentElement, int style, boolean isNomenclatural){
2300 TeamMemberSection section = new TeamMemberSection(this, conversation, parentElement, style, isNomenclatural);
2301 addAndAdaptSection(parentElement, section);
2302 return section;
2303 }
2304
2305 public AnnotationSection createAnnotationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2306 AnnotationSection section = new AnnotationSection(this, conversation, parentElement, style);
2307 addAndAdaptSection(parentElement, section);
2308 return section;
2309 }
2310
2311 public CreditSection createCreditSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2312 CreditSection section = new CreditSection(this, conversation, parentElement, style);
2313 addAndAdaptSection(parentElement, section);
2314 return section;
2315 }
2316
2317 public DescriptionElementSourceSection createDescriptionElementSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2318 DescriptionElementSourceSection section = new DescriptionElementSourceSection(this, conversation, parentElement, style);
2319 addAndAdaptSection(parentElement, section);
2320 return section;
2321 }
2322
2323 public ExtensionSection createExtensionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2324 ExtensionSection section = new ExtensionSection(this, conversation, parentElement, style);
2325 addAndAdaptSection(parentElement, section);
2326 return section;
2327 }
2328
2329 public MarkerSection createMarkerSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2330 MarkerSection section = new MarkerSection(this, conversation, parentElement, style);
2331 addAndAdaptSection(parentElement, section);
2332 return section;
2333 }
2334
2335 public MediaSection createMediaSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2336 MediaSection section = new MediaSection(this, conversation, parentElement, style);
2337 addAndAdaptSection(parentElement, section);
2338 return section;
2339 }
2340
2341 public DescriptionElementMediaSection createDescriptionElementMediaSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2342 DescriptionElementMediaSection section = new DescriptionElementMediaSection(this, conversation, parentElement, style);
2343 addAndAdaptSection(parentElement, section);
2344 return section;
2345 }
2346
2347 public MediaRepresentationSection createMediaRepresentationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2348 MediaRepresentationSection section = new MediaRepresentationSection(this, conversation, parentElement, style);
2349 addAndAdaptSection(parentElement, section);
2350 return section;
2351 }
2352
2353 public MediaRepresentationPartSection createMediaRepresentationPartSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2354 MediaRepresentationPartSection section = new MediaRepresentationPartSection(this, conversation, parentElement, style);
2355 addAndAdaptSection(parentElement, section);
2356 return section;
2357 }
2358
2359 public ModifierSection createModifierSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2360 ModifierSection section = new ModifierSection(this, conversation, parentElement, style);
2361 addAndAdaptSection(parentElement, section);
2362 return section;
2363 }
2364
2365 public NomenclaturalStatusSection createNomenclaturalStatusSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2366 NomenclaturalStatusSection section = new NomenclaturalStatusSection(this, conversation, parentElement, style);
2367 addAndAdaptSection(parentElement, section);
2368 return section;
2369 }
2370
2371 public NameRelationshipDetailSection createNameRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2372 NameRelationshipDetailSection section = new NameRelationshipDetailSection(this, conversation, parentElement, style);
2373 addAndAdaptSection(parentElement, section);
2374 return section;
2375 }
2376
2377 public ProtologueSection createProtologueSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2378 ProtologueSection section = new ProtologueSection(this, conversation, parentElement, style);
2379 addAndAdaptSection(parentElement, section);
2380 return section;
2381 }
2382
2383 public RightsSection createRightsSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2384 RightsSection section = new RightsSection(this, conversation, parentElement, style);
2385 addAndAdaptSection(parentElement, section);
2386 return section;
2387 }
2388
2389 public SourceSection createSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2390 SourceSection section = new SourceSection(this, conversation, parentElement, style);
2391 addAndAdaptSection(parentElement, section);
2392 return section;
2393 }
2394
2395 public ScopeSection createScopeSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2396 ScopeSection section = new ScopeSection(this, conversation, parentElement, style);
2397 addAndAdaptSection(parentElement, section);
2398 return section;
2399 }
2400
2401 public DescriptionSourceSection createDescriptionSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2402 DescriptionSourceSection section = new DescriptionSourceSection(this, conversation, parentElement, style);
2403 addAndAdaptSection(parentElement, section);
2404 return section;
2405 }
2406
2407 public TypeDesignationSection createTypeDesignationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2408 TypeDesignationSection section = new TypeDesignationSection(this, conversation, parentElement, style);
2409 addAndAdaptSection(parentElement, section);
2410 return section;
2411 }
2412
2413 public StateDataSection createStateDataSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2414 StateDataSection section = new StateDataSection(this, conversation, parentElement, style);
2415 addAndAdaptSection(parentElement, section);
2416 return section;
2417 }
2418
2419 public StatisticalMeasurementValueSection createStatisticalMeasurementValueSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2420 StatisticalMeasurementValueSection section = new StatisticalMeasurementValueSection(this, conversation, parentElement, style);
2421 addAndAdaptSection(parentElement, section);
2422 return section;
2423 }
2424
2425 public DescribedSpecimenSection createDescribedSpecimenSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2426 DescribedSpecimenSection section = new DescribedSpecimenSection(this, conversation, parentElement, style);
2427 addAndAdaptSection(parentElement, section);
2428 return section;
2429 }
2430
2431 public StateVocabularyCollectionSection createStateVocabulariesSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2432 StateVocabularyCollectionSection section = new StateVocabularyCollectionSection(this, conversation, parentElement, style);
2433 addAndAdaptSection(parentElement, section);
2434 return section;
2435 }
2436
2437 public RecommendedModifierVocabulariesCollectionSection createRecommendedModifierVocabulariesCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2438 RecommendedModifierVocabulariesCollectionSection section = new RecommendedModifierVocabulariesCollectionSection(this, conversation, parentElement, style);
2439 addAndAdaptSection(parentElement, section);
2440 return section;
2441 }
2442
2443 public MeasurementUnitCollectionSection createMeasurementUnitCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2444 MeasurementUnitCollectionSection section = new MeasurementUnitCollectionSection(this, conversation, parentElement, style);
2445 addAndAdaptSection(parentElement, section);
2446 return section;
2447 }
2448
2449 public StatisticalMeasureCollectionSection createStatisticalMeasureCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2450 StatisticalMeasureCollectionSection section = new StatisticalMeasureCollectionSection(this, conversation, parentElement, style);
2451 addAndAdaptSection(parentElement, section);
2452 return section;
2453 }
2454
2455 public CollectingAreasDetailSection createCollectingAreasDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2456 CollectingAreasDetailSection section = new CollectingAreasDetailSection(this, conversation, parentElement, style);
2457 addAndAdaptSection(parentElement, section);
2458 return section;
2459 }
2460
2461 public GeoScopeDetailSection createGeoScopeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2462 GeoScopeDetailSection section = new GeoScopeDetailSection(this, conversation, parentElement, style);
2463 addAndAdaptSection(parentElement, section);
2464 return section;
2465 }
2466
2467 public GeoScopePolyKeyDetailSection createGeoScopePolyKeyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2468 GeoScopePolyKeyDetailSection section = new GeoScopePolyKeyDetailSection(this, conversation, parentElement, style);
2469 addAndAdaptSection(parentElement, section);
2470 return section;
2471 }
2472
2473 public IdentifierSection createIdentifierDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2474 IdentifierSection section = new IdentifierSection(this, conversation, parentElement, style);
2475 addAndAdaptSection(parentElement, section);
2476 return section;
2477 }
2478
2479 public DerivedUnitFacadeIdentifierSection createDerivedUnitFacadeIdentifierSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2480 DerivedUnitFacadeIdentifierSection section = new DerivedUnitFacadeIdentifierSection(this, conversation, parentElement, style);
2481 addAndAdaptSection(parentElement, section);
2482 return section;
2483 }
2484
2485 public CurrentSampleDesignationDetailSection createCurrentSampleDesignationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2486 CurrentSampleDesignationDetailSection section = new CurrentSampleDesignationDetailSection(this, conversation, parentElement, style);
2487 addAndAdaptSection(parentElement, section);
2488 return section;
2489 }
2490
2491 public CurrentDeterminationDetailSection createCurrentDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2492 CurrentDeterminationDetailSection section = new CurrentDeterminationDetailSection(this, conversation, parentElement, style);
2493 addAndAdaptSection(parentElement, section);
2494 return section;
2495 }
2496
2497 public PreservedSpecimenCurrentDeterminationDetailSection createPreservedSpecimenCurrentDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2498 PreservedSpecimenCurrentDeterminationDetailSection section = new PreservedSpecimenCurrentDeterminationDetailSection(this, conversation, parentElement, style);
2499 addAndAdaptSection(parentElement, section);
2500 return section;
2501 }
2502
2503 public SampleDesignationHistoryDetailSection createSampleDesignationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2504 SampleDesignationHistoryDetailSection section = new SampleDesignationHistoryDetailSection(this, conversation, parentElement, style);
2505 addAndAdaptSection(parentElement, section);
2506 return section;
2507 }
2508
2509 public DeterminationHistoryDetailSection createDeterminationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2510 DeterminationHistoryDetailSection section = new DeterminationHistoryDetailSection(this, conversation, parentElement, style);
2511 addAndAdaptSection(parentElement, section);
2512 return section;
2513 }
2514
2515 public SpecimenCollectionDetailSection createSpecimenCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2516 SpecimenCollectionDetailSection section = new SpecimenCollectionDetailSection(this, conversation, parentElement, style);
2517 addAndAdaptSection(parentElement, section);
2518 return section;
2519 }
2520
2521 public PreservedSpecimenSourceCollectionDetailSection createPreservedSpecimenSourceCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2522 PreservedSpecimenSourceCollectionDetailSection section = new PreservedSpecimenSourceCollectionDetailSection(this, conversation, parentElement, style);
2523 addAndAdaptSection(parentElement, section);
2524 return section;
2525 }
2526
2527 public SourceCollectionDetailSection createSourceCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2528 SourceCollectionDetailSection section = new SourceCollectionDetailSection(this, conversation, parentElement, style);
2529 addAndAdaptSection(parentElement, section);
2530 return section;
2531 }
2532
2533 public ScopeRestrictionSection createScopeRestrictionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2534 ScopeRestrictionSection section = new ScopeRestrictionSection(this, conversation, parentElement, style);
2535 addAndAdaptSection(parentElement, section);
2536 return section;
2537 }
2538
2539 public MemberDetailSection createMemberDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2540 MemberDetailSection section = new MemberDetailSection(this, conversation, parentElement, style);
2541 addAndAdaptSection(parentElement, section);
2542 return section;
2543 }
2544
2545 public GrantedAuthorityDetailSection createGrantedAuthorityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2546 GrantedAuthorityDetailSection section = new GrantedAuthorityDetailSection(this, conversation, parentElement, style);
2547 addAndAdaptSection(parentElement, section);
2548 return section;
2549 }
2550
2551 public GroupsByUserDetailSection createGroupsByUserDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2552 GroupsByUserDetailSection section = new GroupsByUserDetailSection(this, conversation, parentElement, style);
2553 addAndAdaptSection(parentElement, section);
2554 return section;
2555 }
2556
2557 public TaxonomicScopeSection createTaxonomicScopeSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2558 TaxonomicScopeSection section = new TaxonomicScopeSection(this, conversation, parentElement, style);
2559 addAndAdaptSection(parentElement, section);
2560 return section;
2561 }
2562
2563
2564 public AbstractEntityCollectionElement createEntityCollectionElement(AbstractFormSection parentElement,
2565 Object versionableEntity, SelectionListener removeListener, Color backgroundColor, int style) {
2566 AbstractEntityCollectionElement element = null;
2567
2568 Object entity = HibernateProxyHelper.deproxy(versionableEntity);
2569
2570 if (entity instanceof Annotation) {
2571 element = new AnnotationElement(this, parentElement, (Annotation) entity, removeListener, style);
2572 }else if (entity instanceof Person ) {
2573 boolean isNomenclatural = false;
2574 if (parentElement instanceof TeamMemberSection){
2575 isNomenclatural = ((TeamMemberSection) parentElement).isNomenclaturalTeam();
2576 }
2577 element = new TeamMemberElement(this, parentElement, (Person) entity, removeListener, style, isNomenclatural);
2578 } else if (entity instanceof Credit) {
2579 element = new CreditElement(this, parentElement, (Credit) entity, removeListener, style);
2580 } else if (entity instanceof Extension) {
2581 element = new ExtensionElement(this, parentElement, (Extension) entity, removeListener, style);
2582 } else if (entity instanceof Marker) {
2583 element = new MarkerElement(this, parentElement, (Marker) entity, removeListener, style);
2584 } else if (entity instanceof TaxonNodeAgentRelation) {
2585 element = new TaxonNodeAgentRelationCollectionElement(this, parentElement, (TaxonNodeAgentRelation) entity, removeListener, backgroundColor, style);
2586 }else if (entity instanceof Media) {
2587 element = new MediaMetaElement(this, parentElement, (Media) entity, removeListener, style);
2588 } else if (entity instanceof MediaRepresentation) {
2589 element = new MediaRepresentationElement(this, parentElement, (MediaRepresentation) entity, removeListener,
2590 style);
2591 } else if (entity instanceof ImageFile) {
2592 element = new ImageFileElement(this, parentElement, (ImageFile) entity, removeListener, style);
2593 } else if (entity instanceof MediaRepresentationPart) {
2594 element = new MediaRepresentationPartElement<>(this, parentElement, (MediaRepresentationPart) entity,
2595 removeListener, style);
2596 } else if (entity instanceof NomenclaturalStatus) {
2597 element = new NomenclaturalStatusElement(this, parentElement, (NomenclaturalStatus) entity, removeListener,
2598 style);
2599 } else if (entity instanceof Rights) {
2600 element = new RightsElement(this, parentElement, (Rights) entity, removeListener, style);
2601 } else if (entity instanceof DescriptionElementSource) {
2602 element = new DescriptionElementSourceElement(this, parentElement, (DescriptionElementSource) entity,
2603 removeListener, style);
2604 } else if (entity instanceof TaxonNodeAgentRelation) {
2605 element = new TaxonNodeAgentRelationCollectionElement(this, parentElement, (TaxonNodeAgentRelation) entity,
2606 removeListener,backgroundColor, style);
2607 }
2608 else if (entity instanceof IdentifiableSource) {
2609 element = new IdentifiableSourceElement(this, parentElement, (IdentifiableSource) entity, removeListener,
2610 style);
2611 } else if (entity instanceof DefinedTerm) {
2612 switch(((DefinedTerm)entity).getTermType()) {
2613 case Scope:
2614 element = new ScopeElement(this,
2615 parentElement,
2616 (DefinedTerm) entity,
2617 removeListener,
2618 style);
2619 break;
2620 case Modifier:
2621 element = new ModifierElement(this,
2622 parentElement,
2623 (DefinedTerm) entity,
2624 removeListener,
2625 style);
2626 break;
2627 default:
2628 break;
2629
2630 }
2631 } else if (entity instanceof Reference) {
2632 if(parentElement instanceof SequenceReferenceCollectionDetailSection){
2633 element = new SequenceReferenceCollectionDetailElement(this, parentElement, (Reference) entity, removeListener, style);
2634 }
2635 else{
2636 element = new DescriptionSourceElement(this, parentElement, (Reference) entity, removeListener, style);
2637 }
2638 } else if (entity instanceof NameTypeDesignation) {
2639 element = new NameTypeDesignationElement(this, parentElement, (NameTypeDesignation) entity, removeListener,
2640 style);
2641 } else if (entity instanceof NameRelationship) {
2642 element = new NameRelationshipDetailElement(this, parentElement, (NameRelationship) entity, removeListener,
2643 style);
2644 } else if (entity instanceof SpecimenTypeDesignation) {
2645 if(parentElement instanceof DerivedUnitTypeDesignationSection){
2646 element = new DerivedUnitTypeDesignationElement(this, parentElement, (SpecimenTypeDesignation) entity,
2647 removeListener, style);
2648 }
2649 else{
2650 element = new SpecimenTypeDesignationElement(this, parentElement, (SpecimenTypeDesignation) entity,
2651 removeListener, style);
2652 }
2653 } else if (entity instanceof StateData) {
2654 element = new StateDataElement(this, parentElement, (StateData) entity, removeListener, style);
2655 } else if (entity instanceof StatisticalMeasurementValue) {
2656 element = new StatisticalMeasurementValueElement(this, parentElement, (StatisticalMeasurementValue) entity,
2657 removeListener, style);
2658 } else if (entity instanceof DerivedUnit) {
2659 switch(((DerivedUnit)entity).getRecordBasis()) {
2660 case LivingSpecimen:
2661 case PreservedSpecimen:
2662 case OtherSpecimen:
2663 element = new SpecimenCollectionDetailElement(this,
2664 parentElement,
2665 (DerivedUnit) entity,
2666 removeListener,
2667 style);
2668 break;
2669 default:
2670 element = new DerivedUnitElement(this,
2671 parentElement,
2672 (DerivedUnit) entity,
2673 removeListener,
2674 style);
2675 }
2676
2677 } else if (entity instanceof NamedArea) {
2678 element = new NamedAreaDetailElement(this, parentElement, (NamedArea) entity, removeListener, style);
2679 } else if (entity instanceof DeterminationEvent) {
2680 element = new DeterminationEventDetailElement(this, parentElement, (DeterminationEvent) entity, removeListener, style);
2681 } else if (entity instanceof User) {
2682 element = new MemberDetailElement(this, parentElement, (User) entity, removeListener, style);
2683 } else if (entity instanceof GrantedAuthority) {
2684 element = new GrantedAuthorityCollectionElement(this, parentElement, (GrantedAuthorityImpl) entity,
2685 removeListener, style);
2686 } else if (entity instanceof Group) {
2687 element = new GroupsByUserDetailElement(this, parentElement, (Group) entity, removeListener, style);
2688 } else if (entity instanceof Taxon) {
2689 element = new TaxonDetailElement(this, parentElement, (Taxon) entity, removeListener, style);
2690 } else if (entity instanceof DescriptionElementBase) {
2691 // this is the special case for protologs, maybe we can do this
2692 // differently when API improves
2693 DescriptionElementBase descriptionElement = (DescriptionElementBase) entity;
2694 if (descriptionElement.getFeature().equals(Feature.PROTOLOGUE())) {
2695 element = new ProtologueElement(this, parentElement, descriptionElement, removeListener, style);
2696 }
2697 } else if (entity instanceof Identifier) {
2698 if(parentElement instanceof AbstractSampleDesignationDetailSection){
2699 element = new SampleDesignationTextDetailElement(this, parentElement, (Identifier<DnaSample>) entity, removeListener, backgroundColor, style);
2700 }
2701 else{
2702 element = new IdentifierElement(this, parentElement, (Identifier) entity, removeListener, style);
2703 }
2704 } else if (entity instanceof TermVocabulary) {
2705 TermVocabulary<?> termVocabulary = (TermVocabulary<?>)entity;
2706 switch (termVocabulary.getTermType()) {
2707 case State:
2708 element = new StateVocabularyCollectionElement(this, parentElement, (TermVocabulary<State>) entity, removeListener, backgroundColor, style);
2709 break;
2710 case Modifier:
2711 element = new RecommendedModifierVocabulariesElement(this, parentElement, (TermVocabulary<DefinedTerm>) entity, removeListener, backgroundColor, style);
2712 break;
2713 default:
2714 break;
2715 }
2716 } else if (entity instanceof MeasurementUnit) {
2717 element = new MeasurementUnitCollectionElement(this, parentElement, (MeasurementUnit) entity, removeListener, backgroundColor, style);
2718 } else if (entity instanceof StatisticalMeasure) {
2719 element = new StatisticalMeasureCollectionElement(this, parentElement, (StatisticalMeasure) entity, removeListener, backgroundColor, style);
2720 }
2721
2722
2723 if (element == null) {
2724 MessagingUtils.messageDialog("No element for entity", this,
2725 "Could not generate element for entity. Looks like the case is not handled already. Check implementation. Entity: "
2726 + entity, null);
2727 }
2728
2729 else{
2730 if (backgroundColor != null && !backgroundColor.isDisposed()) {
2731 element.setPersistentBackground(backgroundColor);
2732 }
2733 adapt(element);
2734 parentElement.addElement(element);
2735 }
2736
2737 return element;
2738 }
2739
2740 /**
2741 * <p>
2742 * Creates a selection element for the given type T.
2743 * </p>
2744 * <p>
2745 * <strong>Selection elements not handled by this method:</strong>
2746 * <ul>
2747 * <li>{@link TaxonNodeSelectionElement} see
2748 * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
2749 * </li>
2750 * <li>{@link NomenclaturalAuthorTeamSelectionElement} see
2751 * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
2752 * </li>
2753 * </ul>
2754 * </p>
2755 *
2756 * @param clazz
2757 * a {@link Class} object of the type that you want the selection
2758 * element to handle
2759 * @param parentElement
2760 * a {@link ICdmFormElement} object.
2761 * @param labelString
2762 * a {@link String} object.
2763 * @param selectionType
2764 * @param selection
2765 * a {@link ICdmBase} object.
2766 * @param style
2767 * a int.
2768 * @param conversation
2769 * a {@link ConversationHolder} object.
2770 * @return a {@link EntitySelectionElement} object.
2771 */
2772 public <T extends CdmBase> EntitySelectionElement<T> createSelectionElement(Class<T> clazz,
2773 ConversationHolder conversation, ICdmFormElement parentElement, String labelString, T selection, int mode,
2774 int style, boolean filterElement) {
2775 EntitySelectionElement<T> element = new EntitySelectionElement<T>(this, conversation, parentElement, clazz,
2776 labelString, selection, mode, style, filterElement);
2777 adapt(element);
2778 parentElement.addElement(element);
2779 return element;
2780 }
2781
2782 public <T extends CdmBase> EntitySelectionElement<T> createSelectionElement(Class<T> clazz,
2783 ConversationHolder conversation, ICdmFormElement parentElement, String labelString, T selection, int mode,
2784 int style) {
2785 EntitySelectionElement<T> element = new EntitySelectionElement<T>(this, conversation, parentElement, clazz,
2786 labelString, selection, mode, style);
2787 adapt(element);
2788 parentElement.addElement(element);
2789 return element;
2790 }
2791
2792 /**
2793 * <p>
2794 * Creates a selection element for the given type T which shows only the <b>abbreviated</b> title as the label.
2795 * </p>
2796 * <p>
2797 * <strong>Selection elements not handled by this method:</strong>
2798 * <ul>
2799 * <li>{@link TaxonNodeSelectionElement} see
2800 * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
2801 * </li>
2802 * <li>{@link NomenclaturalAuthorTeamSelectionElement} see
2803 * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
2804 * </li>
2805 * </ul>
2806 * </p>
2807 *
2808 * @param clazz
2809 * a {@link Class} object of the type that you want the selection
2810 * element to handle
2811 * @param parentElement
2812 * a {@link ICdmFormElement} object.
2813 * @param labelString
2814 * a {@link String} object.
2815 * @param selectionType
2816 * @param selection
2817 * a {@link ICdmBase} object.
2818 * @param style
2819 * a int.
2820 * @param conversation
2821 * a {@link ConversationHolder} object.
2822 * @return a {@link EntitySelectionElement} object.
2823 */
2824 public <T extends CdmBase> EntitySelectionElementWithAbbreviatedTitle<T> createSelectionElementWithAbbreviatedTitle(
2825 Class<T> clazz, ConversationHolder conversation, ICdmFormElement parentElement, String labelString,
2826 T selection, int mode, int style) {
2827 EntitySelectionElementWithAbbreviatedTitle<T> element = new EntitySelectionElementWithAbbreviatedTitle<T>(this, conversation, parentElement, clazz,
2828 labelString, selection, mode, style);
2829 adapt(element);
2830 parentElement.addElement(element);
2831 return element;
2832 }
2833
2834 public TaxonNodeSelectionElement createTaxonNodeSelectionElement(ConversationHolder conversation,
2835 ICdmFormElement parentElement, String labelString, TaxonNode selection, int mode, int style) {
2836 TaxonNodeSelectionElement element = new TaxonNodeSelectionElement(this, conversation, parentElement,
2837 labelString, selection, mode, style);
2838 adapt(element);
2839 parentElement.addElement(element);
2840 return element;
2841 }
2842
2843 // public NomenclaturalAuthorTeamSelectionElement createNomenclaturalAuthorTeamSelectionElement(
2844 // ConversationHolder conversation, ICdmFormElement parentElement, String labelString, Team selection,
2845 // int mode, int style) {
2846 // NomenclaturalAuthorTeamSelectionElement element = new NomenclaturalAuthorTeamSelectionElement(this,
2847 // conversation, parentElement, labelString, selection, mode, style);
2848 // adapt(element);
2849 // parentElement.addElement(element);
2850 // return element;
2851 // }
2852
2853 /** {@inheritDoc} */
2854 public LabelElement createLabel(ICdmFormElement parentElement, String text) {
2855 LabelElement labelElement = new LabelElement(this, parentElement, text);
2856 adapt(labelElement);
2857 parentElement.addElement(labelElement);
2858 return labelElement;
2859 }
2860
2861 public DateElement createDateElement(ICdmFormElement formElement, String labelText, DateTime dateTime, int style){
2862 Label label = new Label(formElement.getLayoutComposite(), style);
2863 label.setText(labelText+" (yyyy-MM-dd)");
2864 DateElement dateElement = new DateElement(formElement.getLayoutComposite(), dateTime, style);
2865 dateElement.initController(this, formElement);
2866 return dateElement;
2867 }
2868
2869 /**
2870 * <p>
2871 * Getter for the field <code>selectionProvider</code>.
2872 * </p>
2873 *
2874 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
2875 */
2876 public ISelectionProvider getSelectionProvider() {
2877 return selectionProvider;
2878 }
2879
2880 /**
2881 * <p>
2882 * createDetailedDescriptionDetailElement
2883 * </p>
2884 *
2885 * @param parentElement
2886 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
2887 * object.
2888 * @param entity
2889 * a
2890 * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
2891 * object.
2892 * @param style
2893 * a int.
2894 * @return a
2895 * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
2896 * object.
2897 */
2898 public AbstractDetailedDescriptionDetailElement createDetailedDescriptionDetailElement(
2899 ICdmFormElement parentElement, DescriptionElementBase entity, int style) {
2900 AbstractDetailedDescriptionDetailElement detailedDescriptionElement = null;
2901
2902 if (entity instanceof CategoricalData) {
2903 detailedDescriptionElement = new CategoricalDataDetailElement(this, parentElement,
2904 (CategoricalData) entity, style);
2905 } else if (entity instanceof CommonTaxonName) {
2906 detailedDescriptionElement = new CommonNameDetailElement(this, parentElement, (CommonTaxonName) entity,
2907 style);
2908 } else if (entity instanceof Distribution) {
2909 detailedDescriptionElement = new DistributionDetailElement(this, parentElement, (Distribution) entity,
2910 style);
2911 } else if (entity instanceof IndividualsAssociation) {
2912 detailedDescriptionElement = new IndividualsAssociationDetailElement(this, parentElement,
2913 (IndividualsAssociation) entity, style);
2914 } else if (entity instanceof QuantitativeData) {
2915 detailedDescriptionElement = new QuantitativeDataDetailElement(this, parentElement,
2916 (QuantitativeData) entity, style);
2917 } else if (entity instanceof TaxonInteraction) {
2918 detailedDescriptionElement = new TaxonInteractionDetailElement(this, parentElement,
2919 (TaxonInteraction) entity, style);
2920 } else if (entity instanceof TextData) {
2921 detailedDescriptionElement = new TextDataDetailElement(this, parentElement, (TextData) entity, style);
2922 } else {
2923 throw new IllegalStateException("There is no interface for the given description element");
2924 }
2925 adapt(detailedDescriptionElement);
2926 parentElement.addElement(detailedDescriptionElement);
2927 return detailedDescriptionElement;
2928
2929 }
2930
2931 /**
2932 * Creates a styled text as a part of the form.
2933 *
2934 * @param parent
2935 * the text parent
2936 * @param value
2937 * the text initial value
2938 * @param style
2939 * the text style
2940 * @return the text widget
2941 */
2942 public StyledText createStyledText(Composite parent, String value, int style) {
2943 StyledText text = new StyledText(parent, getBorderStyle() | style | getOrientation());
2944 if (value != null) {
2945 text.setText(value);
2946 }
2947 text.setForeground(getColors().getForeground());
2948 text.setBackground(getColors().getBackground());
2949 // text.addFocusListener(visibilityHandler);
2950 return text;
2951 }
2952
2953 public PreservedSpecimenDetailSection createPreservedSpecimenDetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
2954 PreservedSpecimenDetailSection section = new PreservedSpecimenDetailSection(this, conversation, parentElement, selectionProvider, style);
2955 addAndAdaptSection(parentElement, section);
2956 return section;
2957 }
2958
2959 /**
2960 * @param formElement
2961 * @param conversationHolder
2962 * @param style
2963 * @return
2964 */
2965 public TaxonNodeAgentRelationCollectionSection createTaxonNodeAgentRelationCollectionSection(
2966 ICdmFormElement formElement, ConversationHolder conversationHolder, int style) {
2967 TaxonNodeAgentRelationCollectionSection section = new TaxonNodeAgentRelationCollectionSection(this, conversationHolder, formElement, style);
2968 addAndAdaptSection(formElement, section);
2969 return section;
2970 }
2971
2972
2973
2974
2975
2976 }