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