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