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