add the possibility to add taxonnode agent relations to a taxonnode and to edit a...
[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.model.taxon.TaxonNodeAgentRelation;
106 import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
107 import eu.etaxonomy.taxeditor.model.MessagingUtils;
108 import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
109 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
110 import eu.etaxonomy.taxeditor.ui.combo.VocabularyComboElement;
111 import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection.UnitType;
112 import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement;
113 import eu.etaxonomy.taxeditor.ui.openurl.IOpenUrlEnabled;
114 import eu.etaxonomy.taxeditor.ui.openurl.OpenUrlSelectorElement;
115 import eu.etaxonomy.taxeditor.ui.password.EditPasswordElement;
116 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
117 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
118 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
119 import eu.etaxonomy.taxeditor.ui.section.EmptyElement;
120 import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionDetailElement;
121 import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionDetailSection;
122 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailElement;
123 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
124 import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailElement;
125 import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
126 import eu.etaxonomy.taxeditor.ui.section.agent.TeamMemberElement;
127 import eu.etaxonomy.taxeditor.ui.section.agent.TeamMemberSection;
128 import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
129 import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationDetailElement;
130 import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationDetailSection;
131 import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeAgentRelationCollectionElement;
132 import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeAgentRelationCollectionSection;
133 import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailElement;
134 import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailSection;
135 import eu.etaxonomy.taxeditor.ui.section.common.ReferenceEntityDetailElement;
136 import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
137 import eu.etaxonomy.taxeditor.ui.section.description.DerivedUnitElement;
138 import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
139 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailElement;
140 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
141 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailElement;
142 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
143 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
144 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceElement;
145 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
146 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceElement;
147 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
148 import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
149 import eu.etaxonomy.taxeditor.ui.section.description.ModifierElement;
150 import eu.etaxonomy.taxeditor.ui.section.description.ModifierSection;
151 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageDetailElement;
152 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
153 import eu.etaxonomy.taxeditor.ui.section.description.ScopeElement;
154 import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
155 import eu.etaxonomy.taxeditor.ui.section.description.StateDataElement;
156 import eu.etaxonomy.taxeditor.ui.section.description.StateDataSection;
157 import eu.etaxonomy.taxeditor.ui.section.description.StatisticalMeasurementValueElement;
158 import eu.etaxonomy.taxeditor.ui.section.description.StatisticalMeasurementValueSection;
159 import eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement;
160 import eu.etaxonomy.taxeditor.ui.section.description.detail.CategoricalDataDetailElement;
161 import eu.etaxonomy.taxeditor.ui.section.description.detail.CommonNameDetailElement;
162 import eu.etaxonomy.taxeditor.ui.section.description.detail.DistributionDetailElement;
163 import eu.etaxonomy.taxeditor.ui.section.description.detail.IndividualsAssociationDetailElement;
164 import eu.etaxonomy.taxeditor.ui.section.description.detail.QuantitativeDataDetailElement;
165 import eu.etaxonomy.taxeditor.ui.section.description.detail.TaxonInteractionDetailElement;
166 import eu.etaxonomy.taxeditor.ui.section.description.detail.TextDataDetailElement;
167 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailElement;
168 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
169 import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityCollectionElement;
170 import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailElement;
171 import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
172 import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailElement;
173 import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
174 import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailElement;
175 import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
176 import eu.etaxonomy.taxeditor.ui.section.identifier.IdentifierDetailElement;
177 import eu.etaxonomy.taxeditor.ui.section.identifier.IdentifierDetailSection;
178 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailElement;
179 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
180 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailElement;
181 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
182 import eu.etaxonomy.taxeditor.ui.section.key.ScopeRestrictionSection;
183 import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
184 import eu.etaxonomy.taxeditor.ui.section.media.ImageFileElement;
185 import eu.etaxonomy.taxeditor.ui.section.media.MediaDetailElement;
186 import eu.etaxonomy.taxeditor.ui.section.media.MediaMetaElement;
187 import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationElement;
188 import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationPartElement;
189 import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationPartSection;
190 import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationSection;
191 import eu.etaxonomy.taxeditor.ui.section.media.MediaSection;
192 import eu.etaxonomy.taxeditor.ui.section.name.AuthorshipDetailElement;
193 import eu.etaxonomy.taxeditor.ui.section.name.AuthorshipDetailSection;
194 import eu.etaxonomy.taxeditor.ui.section.name.HybridDetailElement;
195 import eu.etaxonomy.taxeditor.ui.section.name.HybridDetailSection;
196 import eu.etaxonomy.taxeditor.ui.section.name.NameDetailElement;
197 import eu.etaxonomy.taxeditor.ui.section.name.NameDetailSection;
198 import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailElement;
199 import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
200 import eu.etaxonomy.taxeditor.ui.section.name.NameTypeDesignationElement;
201 import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusElement;
202 import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
203 import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailElement;
204 import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
205 import eu.etaxonomy.taxeditor.ui.section.name.ProtologueElement;
206 import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
207 import eu.etaxonomy.taxeditor.ui.section.name.SpecimenTypeDesignationElement;
208 import eu.etaxonomy.taxeditor.ui.section.name.SynonymRelationshipDetailElement;
209 import eu.etaxonomy.taxeditor.ui.section.name.SynonymRelationshipDetailSection;
210 import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
211 import eu.etaxonomy.taxeditor.ui.section.occurrence.CollectingAreasDetailSection;
212 import eu.etaxonomy.taxeditor.ui.section.occurrence.CollectionDetailElement;
213 import eu.etaxonomy.taxeditor.ui.section.occurrence.CurrentDeterminationDetailSection;
214 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailElement;
215 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
216 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailElement;
217 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailSection;
218 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailElement;
219 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
220 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationEventDetailElement;
221 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationHistoryDetailSection;
222 import eu.etaxonomy.taxeditor.ui.section.occurrence.EmptySection;
223 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailElement;
224 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
225 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailElement;
226 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
227 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailElement;
228 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
229 import eu.etaxonomy.taxeditor.ui.section.occurrence.GeoScopeDetailSection;
230 import eu.etaxonomy.taxeditor.ui.section.occurrence.GeoScopePolyKeyDetailSection;
231 import eu.etaxonomy.taxeditor.ui.section.occurrence.NamedAreaDetailElement;
232 import eu.etaxonomy.taxeditor.ui.section.occurrence.OriginalLabelDataSection;
233 import eu.etaxonomy.taxeditor.ui.section.occurrence.SourceCollectionDetailSection;
234 import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenCollectionDetailElement;
235 import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenCollectionDetailSection;
236 import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenHierarchyDetailElement;
237 import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenHierarchyDetailSection;
238 import eu.etaxonomy.taxeditor.ui.section.occurrence.association.DerivedUnitTypeDesignationElement;
239 import eu.etaxonomy.taxeditor.ui.section.occurrence.association.DerivedUnitTypeDesignationSection;
240 import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailElement;
241 import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
242 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenCurrentDeterminationDetailSection;
243 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailElement;
244 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailSection;
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, boolean nameChoosable, int style){
1559 NonViralNameDetailSection section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, nameChoosable, 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 TaxonRelationshipDetailSection createTaxonRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1787 TaxonRelationshipDetailSection section = new TaxonRelationshipDetailSection(this, conversation, parentElement, selectionProvider, style);
1788 addAndAdaptSection(parentElement, section);
1789 return section;
1790 }
1791
1792 public ReferencedEntityDetailSection createReferencedEntityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1793 ReferencedEntityDetailSection section = new ReferencedEntityDetailSection(this, conversation, parentElement, selectionProvider, style);
1794 addAndAdaptSection(parentElement, section);
1795 return section;
1796 }
1797
1798 public TermVocabularyDetailSection createTermVocabularyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1799 TermVocabularyDetailSection section = new TermVocabularyDetailSection(this, conversation, parentElement, selectionProvider, style);
1800 addAndAdaptSection(parentElement, section);
1801 return section;
1802 }
1803
1804 public GatheringEventDetailSection createGatheringSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1805 GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
1806 addAndAdaptSection(parentElement, section);
1807 return section;
1808 }
1809
1810 public NamedAreaDetailSection createNamedAreaDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1811 NamedAreaDetailSection section = new NamedAreaDetailSection(this, conversation, parentElement, selectionProvider, style);
1812 addAndAdaptSection(parentElement, section);
1813 return section;
1814 }
1815
1816 public UseRecordDetailSection createUseRecordDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1817 UseRecordDetailSection section = new UseRecordDetailSection(this, conversation, parentElement, selectionProvider, style);
1818 addAndAdaptSection(parentElement, section);
1819 return section;
1820 }
1821
1822 private void addAndAdaptSection(ICdmFormElement parentElement, AbstractFormSection<?> section) {
1823 parentElement.addElement(section);
1824 adapt(section);
1825 }
1826
1827 //--------DetailElements------------
1828
1829 public UseRecordDetailElement createUseRecordDetailElement(ICdmFormElement parentElement){
1830 UseRecordDetailElement element = new UseRecordDetailElement(this, parentElement);
1831 addAndAdaptElement(parentElement, element);
1832 return element;
1833 }
1834
1835 public DefinedTermDetailElement<NamedAreaLevel> createNamedAreaLevelElement(ICdmFormElement parentElement){
1836 DefinedTermDetailElement<NamedAreaLevel> element = new DefinedTermDetailElement<NamedAreaLevel>(this, parentElement);
1837 addAndAdaptElement(parentElement, element);
1838 return element;
1839 }
1840
1841 public eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement createNamedAreaDetailElement(ICdmFormElement parentElement){
1842 eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
1843 addAndAdaptElement(parentElement, element);
1844 return element;
1845 }
1846
1847 public TermVocabularyDetailElement createTermVocabularyDetailElement(ICdmFormElement parentElement){
1848 TermVocabularyDetailElement element = new TermVocabularyDetailElement(this, parentElement);
1849 addAndAdaptElement(parentElement, element);
1850 return element;
1851 }
1852
1853 public ReferenceEntityDetailElement createReferenceEntityDetailElement(ICdmFormElement parentElement){
1854 ReferenceEntityDetailElement element = new ReferenceEntityDetailElement(this, parentElement);
1855 addAndAdaptElement(parentElement, element);
1856 return element;
1857 }
1858
1859 public TaxonRelationshipDetailElement createTaxonRelationshipDetailElement(ICdmFormElement parentElement){
1860 TaxonRelationshipDetailElement element = new TaxonRelationshipDetailElement(this, parentElement);
1861 addAndAdaptElement(parentElement, element);
1862 return element;
1863 }
1864
1865 public GrantedAuthorityDetailElement createGrantedAuthorityDetailElement(ICdmFormElement parentElement){
1866 GrantedAuthorityDetailElement element = new GrantedAuthorityDetailElement(this, parentElement);
1867 addAndAdaptElement(parentElement, element);
1868 return element;
1869 }
1870
1871 public GroupDetailElement createGroupDetailElement(ICdmFormElement parentElement){
1872 GroupDetailElement element = new GroupDetailElement(this, parentElement);
1873 addAndAdaptElement(parentElement, element);
1874 return element;
1875 }
1876
1877 public UserDetailElement createUserDetailElement(ICdmFormElement parentElement){
1878 UserDetailElement element = new UserDetailElement(this, parentElement);
1879 addAndAdaptElement(parentElement, element);
1880 return element;
1881 }
1882
1883 public HybridDetailElement createHybridDetailElement(ICdmFormElement parentElement){
1884 HybridDetailElement element = new HybridDetailElement(this, parentElement);
1885 addAndAdaptElement(parentElement, element);
1886 return element;
1887 }
1888
1889 public InstitutionDetailElement createInstitutionDetailElement(ICdmFormElement parentElement){
1890 InstitutionDetailElement element = new InstitutionDetailElement(this, parentElement);
1891 addAndAdaptElement(parentElement, element);
1892 return element;
1893 }
1894
1895 public PolytomousKeyNodeDetailElement createPolytomousKeyNodeDetailElement(ICdmFormElement parentElement){
1896 PolytomousKeyNodeDetailElement element = new PolytomousKeyNodeDetailElement(this, parentElement);
1897 addAndAdaptElement(parentElement, element);
1898 return element;
1899 }
1900
1901 public PolytomousKeyDetailElement createPolytomousKeyDetailElement(ICdmFormElement parentElement){
1902 PolytomousKeyDetailElement element = new PolytomousKeyDetailElement(this, parentElement);
1903 addAndAdaptElement(parentElement, element);
1904 return element;
1905 }
1906
1907 public CollectionDetailElement createCollectionDetailElement(ICdmFormElement parentElement){
1908 CollectionDetailElement element = new CollectionDetailElement(this, parentElement);
1909 addAndAdaptElement(parentElement, element);
1910 return element;
1911 }
1912
1913 public TaxonNodeAgentRelationCollectionSection createTaxonNodeAgentRelationCollectionElement(ICdmFormElement parentElement, ConversationHolder conversation, int style){
1914 TaxonNodeAgentRelationCollectionSection element = new TaxonNodeAgentRelationCollectionSection(this, conversation, parentElement, style);
1915 adapt(element);
1916 parentElement.addElement(element);
1917
1918 return element;
1919 }
1920
1921 public TaxonNodeDetailElement createTaxonNodeDetailElement(ICdmFormElement parentElement, boolean createNew){
1922 TaxonNodeDetailElement element = new TaxonNodeDetailElement(this, parentElement, createNew);
1923 addAndAdaptElement(parentElement, element);
1924 return element;
1925 }
1926
1927 public ClassificationDetailElement createClassificationDetailElement(ICdmFormElement parentElement){
1928 ClassificationDetailElement element = new ClassificationDetailElement(this, parentElement);
1929 addAndAdaptElement(parentElement, element);
1930 return element;
1931 }
1932
1933 public FeatureDistributionDetailElement createFeatureDistributionDetailElement(ICdmFormElement parentElement){
1934 FeatureDistributionDetailElement element = new FeatureDistributionDetailElement(this, parentElement);
1935 addAndAdaptElement(parentElement, element);
1936 return element;
1937 }
1938
1939 public NaturalLanguageDetailElement createNaturalLanguageDetailElement(ICdmFormElement parentElement){
1940 NaturalLanguageDetailElement element = new NaturalLanguageDetailElement(this, parentElement);
1941 addAndAdaptElement(parentElement, element);
1942 return element;
1943 }
1944
1945 public NonViralNameDetailElement createNonViralNameDetailElement(ICdmFormElement parentElement){
1946 NonViralNameDetailElement element = new NonViralNameDetailElement(this, parentElement);
1947 addAndAdaptElement(parentElement, element);
1948 return element;
1949 }
1950
1951 public DescriptionElementDetailElement createDescriptionElementDetailElement(ICdmFormElement parentElement, int style){
1952 DescriptionElementDetailElement element = new DescriptionElementDetailElement(this, parentElement, style);
1953 addAndAdaptElement(parentElement, element);
1954 return element;
1955 }
1956
1957 public DescriptionDetailElement createDescriptionDetailElement(ICdmFormElement parentElement, int style){
1958 DescriptionDetailElement element = new DescriptionDetailElement(this, parentElement, style);
1959 addAndAdaptElement(parentElement, element);
1960 return element;
1961 }
1962
1963 public PersonDetailElement createPersonDetailElement(ICdmFormElement parentElement, int style){
1964 PersonDetailElement element = new PersonDetailElement(this, parentElement, style);
1965 addAndAdaptElement(parentElement, element);
1966 return element;
1967 }
1968
1969 public TeamDetailElement createTeamDetailElement(ICdmFormElement parentElement, int style){
1970 TeamDetailElement element = new TeamDetailElement(this, parentElement, style);
1971 addAndAdaptElement(parentElement, element);
1972 return element;
1973 }
1974
1975 public AuthorshipDetailElement createAuthorshipDetailElement(ICdmFormElement parentElement, int style){
1976 AuthorshipDetailElement element = new AuthorshipDetailElement(this, parentElement, style);
1977 addAndAdaptElement(parentElement, element);
1978 return element;
1979 }
1980
1981 public TaxonBaseDetailElement createTaxonBaseDetailElement(ICdmFormElement parentElement, int style){
1982 TaxonBaseDetailElement element = new TaxonBaseDetailElement(this, parentElement, style);
1983 addAndAdaptElement(parentElement, element);
1984 return element;
1985 }
1986
1987 public NameDetailElement createNameDetailElement(ICdmFormElement parentElement, int style){
1988 NameDetailElement element = new NameDetailElement(this, parentElement, style);
1989 addAndAdaptElement(parentElement, element);
1990 return element;
1991 }
1992
1993 public ReferenceDetailElement createReferenceDetailElement(ICdmFormElement parentElement, int style){
1994 ReferenceDetailElement element = new ReferenceDetailElement(this, parentElement, style);
1995 addAndAdaptElement(parentElement, element);
1996 return element;
1997 }
1998
1999 public NomenclaturalReferenceDetailElement createNomenclaturalReferenceDetailElement(ICdmFormElement parentElement, int style){
2000 NomenclaturalReferenceDetailElement element = new NomenclaturalReferenceDetailElement(this, parentElement, style);
2001 addAndAdaptElement(parentElement, element);
2002 return element;
2003 }
2004
2005
2006 public FieldUnitGeneralDetailElement createFieldUnitGeneralDetailElement(ICdmFormElement parentElement){
2007 FieldUnitGeneralDetailElement element = new FieldUnitGeneralDetailElement(this, parentElement);
2008 addAndAdaptElement(parentElement, element);
2009 return element;
2010 }
2011
2012 public DerivedUnitGeneralDetailElement createDerivedUnitGeneralDetailElement(ICdmFormElement parentElement){
2013 DerivedUnitGeneralDetailElement element = new DerivedUnitGeneralDetailElement(this, parentElement);
2014 addAndAdaptElement(parentElement, element);
2015 return element;
2016 }
2017
2018 public TaxonAssociationDetailElement createTaxonAssociationDetailElement(ICdmFormElement parentElement){
2019 TaxonAssociationDetailElement element = new TaxonAssociationDetailElement(this, parentElement);
2020 addAndAdaptElement(parentElement, element);
2021 return element;
2022 }
2023
2024 public PreservedSpecimenGeneralDetailElement createPreservedSpecimenGeneralDetailElement(ICdmFormElement parentElement){
2025 PreservedSpecimenGeneralDetailElement element = new PreservedSpecimenGeneralDetailElement(this, parentElement);
2026 addAndAdaptElement(parentElement, element);
2027 return element;
2028 }
2029
2030 public TissueSampleGeneralDetailElement createTissueSampleGeneralDetailElement(ICdmFormElement parentElement){
2031 TissueSampleGeneralDetailElement element = new TissueSampleGeneralDetailElement(this, parentElement);
2032 addAndAdaptElement(parentElement, element);
2033 return element;
2034 }
2035
2036 public DnaSampleGeneralDetailElement createDnaSampleGeneralDetailElement(ICdmFormElement parentElement){
2037 DnaSampleGeneralDetailElement element = new DnaSampleGeneralDetailElement(this, parentElement);
2038 addAndAdaptElement(parentElement, element);
2039 return element;
2040 }
2041
2042 public DnaSamplePreparationPreservationDetailElement createDnaSamplePreparationPreservationDetailElement(ICdmFormElement parentElement){
2043 DnaSamplePreparationPreservationDetailElement element = new DnaSamplePreparationPreservationDetailElement(this, parentElement);
2044 addAndAdaptElement(parentElement, element);
2045 return element;
2046 }
2047
2048 public DnaQualityDetailElement createDnaQualityDetailElement(ICdmFormElement parentElement){
2049 DnaQualityDetailElement element = new DnaQualityDetailElement(this, parentElement);
2050 addAndAdaptElement(parentElement, element);
2051 return element;
2052 }
2053
2054 public SequenceGeneralDetailElement createSequenceGeneralDetailElement(ICdmFormElement parentElement){
2055 SequenceGeneralDetailElement element = new SequenceGeneralDetailElement(this, parentElement);
2056 addAndAdaptElement(parentElement, element);
2057 return element;
2058 }
2059
2060 public SingleReadGeneralDetailElement createSingleReadGeneralDetailElement(ICdmFormElement parentElement){
2061 SingleReadGeneralDetailElement element = new SingleReadGeneralDetailElement(this, parentElement);
2062 addAndAdaptElement(parentElement, element);
2063 return element;
2064 }
2065
2066 public PrimerGeneralDetailElement createPrimerGeneralDetailElement(ICdmFormElement parentElement){
2067 PrimerGeneralDetailElement element = new PrimerGeneralDetailElement(this, parentElement);
2068 addAndAdaptElement(parentElement, element);
2069 return element;
2070 }
2071
2072 public AmplificationGeneralDetailElement createAmplificationGeneralDetailElement(ICdmFormElement parentElement){
2073 AmplificationGeneralDetailElement element = new AmplificationGeneralDetailElement(this, parentElement);
2074 addAndAdaptElement(parentElement, element);
2075 return element;
2076 }
2077
2078 public AmplificationPrimerDetailElement createAmplificationPrimerDetailElement(ICdmFormElement parentElement){
2079 AmplificationPrimerDetailElement element = new AmplificationPrimerDetailElement(this, parentElement);
2080 addAndAdaptElement(parentElement, element);
2081 return element;
2082 }
2083
2084 public AmplificationCloningDetailElement createAmplificationCloningDetailElement(ICdmFormElement parentElement){
2085 AmplificationCloningDetailElement element = new AmplificationCloningDetailElement(this, parentElement);
2086 addAndAdaptElement(parentElement, element);
2087 return element;
2088 }
2089
2090 public AmplificationGelPhotoDetailElement createAmplificationGelPhotoDetailElement(ICdmFormElement parentElement){
2091 AmplificationGelPhotoDetailElement element = new AmplificationGelPhotoDetailElement(this, parentElement);
2092 addAndAdaptElement(parentElement, element);
2093 return element;
2094 }
2095
2096 public MediaSpecimenGeneralDetailElement createMediaSpecimenGeneralDetailElement(ICdmFormElement parentElement){
2097 MediaSpecimenGeneralDetailElement element = new MediaSpecimenGeneralDetailElement(this, parentElement);
2098 addAndAdaptElement(parentElement, element);
2099 return element;
2100 }
2101
2102 public MediaDetailElement createMediaDetailElement(ICdmFormElement parentElement){
2103 MediaDetailElement mediaDetailElement = new MediaDetailElement(this, parentElement);
2104 addAndAdaptElement(parentElement, mediaDetailElement);
2105 return mediaDetailElement;
2106 }
2107
2108 public GatheringEventDetailElement createGatheringEventDetailElement(ICdmFormElement parentElement) {
2109 GatheringEventDetailElement element = new GatheringEventDetailElement(this, parentElement);
2110 addAndAdaptElement(parentElement, element);
2111 return element;
2112 }
2113
2114 public FieldUnitDetailElement createFieldUnitDetailElement(ICdmFormElement parentElement) {
2115 FieldUnitDetailElement element = new FieldUnitDetailElement(this, parentElement);
2116 addAndAdaptElement(parentElement, element);
2117 return element;
2118 }
2119
2120 public SpecimenHierarchyDetailElement createSpecimenHierarchyDetailElement(ICdmFormElement parentElement) {
2121 SpecimenHierarchyDetailElement element = new SpecimenHierarchyDetailElement(this, parentElement);
2122 addAndAdaptElement(parentElement, element);
2123 return element;
2124 }
2125
2126 public DerivedUnitBaseDetailElement createDerivedUnitBaseDetailElement(ICdmFormElement parentElement) {
2127 DerivedUnitBaseDetailElement element = new DerivedUnitBaseDetailElement(this, parentElement);
2128 addAndAdaptElement(parentElement, element);
2129 return element;
2130 }
2131
2132 public OriginalLabelDataElement createOriginalLabelDataElement(ICdmFormElement parentElement) {
2133 OriginalLabelDataElement element = new OriginalLabelDataElement(this, parentElement);
2134 addAndAdaptElement(parentElement, element);
2135 return element;
2136 }
2137
2138 public PreservedSpecimenDetailElement createPreservedSpecimenDetailElement(ICdmFormElement parentElement) {
2139 PreservedSpecimenDetailElement element = new PreservedSpecimenDetailElement(this, parentElement);
2140 addAndAdaptElement(parentElement, element);
2141 return element;
2142 }
2143
2144 public DeterminationDetailElement createDeterminationDetailElement(ICdmFormElement parentElement) {
2145 DeterminationDetailElement element = new DeterminationDetailElement(this, parentElement);
2146 addAndAdaptElement(parentElement, element);
2147 return element;
2148 }
2149
2150 public SampleDesignationDetailElement createSampleDesignationDetailElement(ICdmFormElement parentElement) {
2151 SampleDesignationDetailElement element = new SampleDesignationDetailElement(this, parentElement);
2152 addAndAdaptElement(parentElement, element);
2153 return element;
2154 }
2155
2156 /**
2157 * @param parentElement
2158 * @param element
2159 */
2160 private void addAndAdaptElement(ICdmFormElement parentElement, AbstractCdmDetailElement<?> element) {
2161 adapt(element);
2162 parentElement.addElement(element);
2163 }
2164
2165 //--------EntityCollectionSection----------
2166 public TeamMemberSection createTeamMemberSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2167 TeamMemberSection section = new TeamMemberSection(this, conversation, parentElement, style);
2168 addAndAdaptSection(parentElement, section);
2169 return section;
2170 }
2171
2172 public AnnotationSection createAnnotationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2173 AnnotationSection section = new AnnotationSection(this, conversation, parentElement, style);
2174 addAndAdaptSection(parentElement, section);
2175 return section;
2176 }
2177
2178 public CreditSection createCreditSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2179 CreditSection section = new CreditSection(this, conversation, parentElement, style);
2180 addAndAdaptSection(parentElement, section);
2181 return section;
2182 }
2183
2184 public DescriptionElementSourceSection createDescriptionElementSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2185 DescriptionElementSourceSection section = new DescriptionElementSourceSection(this, conversation, parentElement, style);
2186 addAndAdaptSection(parentElement, section);
2187 return section;
2188 }
2189
2190 public ExtensionSection createExtensionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2191 ExtensionSection section = new ExtensionSection(this, conversation, parentElement, style);
2192 addAndAdaptSection(parentElement, section);
2193 return section;
2194 }
2195
2196 public MarkerSection createMarkerSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2197 MarkerSection section = new MarkerSection(this, conversation, parentElement, style);
2198 addAndAdaptSection(parentElement, section);
2199 return section;
2200 }
2201
2202 public MediaSection createMediaSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2203 MediaSection section = new MediaSection(this, conversation, parentElement, style);
2204 addAndAdaptSection(parentElement, section);
2205 return section;
2206 }
2207
2208 public DescriptionElementMediaSection createDescriptionElementMediaSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2209 DescriptionElementMediaSection section = new DescriptionElementMediaSection(this, conversation, parentElement, style);
2210 addAndAdaptSection(parentElement, section);
2211 return section;
2212 }
2213
2214 public MediaRepresentationSection createMediaRepresentationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2215 MediaRepresentationSection section = new MediaRepresentationSection(this, conversation, parentElement, style);
2216 addAndAdaptSection(parentElement, section);
2217 return section;
2218 }
2219
2220 public MediaRepresentationPartSection createMediaRepresentationPartSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2221 MediaRepresentationPartSection section = new MediaRepresentationPartSection(this, conversation, parentElement, style);
2222 addAndAdaptSection(parentElement, section);
2223 return section;
2224 }
2225
2226 public ModifierSection createModifierSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2227 ModifierSection section = new ModifierSection(this, conversation, parentElement, style);
2228 addAndAdaptSection(parentElement, section);
2229 return section;
2230 }
2231
2232 public NomenclaturalStatusSection createNomenclaturalStatusSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2233 NomenclaturalStatusSection section = new NomenclaturalStatusSection(this, conversation, parentElement, style);
2234 addAndAdaptSection(parentElement, section);
2235 return section;
2236 }
2237
2238 public NameRelationshipDetailSection createNameRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2239 NameRelationshipDetailSection section = new NameRelationshipDetailSection(this, conversation, parentElement, style);
2240 addAndAdaptSection(parentElement, section);
2241 return section;
2242 }
2243
2244 public SynonymRelationshipDetailSection createSynonymRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2245 SynonymRelationshipDetailSection section = new SynonymRelationshipDetailSection(this, conversation, parentElement, style);
2246 addAndAdaptSection(parentElement, section);
2247 return section;
2248 }
2249
2250 public ProtologueSection createProtologueSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2251 ProtologueSection section = new ProtologueSection(this, conversation, parentElement, style);
2252 addAndAdaptSection(parentElement, section);
2253 return section;
2254 }
2255
2256 public RightsSection createRightsSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2257 RightsSection section = new RightsSection(this, conversation, parentElement, style);
2258 addAndAdaptSection(parentElement, section);
2259 return section;
2260 }
2261
2262 public SourceSection createSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2263 SourceSection section = new SourceSection(this, conversation, parentElement, style);
2264 addAndAdaptSection(parentElement, section);
2265 return section;
2266 }
2267
2268 public ScopeSection createScopeSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2269 ScopeSection section = new ScopeSection(this, conversation, parentElement, style);
2270 addAndAdaptSection(parentElement, section);
2271 return section;
2272 }
2273
2274 public DescriptionSourceSection createDescriptionSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2275 DescriptionSourceSection section = new DescriptionSourceSection(this, conversation, parentElement, style);
2276 addAndAdaptSection(parentElement, section);
2277 return section;
2278 }
2279
2280 public TypeDesignationSection createTypeDesignationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2281 TypeDesignationSection section = new TypeDesignationSection(this, conversation, parentElement, style);
2282 addAndAdaptSection(parentElement, section);
2283 return section;
2284 }
2285
2286 public StateDataSection createStateDataSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2287 StateDataSection section = new StateDataSection(this, conversation, parentElement, style);
2288 addAndAdaptSection(parentElement, section);
2289 return section;
2290 }
2291
2292 public StatisticalMeasurementValueSection createStatisticalMeasurementValueSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2293 StatisticalMeasurementValueSection section = new StatisticalMeasurementValueSection(this, conversation, parentElement, style);
2294 addAndAdaptSection(parentElement, section);
2295 return section;
2296 }
2297
2298 public DescribedSpecimenSection createDescribedSpecimenSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2299 DescribedSpecimenSection section = new DescribedSpecimenSection(this, conversation, parentElement, style);
2300 addAndAdaptSection(parentElement, section);
2301 return section;
2302 }
2303
2304 public StateVocabularyCollectionSection createStateVocabulariesSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2305 StateVocabularyCollectionSection section = new StateVocabularyCollectionSection(this, conversation, parentElement, style);
2306 addAndAdaptSection(parentElement, section);
2307 return section;
2308 }
2309
2310 public RecommendedModifierVocabulariesCollectionSection createRecommendedModifierVocabulariesCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2311 RecommendedModifierVocabulariesCollectionSection section = new RecommendedModifierVocabulariesCollectionSection(this, conversation, parentElement, style);
2312 addAndAdaptSection(parentElement, section);
2313 return section;
2314 }
2315
2316 public MeasurementUnitCollectionSection createMeasurementUnitCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2317 MeasurementUnitCollectionSection section = new MeasurementUnitCollectionSection(this, conversation, parentElement, style);
2318 addAndAdaptSection(parentElement, section);
2319 return section;
2320 }
2321
2322 public StatisticalMeasureCollectionSection createStatisticalMeasureCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2323 StatisticalMeasureCollectionSection section = new StatisticalMeasureCollectionSection(this, conversation, parentElement, style);
2324 addAndAdaptSection(parentElement, section);
2325 return section;
2326 }
2327
2328 public CollectingAreasDetailSection createCollectingAreasDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2329 CollectingAreasDetailSection section = new CollectingAreasDetailSection(this, conversation, parentElement, style);
2330 addAndAdaptSection(parentElement, section);
2331 return section;
2332 }
2333
2334 public GeoScopeDetailSection createGeoScopeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2335 GeoScopeDetailSection section = new GeoScopeDetailSection(this, conversation, parentElement, style);
2336 addAndAdaptSection(parentElement, section);
2337 return section;
2338 }
2339
2340 public GeoScopePolyKeyDetailSection createGeoScopePolyKeyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2341 GeoScopePolyKeyDetailSection section = new GeoScopePolyKeyDetailSection(this, conversation, parentElement, style);
2342 addAndAdaptSection(parentElement, section);
2343 return section;
2344 }
2345
2346 public IdentifierDetailSection createIdentifierDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2347 IdentifierDetailSection section = new IdentifierDetailSection(this, conversation, parentElement, style);
2348 addAndAdaptSection(parentElement, section);
2349 return section;
2350 }
2351
2352 public CurrentSampleDesignationDetailSection createCurrentSampleDesignationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2353 CurrentSampleDesignationDetailSection section = new CurrentSampleDesignationDetailSection(this, conversation, parentElement, style);
2354 addAndAdaptSection(parentElement, section);
2355 return section;
2356 }
2357
2358 public CurrentDeterminationDetailSection createCurrentDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2359 CurrentDeterminationDetailSection section = new CurrentDeterminationDetailSection(this, conversation, parentElement, style);
2360 addAndAdaptSection(parentElement, section);
2361 return section;
2362 }
2363
2364 public PreservedSpecimenCurrentDeterminationDetailSection createPreservedSpecimenCurrentDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2365 PreservedSpecimenCurrentDeterminationDetailSection section = new PreservedSpecimenCurrentDeterminationDetailSection(this, conversation, parentElement, style);
2366 addAndAdaptSection(parentElement, section);
2367 return section;
2368 }
2369
2370 public SampleDesignationHistoryDetailSection createSampleDesignationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2371 SampleDesignationHistoryDetailSection section = new SampleDesignationHistoryDetailSection(this, conversation, parentElement, style);
2372 addAndAdaptSection(parentElement, section);
2373 return section;
2374 }
2375
2376 public DeterminationHistoryDetailSection createDeterminationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2377 DeterminationHistoryDetailSection section = new DeterminationHistoryDetailSection(this, conversation, parentElement, style);
2378 addAndAdaptSection(parentElement, section);
2379 return section;
2380 }
2381
2382 public SpecimenCollectionDetailSection createSpecimenCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2383 SpecimenCollectionDetailSection section = new SpecimenCollectionDetailSection(this, conversation, parentElement, style);
2384 addAndAdaptSection(parentElement, section);
2385 return section;
2386 }
2387
2388 public PreservedSpecimenSourceCollectionDetailSection createPreservedSpecimenSourceCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2389 PreservedSpecimenSourceCollectionDetailSection section = new PreservedSpecimenSourceCollectionDetailSection(this, conversation, parentElement, style);
2390 addAndAdaptSection(parentElement, section);
2391 return section;
2392 }
2393
2394 public SourceCollectionDetailSection createSourceCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2395 SourceCollectionDetailSection section = new SourceCollectionDetailSection(this, conversation, parentElement, style);
2396 addAndAdaptSection(parentElement, section);
2397 return section;
2398 }
2399
2400 public ScopeRestrictionSection createScopeRestrictionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2401 ScopeRestrictionSection section = new ScopeRestrictionSection(this, conversation, parentElement, style);
2402 addAndAdaptSection(parentElement, section);
2403 return section;
2404 }
2405
2406 public MemberDetailSection createMemberDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2407 MemberDetailSection section = new MemberDetailSection(this, conversation, parentElement, style);
2408 addAndAdaptSection(parentElement, section);
2409 return section;
2410 }
2411
2412 public GrantedAuthorityDetailSection createGrantedAuthorityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2413 GrantedAuthorityDetailSection section = new GrantedAuthorityDetailSection(this, conversation, parentElement, style);
2414 addAndAdaptSection(parentElement, section);
2415 return section;
2416 }
2417
2418 public GroupsByUserDetailSection createGroupsByUserDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2419 GroupsByUserDetailSection section = new GroupsByUserDetailSection(this, conversation, parentElement, style);
2420 addAndAdaptSection(parentElement, section);
2421 return section;
2422 }
2423
2424 public TaxonomicScopeSection createTaxonomicScopeSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
2425 TaxonomicScopeSection section = new TaxonomicScopeSection(this, conversation, parentElement, style);
2426 addAndAdaptSection(parentElement, section);
2427 return section;
2428 }
2429
2430
2431 public AbstractEntityCollectionElement createEntityCollectionElement(AbstractFormSection parentElement,
2432 Object versionableEntity, SelectionListener removeListener, Color backgroundColor, int style) {
2433 AbstractEntityCollectionElement element = null;
2434
2435 Object entity = HibernateProxyHelper.deproxy(versionableEntity);
2436
2437 if (entity instanceof Annotation) {
2438 element = new AnnotationElement(this, parentElement, (Annotation) entity, removeListener, style);
2439 }else if (entity instanceof Person) {
2440 element = new TeamMemberElement(this, parentElement, (Person) entity, removeListener, style);
2441 } else if (entity instanceof Credit) {
2442 element = new CreditElement(this, parentElement, (Credit) entity, removeListener, style);
2443 } else if (entity instanceof Extension) {
2444 element = new ExtensionElement(this, parentElement, (Extension) entity, removeListener, style);
2445 } else if (entity instanceof Marker) {
2446 element = new MarkerElement(this, parentElement, (Marker) entity, removeListener, style);
2447 } else if (entity instanceof TaxonNodeAgentRelation) {
2448 element = new TaxonNodeAgentRelationCollectionElement(this, parentElement, (TaxonNodeAgentRelation) entity, removeListener, backgroundColor, style);
2449 }else if (entity instanceof Media) {
2450 element = new MediaMetaElement(this, parentElement, (Media) entity, removeListener, true, style);
2451 } else if (entity instanceof MediaRepresentation) {
2452 element = new MediaRepresentationElement(this, parentElement, (MediaRepresentation) entity, removeListener,
2453 style);
2454 } else if (entity instanceof ImageFile) {
2455 element = new ImageFileElement(this, parentElement, (ImageFile) entity, removeListener, style);
2456 } else if (entity instanceof MediaRepresentationPart) {
2457 element = new MediaRepresentationPartElement(this, parentElement, (MediaRepresentationPart) entity,
2458 removeListener, style);
2459 } else if (entity instanceof NomenclaturalStatus) {
2460 element = new NomenclaturalStatusElement(this, parentElement, (NomenclaturalStatus) entity, removeListener,
2461 style);
2462 } else if (entity instanceof Rights) {
2463 element = new RightsElement(this, parentElement, (Rights) entity, removeListener, style);
2464 } else if (entity instanceof DescriptionElementSource) {
2465 element = new DescriptionElementSourceElement(this, parentElement, (DescriptionElementSource) entity,
2466 removeListener, style);
2467 } else if (entity instanceof TaxonNodeAgentRelation) {
2468 element = new TaxonNodeAgentRelationCollectionElement(this, parentElement, (TaxonNodeAgentRelation) entity,
2469 removeListener,backgroundColor, style);
2470 }
2471 else if (entity instanceof IdentifiableSource) {
2472 element = new IdentifiableSourceElement(this, parentElement, (IdentifiableSource) entity, removeListener,
2473 style);
2474 } else if (entity instanceof DefinedTerm) {
2475 switch(((DefinedTerm)entity).getTermType()) {
2476 case Scope:
2477 element = new ScopeElement(this,
2478 parentElement,
2479 (DefinedTerm) entity,
2480 removeListener,
2481 style);
2482 break;
2483 case Modifier:
2484 element = new ModifierElement(this,
2485 parentElement,
2486 (DefinedTerm) entity,
2487 removeListener,
2488 style);
2489 break;
2490 default:
2491 break;
2492
2493 }
2494 } else if (entity instanceof Reference) {
2495 if(parentElement instanceof SequenceReferenceCollectionDetailSection){
2496 element = new SequenceReferenceCollectionDetailElement(this, parentElement, (Reference) entity, removeListener, style);
2497 }
2498 else{
2499 element = new DescriptionSourceElement(this, parentElement, (Reference) entity, removeListener, style);
2500 }
2501 } else if (entity instanceof NameTypeDesignation) {
2502 element = new NameTypeDesignationElement(this, parentElement, (NameTypeDesignation) entity, removeListener,
2503 style);
2504 } else if (entity instanceof NameRelationship) {
2505 element = new NameRelationshipDetailElement(this, parentElement, (NameRelationship) entity, removeListener,
2506 style);
2507 } else if (entity instanceof SynonymRelationship) {
2508 element = new SynonymRelationshipDetailElement(this, parentElement, (SynonymRelationship) entity, removeListener,
2509 style);
2510 } else if (entity instanceof SpecimenTypeDesignation) {
2511 if(parentElement instanceof DerivedUnitTypeDesignationSection){
2512 element = new DerivedUnitTypeDesignationElement(this, parentElement, (SpecimenTypeDesignation) entity,
2513 removeListener, style);
2514 }
2515 else{
2516 element = new SpecimenTypeDesignationElement(this, parentElement, (SpecimenTypeDesignation) entity,
2517 removeListener, style);
2518 }
2519 } else if (entity instanceof StateData) {
2520 element = new StateDataElement(this, parentElement, (StateData) entity, removeListener, style);
2521 } else if (entity instanceof StatisticalMeasurementValue) {
2522 element = new StatisticalMeasurementValueElement(this, parentElement, (StatisticalMeasurementValue) entity,
2523 removeListener, style);
2524 } else if (entity instanceof DerivedUnit) {
2525 switch(((DerivedUnit)entity).getRecordBasis()) {
2526 case LivingSpecimen:
2527 case PreservedSpecimen:
2528 case OtherSpecimen:
2529 element = new SpecimenCollectionDetailElement(this,
2530 parentElement,
2531 (DerivedUnit) entity,
2532 removeListener,
2533 style);
2534 break;
2535 default:
2536 element = new DerivedUnitElement(this,
2537 parentElement,
2538 (DerivedUnit) entity,
2539 removeListener,
2540 style);
2541 }
2542
2543 } else if (entity instanceof NamedArea) {
2544 element = new NamedAreaDetailElement(this, parentElement, (NamedArea) entity, removeListener, style);
2545 } else if (entity instanceof DeterminationEvent) {
2546 element = new DeterminationEventDetailElement(this, parentElement, (DeterminationEvent) entity, removeListener, style);
2547 } else if (entity instanceof User) {
2548 element = new MemberDetailElement(this, parentElement, (User) entity, removeListener, style);
2549 } else if (entity instanceof GrantedAuthority) {
2550 element = new GrantedAuthorityCollectionElement(this, parentElement, (GrantedAuthorityImpl) entity,
2551 removeListener, style);
2552 } else if (entity instanceof Group) {
2553 element = new GroupsByUserDetailElement(this, parentElement, (Group) entity, removeListener, style);
2554 } else if (entity instanceof Taxon) {
2555 element = new TaxonDetailElement(this, parentElement, (Taxon) entity, removeListener, style);
2556 } else if (entity instanceof DescriptionElementBase) {
2557 // this is the special case for protologs, maybe we can do this
2558 // differently when API improves
2559 DescriptionElementBase descriptionElement = (DescriptionElementBase) entity;
2560 if (descriptionElement.getFeature().equals(Feature.PROTOLOGUE())) {
2561 element = new ProtologueElement(this, parentElement, descriptionElement, removeListener, style);
2562 }
2563 } else if (entity instanceof Identifier) {
2564 if(parentElement instanceof AbstractSampleDesignationDetailSection){
2565 element = new SampleDesignationTextDetailElement(this, parentElement, (Identifier<DnaSample>) entity, removeListener, backgroundColor, style);
2566 }
2567 else{
2568 element = new IdentifierDetailElement(this, parentElement, (Identifier) entity, removeListener, style);
2569 }
2570 } else if (entity instanceof TermVocabulary) {
2571 TermVocabulary<?> termVocabulary = (TermVocabulary<?>)entity;
2572 switch (termVocabulary.getTermType()) {
2573 case State:
2574 element = new StateVocabularyCollectionElement(this, parentElement, (TermVocabulary<State>) entity, removeListener, backgroundColor, style);
2575 break;
2576 case Modifier:
2577 element = new RecommendedModifierVocabulariesElement(this, parentElement, (TermVocabulary<DefinedTerm>) entity, removeListener, backgroundColor, style);
2578 break;
2579 default:
2580 break;
2581 }
2582 } else if (entity instanceof MeasurementUnit) {
2583 element = new MeasurementUnitCollectionElement(this, parentElement, (MeasurementUnit) entity, removeListener, backgroundColor, style);
2584 } else if (entity instanceof StatisticalMeasure) {
2585 element = new StatisticalMeasureCollectionElement(this, parentElement, (StatisticalMeasure) entity, removeListener, backgroundColor, style);
2586 }
2587
2588
2589 if (element == null) {
2590 MessagingUtils.messageDialog("No element for entity", this,
2591 "Could not generate element for entity. Looks like the case is not handled already. Check implementation. Entity: "
2592 + entity, null);
2593 }
2594
2595 else{
2596 if (backgroundColor != null && !backgroundColor.isDisposed()) {
2597 element.setPersistentBackground(backgroundColor);
2598 }
2599 adapt(element);
2600 parentElement.addElement(element);
2601 }
2602
2603 return element;
2604 }
2605
2606 /**
2607 * <p>
2608 * Creates a selection element for the given type T.
2609 * </p>
2610 * <p>
2611 * <strong>Selection elements not handled by this method:</strong>
2612 * <ul>
2613 * <li>{@link TaxonNodeSelectionElement} see
2614 * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
2615 * </li>
2616 * <li>{@link NomenclaturalAuthorTeamSelectionElement} see
2617 * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
2618 * </li>
2619 * </ul>
2620 * </p>
2621 *
2622 * @param clazz
2623 * a {@link Class} object of the type that you want the selection
2624 * element to handle
2625 * @param parentElement
2626 * a {@link ICdmFormElement} object.
2627 * @param labelString
2628 * a {@link String} object.
2629 * @param selectionType
2630 * @param selection
2631 * a {@link ICdmBase} object.
2632 * @param style
2633 * a int.
2634 * @param conversation
2635 * a {@link ConversationHolder} object.
2636 * @return a {@link EntitySelectionElement} object.
2637 */
2638 public <T extends CdmBase> EntitySelectionElement<T> createSelectionElement(Class<T> clazz,
2639 ConversationHolder conversation, ICdmFormElement parentElement, String labelString, T selection, int mode,
2640 int style) {
2641 EntitySelectionElement<T> element = new EntitySelectionElement<T>(this, conversation, parentElement, clazz,
2642 labelString, selection, mode, style);
2643 adapt(element);
2644 parentElement.addElement(element);
2645 return element;
2646 }
2647
2648 /**
2649 * <p>
2650 * Creates a selection element for the given type T which shows only the <b>abbreviated</b> title as the label.
2651 * </p>
2652 * <p>
2653 * <strong>Selection elements not handled by this method:</strong>
2654 * <ul>
2655 * <li>{@link TaxonNodeSelectionElement} see
2656 * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
2657 * </li>
2658 * <li>{@link NomenclaturalAuthorTeamSelectionElement} see
2659 * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
2660 * </li>
2661 * </ul>
2662 * </p>
2663 *
2664 * @param clazz
2665 * a {@link Class} object of the type that you want the selection
2666 * element to handle
2667 * @param parentElement
2668 * a {@link ICdmFormElement} object.
2669 * @param labelString
2670 * a {@link String} object.
2671 * @param selectionType
2672 * @param selection
2673 * a {@link ICdmBase} object.
2674 * @param style
2675 * a int.
2676 * @param conversation
2677 * a {@link ConversationHolder} object.
2678 * @return a {@link EntitySelectionElement} object.
2679 */
2680 public <T extends CdmBase> EntitySelectionElementWithAbbreviatedTitle<T> createSelectionElementWithAbbreviatedTitle(
2681 Class<T> clazz, ConversationHolder conversation, ICdmFormElement parentElement, String labelString,
2682 T selection, int mode, int style) {
2683 EntitySelectionElementWithAbbreviatedTitle<T> element = new EntitySelectionElementWithAbbreviatedTitle<T>(this, conversation, parentElement, clazz,
2684 labelString, selection, mode, style);
2685 adapt(element);
2686 parentElement.addElement(element);
2687 return element;
2688 }
2689
2690 public TaxonNodeSelectionElement createTaxonNodeSelectionElement(ConversationHolder conversation,
2691 ICdmFormElement parentElement, String labelString, TaxonNode selection, int mode, int style) {
2692 TaxonNodeSelectionElement element = new TaxonNodeSelectionElement(this, conversation, parentElement,
2693 labelString, selection, mode, style);
2694 adapt(element);
2695 parentElement.addElement(element);
2696 return element;
2697 }
2698
2699 public NomenclaturalAuthorTeamSelectionElement createNomenclaturalAuthorTeamSelectionElement(
2700 ConversationHolder conversation, ICdmFormElement parentElement, String labelString, Team selection,
2701 int mode, int style) {
2702 NomenclaturalAuthorTeamSelectionElement element = new NomenclaturalAuthorTeamSelectionElement(this,
2703 conversation, parentElement, labelString, selection, mode, style);
2704 adapt(element);
2705 parentElement.addElement(element);
2706 return element;
2707 }
2708
2709 /** {@inheritDoc} */
2710 public LabelElement createLabel(ICdmFormElement parentElement, String text) {
2711 LabelElement labelElement = new LabelElement(this, parentElement, text);
2712 adapt(labelElement);
2713 parentElement.addElement(labelElement);
2714 return labelElement;
2715 }
2716
2717 public DateElement createDateElement(ICdmFormElement formElement, String labelText, DateTime dateTime, int style){
2718 Label label = new Label(formElement.getLayoutComposite(), style);
2719 label.setText(labelText+" (yyyy-MM-dd)");
2720 DateElement dateElement = new DateElement(formElement.getLayoutComposite(), dateTime, style);
2721 dateElement.initController(this, formElement);
2722 return dateElement;
2723 }
2724
2725 /**
2726 * <p>
2727 * Getter for the field <code>selectionProvider</code>.
2728 * </p>
2729 *
2730 * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
2731 */
2732 public ISelectionProvider getSelectionProvider() {
2733 return selectionProvider;
2734 }
2735
2736 /**
2737 * <p>
2738 * createDetailedDescriptionDetailElement
2739 * </p>
2740 *
2741 * @param parentElement
2742 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
2743 * object.
2744 * @param entity
2745 * a
2746 * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
2747 * object.
2748 * @param style
2749 * a int.
2750 * @return a
2751 * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
2752 * object.
2753 */
2754 public AbstractDetailedDescriptionDetailElement createDetailedDescriptionDetailElement(
2755 ICdmFormElement parentElement, DescriptionElementBase entity, int style) {
2756 AbstractDetailedDescriptionDetailElement detailedDescriptionElement = null;
2757
2758 if (entity instanceof CategoricalData) {
2759 detailedDescriptionElement = new CategoricalDataDetailElement(this, parentElement,
2760 (CategoricalData) entity, style);
2761 } else if (entity instanceof CommonTaxonName) {
2762 detailedDescriptionElement = new CommonNameDetailElement(this, parentElement, (CommonTaxonName) entity,
2763 style);
2764 } else if (entity instanceof Distribution) {
2765 detailedDescriptionElement = new DistributionDetailElement(this, parentElement, (Distribution) entity,
2766 style);
2767 } else if (entity instanceof IndividualsAssociation) {
2768 detailedDescriptionElement = new IndividualsAssociationDetailElement(this, parentElement,
2769 (IndividualsAssociation) entity, style);
2770 } else if (entity instanceof QuantitativeData) {
2771 detailedDescriptionElement = new QuantitativeDataDetailElement(this, parentElement,
2772 (QuantitativeData) entity, style);
2773 } else if (entity instanceof TaxonInteraction) {
2774 detailedDescriptionElement = new TaxonInteractionDetailElement(this, parentElement,
2775 (TaxonInteraction) entity, style);
2776 } else if (entity instanceof TextData) {
2777 detailedDescriptionElement = new TextDataDetailElement(this, parentElement, (TextData) entity, style);
2778 } else {
2779 throw new IllegalStateException("There is no interface for the given description element");
2780 }
2781 adapt(detailedDescriptionElement);
2782 parentElement.addElement(detailedDescriptionElement);
2783 return detailedDescriptionElement;
2784
2785 }
2786
2787 /**
2788 * Creates a styled text as a part of the form.
2789 *
2790 * @param parent
2791 * the text parent
2792 * @param value
2793 * the text initial value
2794 * @param style
2795 * the text style
2796 * @return the text widget
2797 */
2798 public StyledText createStyledText(Composite parent, String value, int style) {
2799 StyledText text = new StyledText(parent, getBorderStyle() | style | getOrientation());
2800 if (value != null) {
2801 text.setText(value);
2802 }
2803 text.setForeground(getColors().getForeground());
2804 text.setBackground(getColors().getBackground());
2805 // text.addFocusListener(visibilityHandler);
2806 return text;
2807 }
2808
2809 public PreservedSpecimenDetailSection createPreservedSpecimenDetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
2810 PreservedSpecimenDetailSection section = new PreservedSpecimenDetailSection(this, conversation, parentElement, selectionProvider, style);
2811 addAndAdaptSection(parentElement, section);
2812 return section;
2813 }
2814
2815 /**
2816 * @param formElement
2817 * @param conversationHolder
2818 * @param style
2819 * @return
2820 */
2821 public TaxonNodeAgentRelationCollectionSection createTaxonNodeAgentRelationCollectionSection(
2822 ICdmFormElement formElement, ConversationHolder conversationHolder, int style) {
2823 TaxonNodeAgentRelationCollectionSection section = new TaxonNodeAgentRelationCollectionSection(this, conversationHolder, formElement, style);
2824 addAndAdaptSection(formElement, section);
2825 return section;
2826 }
2827
2828 }