ref #4867 Implement "Clone Classification" functionality
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / element / CdmFormFactory.java
1 /**
2 *
3 */
4 package eu.etaxonomy.taxeditor.ui.element;
5
6 import java.net.URI;
7 import java.util.ArrayList;
8 import java.util.HashSet;
9 import java.util.List;
10 import java.util.Map;
11 import java.util.Set;
12
13 import org.eclipse.jface.util.IPropertyChangeListener;
14 import org.eclipse.jface.viewers.ISelection;
15 import org.eclipse.jface.viewers.ISelectionProvider;
16 import org.eclipse.jface.window.Window;
17 import org.eclipse.swt.SWT;
18 import org.eclipse.swt.custom.StyledText;
19 import org.eclipse.swt.events.FocusAdapter;
20 import org.eclipse.swt.events.FocusEvent;
21 import org.eclipse.swt.events.FocusListener;
22 import org.eclipse.swt.events.MouseAdapter;
23 import org.eclipse.swt.events.MouseEvent;
24 import org.eclipse.swt.events.MouseListener;
25 import org.eclipse.swt.events.SelectionEvent;
26 import org.eclipse.swt.events.SelectionListener;
27 import org.eclipse.swt.events.TypedEvent;
28 import org.eclipse.swt.graphics.Color;
29 import org.eclipse.swt.graphics.Font;
30 import org.eclipse.swt.widgets.Composite;
31 import org.eclipse.swt.widgets.Control;
32 import org.eclipse.swt.widgets.Display;
33 import org.eclipse.swt.widgets.Event;
34 import org.eclipse.swt.widgets.Label;
35 import org.eclipse.ui.forms.IFormColors;
36 import org.eclipse.ui.forms.widgets.ExpandableComposite;
37 import org.eclipse.ui.forms.widgets.FormToolkit;
38 import org.eclipse.ui.forms.widgets.Section;
39 import org.eclipse.ui.internal.forms.widgets.FormFonts;
40 import org.joda.time.DateTime;
41 import org.joda.time.Partial;
42 import org.springframework.security.core.GrantedAuthority;
43
44 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
45 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
46 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
47 import eu.etaxonomy.cdm.model.agent.Person;
48 import eu.etaxonomy.cdm.model.agent.Team;
49 import eu.etaxonomy.cdm.model.common.Annotation;
50 import eu.etaxonomy.cdm.model.common.CdmBase;
51 import eu.etaxonomy.cdm.model.common.Credit;
52 import eu.etaxonomy.cdm.model.common.DefinedTerm;
53 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
54 import eu.etaxonomy.cdm.model.common.Extension;
55 import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
56 import eu.etaxonomy.cdm.model.common.Group;
57 import eu.etaxonomy.cdm.model.common.ICdmBase;
58 import eu.etaxonomy.cdm.model.common.IEnumTerm;
59 import eu.etaxonomy.cdm.model.common.IdentifiableSource;
60 import eu.etaxonomy.cdm.model.common.Identifier;
61 import eu.etaxonomy.cdm.model.common.LSID;
62 import eu.etaxonomy.cdm.model.common.Language;
63 import eu.etaxonomy.cdm.model.common.LanguageString;
64 import eu.etaxonomy.cdm.model.common.Marker;
65 import eu.etaxonomy.cdm.model.common.Representation;
66 import eu.etaxonomy.cdm.model.common.TermBase;
67 import eu.etaxonomy.cdm.model.common.TermType;
68 import eu.etaxonomy.cdm.model.common.TermVocabulary;
69 import eu.etaxonomy.cdm.model.common.TimePeriod;
70 import eu.etaxonomy.cdm.model.common.User;
71 import eu.etaxonomy.cdm.model.common.VersionableEntity;
72 import eu.etaxonomy.cdm.model.description.CategoricalData;
73 import eu.etaxonomy.cdm.model.description.CommonTaxonName;
74 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
75 import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
76 import eu.etaxonomy.cdm.model.description.Distribution;
77 import eu.etaxonomy.cdm.model.description.Feature;
78 import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
79 import eu.etaxonomy.cdm.model.description.KeyStatement;
80 import eu.etaxonomy.cdm.model.description.MeasurementUnit;
81 import eu.etaxonomy.cdm.model.description.QuantitativeData;
82 import eu.etaxonomy.cdm.model.description.State;
83 import eu.etaxonomy.cdm.model.description.StateData;
84 import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
85 import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue;
86 import eu.etaxonomy.cdm.model.description.TaxonInteraction;
87 import eu.etaxonomy.cdm.model.description.TextData;
88 import eu.etaxonomy.cdm.model.location.NamedArea;
89 import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
90 import eu.etaxonomy.cdm.model.location.Point;
91 import eu.etaxonomy.cdm.model.media.ImageFile;
92 import eu.etaxonomy.cdm.model.media.Media;
93 import eu.etaxonomy.cdm.model.media.MediaRepresentation;
94 import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
95 import eu.etaxonomy.cdm.model.media.Rights;
96 import eu.etaxonomy.cdm.model.molecular.DnaSample;
97 import eu.etaxonomy.cdm.model.name.NameRelationship;
98 import eu.etaxonomy.cdm.model.name.NameTypeDesignation;
99 import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
100 import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
101 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
102 import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
103 import eu.etaxonomy.cdm.model.reference.Reference;
104 import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
105 import eu.etaxonomy.cdm.model.taxon.Taxon;
106 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
107 import eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation;
108 import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
109 import eu.etaxonomy.taxeditor.model.MessagingUtils;
110 import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
111 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
112 import eu.etaxonomy.taxeditor.ui.combo.VocabularyComboElement;
113 import eu.etaxonomy.taxeditor.ui.dialog.CloneClassificationDetailElement;
114 import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection.UnitType;
115 import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement;
116 import eu.etaxonomy.taxeditor.ui.openurl.IOpenUrlEnabled;
117 import eu.etaxonomy.taxeditor.ui.openurl.OpenUrlSelectorElement;
118 import eu.etaxonomy.taxeditor.ui.password.EditPasswordElement;
119 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
120 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
121 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
122 import eu.etaxonomy.taxeditor.ui.section.EmptyElement;
123 import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionDetailElement;
124 import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionDetailSection;
125 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailElement;
126 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
127 import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailElement;
128 import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
129 import eu.etaxonomy.taxeditor.ui.section.agent.TeamMemberElement;
130 import eu.etaxonomy.taxeditor.ui.section.agent.TeamMemberSection;
131 import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
132 import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationDetailElement;
133 import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationDetailSection;
134 import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeAgentRelationCollectionElement;
135 import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeAgentRelationCollectionSection;
136 import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailElement;
137 import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailSection;
138 import eu.etaxonomy.taxeditor.ui.section.common.ReferenceEntityDetailElement;
139 import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
140 import eu.etaxonomy.taxeditor.ui.section.description.DerivedUnitElement;
141 import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
142 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailElement;
143 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
144 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailElement;
145 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
146 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
147 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceElement;
148 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
149 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceElement;
150 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
151 import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
152 import eu.etaxonomy.taxeditor.ui.section.description.ModifierElement;
153 import eu.etaxonomy.taxeditor.ui.section.description.ModifierSection;
154 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageDetailElement;
155 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
156 import eu.etaxonomy.taxeditor.ui.section.description.ScopeElement;
157 import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
158 import eu.etaxonomy.taxeditor.ui.section.description.StateDataElement;
159 import eu.etaxonomy.taxeditor.ui.section.description.StateDataSection;
160 import eu.etaxonomy.taxeditor.ui.section.description.StatisticalMeasurementValueElement;
161 import eu.etaxonomy.taxeditor.ui.section.description.StatisticalMeasurementValueSection;
162 import eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement;
163 import eu.etaxonomy.taxeditor.ui.section.description.detail.CategoricalDataDetailElement;
164 import eu.etaxonomy.taxeditor.ui.section.description.detail.CommonNameDetailElement;
165 import eu.etaxonomy.taxeditor.ui.section.description.detail.DistributionDetailElement;
166 import eu.etaxonomy.taxeditor.ui.section.description.detail.IndividualsAssociationDetailElement;
167 import eu.etaxonomy.taxeditor.ui.section.description.detail.QuantitativeDataDetailElement;
168 import eu.etaxonomy.taxeditor.ui.section.description.detail.TaxonInteractionDetailElement;
169 import eu.etaxonomy.taxeditor.ui.section.description.detail.TextDataDetailElement;
170 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailElement;
171 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
172 import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityCollectionElement;
173 import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailElement;
174 import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
175 import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailElement;
176 import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
177 import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailElement;
178 import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
179 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailElement;
180 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
181 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailElement;
182 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
183 import eu.etaxonomy.taxeditor.ui.section.key.ScopeRestrictionSection;
184 import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
185 import eu.etaxonomy.taxeditor.ui.section.media.ImageFileElement;
186 import eu.etaxonomy.taxeditor.ui.section.media.MediaDetailElement;
187 import eu.etaxonomy.taxeditor.ui.section.media.MediaMetaElement;
188 import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationElement;
189 import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationPartElement;
190 import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationPartSection;
191 import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationSection;
192 import eu.etaxonomy.taxeditor.ui.section.media.MediaSection;
193 import eu.etaxonomy.taxeditor.ui.section.name.AuthorshipDetailElement;
194 import eu.etaxonomy.taxeditor.ui.section.name.AuthorshipDetailSection;
195 import eu.etaxonomy.taxeditor.ui.section.name.HybridDetailElement;
196 import eu.etaxonomy.taxeditor.ui.section.name.HybridDetailSection;
197 import eu.etaxonomy.taxeditor.ui.section.name.NameDetailElement;
198 import eu.etaxonomy.taxeditor.ui.section.name.NameDetailSection;
199 import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailElement;
200 import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
201 import eu.etaxonomy.taxeditor.ui.section.name.NameTypeDesignationElement;
202 import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusElement;
203 import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
204 import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailElement;
205 import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
206 import eu.etaxonomy.taxeditor.ui.section.name.ProtologueElement;
207 import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
208 import eu.etaxonomy.taxeditor.ui.section.name.SpecimenTypeDesignationElement;
209 import eu.etaxonomy.taxeditor.ui.section.name.SynonymRelationshipDetailElement;
210 import eu.etaxonomy.taxeditor.ui.section.name.SynonymRelationshipDetailSection;
211 import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
212 import eu.etaxonomy.taxeditor.ui.section.occurrence.CollectingAreasDetailSection;
213 import eu.etaxonomy.taxeditor.ui.section.occurrence.CollectionDetailElement;
214 import eu.etaxonomy.taxeditor.ui.section.occurrence.CurrentDeterminationDetailSection;
215 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailElement;
216 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
217 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailElement;
218 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailSection;
219 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailElement;
220 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
221 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationEventDetailElement;
222 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationHistoryDetailSection;
223 import eu.etaxonomy.taxeditor.ui.section.occurrence.EmptySection;
224 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailElement;
225 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
226 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailElement;
227 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
228 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailElement;
229 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
230 import eu.etaxonomy.taxeditor.ui.section.occurrence.GeoScopeDetailSection;
231 import eu.etaxonomy.taxeditor.ui.section.occurrence.GeoScopePolyKeyDetailSection;
232 import eu.etaxonomy.taxeditor.ui.section.occurrence.NamedAreaDetailElement;
233 import eu.etaxonomy.taxeditor.ui.section.occurrence.OriginalLabelDataSection;
234 import eu.etaxonomy.taxeditor.ui.section.occurrence.SourceCollectionDetailSection;
235 import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenCollectionDetailElement;
236 import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenCollectionDetailSection;
237 import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenHierarchyDetailElement;
238 import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenHierarchyDetailSection;
239 import eu.etaxonomy.taxeditor.ui.section.occurrence.association.DerivedUnitTypeDesignationElement;
240 import eu.etaxonomy.taxeditor.ui.section.occurrence.association.DerivedUnitTypeDesignationSection;
241 import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailElement;
242 import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
243 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenCurrentDeterminationDetailSection;
244 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailElement;
245 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailSection;
246 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenGeneralDetailElement;
247 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenGeneralDetailSection;
248 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenSourceCollectionDetailSection;
249 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractSampleDesignationDetailSection;
250 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationCloningDetailElement;
251 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationCloningDetailSection;
252 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGelPhotoCollectionDetailSection;
253 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGelPhotoDetailElement;
254 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGeneralDetailElement;
255 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGeneralDetailSection;
256 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationPrimerDetailElement;
257 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationPrimerDetailSection;
258 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.CurrentSampleDesignationDetailSection;
259 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailElement;
260 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailSection;
261 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailElement;
262 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailSection;
263 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSamplePreparationPreservationDetailElement;
264 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSamplePreparationPreservationSection;
265 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.PrimerGeneralDetailElement;
266 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailElement;
267 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailSection;
268 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationHistoryDetailSection;
269 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationTextDetailElement;
270 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceContigFileCollectionDetailSection;
271 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailElement;
272 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailSection;
273 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollectionDetailElement;
274 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollectionDetailSection;
275 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailElement;
276 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailSection;
277 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
278 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailElement;
279 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
280 import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailElement;
281 import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
282 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailElement;
283 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
284 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailElement;
285 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
286 import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationElement;
287 import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
288 import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseElement;
289 import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseSection;
290 import eu.etaxonomy.taxeditor.ui.section.supplemental.CreditElement;
291 import eu.etaxonomy.taxeditor.ui.section.supplemental.CreditSection;
292 import eu.etaxonomy.taxeditor.ui.section.supplemental.ExtensionElement;
293 import eu.etaxonomy.taxeditor.ui.section.supplemental.ExtensionSection;
294 import eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection;
295 import eu.etaxonomy.taxeditor.ui.section.supplemental.IdentifiableSourceElement;
296 import eu.etaxonomy.taxeditor.ui.section.supplemental.MarkerElement;
297 import eu.etaxonomy.taxeditor.ui.section.supplemental.MarkerSection;
298 import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsElement;
299 import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection;
300 import eu.etaxonomy.taxeditor.ui.section.supplemental.SourceSection;
301 import eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement;
302 import eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection;
303 import eu.etaxonomy.taxeditor.ui.section.supplemental.identifier.DerivedUnitFacadeIdentifierSection;
304 import eu.etaxonomy.taxeditor.ui.section.supplemental.identifier.IdentifierElement;
305 import eu.etaxonomy.taxeditor.ui.section.supplemental.identifier.IdentifierSection;
306 import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement;
307 import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
308 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailElement;
309 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
310 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonDetailElement;
311 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailElement;
312 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
313 import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailElement;
314 import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
315 import eu.etaxonomy.taxeditor.ui.section.user.UserDetailElement;
316 import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
317 import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailElement;
318 import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
319 import eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailElement;
320 import eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailSection;
321 import eu.etaxonomy.taxeditor.ui.section.vocabulary.FeatureDetailElement;
322 import eu.etaxonomy.taxeditor.ui.section.vocabulary.MeasurementUnitCollectionElement;
323 import eu.etaxonomy.taxeditor.ui.section.vocabulary.MeasurementUnitCollectionSection;
324 import eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailSection;
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 TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termType, labelString, selection, true, style, false);
919 adapt(element);
920 parentElement.addElement(element);
921 return element;
922 }
923
924 public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
925 TermType termType,
926 ICdmFormElement parentElement,
927 String labelString,
928 T selection,
929 boolean addEmptyElement,
930 int style) {
931 TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termType, labelString, selection, addEmptyElement, style, false);
932 adapt(element);
933 parentElement.addElement(element);
934 return element;
935 }
936 public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
937 TermType termType,
938 ICdmFormElement parentElement,
939 String labelString,
940 T selection,
941 boolean addEmptyElement,
942 int style, boolean useAbbrevLabel) {
943 TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termType, labelString, selection, addEmptyElement, style, useAbbrevLabel);
944 adapt(element);
945 parentElement.addElement(element);
946 return element;
947 }
948
949
950 public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
951 TermVocabulary<?> termVocabulary,
952 ICdmFormElement parentElement,
953 String labelString,
954 T selection,
955 int style) {
956 TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termVocabulary, labelString, selection, true, style);
957 adapt(element);
958 parentElement.addElement(element);
959 return element;
960 }
961
962 public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
963 TermVocabulary<?> termVocabulary,
964 ICdmFormElement parentElement,
965 String labelString,
966 T selection,
967 boolean addEmptyElement,
968 int style) {
969 TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termVocabulary, labelString, selection, addEmptyElement, style);
970 adapt(element);
971 parentElement.addElement(element);
972 return element;
973 }
974
975 /**
976 * <p>
977 * createEnumComboElement
978 * </p>
979 *
980 * @param enumComboType
981 * a
982 * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EnumComboType}
983 * object.
984 * @param parentElement
985 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
986 * object.
987 * @param style
988 * a int.
989 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
990 * object.
991 */
992 public <T extends IEnumTerm<T>> EnumComboElement<T> createEnumComboElement(
993 Class<T> enumComboType, ICdmFormElement parentElement,
994 int style) {
995 EnumComboElement<T> element = new EnumComboElement<T>(this, parentElement, enumComboType, style);
996 adapt(element);
997 parentElement.addElement(element);
998 return element;
999 }
1000
1001 public <TERM extends DefinedTermBase<TERM>, VOC extends TermVocabulary<TERM>> VocabularyComboElement<TERM, VOC> createVocabularyComboElement(
1002 TermType termType, String label, VOC selection, ICdmFormElement parentElement, int style) {
1003 VocabularyComboElement<TERM, VOC> element = new VocabularyComboElement<TERM, VOC>(this, parentElement, termType, label, selection, style);
1004 adapt(element);
1005 parentElement.addElement(element);
1006 return element;
1007 }
1008
1009 /**
1010 * <p>
1011 * createBrowserElement
1012 * </p>
1013 *
1014 * @param imageUri
1015 * a {@link java.net.URI} object.
1016 * @param style
1017 * a int.
1018 * @param parentElement
1019 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1020 * object.
1021 * @return a {@link eu.etaxonomy.taxeditor.ui.element.BrowserElement}
1022 * object.
1023 */
1024 public BrowserElement createBrowserElement(ICdmFormElement parentElement, URI imageUri, int style) {
1025 BrowserElement element = new BrowserElement(this, parentElement, imageUri, style);
1026 adapt(element);
1027 parentElement.addElement(element);
1028 return element;
1029 }
1030
1031 /**
1032 * <p>
1033 * createImageElement
1034 * </p>
1035 *
1036 * @param parentElement
1037 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1038 * object.
1039 * @param imageUri
1040 * a {@link java.net.URI} object.
1041 * @param style
1042 * a int.
1043 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ImageElement} object.
1044 */
1045 public ImageElement createImageElement(ICdmFormElement parentElement, URI imageUri, int style) {
1046 ImageElement element = new ImageElement(this, parentElement, imageUri, style);
1047 adapt(element);
1048 parentElement.addElement(element);
1049 return element;
1050 }
1051
1052 /**
1053 * <p>
1054 * createTextActionElement
1055 * </p>
1056 *
1057 * @param labelString
1058 * a {@link java.lang.String} object.
1059 * @param initialText
1060 * a {@link java.lang.String} object.
1061 * @param style
1062 * a int.
1063 * @param parentElement
1064 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1065 * object.
1066 * @param buttonLabel
1067 * a {@link java.lang.String} object.
1068 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextActionElement}
1069 * object.
1070 */
1071 public TextActionElement createTextActionElement(ICdmFormElement parentElement, String labelString,
1072 String buttonLabel, String initialText, int style) {
1073 TextActionElement element = new TextActionElement(this, parentElement, labelString, buttonLabel, initialText,
1074 style);
1075 adapt(element);
1076 parentElement.addElement(element);
1077 return element;
1078 }
1079
1080 /**
1081 * <p>
1082 * createCheckbox
1083 * </p>
1084 *
1085 * @param parentElement
1086 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1087 * object.
1088 * @param label
1089 * a {@link java.lang.String} object.
1090 * @param initialState
1091 * a boolean.
1092 * @param style
1093 * a int.
1094 * @return a {@link eu.etaxonomy.taxeditor.ui.element.CheckboxElement}
1095 * object.
1096 */
1097 public CheckboxElement createCheckbox(ICdmFormElement parentElement, String label, Boolean initialState, int style) {
1098 if(initialState==null){
1099 initialState = Boolean.FALSE;
1100 }
1101 CheckboxElement element = new CheckboxElement(this, parentElement, label, initialState, style | orientation);
1102 adapt(element);
1103 parentElement.addElement(element);
1104 return element;
1105 }
1106
1107 /**
1108 * Creates a section as a part of the form.
1109 *
1110 * @return the section widget
1111 * @param section
1112 * a
1113 * {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1114 * object.
1115 */
1116 public Section adapt(AbstractFormSection section) {
1117 section.setMenu(section.getLayoutComposite().getMenu());
1118 adapt(section, true, true);
1119
1120 // handle focus and property change events for cdm use
1121 section.addFocusListener(selectionFocusHandler);
1122 section.setPropertyChangeListeners(propertyChangeListeners);
1123
1124 if (section.getToggle() != null) {
1125 section.getToggle().setHoverDecorationColor(getColors().getColor(IFormColors.TB_TOGGLE_HOVER));
1126 section.getToggle().setDecorationColor(getColors().getColor(IFormColors.TB_TOGGLE));
1127 }
1128
1129 section.setFont(boldFontHolder2.getBoldFont(section.getLayoutComposite().getFont()));
1130
1131 if ((section.getStyle() & ExpandableComposite.TITLE_BAR) != 0
1132 || (section.getStyle() & ExpandableComposite.SHORT_TITLE_BAR) != 0) {
1133 getColors().initializeSectionToolBarColors();
1134 section.setTitleBarBackground(getColors().getColor(IFormColors.TB_BG));
1135 section.setTitleBarBorderColor(getColors().getColor(IFormColors.TB_BORDER));
1136 }
1137 // call setTitleBarForeground regardless as it also sets the label color
1138 section.setTitleBarForeground(getColors().getColor(IFormColors.TB_TOGGLE));
1139 return section;
1140 }
1141
1142 private class BoldFontHolder2 {
1143 private Font normalFont;
1144
1145 private Font boldFont;
1146
1147 public BoldFontHolder2() {
1148 }
1149
1150 public Font getBoldFont(Font font) {
1151 createBoldFont(font);
1152 return boldFont;
1153 }
1154
1155 private void createBoldFont(Font font) {
1156 if (normalFont == null || !normalFont.equals(font)) {
1157 normalFont = font;
1158 dispose();
1159 }
1160 if (boldFont == null) {
1161 boldFont = FormFonts.getInstance().getBoldFont(getColors().getDisplay(), normalFont);
1162 }
1163 }
1164
1165 public void dispose() {
1166 if (boldFont != null) {
1167 FormFonts.getInstance().markFinished(boldFont, getColors().getDisplay());
1168 boldFont = null;
1169 }
1170 }
1171 }
1172
1173 /**
1174 * <p>
1175 * createToggleableTextField
1176 * </p>
1177 *
1178 * @param parentElement
1179 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1180 * object.
1181 * @param labelString
1182 * a {@link java.lang.String} object.
1183 * @param initialText
1184 * a {@link java.lang.String} object.
1185 * @param initialState
1186 * a boolean.
1187 * @param style
1188 * a int.
1189 * @return a {@link eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement}
1190 * object.
1191 */
1192 public ToggleableTextElement createToggleableTextField(ICdmFormElement parentElement, String labelString,
1193 String initialText, boolean initialState, int style) {
1194 ToggleableTextElement element = new ToggleableTextElement(this, parentElement, labelString, initialText,
1195 initialState, style | orientation);
1196 adapt(element);
1197 parentElement.addElement(element);
1198 return element;
1199 }
1200
1201 /**
1202 * <p>
1203 * createTimePeriodElement
1204 * </p>
1205 *
1206 * @param parentElement
1207 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1208 * object.
1209 * @param labelString
1210 * a {@link java.lang.String} object.
1211 * @param timePeriod
1212 * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
1213 * @param style
1214 * a int.
1215 * @return a {@link eu.etaxonomy.taxeditor.ui.element.TimePeriodElement}
1216 * object.
1217 */
1218 public TimePeriodElement createTimePeriodElement(ICdmFormElement parentElement, String labelString,
1219 TimePeriod timePeriod, int style) {
1220 TimePeriodElement element = new TimePeriodElement(this, parentElement, labelString, timePeriod, style);
1221 adapt(element);
1222 parentElement.addElement(element);
1223 return element;
1224 }
1225
1226 /**
1227 * <p>
1228 * createGatheringEventUnitElement
1229 * </p>
1230 *
1231 * @param parentElement
1232 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1233 * object.
1234 * @param labelString
1235 * a {@link java.lang.String} object.
1236 * @param timePeriod
1237 * a {@link eu.etaxonomy.cdm.model.common.GatheringEvent} object.
1238 * @param style
1239 * a int.
1240 * @return a {@link eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement}
1241 * object.
1242 */
1243 public GatheringEventUnitElement createGatheringEventUnitElement(
1244 ICdmFormElement parentElement,
1245 String labelString,
1246 DerivedUnitFacade gatheringEvent,
1247 MinMaxTextSection.UnitType unitType,
1248 int style) {
1249 GatheringEventUnitElement element = new GatheringEventUnitElement(this,
1250 parentElement,
1251 labelString,
1252 gatheringEvent,
1253 unitType,
1254 style);
1255 adapt(element);
1256 parentElement.addElement(element);
1257 return element;
1258 }
1259
1260 /**
1261 * <p>
1262 * createPointElement
1263 * </p>
1264 *
1265 * @param style
1266 * a int.
1267 * @param parentElement
1268 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1269 * object.
1270 * @param point
1271 * a {@link eu.etaxonomy.cdm.model.location.Point} object.
1272 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PointElement} object.
1273 */
1274 public PointElement createPointElement(ICdmFormElement parentElement, Point point, int style) {
1275 PointElement element = new PointElement(this, parentElement, point, style);
1276 adapt(element);
1277 parentElement.addElement(element);
1278 return element;
1279 }
1280
1281
1282
1283 /**
1284 * @param conversationHolder
1285 * @param parent
1286 * @param detailsViewer
1287 * @param i
1288 * @return
1289 */
1290 public EmptySection createEmptySection(CdmFormFactory formFactory, ICdmFormElement parentElement, int style) {
1291 EmptySection section = new EmptySection(formFactory, parentElement, style);
1292 parentElement.addElement(section);
1293 adapt(section);
1294 return section;
1295 }
1296
1297 /**
1298 * <p>
1299 * createDateDetailSection
1300 * </p>
1301 *
1302 * @param parentElement
1303 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1304 * object.
1305 * @param style
1306 * a int.
1307 * @return a {@link eu.etaxonomy.taxeditor.ui.element.DateDetailSection}
1308 * object.
1309 */
1310 public DateDetailSection createDateDetailSection(ICdmFormElement parentElement, int style) {
1311 DateDetailSection section = new DateDetailSection(this, parentElement, style);
1312 parentElement.addElement(section);
1313 adapt(section);
1314 return section;
1315 }
1316
1317 /**
1318 * <p>
1319 * createDateDetailSection
1320 * </p>
1321 *
1322 * @param parentElement
1323 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1324 * object.
1325 * @param style
1326 * a int.
1327 * @return a {@link eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection}
1328 * object.
1329 */
1330 public MinMaxTextSection createMinMaxTextSection(ICdmFormElement parentElement, UnitType unitType, int style) {
1331 MinMaxTextSection section = new MinMaxTextSection(this, parentElement, unitType, style);
1332 parentElement.addElement(section);
1333 adapt(section);
1334 return section;
1335 }
1336
1337 /**
1338 * <p>
1339 * createPartialElement
1340 * </p>
1341 *
1342 * @param parentElement
1343 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1344 * object.
1345 * @param labelString
1346 * a {@link java.lang.String} object.
1347 * @param partial
1348 * a {@link org.joda.time.Partial} object.
1349 * @param style
1350 * a int.
1351 * @return a {@link eu.etaxonomy.taxeditor.ui.element.PartialElement}
1352 * object.
1353 */
1354 public PartialElement createPartialElement(ICdmFormElement parentElement, String labelString, Partial partial,
1355 int style) {
1356 PartialElement element = new PartialElement(this, parentElement, labelString, style);
1357 adapt(element);
1358 parentElement.addElement(element);
1359 return element;
1360 }
1361
1362 /**
1363 * <p>
1364 * addSelectionListener
1365 * </p>
1366 *
1367 * @param listener
1368 * a {@link org.eclipse.swt.events.SelectionListener} object.
1369 */
1370 public void addSelectionListener(SelectionListener listener) {
1371 selectionListenerList.add(listener);
1372 }
1373
1374 /**
1375 * <p>
1376 * removeSelectionListener
1377 * </p>
1378 *
1379 * @param listener
1380 * a {@link org.eclipse.swt.events.SelectionListener} object.
1381 */
1382 public void removeSelectionListener(SelectionListener listener) {
1383 if (listener == null) {
1384 MessagingUtils.error(this.getClass(),
1385 "Tried to remove a selection listener from this factories listeners but was null", null);
1386 } else {
1387 selectionListenerList.remove(listener);
1388 }
1389 }
1390
1391 /**
1392 * <p>
1393 * addPropertyChangeListener
1394 * </p>
1395 *
1396 * @param listener
1397 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1398 * object.
1399 */
1400 public void addPropertyChangeListener(IPropertyChangeListener listener) {
1401 if (propertyChangeListeners.contains(listener)) {
1402 return;
1403 }
1404 propertyChangeListeners.add(0, listener);
1405 }
1406
1407 /**
1408 * <p>
1409 * removePropertyChangeListener
1410 * </p>
1411 *
1412 * @param listener
1413 * a {@link org.eclipse.jface.util.IPropertyChangeListener}
1414 * object.
1415 */
1416 public void removePropertyChangeListener(IPropertyChangeListener listener) {
1417 propertyChangeListeners.remove(listener);
1418 }
1419
1420 /**
1421 * @return the propertyChangeListeners
1422 */
1423 public List<IPropertyChangeListener> getPropertyChangeListeners() {
1424 return propertyChangeListeners;
1425 }
1426
1427 /**
1428 * <p>
1429 * createHorizontalSeparator
1430 * </p>
1431 *
1432 * @param parentElement
1433 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1434 * object.
1435 * @param style
1436 * a int.
1437 * @return a {@link org.eclipse.swt.widgets.Label} object.
1438 */
1439 public Label createHorizontalSeparator(ICdmFormElement parentElement, int style) {
1440 Label separator = this.createSeparator(parentElement.getLayoutComposite(), SWT.HORIZONTAL | style);
1441 separator.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
1442 return separator;
1443 }
1444
1445 /**
1446 * <p>
1447 * createVersionElement
1448 * </p>
1449 *
1450 * @param parentElement
1451 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1452 * object.
1453 * @param entity
1454 * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
1455 * object.
1456 * @param style
1457 * a int.
1458 * @return a
1459 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
1460 * object.
1461 */
1462 public VersionElement createVersionElement(ICdmFormElement parentElement, VersionableEntity entity, int style) {
1463 VersionElement element = new VersionElement(this, parentElement, entity, style);
1464 adapt(element);
1465 parentElement.addElement(element);
1466 return element;
1467 }
1468
1469 /**
1470 * @param cdmBaseSection
1471 * @param object
1472 * @param style
1473 * @return
1474 */
1475 public CdmBaseElement createCdmBaseElement(ICdmFormElement parentElement, CdmBase entity, int style) {
1476 CdmBaseElement element = new CdmBaseElement(this, parentElement, entity, style);
1477 adapt(element);
1478 parentElement.addElement(element);
1479 return element;
1480 }
1481
1482 /**
1483 * <p>
1484 * createVersionSection
1485 * </p>
1486 *
1487 * @param parentElement
1488 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1489 * object.
1490 * @param style
1491 * a int.
1492 * @return a
1493 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
1494 * object.
1495 */
1496 public VersionSection createVersionSection(ICdmFormElement parentElement, int style) {
1497 VersionSection section = new VersionSection(this, parentElement, style);
1498 parentElement.addElement(section);
1499 adapt(section);
1500 return section;
1501 }
1502
1503 /**
1504 * @param parent
1505 * @param i
1506 * @return
1507 */
1508 public CdmBaseSection createCdmBaseSection(ICdmFormElement parentElement, int style) {
1509 CdmBaseSection section = new CdmBaseSection(this, parentElement, style);
1510 parentElement.addElement(section);
1511 adapt(section);
1512 return section;
1513 }
1514
1515 /**
1516 * <p>
1517 * createEmptyElement
1518 * </p>
1519 *
1520 * @param parentElement
1521 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1522 * object.
1523 * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
1524 */
1525 public EmptyElement createEmptyElement(ICdmFormElement parentElement, String emptyText) {
1526 EmptyElement element = new EmptyElement(this, parentElement, emptyText, SWT.NULL);
1527 adapt(element);
1528 parentElement.addElement(element);
1529 return element;
1530 }
1531
1532 /**
1533 * <p>
1534 * createHeadlineSection
1535 * </p>
1536 *
1537 * @param parentElement
1538 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1539 * object.
1540 * @return a
1541 * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
1542 * object.
1543 */
1544 public HeadlineSection createHeadlineSection(ICdmFormElement parentElement) {
1545 HeadlineSection section = new HeadlineSection(this, parentElement, SWT.NULL);
1546 parentElement.addElement(section);
1547 adapt(section);
1548 return section;
1549 }
1550
1551 /**
1552 * <p>
1553 * createParsingMessageElement
1554 * </p>
1555 *
1556 * @param parentElement
1557 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1558 * object.
1559 * @param parserProblem
1560 * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
1561 * object.
1562 * @param style
1563 * a int.
1564 * @return a
1565 * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
1566 * object.
1567 */
1568 public ParsingMessageElement createParsingMessageElement(ICdmFormElement parentElement,
1569 ParserProblem parserProblem, int style) {
1570 ParsingMessageElement element = new ParsingMessageElement(this, parentElement, parserProblem, style);
1571 adapt(element);
1572 parentElement.addElement(element);
1573 return element;
1574 }
1575
1576 public AbstractFormSection createDefinedTermDetailSection(Class definedTermClass, ConversationHolder conversation,
1577 ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
1578
1579 AbstractFormSection section = new DefinedTermDetailSection(this, definedTermClass, conversation, parentElement,
1580 selectionProvider, style);
1581
1582 parentElement.addElement(section);
1583 adapt(section);
1584 return section;
1585
1586 }
1587
1588 /**
1589 * @param definedTermClass
1590 * @param formElement
1591 * @param style
1592 * @return
1593 */
1594 public AbstractCdmDetailElement createDefinedTermDetailElement(Class definedTermClass,
1595 AbstractCdmDetailSection parentElement, int style) {
1596 AbstractCdmDetailElement element = null;
1597
1598 if (NamedArea.class.isAssignableFrom(definedTermClass)) {
1599 element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
1600 } else if (definedTermClass.equals(Feature.class)) {
1601 element = new FeatureDetailElement(this, parentElement);
1602 } else {
1603 element = new DefinedTermDetailElement(this, parentElement);
1604 }
1605
1606 adapt(element);
1607 parentElement.addElement(element);
1608 return element;
1609 }
1610
1611
1612 //--------DetailSections---------
1613 public NameDetailSection createNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1614 NameDetailSection section = new NameDetailSection(this, conversation, parentElement, selectionProvider, style);
1615 addAndAdaptSection(parentElement, section);
1616 return section;
1617 }
1618
1619 public ReferenceDetailSection createReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1620 ReferenceDetailSection section = new ReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
1621 addAndAdaptSection(parentElement, section);
1622 return section;
1623 }
1624
1625 public NomenclaturalReferenceDetailSection createNomenclaturalReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1626 NomenclaturalReferenceDetailSection section = new NomenclaturalReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
1627 addAndAdaptSection(parentElement, section);
1628 return section;
1629 }
1630
1631 public TaxonBaseDetailSection createTaxonBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1632 TaxonBaseDetailSection section = new TaxonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1633 addAndAdaptSection(parentElement, section);
1634 return section;
1635 }
1636
1637 public AuthorshipDetailSection createAuthorshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1638 AuthorshipDetailSection section = new AuthorshipDetailSection(this, conversation, parentElement, selectionProvider, style);
1639 addAndAdaptSection(parentElement, section);
1640 return section;
1641 }
1642
1643 public TeamOrPersonBaseDetailSection createTeamOrPersonBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1644 TeamOrPersonBaseDetailSection section = new TeamOrPersonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1645 addAndAdaptSection(parentElement, section);
1646 return section;
1647 }
1648
1649 public TeamDetailSection createTeamDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1650 TeamDetailSection section = new TeamDetailSection(this, conversation, parentElement, null, style);
1651 addAndAdaptSection(parentElement, section);
1652 return section;
1653 }
1654
1655 public PersonDetailSection createPersonDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1656 PersonDetailSection section = new PersonDetailSection(this, conversation, parentElement, null, style);
1657 addAndAdaptSection(parentElement, section);
1658 return section;
1659 }
1660
1661 public DescriptionDetailSection createDescriptionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1662 DescriptionDetailSection section = new DescriptionDetailSection(this, conversation, parentElement, selectionProvider, style);
1663 addAndAdaptSection(parentElement, section);
1664 return section;
1665 }
1666
1667 public DescriptionElementDetailSection createDescriptionElementDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1668 DescriptionElementDetailSection section = new DescriptionElementDetailSection(this, conversation, parentElement, selectionProvider, style);
1669 addAndAdaptSection(parentElement, section);
1670 return section;
1671 }
1672
1673 public ParsingMessagesSection createParsingMessagesSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1674 ParsingMessagesSection section = new ParsingMessagesSection(this, conversation, parentElement, selectionProvider, style);
1675 addAndAdaptSection(parentElement, section);
1676 return section;
1677 }
1678
1679 public NonViralNameDetailSection createNonViralNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, boolean nameChoosable, int style){
1680 NonViralNameDetailSection section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, nameChoosable, style);
1681 addAndAdaptSection(parentElement, section);
1682 return section;
1683 }
1684
1685 public MediaDetailsSection createMediaDetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1686 MediaDetailsSection section = new MediaDetailsSection(this, conversation, parentElement, selectionProvider, style);
1687 addAndAdaptSection(parentElement, section);
1688 return section;
1689 }
1690
1691 public FieldUnitDetailSection createFieldUnitDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1692 FieldUnitDetailSection section = new FieldUnitDetailSection(this, conversation, parentElement, selectionProvider, style);
1693 addAndAdaptSection(parentElement, section);
1694 return section;
1695 }
1696
1697 public GatheringEventDetailSection createGatheringEventDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1698 GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
1699 addAndAdaptSection(parentElement, section);
1700 return section;
1701 }
1702
1703 public SpecimenHierarchyDetailSection createSpecimenHierarchyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1704 SpecimenHierarchyDetailSection section = new SpecimenHierarchyDetailSection(this, conversation, parentElement, selectionProvider, style);
1705 addAndAdaptSection(parentElement, section);
1706 return section;
1707 }
1708
1709 public DerivedUnitBaseDetailSection createDerivedUnitBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1710 DerivedUnitBaseDetailSection section = new DerivedUnitBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1711 addAndAdaptSection(parentElement, section);
1712 return section;
1713 }
1714
1715 public DerivedUnitTypeDesignationSection createDerivedUnitTypeDesignationSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1716 DerivedUnitTypeDesignationSection section = new DerivedUnitTypeDesignationSection(this, conversation, parentElement, style);
1717 addAndAdaptSection(parentElement, section);
1718 return section;
1719 }
1720
1721 public TaxonAssociationDetailSection createTaxonAssociationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1722 TaxonAssociationDetailSection section = new TaxonAssociationDetailSection(this, conversation, parentElement, selectionProvider, style);
1723 addAndAdaptSection(parentElement, section);
1724 return section;
1725 }
1726
1727 public OriginalLabelDataSection createOriginalLabelDataSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1728 OriginalLabelDataSection section = new OriginalLabelDataSection(this, conversation, parentElement, selectionProvider, style);
1729 addAndAdaptSection(parentElement, section);
1730 return section;
1731 }
1732
1733 public NaturalLanguageSection createNaturalLanguageSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1734 NaturalLanguageSection section = new NaturalLanguageSection(this, conversation, parentElement, selectionProvider, style);
1735 addAndAdaptSection(parentElement, section);
1736 return section;
1737 }
1738
1739 public FeatureDistributionDetailSection createFeatureDistributionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1740 FeatureDistributionDetailSection section = new FeatureDistributionDetailSection(this, conversation, parentElement, selectionProvider, style);
1741 addAndAdaptSection(parentElement, section);
1742 return section;
1743 }
1744
1745 public ClassificationDetailSection createClassificationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1746 ClassificationDetailSection section = new ClassificationDetailSection(this, conversation, parentElement, selectionProvider, style);
1747 addAndAdaptSection(parentElement, section);
1748 return section;
1749 }
1750
1751 public TaxonNodeDetailSection createTaxonNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1752 TaxonNodeDetailSection section = new TaxonNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
1753 addAndAdaptSection(parentElement, section);
1754 return section;
1755 }
1756
1757 public PolytomousKeyDetailSection createPolytomousKeyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1758 PolytomousKeyDetailSection section = new PolytomousKeyDetailSection(this, conversation, parentElement, selectionProvider, style);
1759 addAndAdaptSection(parentElement, section);
1760 return section;
1761 }
1762
1763 public PolytomousKeyNodeDetailSection createPolytomousKeyNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1764 PolytomousKeyNodeDetailSection section = new PolytomousKeyNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
1765 addAndAdaptSection(parentElement, section);
1766 return section;
1767 }
1768
1769 public InstitutionDetailSection createInstitutionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1770 InstitutionDetailSection section = new InstitutionDetailSection(this, conversation, parentElement, selectionProvider, style);
1771 addAndAdaptSection(parentElement, section);
1772 return section;
1773 }
1774
1775 public FieldUnitGeneralDetailSection createFieldUnitGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1776 FieldUnitGeneralDetailSection section = new FieldUnitGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1777 addAndAdaptSection(parentElement, section);
1778 return section;
1779 }
1780
1781 public DerivedUnitGeneralDetailSection createDerivedUnitGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1782 DerivedUnitGeneralDetailSection section = new DerivedUnitGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1783 addAndAdaptSection(parentElement, section);
1784 return section;
1785 }
1786
1787 public PreservedSpecimenGeneralDetailSection createPreservedSpecimenGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1788 PreservedSpecimenGeneralDetailSection section = new PreservedSpecimenGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1789 addAndAdaptSection(parentElement, section);
1790 return section;
1791 }
1792
1793 public TissueSampleGeneralDetailSection createTissueSampleGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1794 TissueSampleGeneralDetailSection section = new TissueSampleGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1795 addAndAdaptSection(parentElement, section);
1796 return section;
1797 }
1798
1799 public DnaSampleGeneralDetailSection createDnaSampleGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1800 DnaSampleGeneralDetailSection section = new DnaSampleGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1801 addAndAdaptSection(parentElement, section);
1802 return section;
1803 }
1804
1805 public DnaSamplePreparationPreservationSection createDnaSamplePreparationPreservationSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1806 DnaSamplePreparationPreservationSection section = new DnaSamplePreparationPreservationSection(this, conversation, parentElement, selectionProvider, style);
1807 addAndAdaptSection(parentElement, section);
1808 return section;
1809 }
1810
1811 public DnaQualityDetailSection createDnaQualityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1812 DnaQualityDetailSection section = new DnaQualityDetailSection(this, conversation, parentElement, selectionProvider, style);
1813 addAndAdaptSection(parentElement, section);
1814 return section;
1815 }
1816
1817 public SequenceGeneralDetailSection createSequenceGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1818 SequenceGeneralDetailSection section = new SequenceGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1819 addAndAdaptSection(parentElement, section);
1820 return section;
1821 }
1822
1823 public SequenceContigFileCollectionDetailSection createSequenceContigFileCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1824 SequenceContigFileCollectionDetailSection section = new SequenceContigFileCollectionDetailSection(this, conversation, parentElement, style);
1825 addAndAdaptSection(parentElement, section);
1826 return section;
1827 }
1828
1829 public SingleReadPherogramCollectionDetailSection createSingleReadPherogramCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1830 SingleReadPherogramCollectionDetailSection section = new SingleReadPherogramCollectionDetailSection(this, conversation, parentElement, style);
1831 addAndAdaptSection(parentElement, section);
1832 return section;
1833 }
1834
1835 public SequenceReferenceCollectionDetailSection createSequenceReferenceCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1836 SequenceReferenceCollectionDetailSection section = new SequenceReferenceCollectionDetailSection(this, conversation, parentElement, style);
1837 addAndAdaptSection(parentElement, section);
1838 return section;
1839 }
1840
1841 public SingleReadGeneralDetailSection createSingleReadGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1842 SingleReadGeneralDetailSection section = new SingleReadGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1843 addAndAdaptSection(parentElement, section);
1844 return section;
1845 }
1846
1847 public AmplificationGeneralDetailSection createAmplificationGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1848 AmplificationGeneralDetailSection section = new AmplificationGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1849 addAndAdaptSection(parentElement, section);
1850 return section;
1851 }
1852
1853 public AmplificationPrimerDetailSection createAmplificationPrimerDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1854 AmplificationPrimerDetailSection section = new AmplificationPrimerDetailSection(this, conversation, parentElement, selectionProvider, style);
1855 addAndAdaptSection(parentElement, section);
1856 return section;
1857 }
1858
1859 public AmplificationCloningDetailSection createAmplificationCloningDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1860 AmplificationCloningDetailSection section = new AmplificationCloningDetailSection(this, conversation, parentElement, selectionProvider, style);
1861 addAndAdaptSection(parentElement, section);
1862 return section;
1863 }
1864
1865 public AmplificationGelPhotoCollectionDetailSection createAmplificationGelPhotoCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1866 AmplificationGelPhotoCollectionDetailSection section = new AmplificationGelPhotoCollectionDetailSection(this, conversation, parentElement, style);
1867 addAndAdaptSection(parentElement, section);
1868 return section;
1869 }
1870
1871 public MediaSpecimenGeneralDetailSection createMediaSpecimenGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1872 MediaSpecimenGeneralDetailSection section = new MediaSpecimenGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1873 addAndAdaptSection(parentElement, section);
1874 return section;
1875 }
1876
1877 public HybridDetailSection createHybridDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1878 HybridDetailSection section = new HybridDetailSection(this, conversation, parentElement, selectionProvider, style);
1879 addAndAdaptSection(parentElement, section);
1880 return section;
1881 }
1882
1883 public UserDetailSection createUserDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1884 UserDetailSection section = new UserDetailSection(this, conversation, parentElement, selectionProvider, style);
1885 addAndAdaptSection(parentElement, section);
1886 return section;
1887 }
1888
1889 public GroupDetailSection createGroupDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1890 GroupDetailSection section = new GroupDetailSection(this, conversation, parentElement, selectionProvider, style);
1891 addAndAdaptSection(parentElement, section);
1892 return section;
1893 }
1894
1895 public DeterminationDetailSection createDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1896 DeterminationDetailSection section = new DeterminationDetailSection(this, conversation, parentElement, selectionProvider, style);
1897 addAndAdaptSection(parentElement, section);
1898 return section;
1899 }
1900
1901 public SampleDesignationDetailSection createSampleDesignationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1902 SampleDesignationDetailSection section = new SampleDesignationDetailSection(this, conversation, parentElement, selectionProvider, style);
1903 addAndAdaptSection(parentElement, section);
1904 return section;
1905 }
1906
1907 public TaxonRelationshipDetailSection createTaxonRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1908 TaxonRelationshipDetailSection section = new TaxonRelationshipDetailSection(this, conversation, parentElement, selectionProvider, style);
1909 addAndAdaptSection(parentElement, section);
1910 return section;
1911 }
1912
1913 public ReferencedEntityDetailSection createReferencedEntityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1914 ReferencedEntityDetailSection section = new ReferencedEntityDetailSection(this, conversation, parentElement, selectionProvider, style);
1915 addAndAdaptSection(parentElement, section);
1916 return section;
1917 }
1918
1919 public TermVocabularyDetailSection createTermVocabularyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1920 TermVocabularyDetailSection section = new TermVocabularyDetailSection(this, conversation, parentElement, selectionProvider, style);
1921 addAndAdaptSection(parentElement, section);
1922 return section;
1923 }
1924
1925 public GatheringEventDetailSection createGatheringSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1926 GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
1927 addAndAdaptSection(parentElement, section);
1928 return section;
1929 }
1930
1931 public NamedAreaDetailSection createNamedAreaDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1932 NamedAreaDetailSection section = new NamedAreaDetailSection(this, conversation, parentElement, selectionProvider, style);
1933 addAndAdaptSection(parentElement, section);
1934 return section;
1935 }
1936
1937 public UseRecordDetailSection createUseRecordDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1938 UseRecordDetailSection section = new UseRecordDetailSection(this, conversation, parentElement, selectionProvider, style);
1939 addAndAdaptSection(parentElement, section);
1940 return section;
1941 }
1942
1943 private void addAndAdaptSection(ICdmFormElement parentElement, AbstractFormSection<?> section) {
1944 parentElement.addElement(section);
1945 adapt(section);
1946 }
1947
1948 //--------DetailElements------------
1949
1950 public UseRecordDetailElement createUseRecordDetailElement(ICdmFormElement parentElement){
1951 UseRecordDetailElement element = new UseRecordDetailElement(this, parentElement);
1952 addAndAdaptElement(parentElement, element);
1953 return element;
1954 }
1955
1956 public DefinedTermDetailElement<NamedAreaLevel> createNamedAreaLevelElement(ICdmFormElement parentElement){
1957 DefinedTermDetailElement<NamedAreaLevel> element = new DefinedTermDetailElement<NamedAreaLevel>(this, parentElement);
1958 addAndAdaptElement(parentElement, element);
1959 return element;
1960 }
1961
1962 public eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement createNamedAreaDetailElement(ICdmFormElement parentElement){
1963 eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
1964 addAndAdaptElement(parentElement, element);
1965 return element;
1966 }
1967
1968 public TermVocabularyDetailElement createTermVocabularyDetailElement(ICdmFormElement parentElement){
1969 TermVocabularyDetailElement element = new TermVocabularyDetailElement(this, parentElement);
1970 addAndAdaptElement(parentElement, element);
1971 return element;
1972 }
1973
1974 public ReferenceEntityDetailElement createReferenceEntityDetailElement(ICdmFormElement parentElement){
1975 ReferenceEntityDetailElement element = new ReferenceEntityDetailElement(this, parentElement);
1976 addAndAdaptElement(parentElement, element);
1977 return element;
1978 }
1979
1980 public TaxonRelationshipDetailElement createTaxonRelationshipDetailElement(ICdmFormElement parentElement){
1981 TaxonRelationshipDetailElement element = new TaxonRelationshipDetailElement(this, parentElement);
1982 addAndAdaptElement(parentElement, element);
1983 return element;
1984 }
1985
1986 public GrantedAuthorityDetailElement createGrantedAuthorityDetailElement(ICdmFormElement parentElement){
1987 GrantedAuthorityDetailElement element = new GrantedAuthorityDetailElement(this, parentElement);
1988 addAndAdaptElement(parentElement, element);
1989 return element;
1990 }
1991
1992 public GroupDetailElement createGroupDetailElement(ICdmFormElement parentElement){
1993 GroupDetailElement element = new GroupDetailElement(this, parentElement);
1994 addAndAdaptElement(parentElement, element);
1995 return element;
1996 }
1997
1998 public UserDetailElement createUserDetailElement(ICdmFormElement parentElement){
1999 UserDetailElement element = new UserDetailElement(this, parentElement);
2000 addAndAdaptElement(parentElement, element);
2001 return element;
2002 }
2003
2004 public HybridDetailElement createHybridDetailElement(ICdmFormElement parentElement){
2005 HybridDetailElement element = new HybridDetailElement(this, parentElement);
2006 addAndAdaptElement(parentElement, element);
2007 return element;
2008 }
2009
2010 public InstitutionDetailElement createInstitutionDetailElement(ICdmFormElement parentElement){
2011 InstitutionDetailElement element = new InstitutionDetailElement(this, parentElement);
2012 addAndAdaptElement(parentElement, element);
2013 return element;
2014 }
2015
2016 public PolytomousKeyNodeDetailElement createPolytomousKeyNodeDetailElement(ICdmFormElement parentElement){
2017 PolytomousKeyNodeDetailElement element = new PolytomousKeyNodeDetailElement(this, parentElement);
2018 addAndAdaptElement(parentElement, element);
2019 return element;
2020 }
2021
2022 public PolytomousKeyDetailElement createPolytomousKeyDetailElement(ICdmFormElement parentElement){
2023 PolytomousKeyDetailElement element = new PolytomousKeyDetailElement(this, parentElement);
2024 addAndAdaptElement(parentElement, element);
2025 return element;
2026 }
2027
2028 public CollectionDetailElement createCollectionDetailElement(ICdmFormElement parentElement){
2029 CollectionDetailElement element = new CollectionDetailElement(this, parentElement);
2030 addAndAdaptElement(parentElement, element);
2031 return element;
2032 }
2033
2034 public TaxonNodeAgentRelationCollectionSection createTaxonNodeAgentRelationCollectionElement(ICdmFormElement parentElement, ConversationHolder conversation, int style){
2035 TaxonNodeAgentRelationCollectionSection element = new TaxonNodeAgentRelationCollectionSection(this, conversation, parentElement, style);
2036 adapt(element);
2037 parentElement.addElement(element);
2038
2039 return element;
2040 }
2041
2042 public TaxonNodeDetailElement createTaxonNodeDetailElement(ICdmFormElement parentElement, boolean createNew){
2043 TaxonNodeDetailElement element = new TaxonNodeDetailElement(this, parentElement, createNew);
2044 addAndAdaptElement(parentElement, element);
2045 return element;
2046 }
2047
2048 public ClassificationDetailElement createClassificationDetailElement(ICdmFormElement parentElement){
2049 ClassificationDetailElement element = new ClassificationDetailElement(this, parentElement);
2050 addAndAdaptElement(parentElement, element);
2051 return element;
2052 }
2053
2054 public CloneClassificationDetailElement createCloneClassificationDetailElement(ICdmFormElement parentElement){
2055 CloneClassificationDetailElement element = new CloneClassificationDetailElement(this, parentElement);
2056 addAndAdaptElement(parentElement, element);
2057 return element;
2058 }
2059
2060 public FeatureDistributionDetailElement createFeatureDistributionDetailElement(ICdmFormElement parentElement){
2061 FeatureDistributionDetailElement element = new FeatureDistributionDetailElement(this, parentElement);
2062 addAndAdaptElement(parentElement, element);
2063 return element;
2064 }
2065
2066 public NaturalLanguageDetailElement createNaturalLanguageDetailElement(ICdmFormElement parentElement){
2067 NaturalLanguageDetailElement element = new NaturalLanguageDetailElement(this, parentElement);
2068 addAndAdaptElement(parentElement, element);
2069 return element;
2070 }
2071
2072 public NonViralNameDetailElement createNonViralNameDetailElement(ICdmFormElement parentElement){
2073 NonViralNameDetailElement element = new NonViralNameDetailElement(this, parentElement);
2074 addAndAdaptElement(parentElement, element);
2075 return element;
2076 }
2077
2078 public DescriptionElementDetailElement createDescriptionElementDetailElement(ICdmFormElement parentElement, int style){
2079 DescriptionElementDetailElement element = new DescriptionElementDetailElement(this, parentElement, style);
2080 addAndAdaptElement(parentElement, element);
2081 return element;
2082 }
2083
2084 public DescriptionDetailElement createDescriptionDetailElement(ICdmFormElement parentElement, int style){
2085 DescriptionDetailElement element = new DescriptionDetailElement(this, parentElement, style);
2086 addAndAdaptElement(parentElement, element);
2087 return element;
2088 }
2089
2090 public PersonDetailElement createPersonDetailElement(ICdmFormElement parentElement, int style){
2091 PersonDetailElement element = new PersonDetailElement(this, parentElement, style);
2092 addAndAdaptElement(parentElement, element);
2093 return element;
2094 }
2095
2096 public TeamDetailElement createTeamDetailElement(ICdmFormElement parentElement, int style, boolean isNomenclatural){
2097 TeamDetailElement element = new TeamDetailElement(this, parentElement, style, isNomenclatural);
2098 addAndAdaptElement(parentElement, element);
2099 return element;
2100 }
2101
2102 public AuthorshipDetailElement createAuthorshipDetailElement(ICdmFormElement parentElement, int style){
2103 AuthorshipDetailElement element = new AuthorshipDetailElement(this, parentElement, style);
2104 addAndAdaptElement(parentElement, element);
2105 return element;
2106 }
2107
2108 public TaxonBaseDetailElement createTaxonBaseDetailElement(ICdmFormElement parentElement, int style){
2109 TaxonBaseDetailElement element = new TaxonBaseDetailElement(this, parentElement, style);
2110 addAndAdaptElement(parentElement, element);
2111 return element;
2112 }
2113
2114 public NameDetailElement createNameDetailElement(ICdmFormElement parentElement, int style){
2115 NameDetailElement element = new NameDetailElement(this, parentElement, style);
2116 addAndAdaptElement(parentElement, element);
2117 return element;
2118 }
2119
2120 public ReferenceDetailElement createReferenceDetailElement(ICdmFormElement parentElement, int style){
2121 ReferenceDetailElement element = new ReferenceDetailElement(this, parentElement, style);
2122 addAndAdaptElement(parentElement, element);
2123 return element;
2124 }
2125
2126 public NomenclaturalReferenceDetailElement createNomenclaturalReferenceDetailElement(ICdmFormElement parentElement, int style){
2127 NomenclaturalReferenceDetailElement element = new NomenclaturalReferenceDetailElement(this, parentElement, style);
2128 addAndAdaptElement(parentElement, element);
2129 return element;
2130 }
2131
2132
2133 public FieldUnitGeneralDetailElement createFieldUnitGeneralDetailElement(ICdmFormElement parentElement){
2134 FieldUnitGeneralDetailElement element = new FieldUnitGeneralDetailElement(this, parentElement);
2135 addAndAdaptElement(parentElement, element);
2136 return element;
2137 }
2138
2139 public DerivedUnitGeneralDetailElement createDerivedUnitGeneralDetailElement(ICdmFormElement parentElement){
2140 DerivedUnitGeneralDetailElement element = new DerivedUnitGeneralDetailElement(this, parentElement);
2141 addAndAdaptElement(parentElement, element);
2142 return element;
2143 }
2144
2145 public TaxonAssociationDetailElement createTaxonAssociationDetailElement(ICdmFormElement parentElement){
2146 TaxonAssociationDetailElement element = new TaxonAssociationDetailElement(this, parentElement);
2147 addAndAdaptElement(parentElement, element);
2148 return element;
2149 }
2150
2151 public PreservedSpecimenGeneralDetailElement createPreservedSpecimenGeneralDetailElement(ICdmFormElement parentElement){
2152 PreservedSpecimenGeneralDetailElement element = new PreservedSpecimenGeneralDetailElement(this, parentElement);
2153 addAndAdaptElement(parentElement, element);
2154 return element;
2155 }
2156
2157 public TissueSampleGeneralDetailElement createTissueSampleGeneralDetailElement(ICdmFormElement parentElement){
2158 TissueSampleGeneralDetailElement element = new TissueSampleGeneralDetailElement(this, parentElement);
2159 addAndAdaptElement(parentElement, element);
2160 return element;
2161 }
2162
2163 public DnaSampleGeneralDetailElement createDnaSampleGeneralDetailElement(ICdmFormElement parentElement){
2164 DnaSampleGeneralDetailElement element = new DnaSampleGeneralDetailElement(this, parentElement);
2165 addAndAdaptElement(parentElement, element);
2166 return element;
2167 }
2168
2169 public DnaSamplePreparationPreservationDetailElement createDnaSamplePreparationPreservationDetailElement(ICdmFormElement parentElement){
2170 DnaSamplePreparationPreservationDetailElement element = new DnaSamplePreparationPreservationDetailElement(this, parentElement);
2171 addAndAdaptElement(parentElement, element);
2172 return element;
2173 }
2174
2175 public DnaQualityDetailElement createDnaQualityDetailElement(ICdmFormElement parentElement){
2176 DnaQualityDetailElement element = new DnaQualityDetailElement(this, parentElement);
2177 addAndAdaptElement(parentElement, element);
2178 return element;
2179 }
2180
2181 public SequenceGeneralDetailElement createSequenceGeneralDetailElement(ICdmFormElement parentElement){
2182 SequenceGeneralDetailElement element = new SequenceGeneralDetailElement(this, parentElement);
2183 addAndAdaptElement(parentElement, element);
2184 return element;
2185 }
2186
2187 public SingleReadGeneralDetailElement createSingleReadGeneralDetailElement(ICdmFormElement parentElement){
2188 SingleReadGeneralDetailElement element = new SingleReadGeneralDetailElement(this, parentElement);
2189 addAndAdaptElement(parentElement, element);
2190 return element;
2191 }
2192
2193 public PrimerGeneralDetailElement createPrimerGeneralDetailElement(ICdmFormElement parentElement){
2194 PrimerGeneralDetailElement element = new PrimerGeneralDetailElement(this, parentElement);
2195 addAndAdaptElement(parentElement, element);
2196 return element;
2197 }
2198
2199 public AmplificationGeneralDetailElement createAmplificationGeneralDetailElement(ICdmFormElement parentElement){
2200 AmplificationGeneralDetailElement element = new AmplificationGeneralDetailElement(this, parentElement);
2201 addAndAdaptElement(parentElement, element);
2202 return element;
2203 }
2204
2205 public AmplificationPrimerDetailElement createAmplificationPrimerDetailElement(ICdmFormElement parentElement){
2206 AmplificationPrimerDetailElement element = new AmplificationPrimerDetailElement(this, parentElement);
2207 addAndAdaptElement(parentElement, element);
2208 return element;
2209 }
2210
2211 public AmplificationCloningDetailElement createAmplificationCloningDetailElement(ICdmFormElement parentElement){
2212 AmplificationCloningDetailElement element = new AmplificationCloningDetailElement(this, parentElement);
2213 addAndAdaptElement(parentElement, element);
2214 return element;
2215 }
2216
2217 public AmplificationGelPhotoDetailElement createAmplificationGelPhotoDetailElement(ICdmFormElement parentElement){
2218 AmplificationGelPhotoDetailElement element = new AmplificationGelPhotoDetailElement(this, parentElement);
2219 addAndAdaptElement(parentElement, element);
2220 return element;
2221 }
2222
2223 public MediaSpecimenGeneralDetailElement createMediaSpecimenGeneralDetailElement(ICdmFormElement parentElement){
2224 MediaSpecimenGeneralDetailElement element = new MediaSpecimenGeneralDetailElement(this, parentElement);
2225 addAndAdaptElement(parentElement, element);
2226 return element;
2227 }
2228
2229 public MediaDetailElement createMediaDetailElement(ICdmFormElement parentElement){
2230 MediaDetailElement mediaDetailElement = new MediaDetailElement(this, parentElement);
2231 addAndAdaptElement(parentElement, mediaDetailElement);
2232 return mediaDetailElement;
2233 }
2234
2235 public GatheringEventDetailElement createGatheringEventDetailElement(ICdmFormElement parentElement) {
2236 GatheringEventDetailElement element = new GatheringEventDetailElement(this, parentElement);
2237 addAndAdaptElement(parentElement, element);
2238 return element;
2239 }
2240
2241 public FieldUnitDetailElement createFieldUnitDetailElement(ICdmFormElement parentElement) {
2242 FieldUnitDetailElement element = new FieldUnitDetailElement(this, parentElement);
2243 addAndAdaptElement(parentElement, element);
2244 return element;
2245 }
2246
2247 public SpecimenHierarchyDetailElement createSpecimenHierarchyDetailElement(ICdmFormElement parentElement) {
2248 SpecimenHierarchyDetailElement element = new SpecimenHierarchyDetailElement(this, parentElement);
2249 addAndAdaptElement(parentElement, element);
2250 return element;
2251 }
2252
2253 public DerivedUnitBaseDetailElement createDerivedUnitBaseDetailElement(ICdmFormElement parentElement) {
2254 DerivedUnitBaseDetailElement element = new DerivedUnitBaseDetailElement(this, parentElement);
2255 addAndAdaptElement(parentElement, element);
2256 return element;
2257 }
2258
2259 public OriginalLabelDataElement createOriginalLabelDataElement(ICdmFormElement parentElement) {
2260 OriginalLabelDataElement element = new OriginalLabelDataElement(this, parentElement);
2261 addAndAdaptElement(parentElement, element);
2262 return element;
2263 }
2264
2265 public PreservedSpecimenDetailElement createPreservedSpecimenDetailElement(ICdmFormElement parentElement) {
2266 PreservedSpecimenDetailElement element = new PreservedSpecimenDetailElement(this, parentElement);
2267 addAndAdaptElement(parentElement, element);
2268 return element;
2269 }
2270
2271 public DeterminationDetailElement createDeterminationDetailElement(ICdmFormElement parentElement) {
2272 DeterminationDetailElement element = new DeterminationDetailElement(this, parentElement);
2273 addAndAdaptElement(parentElement, element);
2274 return element;
2275 }
2276
2277 public SampleDesignationDetailElement createSampleDesignationDetailElement(ICdmFormElement parentElement) {
2278 SampleDesignationDetailElement element = new SampleDesignationDetailElement(this, parentElement);
2279 addAndAdaptElement(parentElement, element);
2280 return element;
2281 }
2282
2283 /**
2284 * @param parentElement
2285 * @param element
2286 */
2287 private void addAndAdaptElement(ICdmFormElement parentElement, AbstractCdmDetailElement<?> element) {
2288 adapt(element);
2289 parentElement.addElement(element);
2290 }
2291
2292 //--------EntityCollectionSection----------
2293 public TeamMemberSection createTeamMemberSection(ConversationHolder conversation, ICdmFormElement parentElement, int style, boolean isNomenclatural){
2294 TeamMemberSection section = new TeamMemberSection(this, conversation, parentElement, style, isNomenclatural);
2295 addAndAdaptSection(parentElement, section);
2296 return section;
2297 }
2298
2299 public AnnotationSection createAnnotationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2300 AnnotationSection section = new AnnotationSection(this, conversation, parentElement, style);
2301 addAndAdaptSection(parentElement, section);
2302 return section;
2303 }
2304
2305 public CreditSection createCreditSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2306 CreditSection section = new CreditSection(this, conversation, parentElement, style);
2307 addAndAdaptSection(parentElement, section);
2308 return section;
2309 }
2310
2311 public DescriptionElementSourceSection createDescriptionElementSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2312 DescriptionElementSourceSection section = new DescriptionElementSourceSection(this, conversation, parentElement, style);
2313 addAndAdaptSection(parentElement, section);
2314 return section;
2315 }
2316
2317 public ExtensionSection createExtensionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2318 ExtensionSection section = new ExtensionSection(this, conversation, parentElement, style);
2319 addAndAdaptSection(parentElement, section);
2320 return section;
2321 }
2322
2323 public MarkerSection createMarkerSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2324 MarkerSection section = new MarkerSection(this, conversation, parentElement, style);
2325 addAndAdaptSection(parentElement, section);
2326 return section;
2327 }
2328
2329 public MediaSection createMediaSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2330 MediaSection section = new MediaSection(this, conversation, parentElement, style);
2331 addAndAdaptSection(parentElement, section);
2332 return section;
2333 }
2334
2335 public DescriptionElementMediaSection createDescriptionElementMediaSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2336 DescriptionElementMediaSection section = new DescriptionElementMediaSection(this, conversation, parentElement, style);
2337 addAndAdaptSection(parentElement, section);
2338 return section;
2339 }
2340
2341 public MediaRepresentationSection createMediaRepresentationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2342 MediaRepresentationSection section = new MediaRepresentationSection(this, conversation, parentElement, style);
2343 addAndAdaptSection(parentElement, section);
2344 return section;
2345 }
2346
2347 public MediaRepresentationPartSection createMediaRepresentationPartSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2348 MediaRepresentationPartSection section = new MediaRepresentationPartSection(this, conversation, parentElement, style);
2349 addAndAdaptSection(parentElement, section);
2350 return section;
2351 }
2352
2353 public ModifierSection createModifierSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2354 ModifierSection section = new ModifierSection(this, conversation, parentElement, style);
2355 addAndAdaptSection(parentElement, section);
2356 return section;
2357 }
2358
2359 public NomenclaturalStatusSection createNomenclaturalStatusSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2360 NomenclaturalStatusSection section = new NomenclaturalStatusSection(this, conversation, parentElement, style);
2361 addAndAdaptSection(parentElement, section);
2362 return section;
2363 }
2364
2365 public NameRelationshipDetailSection createNameRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2366 NameRelationshipDetailSection section = new NameRelationshipDetailSection(this, conversation, parentElement, style);
2367 addAndAdaptSection(parentElement, section);
2368 return section;
2369 }
2370
2371 public SynonymRelationshipDetailSection createSynonymRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2372 SynonymRelationshipDetailSection section = new SynonymRelationshipDetailSection(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, true, 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 SynonymRelationship) {
2645 element = new SynonymRelationshipDetailElement(this, parentElement, (SynonymRelationship) entity, removeListener,
2646 style);
2647 } else if (entity instanceof SpecimenTypeDesignation) {
2648 if(parentElement instanceof DerivedUnitTypeDesignationSection){
2649 element = new DerivedUnitTypeDesignationElement(this, parentElement, (SpecimenTypeDesignation) entity,
2650 removeListener, style);
2651 }
2652 else{
2653 element = new SpecimenTypeDesignationElement(this, parentElement, (SpecimenTypeDesignation) entity,
2654 removeListener, style);
2655 }
2656 } else if (entity instanceof StateData) {
2657 element = new StateDataElement(this, parentElement, (StateData) entity, removeListener, style);
2658 } else if (entity instanceof StatisticalMeasurementValue) {
2659 element = new StatisticalMeasurementValueElement(this, parentElement, (StatisticalMeasurementValue) entity,
2660 removeListener, style);
2661 } else if (entity instanceof DerivedUnit) {
2662 switch(((DerivedUnit)entity).getRecordBasis()) {
2663 case LivingSpecimen:
2664 case PreservedSpecimen:
2665 case OtherSpecimen:
2666 element = new SpecimenCollectionDetailElement(this,
2667 parentElement,
2668 (DerivedUnit) entity,
2669 removeListener,
2670 style);
2671 break;
2672 default:
2673 element = new DerivedUnitElement(this,
2674 parentElement,
2675 (DerivedUnit) entity,
2676 removeListener,
2677 style);
2678 }
2679
2680 } else if (entity instanceof NamedArea) {
2681 element = new NamedAreaDetailElement(this, parentElement, (NamedArea) entity, removeListener, style);
2682 } else if (entity instanceof DeterminationEvent) {
2683 element = new DeterminationEventDetailElement(this, parentElement, (DeterminationEvent) entity, removeListener, style);
2684 } else if (entity instanceof User) {
2685 element = new MemberDetailElement(this, parentElement, (User) entity, removeListener, style);
2686 } else if (entity instanceof GrantedAuthority) {
2687 element = new GrantedAuthorityCollectionElement(this, parentElement, (GrantedAuthorityImpl) entity,
2688 removeListener, style);
2689 } else if (entity instanceof Group) {
2690 element = new GroupsByUserDetailElement(this, parentElement, (Group) entity, removeListener, style);
2691 } else if (entity instanceof Taxon) {
2692 element = new TaxonDetailElement(this, parentElement, (Taxon) entity, removeListener, style);
2693 } else if (entity instanceof DescriptionElementBase) {
2694 // this is the special case for protologs, maybe we can do this
2695 // differently when API improves
2696 DescriptionElementBase descriptionElement = (DescriptionElementBase) entity;
2697 if (descriptionElement.getFeature().equals(Feature.PROTOLOGUE())) {
2698 element = new ProtologueElement(this, parentElement, descriptionElement, removeListener, style);
2699 }
2700 } else if (entity instanceof Identifier) {
2701 if(parentElement instanceof AbstractSampleDesignationDetailSection){
2702 element = new SampleDesignationTextDetailElement(this, parentElement, (Identifier<DnaSample>) entity, removeListener, backgroundColor, style);
2703 }
2704 else{
2705 element = new IdentifierElement(this, parentElement, (Identifier) entity, removeListener, style);
2706 }
2707 } else if (entity instanceof TermVocabulary) {
2708 TermVocabulary<?> termVocabulary = (TermVocabulary<?>)entity;
2709 switch (termVocabulary.getTermType()) {
2710 case State:
2711 element = new StateVocabularyCollectionElement(this, parentElement, (TermVocabulary<State>) entity, removeListener, backgroundColor, style);
2712 break;
2713 case Modifier:
2714 element = new RecommendedModifierVocabulariesElement(this, parentElement, (TermVocabulary<DefinedTerm>) entity, removeListener, backgroundColor, style);
2715 break;
2716 default:
2717 break;
2718 }
2719 } else if (entity instanceof MeasurementUnit) {
2720 element = new MeasurementUnitCollectionElement(this, parentElement, (MeasurementUnit) entity, removeListener, backgroundColor, style);
2721 } else if (entity instanceof StatisticalMeasure) {
2722 element = new StatisticalMeasureCollectionElement(this, parentElement, (StatisticalMeasure) entity, removeListener, backgroundColor, style);
2723 }
2724
2725
2726 if (element == null) {
2727 MessagingUtils.messageDialog("No element for entity", this,
2728 "Could not generate element for entity. Looks like the case is not handled already. Check implementation. Entity: "
2729 + entity, null);
2730 }
2731
2732 else{
2733 if (backgroundColor != null && !backgroundColor.isDisposed()) {
2734 element.setPersistentBackground(backgroundColor);
2735 }
2736 adapt(element);
2737 parentElement.addElement(element);
2738 }
2739
2740 return element;
2741 }
2742
2743 /**
2744 * <p>
2745 * Creates a selection element for the given type T.
2746 * </p>
2747 * <p>
2748 * <strong>Selection elements not handled by this method:</strong>
2749 * <ul>
2750 * <li>{@link TaxonNodeSelectionElement} see
2751 * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
2752 * </li>
2753 * <li>{@link NomenclaturalAuthorTeamSelectionElement} see
2754 * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
2755 * </li>
2756 * </ul>
2757 * </p>
2758 *
2759 * @param clazz
2760 * a {@link Class} object of the type that you want the selection
2761 * element to handle
2762 * @param parentElement
2763 * a {@link ICdmFormElement} object.
2764 * @param labelString
2765 * a {@link String} object.
2766 * @param selectionType
2767 * @param selection
2768 * a {@link ICdmBase} object.
2769 * @param style
2770 * a int.
2771 * @param conversation
2772 * a {@link ConversationHolder} object.
2773 * @return a {@link EntitySelectionElement} object.
2774 */
2775 public <T extends CdmBase> EntitySelectionElement<T> createSelectionElement(Class<T> clazz,
2776 ConversationHolder conversation, ICdmFormElement parentElement, String labelString, T selection, int mode,
2777 int style) {
2778 EntitySelectionElement<T> element = new EntitySelectionElement<T>(this, conversation, parentElement, clazz,
2779 labelString, selection, mode, style);
2780 adapt(element);
2781 parentElement.addElement(element);
2782 return element;
2783 }
2784
2785 /**
2786 * <p>
2787 * Creates a selection element for the given type T which shows only the <b>abbreviated</b> title as the label.
2788 * </p>
2789 * <p>
2790 * <strong>Selection elements not handled by this method:</strong>
2791 * <ul>
2792 * <li>{@link TaxonNodeSelectionElement} see
2793 * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
2794 * </li>
2795 * <li>{@link NomenclaturalAuthorTeamSelectionElement} see
2796 * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
2797 * </li>
2798 * </ul>
2799 * </p>
2800 *
2801 * @param clazz
2802 * a {@link Class} object of the type that you want the selection
2803 * element to handle
2804 * @param parentElement
2805 * a {@link ICdmFormElement} object.
2806 * @param labelString
2807 * a {@link String} object.
2808 * @param selectionType
2809 * @param selection
2810 * a {@link ICdmBase} object.
2811 * @param style
2812 * a int.
2813 * @param conversation
2814 * a {@link ConversationHolder} object.
2815 * @return a {@link EntitySelectionElement} object.
2816 */
2817 public <T extends CdmBase> EntitySelectionElementWithAbbreviatedTitle<T> createSelectionElementWithAbbreviatedTitle(
2818 Class<T> clazz, ConversationHolder conversation, ICdmFormElement parentElement, String labelString,
2819 T selection, int mode, int style) {
2820 EntitySelectionElementWithAbbreviatedTitle<T> element = new EntitySelectionElementWithAbbreviatedTitle<T>(this, conversation, parentElement, clazz,
2821 labelString, selection, mode, style);
2822 adapt(element);
2823 parentElement.addElement(element);
2824 return element;
2825 }
2826
2827 public TaxonNodeSelectionElement createTaxonNodeSelectionElement(ConversationHolder conversation,
2828 ICdmFormElement parentElement, String labelString, TaxonNode selection, int mode, int style) {
2829 TaxonNodeSelectionElement element = new TaxonNodeSelectionElement(this, conversation, parentElement,
2830 labelString, selection, mode, style);
2831 adapt(element);
2832 parentElement.addElement(element);
2833 return element;
2834 }
2835
2836 // public NomenclaturalAuthorTeamSelectionElement createNomenclaturalAuthorTeamSelectionElement(
2837 // ConversationHolder conversation, ICdmFormElement parentElement, String labelString, Team selection,
2838 // int mode, int style) {
2839 // NomenclaturalAuthorTeamSelectionElement element = new NomenclaturalAuthorTeamSelectionElement(this,
2840 // conversation, parentElement, labelString, selection, mode, style);
2841 // adapt(element);
2842 // parentElement.addElement(element);
2843 // return element;
2844 // }
2845
2846 /** {@inheritDoc} */
2847 public LabelElement createLabel(ICdmFormElement parentElement, String text) {
2848 LabelElement labelElement = new LabelElement(this, parentElement, text);
2849 adapt(labelElement);
2850 parentElement.addElement(labelElement);
2851 return labelElement;
2852 }
2853
2854 public DateElement createDateElement(ICdmFormElement formElement, String labelText, DateTime dateTime, int style){
2855 Label label = new Label(formElement.getLayoutComposite(), style);
2856 label.setText(labelText+" (yyyy-MM-dd)");
2857 DateElement dateElement = new DateElement(formElement.getLayoutComposite(), dateTime, style);
2858 dateElement.initController(this, formElement);
2859 return dateElement;
2860 }
2861
2862 /**
2863 * <p>
2864 * Getter for the field <code>selectionProvider</code>.
2865 * </p>
2866 *
2867 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
2868 */
2869 public ISelectionProvider getSelectionProvider() {
2870 return selectionProvider;
2871 }
2872
2873 /**
2874 * <p>
2875 * createDetailedDescriptionDetailElement
2876 * </p>
2877 *
2878 * @param parentElement
2879 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
2880 * object.
2881 * @param entity
2882 * a
2883 * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
2884 * object.
2885 * @param style
2886 * a int.
2887 * @return a
2888 * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
2889 * object.
2890 */
2891 public AbstractDetailedDescriptionDetailElement createDetailedDescriptionDetailElement(
2892 ICdmFormElement parentElement, DescriptionElementBase entity, int style) {
2893 AbstractDetailedDescriptionDetailElement detailedDescriptionElement = null;
2894
2895 if (entity instanceof CategoricalData) {
2896 detailedDescriptionElement = new CategoricalDataDetailElement(this, parentElement,
2897 (CategoricalData) entity, style);
2898 } else if (entity instanceof CommonTaxonName) {
2899 detailedDescriptionElement = new CommonNameDetailElement(this, parentElement, (CommonTaxonName) entity,
2900 style);
2901 } else if (entity instanceof Distribution) {
2902 detailedDescriptionElement = new DistributionDetailElement(this, parentElement, (Distribution) entity,
2903 style);
2904 } else if (entity instanceof IndividualsAssociation) {
2905 detailedDescriptionElement = new IndividualsAssociationDetailElement(this, parentElement,
2906 (IndividualsAssociation) entity, style);
2907 } else if (entity instanceof QuantitativeData) {
2908 detailedDescriptionElement = new QuantitativeDataDetailElement(this, parentElement,
2909 (QuantitativeData) entity, style);
2910 } else if (entity instanceof TaxonInteraction) {
2911 detailedDescriptionElement = new TaxonInteractionDetailElement(this, parentElement,
2912 (TaxonInteraction) entity, style);
2913 } else if (entity instanceof TextData) {
2914 detailedDescriptionElement = new TextDataDetailElement(this, parentElement, (TextData) entity, style);
2915 } else {
2916 throw new IllegalStateException("There is no interface for the given description element");
2917 }
2918 adapt(detailedDescriptionElement);
2919 parentElement.addElement(detailedDescriptionElement);
2920 return detailedDescriptionElement;
2921
2922 }
2923
2924 /**
2925 * Creates a styled text as a part of the form.
2926 *
2927 * @param parent
2928 * the text parent
2929 * @param value
2930 * the text initial value
2931 * @param style
2932 * the text style
2933 * @return the text widget
2934 */
2935 public StyledText createStyledText(Composite parent, String value, int style) {
2936 StyledText text = new StyledText(parent, getBorderStyle() | style | getOrientation());
2937 if (value != null) {
2938 text.setText(value);
2939 }
2940 text.setForeground(getColors().getForeground());
2941 text.setBackground(getColors().getBackground());
2942 // text.addFocusListener(visibilityHandler);
2943 return text;
2944 }
2945
2946 public PreservedSpecimenDetailSection createPreservedSpecimenDetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
2947 PreservedSpecimenDetailSection section = new PreservedSpecimenDetailSection(this, conversation, parentElement, selectionProvider, style);
2948 addAndAdaptSection(parentElement, section);
2949 return section;
2950 }
2951
2952 /**
2953 * @param formElement
2954 * @param conversationHolder
2955 * @param style
2956 * @return
2957 */
2958 public TaxonNodeAgentRelationCollectionSection createTaxonNodeAgentRelationCollectionSection(
2959 ICdmFormElement formElement, ConversationHolder conversationHolder, int style) {
2960 TaxonNodeAgentRelationCollectionSection section = new TaxonNodeAgentRelationCollectionSection(this, conversationHolder, formElement, style);
2961 addAndAdaptSection(formElement, section);
2962 return section;
2963 }
2964
2965 /**
2966 * @param conversationHolder
2967 * @param formElement
2968 * @param expanded
2969 * @return
2970 */
2971 public TeamMemberSection createNomenclaturalTeamMemberSection(ConversationHolder conversationHolder,
2972 ICdmFormElement formElement, int expanded) {
2973 // TODO Auto-generated method stub
2974 return null;
2975 }
2976
2977 }