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