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