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