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