1
|
/**
|
2
|
*
|
3
|
*/
|
4
|
package eu.etaxonomy.taxeditor.forms;
|
5
|
|
6
|
import java.net.URI;
|
7
|
import java.util.HashSet;
|
8
|
import java.util.Map;
|
9
|
import java.util.Set;
|
10
|
|
11
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
12
|
import org.eclipse.jface.viewers.ISelection;
|
13
|
import org.eclipse.jface.viewers.ISelectionProvider;
|
14
|
import org.eclipse.jface.window.Window;
|
15
|
import org.eclipse.swt.SWT;
|
16
|
import org.eclipse.swt.custom.StyledText;
|
17
|
import org.eclipse.swt.events.FocusAdapter;
|
18
|
import org.eclipse.swt.events.FocusEvent;
|
19
|
import org.eclipse.swt.events.FocusListener;
|
20
|
import org.eclipse.swt.events.MouseAdapter;
|
21
|
import org.eclipse.swt.events.MouseEvent;
|
22
|
import org.eclipse.swt.events.MouseListener;
|
23
|
import org.eclipse.swt.events.SelectionEvent;
|
24
|
import org.eclipse.swt.events.SelectionListener;
|
25
|
import org.eclipse.swt.events.TypedEvent;
|
26
|
import org.eclipse.swt.graphics.Color;
|
27
|
import org.eclipse.swt.graphics.Font;
|
28
|
import org.eclipse.swt.widgets.Composite;
|
29
|
import org.eclipse.swt.widgets.Control;
|
30
|
import org.eclipse.swt.widgets.Display;
|
31
|
import org.eclipse.swt.widgets.Event;
|
32
|
import org.eclipse.swt.widgets.Label;
|
33
|
import org.eclipse.ui.forms.IFormColors;
|
34
|
import org.eclipse.ui.forms.widgets.FormToolkit;
|
35
|
import org.eclipse.ui.forms.widgets.Section;
|
36
|
import org.eclipse.ui.forms.widgets.TableWrapData;
|
37
|
import org.eclipse.ui.forms.widgets.TableWrapLayout;
|
38
|
import org.eclipse.ui.internal.forms.widgets.FormFonts;
|
39
|
import org.joda.time.Partial;
|
40
|
|
41
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
42
|
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
|
43
|
import eu.etaxonomy.cdm.model.agent.Institution;
|
44
|
import eu.etaxonomy.cdm.model.agent.Person;
|
45
|
import eu.etaxonomy.cdm.model.agent.Team;
|
46
|
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
|
47
|
import eu.etaxonomy.cdm.model.common.Annotation;
|
48
|
import eu.etaxonomy.cdm.model.common.AnnotationType;
|
49
|
import eu.etaxonomy.cdm.model.common.Credit;
|
50
|
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
|
51
|
import eu.etaxonomy.cdm.model.common.DescriptionElementSource;
|
52
|
import eu.etaxonomy.cdm.model.common.Extension;
|
53
|
import eu.etaxonomy.cdm.model.common.ExtensionType;
|
54
|
import eu.etaxonomy.cdm.model.common.IAnnotatableEntity;
|
55
|
import eu.etaxonomy.cdm.model.common.IVersionableEntity;
|
56
|
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
|
57
|
import eu.etaxonomy.cdm.model.common.Language;
|
58
|
import eu.etaxonomy.cdm.model.common.LanguageString;
|
59
|
import eu.etaxonomy.cdm.model.common.Marker;
|
60
|
import eu.etaxonomy.cdm.model.common.MarkerType;
|
61
|
import eu.etaxonomy.cdm.model.common.TimePeriod;
|
62
|
import eu.etaxonomy.cdm.model.common.VersionableEntity;
|
63
|
import eu.etaxonomy.cdm.model.description.CategoricalData;
|
64
|
import eu.etaxonomy.cdm.model.description.CommonTaxonName;
|
65
|
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
|
66
|
import eu.etaxonomy.cdm.model.description.Distribution;
|
67
|
import eu.etaxonomy.cdm.model.description.Feature;
|
68
|
import eu.etaxonomy.cdm.model.description.FeatureTree;
|
69
|
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
|
70
|
import eu.etaxonomy.cdm.model.description.MeasurementUnit;
|
71
|
import eu.etaxonomy.cdm.model.description.Modifier;
|
72
|
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase;
|
73
|
import eu.etaxonomy.cdm.model.description.QuantitativeData;
|
74
|
import eu.etaxonomy.cdm.model.description.Scope;
|
75
|
import eu.etaxonomy.cdm.model.description.Sex;
|
76
|
import eu.etaxonomy.cdm.model.description.Stage;
|
77
|
import eu.etaxonomy.cdm.model.description.State;
|
78
|
import eu.etaxonomy.cdm.model.description.StateData;
|
79
|
import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
|
80
|
import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue;
|
81
|
import eu.etaxonomy.cdm.model.description.TaxonInteraction;
|
82
|
import eu.etaxonomy.cdm.model.description.TextData;
|
83
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
84
|
import eu.etaxonomy.cdm.model.location.NamedAreaType;
|
85
|
import eu.etaxonomy.cdm.model.location.Point;
|
86
|
import eu.etaxonomy.cdm.model.location.ReferenceSystem;
|
87
|
import eu.etaxonomy.cdm.model.media.ImageFile;
|
88
|
import eu.etaxonomy.cdm.model.media.Media;
|
89
|
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
|
90
|
import eu.etaxonomy.cdm.model.media.Rights;
|
91
|
import eu.etaxonomy.cdm.model.media.RightsTerm;
|
92
|
import eu.etaxonomy.cdm.model.name.NameRelationship;
|
93
|
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
|
94
|
import eu.etaxonomy.cdm.model.name.NameTypeDesignation;
|
95
|
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus;
|
96
|
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
|
97
|
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
|
98
|
import eu.etaxonomy.cdm.model.name.Rank;
|
99
|
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
|
100
|
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
|
101
|
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
102
|
import eu.etaxonomy.cdm.model.occurrence.Collection;
|
103
|
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
|
104
|
import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
|
105
|
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
|
106
|
import eu.etaxonomy.cdm.model.occurrence.DeterminationModifier;
|
107
|
import eu.etaxonomy.cdm.model.occurrence.FieldObservation;
|
108
|
import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
|
109
|
import eu.etaxonomy.cdm.model.occurrence.Specimen;
|
110
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
111
|
import eu.etaxonomy.cdm.model.taxon.Classification;
|
112
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
113
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
114
|
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
|
115
|
import eu.etaxonomy.taxeditor.editor.EditorUtil;
|
116
|
import eu.etaxonomy.taxeditor.forms.selection.AbstractSelectionElement;
|
117
|
import eu.etaxonomy.taxeditor.forms.selection.AgentSelectionElement;
|
118
|
import eu.etaxonomy.taxeditor.forms.selection.ClassificationSelectionElement;
|
119
|
import eu.etaxonomy.taxeditor.forms.selection.CollectionSelectionElement;
|
120
|
import eu.etaxonomy.taxeditor.forms.selection.DerivedUnitBaseSelectionElement;
|
121
|
import eu.etaxonomy.taxeditor.forms.selection.FeatureTreeSelectionElement;
|
122
|
import eu.etaxonomy.taxeditor.forms.selection.FieldObservationSelectionElement;
|
123
|
import eu.etaxonomy.taxeditor.forms.selection.InstitutionSelectionElement;
|
124
|
import eu.etaxonomy.taxeditor.forms.selection.NameSelectionElement;
|
125
|
import eu.etaxonomy.taxeditor.forms.selection.NamedAreaSelectionElement;
|
126
|
import eu.etaxonomy.taxeditor.forms.selection.NomenclaturalAuthorTeamSelectionElement;
|
127
|
import eu.etaxonomy.taxeditor.forms.selection.PersonSelectionElement;
|
128
|
import eu.etaxonomy.taxeditor.forms.selection.ReferenceSelectionElement;
|
129
|
import eu.etaxonomy.taxeditor.forms.selection.TaxonBaseSelectionElement;
|
130
|
import eu.etaxonomy.taxeditor.forms.selection.TaxonNodeSelectionElement;
|
131
|
import eu.etaxonomy.taxeditor.forms.selection.TeamSelectionElement;
|
132
|
import eu.etaxonomy.taxeditor.forms.term.AbstractEnumComboElement;
|
133
|
import eu.etaxonomy.taxeditor.forms.term.AbstractTermComboElement;
|
134
|
import eu.etaxonomy.taxeditor.forms.term.AnnotationTypeComboElement;
|
135
|
import eu.etaxonomy.taxeditor.forms.term.DeterminationModifierComboElement;
|
136
|
import eu.etaxonomy.taxeditor.forms.term.EmptyComboElement;
|
137
|
import eu.etaxonomy.taxeditor.forms.term.ExtensionTypeComboElement;
|
138
|
import eu.etaxonomy.taxeditor.forms.term.LanguageComboElement;
|
139
|
import eu.etaxonomy.taxeditor.forms.term.MarkerTypeComboElement;
|
140
|
import eu.etaxonomy.taxeditor.forms.term.MeasurementUnitComboElement;
|
141
|
import eu.etaxonomy.taxeditor.forms.term.ModifierComboElement;
|
142
|
import eu.etaxonomy.taxeditor.forms.term.NameRelationshipTypeComboElement;
|
143
|
import eu.etaxonomy.taxeditor.forms.term.NameTypeDesignationStatusComboElement;
|
144
|
import eu.etaxonomy.taxeditor.forms.term.NamedAreaTypeComboElement;
|
145
|
import eu.etaxonomy.taxeditor.forms.term.NomenclaturalCodeComboElement;
|
146
|
import eu.etaxonomy.taxeditor.forms.term.NomenclaturalStatusTypeComboElement;
|
147
|
import eu.etaxonomy.taxeditor.forms.term.PresenceAbsenceTermComboElement;
|
148
|
import eu.etaxonomy.taxeditor.forms.term.PreservationMethodComboElement;
|
149
|
import eu.etaxonomy.taxeditor.forms.term.RankComboElement;
|
150
|
import eu.etaxonomy.taxeditor.forms.term.ReferenceSystemComboElement;
|
151
|
import eu.etaxonomy.taxeditor.forms.term.ReferenceTypeComboElement;
|
152
|
import eu.etaxonomy.taxeditor.forms.term.RightsTypeComboElement;
|
153
|
import eu.etaxonomy.taxeditor.forms.term.ScopeComboElement;
|
154
|
import eu.etaxonomy.taxeditor.forms.term.SexComboElement;
|
155
|
import eu.etaxonomy.taxeditor.forms.term.SpecimenTypeDesignationStatusComboElement;
|
156
|
import eu.etaxonomy.taxeditor.forms.term.StageComboElement;
|
157
|
import eu.etaxonomy.taxeditor.forms.term.StateComboElement;
|
158
|
import eu.etaxonomy.taxeditor.forms.term.StatisticalMeasureComboElement;
|
159
|
import eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement;
|
160
|
import eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement;
|
161
|
import eu.etaxonomy.taxeditor.section.EmptyElement;
|
162
|
import eu.etaxonomy.taxeditor.section.agent.PersonDetailElement;
|
163
|
import eu.etaxonomy.taxeditor.section.agent.PersonDetailSection;
|
164
|
import eu.etaxonomy.taxeditor.section.agent.TeamDetailElement;
|
165
|
import eu.etaxonomy.taxeditor.section.agent.TeamDetailSection;
|
166
|
import eu.etaxonomy.taxeditor.section.agent.TeamMemberElement;
|
167
|
import eu.etaxonomy.taxeditor.section.agent.TeamMemberSection;
|
168
|
import eu.etaxonomy.taxeditor.section.agent.TeamOrPersonBaseDetailSection;
|
169
|
import eu.etaxonomy.taxeditor.section.classification.ClassificationDetailElement;
|
170
|
import eu.etaxonomy.taxeditor.section.classification.ClassificationDetailSection;
|
171
|
import eu.etaxonomy.taxeditor.section.classification.TaxonNodeDetailElement;
|
172
|
import eu.etaxonomy.taxeditor.section.classification.TaxonNodeDetailSection;
|
173
|
import eu.etaxonomy.taxeditor.section.description.DerivedUnitElement;
|
174
|
import eu.etaxonomy.taxeditor.section.description.DescribedSpecimenSection;
|
175
|
import eu.etaxonomy.taxeditor.section.description.DescriptionDetailElement;
|
176
|
import eu.etaxonomy.taxeditor.section.description.DescriptionDetailSection;
|
177
|
import eu.etaxonomy.taxeditor.section.description.DescriptionElementDetailElement;
|
178
|
import eu.etaxonomy.taxeditor.section.description.DescriptionElementDetailSection;
|
179
|
import eu.etaxonomy.taxeditor.section.description.DescriptionElementMediaSection;
|
180
|
import eu.etaxonomy.taxeditor.section.description.DescriptionElementSourceElement;
|
181
|
import eu.etaxonomy.taxeditor.section.description.DescriptionElementSourceSection;
|
182
|
import eu.etaxonomy.taxeditor.section.description.DescriptionSourceElement;
|
183
|
import eu.etaxonomy.taxeditor.section.description.DescriptionSourceSection;
|
184
|
import eu.etaxonomy.taxeditor.section.description.ModifierElement;
|
185
|
import eu.etaxonomy.taxeditor.section.description.ModifierSection;
|
186
|
import eu.etaxonomy.taxeditor.section.description.NaturalLanguageDetailElement;
|
187
|
import eu.etaxonomy.taxeditor.section.description.NaturalLanguageSection;
|
188
|
import eu.etaxonomy.taxeditor.section.description.ScopeElement;
|
189
|
import eu.etaxonomy.taxeditor.section.description.ScopeSection;
|
190
|
import eu.etaxonomy.taxeditor.section.description.StateDataElement;
|
191
|
import eu.etaxonomy.taxeditor.section.description.StateDataSection;
|
192
|
import eu.etaxonomy.taxeditor.section.description.StatisticalMeasurementValueElement;
|
193
|
import eu.etaxonomy.taxeditor.section.description.StatisticalMeasurementValueSection;
|
194
|
import eu.etaxonomy.taxeditor.section.description.detail.AbstractDetailedDescriptionDetailElement;
|
195
|
import eu.etaxonomy.taxeditor.section.description.detail.CategoricalDataDetailElement;
|
196
|
import eu.etaxonomy.taxeditor.section.description.detail.CommonNameDetailElement;
|
197
|
import eu.etaxonomy.taxeditor.section.description.detail.DistributionDetailElement;
|
198
|
import eu.etaxonomy.taxeditor.section.description.detail.IndividualsAssociationDetailElement;
|
199
|
import eu.etaxonomy.taxeditor.section.description.detail.QuantitativeDataDetailElement;
|
200
|
import eu.etaxonomy.taxeditor.section.description.detail.TaxonInteractionDetailElement;
|
201
|
import eu.etaxonomy.taxeditor.section.description.detail.TextDataDetailElement;
|
202
|
import eu.etaxonomy.taxeditor.section.feature.FeatureDistributionDetailElement;
|
203
|
import eu.etaxonomy.taxeditor.section.feature.FeatureDistributionDetailSection;
|
204
|
import eu.etaxonomy.taxeditor.section.name.AuthorshipDetailElement;
|
205
|
import eu.etaxonomy.taxeditor.section.name.AuthorshipDetailSection;
|
206
|
import eu.etaxonomy.taxeditor.section.name.NameDetailElement;
|
207
|
import eu.etaxonomy.taxeditor.section.name.NameDetailSection;
|
208
|
import eu.etaxonomy.taxeditor.section.name.NameRelationshipDetailElement;
|
209
|
import eu.etaxonomy.taxeditor.section.name.NameRelationshipDetailSection;
|
210
|
import eu.etaxonomy.taxeditor.section.name.NameTypeDesignationElement;
|
211
|
import eu.etaxonomy.taxeditor.section.name.NomenclaturalStatusElement;
|
212
|
import eu.etaxonomy.taxeditor.section.name.NomenclaturalStatusSection;
|
213
|
import eu.etaxonomy.taxeditor.section.name.NonViralNameDetailElement;
|
214
|
import eu.etaxonomy.taxeditor.section.name.NonViralNameDetailSection;
|
215
|
import eu.etaxonomy.taxeditor.section.name.ProtologueElement;
|
216
|
import eu.etaxonomy.taxeditor.section.name.ProtologueSection;
|
217
|
import eu.etaxonomy.taxeditor.section.name.SpecimenTypeDesignationElement;
|
218
|
import eu.etaxonomy.taxeditor.section.name.TypeDesignationSection;
|
219
|
import eu.etaxonomy.taxeditor.section.occurrence.CollectingAreasDetailElement;
|
220
|
import eu.etaxonomy.taxeditor.section.occurrence.CollectingAreasDetailSection;
|
221
|
import eu.etaxonomy.taxeditor.section.occurrence.CollectionDetailElement;
|
222
|
import eu.etaxonomy.taxeditor.section.occurrence.DerivedUnitBaseDetailElement;
|
223
|
import eu.etaxonomy.taxeditor.section.occurrence.DerivedUnitBaseDetailSection;
|
224
|
import eu.etaxonomy.taxeditor.section.occurrence.DerivedUnitFacadeDetailElement;
|
225
|
import eu.etaxonomy.taxeditor.section.occurrence.DerivedUnitFacadeDetailSection;
|
226
|
import eu.etaxonomy.taxeditor.section.occurrence.DeterminationEventDetailElement;
|
227
|
import eu.etaxonomy.taxeditor.section.occurrence.DeterminationEventDetailSection;
|
228
|
import eu.etaxonomy.taxeditor.section.occurrence.FieldObservationDetailElement;
|
229
|
import eu.etaxonomy.taxeditor.section.occurrence.FieldObservationDetailSection;
|
230
|
import eu.etaxonomy.taxeditor.section.occurrence.GatheringEventDetailElement;
|
231
|
import eu.etaxonomy.taxeditor.section.occurrence.GatheringEventDetailSection;
|
232
|
import eu.etaxonomy.taxeditor.section.occurrence.SourceCollectionDetailSection;
|
233
|
import eu.etaxonomy.taxeditor.section.occurrence.SpecimenCollectionDetailElement;
|
234
|
import eu.etaxonomy.taxeditor.section.occurrence.SpecimenCollectionDetailSection;
|
235
|
import eu.etaxonomy.taxeditor.section.reference.NomenclaturalReferenceDetailElement;
|
236
|
import eu.etaxonomy.taxeditor.section.reference.NomenclaturalReferenceDetailSection;
|
237
|
import eu.etaxonomy.taxeditor.section.reference.ReferenceBaseDetailElement;
|
238
|
import eu.etaxonomy.taxeditor.section.reference.ReferenceBaseDetailSection;
|
239
|
import eu.etaxonomy.taxeditor.section.supplemental.AnnotationElement;
|
240
|
import eu.etaxonomy.taxeditor.section.supplemental.AnnotationSection;
|
241
|
import eu.etaxonomy.taxeditor.section.supplemental.CreditElement;
|
242
|
import eu.etaxonomy.taxeditor.section.supplemental.CreditSection;
|
243
|
import eu.etaxonomy.taxeditor.section.supplemental.ExtensionElement;
|
244
|
import eu.etaxonomy.taxeditor.section.supplemental.ExtensionSection;
|
245
|
import eu.etaxonomy.taxeditor.section.supplemental.HeadlineSection;
|
246
|
import eu.etaxonomy.taxeditor.section.supplemental.IdentifiableSourceElement;
|
247
|
import eu.etaxonomy.taxeditor.section.supplemental.ImageFileElement;
|
248
|
import eu.etaxonomy.taxeditor.section.supplemental.MarkerElement;
|
249
|
import eu.etaxonomy.taxeditor.section.supplemental.MarkerSection;
|
250
|
import eu.etaxonomy.taxeditor.section.supplemental.MediaElement;
|
251
|
import eu.etaxonomy.taxeditor.section.supplemental.MediaRepresentationElement;
|
252
|
import eu.etaxonomy.taxeditor.section.supplemental.MediaRepresentationPartSection;
|
253
|
import eu.etaxonomy.taxeditor.section.supplemental.MediaRepresentationSection;
|
254
|
import eu.etaxonomy.taxeditor.section.supplemental.MediaSection;
|
255
|
import eu.etaxonomy.taxeditor.section.supplemental.RightsElement;
|
256
|
import eu.etaxonomy.taxeditor.section.supplemental.RightsSection;
|
257
|
import eu.etaxonomy.taxeditor.section.supplemental.SourceSection;
|
258
|
import eu.etaxonomy.taxeditor.section.supplemental.VersionElement;
|
259
|
import eu.etaxonomy.taxeditor.section.supplemental.VersionSection;
|
260
|
import eu.etaxonomy.taxeditor.section.taxon.ParsingMessageElement;
|
261
|
import eu.etaxonomy.taxeditor.section.taxon.ParsingMessagesSection;
|
262
|
import eu.etaxonomy.taxeditor.section.taxon.TaxonBaseDetailElement;
|
263
|
import eu.etaxonomy.taxeditor.section.taxon.TaxonBaseDetailSection;
|
264
|
|
265
|
/**
|
266
|
* <p>CdmFormFactory class.</p>
|
267
|
*
|
268
|
* @author n.hoffmann
|
269
|
* @created Feb 24, 2010
|
270
|
* @version 1.0
|
271
|
*/
|
272
|
public class CdmFormFactory extends FormToolkit{
|
273
|
|
274
|
private BoldFontHolder2 boldFontHolder2;
|
275
|
private MouseListener selectionMouseHandler;
|
276
|
private FocusListener selectionFocusHandler;
|
277
|
|
278
|
private Set selectionListenerList = new HashSet();
|
279
|
|
280
|
private Set<IPropertyChangeListener> propertyChangeListeners = new HashSet<IPropertyChangeListener>();
|
281
|
|
282
|
private int orientation = Window.getDefaultOrientation();
|
283
|
private ISelectionProvider selectionProvider;
|
284
|
|
285
|
/**
|
286
|
* <p>LAYOUT</p>
|
287
|
*
|
288
|
* @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
|
289
|
*/
|
290
|
public static final TableWrapLayout LAYOUT(){
|
291
|
return LAYOUT(1, false);
|
292
|
}
|
293
|
|
294
|
/**
|
295
|
* <p>LAYOUT</p>
|
296
|
*
|
297
|
* @param columns a int.
|
298
|
* @param equalWidth a boolean.
|
299
|
* @return a {@link org.eclipse.ui.forms.widgets.TableWrapLayout} object.
|
300
|
*/
|
301
|
public static final TableWrapLayout LAYOUT(int columns, boolean equalWidth){
|
302
|
TableWrapLayout layout = new TableWrapLayout();
|
303
|
layout.topMargin = 0;
|
304
|
layout.rightMargin = 0;
|
305
|
layout.bottomMargin = 0;
|
306
|
layout.leftMargin = 0;
|
307
|
layout.numColumns = columns;
|
308
|
layout.makeColumnsEqualWidth = equalWidth;
|
309
|
layout.verticalSpacing = 0;
|
310
|
layout.horizontalSpacing = 0;
|
311
|
return layout;
|
312
|
}
|
313
|
|
314
|
/**
|
315
|
* <p>FILL</p>
|
316
|
*
|
317
|
* @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
|
318
|
*/
|
319
|
public static final TableWrapData FILL(){
|
320
|
return FILL(1, 1);
|
321
|
}
|
322
|
|
323
|
/**
|
324
|
* <p>FILL</p>
|
325
|
*
|
326
|
* @param horizontalSpan a int.
|
327
|
* @param verticalSpan a int.
|
328
|
* @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
|
329
|
*/
|
330
|
public static final TableWrapData FILL(int horizontalSpan, int verticalSpan){
|
331
|
TableWrapData layoutData = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB);
|
332
|
layoutData.colspan = horizontalSpan;
|
333
|
layoutData.rowspan = verticalSpan;
|
334
|
return layoutData;
|
335
|
}
|
336
|
|
337
|
/**
|
338
|
* <p>LEFT</p>
|
339
|
*
|
340
|
* @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
|
341
|
*/
|
342
|
public static final TableWrapData LEFT(){
|
343
|
return new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP);
|
344
|
}
|
345
|
|
346
|
/**
|
347
|
* <p>RIGHT</p>
|
348
|
*
|
349
|
* @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
|
350
|
*/
|
351
|
public static final TableWrapData RIGHT(){
|
352
|
return new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP);
|
353
|
}
|
354
|
|
355
|
/**
|
356
|
* <p>FILL_HORIZONTALLY</p>
|
357
|
*
|
358
|
* @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
|
359
|
*/
|
360
|
public static final TableWrapData FILL_HORIZONTALLY(){
|
361
|
return FILL_HORIZONTALLY(1, 1);
|
362
|
}
|
363
|
|
364
|
/**
|
365
|
* <p>FILL_HORIZONTALLY</p>
|
366
|
*
|
367
|
* @param horizontalSpan a int.
|
368
|
* @param verticalSpan a int.
|
369
|
* @return a {@link org.eclipse.ui.forms.widgets.TableWrapData} object.
|
370
|
*/
|
371
|
public static final TableWrapData FILL_HORIZONTALLY(int horizontalSpan, int verticalSpan){
|
372
|
TableWrapData layoutData = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP);
|
373
|
layoutData.colspan = horizontalSpan;
|
374
|
layoutData.rowspan = verticalSpan;
|
375
|
return layoutData;
|
376
|
}
|
377
|
|
378
|
/** Constant <code>EMPTY_SELECTION</code> */
|
379
|
public static ISelection EMPTY_SELECTION = new ISelection() {
|
380
|
public boolean isEmpty() {
|
381
|
return true;
|
382
|
}
|
383
|
};
|
384
|
|
385
|
private class SelectionMouseHandler extends MouseAdapter{
|
386
|
@Override
|
387
|
public void mouseDown(MouseEvent e) {
|
388
|
notifySelectionListeners(e);
|
389
|
}
|
390
|
}
|
391
|
|
392
|
private class SelectionFocusHandler extends FocusAdapter{
|
393
|
@Override
|
394
|
public void focusGained(FocusEvent e) {
|
395
|
notifySelectionListeners(e);
|
396
|
}
|
397
|
}
|
398
|
|
399
|
private void notifySelectionListeners(TypedEvent e){
|
400
|
Event event = new Event();
|
401
|
event.widget = e.widget;
|
402
|
SelectionEvent selectionEvent = new SelectionEvent(event);
|
403
|
|
404
|
for(Object listener : selectionListenerList){
|
405
|
((SelectionListener) listener).widgetSelected(selectionEvent);
|
406
|
}
|
407
|
}
|
408
|
|
409
|
/**
|
410
|
* <p>Constructor for CdmFormFactory.</p>
|
411
|
*
|
412
|
* @param display a {@link org.eclipse.swt.widgets.Display} object.
|
413
|
* @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
|
414
|
*/
|
415
|
public CdmFormFactory(Display display, ISelectionProvider selectionProvider) {
|
416
|
super(display);
|
417
|
this.selectionProvider = selectionProvider;
|
418
|
init();
|
419
|
}
|
420
|
|
421
|
/**
|
422
|
* <p>Constructor for CdmFormFactory.</p>
|
423
|
*
|
424
|
* @param display a {@link org.eclipse.swt.widgets.Display} object.
|
425
|
*/
|
426
|
public CdmFormFactory(Display display){
|
427
|
super(display);
|
428
|
init();
|
429
|
}
|
430
|
|
431
|
/**
|
432
|
*
|
433
|
*/
|
434
|
private void init() {
|
435
|
boldFontHolder2 = new BoldFontHolder2();
|
436
|
selectionMouseHandler = new SelectionMouseHandler();
|
437
|
selectionFocusHandler = new SelectionFocusHandler();
|
438
|
}
|
439
|
|
440
|
/**
|
441
|
* Creates an instance initialized with the correct selectionProvider
|
442
|
*
|
443
|
* Make sure to remove the instance when the entityComposite disposes via
|
444
|
* destroySelectionArbitrator(..)
|
445
|
*
|
446
|
* @param entityElement a {@link eu.etaxonomy.taxeditor.forms.IEntityElement} object.
|
447
|
* @return a {@link eu.etaxonomy.taxeditor.forms.SelectionArbitrator} object.
|
448
|
*/
|
449
|
public SelectionArbitrator createSelectionArbitrator(IEntityElement entityElement){
|
450
|
SelectionArbitrator selectionArbitrator = new SelectionArbitrator(entityElement);
|
451
|
selectionArbitrator.addSelectionProvider(selectionProvider);
|
452
|
selectionProvider.addSelectionChangedListener(selectionArbitrator);
|
453
|
addSelectionListener(selectionArbitrator);
|
454
|
return selectionArbitrator;
|
455
|
}
|
456
|
|
457
|
/**
|
458
|
* <p>destroySelectionArbitrator</p>
|
459
|
*
|
460
|
* @param selectionArbitrator a {@link eu.etaxonomy.taxeditor.forms.SelectionArbitrator} object.
|
461
|
*/
|
462
|
public void destroySelectionArbitrator(SelectionArbitrator selectionArbitrator){
|
463
|
removeSelectionListener(selectionArbitrator);
|
464
|
if(selectionProvider != null){
|
465
|
selectionProvider.removeSelectionChangedListener(selectionArbitrator);
|
466
|
}else{
|
467
|
EditorUtil.error(this.getClass(), "Tried to destroy a selection listener from this factories listeners but was null", null);
|
468
|
}
|
469
|
}
|
470
|
|
471
|
/** {@inheritDoc} */
|
472
|
@Override
|
473
|
public void adapt(Composite composite) {
|
474
|
composite.addMouseListener(selectionMouseHandler);
|
475
|
super.adapt(composite);
|
476
|
}
|
477
|
|
478
|
/**
|
479
|
* <p>adapt</p>
|
480
|
*
|
481
|
* @param formElement a {@link eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement} object.
|
482
|
*/
|
483
|
public void adapt(AbstractCdmFormElement formElement){
|
484
|
formElement.setPropertyChangeListeners(propertyChangeListeners);
|
485
|
}
|
486
|
|
487
|
/** {@inheritDoc} */
|
488
|
@Override
|
489
|
public void adapt(Control control, boolean trackFocus, boolean trackKeyboard) {
|
490
|
if(trackFocus){
|
491
|
control.addFocusListener(selectionFocusHandler);
|
492
|
}
|
493
|
super.adapt(control, trackFocus, trackKeyboard);
|
494
|
}
|
495
|
|
496
|
/**
|
497
|
* <p>destroyElement</p>
|
498
|
*
|
499
|
* @param formElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
500
|
*/
|
501
|
public void destroyElement(ICdmFormElement formElement){
|
502
|
// return if element was not initialized
|
503
|
if(formElement == null){
|
504
|
return;
|
505
|
}
|
506
|
// destroy selection arbitrator, if any
|
507
|
if(formElement instanceof ISelectableElement){
|
508
|
destroySelectionArbitrator(((ISelectableElement) formElement).getSelectionArbitrator());
|
509
|
}
|
510
|
// remove this element form its parents list of elements
|
511
|
// ICdmFormElement parentElement = formElement.getParentElement();
|
512
|
// if(parentElement != null){
|
513
|
// parentElement.removeElement(formElement);
|
514
|
// }
|
515
|
// call destroy on child elements recursively
|
516
|
for(ICdmFormElement childElement : formElement.getElements()){
|
517
|
destroyElement(childElement);
|
518
|
}
|
519
|
// dispose of the controls
|
520
|
for(Control control : formElement.getControls()){
|
521
|
// we added the layoutComposite of the parental element as the layout composite to this formElement
|
522
|
// but we do not want to destroy it.
|
523
|
if(control.equals(formElement.getLayoutComposite())){
|
524
|
continue;
|
525
|
}else{
|
526
|
control.dispose();
|
527
|
control = null;
|
528
|
}
|
529
|
}
|
530
|
}
|
531
|
|
532
|
|
533
|
/**
|
534
|
* <p>createEmptyCell</p>
|
535
|
*
|
536
|
* @param parent a {@link org.eclipse.swt.widgets.Composite} object.
|
537
|
* @return a {@link org.eclipse.swt.widgets.Label} object.
|
538
|
*/
|
539
|
public Label createEmptyCell(Composite parent){
|
540
|
return this.createLabel(parent, null);
|
541
|
}
|
542
|
|
543
|
/**
|
544
|
* <p>createMultilineTextWithLabel</p>
|
545
|
*
|
546
|
* @param labelString a {@link java.lang.String} object.
|
547
|
* @param textHeight a int.
|
548
|
* @param style a int.
|
549
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
550
|
* @return a {@link eu.etaxonomy.taxeditor.forms.TextWithLabelElement} object.
|
551
|
*/
|
552
|
public TextWithLabelElement createMultilineTextWithLabel(ICdmFormElement parentElement, String labelString, int textHeight, int style){
|
553
|
TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, "", textHeight, style);
|
554
|
adapt(element);
|
555
|
parentElement.addElement(element);
|
556
|
return element;
|
557
|
}
|
558
|
|
559
|
|
560
|
/**
|
561
|
* <p>createMultiLanguageTextElement</p>
|
562
|
*
|
563
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
564
|
* @param labelString a {@link java.lang.String} object.
|
565
|
* @param multilanguageText a {@link java.util.Map} object.
|
566
|
* @param textHeight a int.
|
567
|
* @param style a int.
|
568
|
* @return a {@link eu.etaxonomy.taxeditor.forms.MultilanguageTextElement} object.
|
569
|
*/
|
570
|
public MultilanguageTextElement createMultiLanguageTextElement(
|
571
|
ICdmFormElement parentElement, String labelString, Map<Language, LanguageString> multilanguageText, int textHeight,
|
572
|
int style) {
|
573
|
MultilanguageTextElement element = new MultilanguageTextElement(this, parentElement, labelString, multilanguageText, textHeight, style);
|
574
|
adapt(element);
|
575
|
parentElement.addElement(element);
|
576
|
return element;
|
577
|
}
|
578
|
|
579
|
|
580
|
/**
|
581
|
* <p>createTextWithLabelElement</p>
|
582
|
*
|
583
|
* @param labelString a {@link java.lang.String} object.
|
584
|
* @param initialText a {@link java.lang.String} object.
|
585
|
* @param style a int.
|
586
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
587
|
* @return a {@link eu.etaxonomy.taxeditor.forms.TextWithLabelElement} object.
|
588
|
*/
|
589
|
public TextWithLabelElement createTextWithLabelElement(ICdmFormElement parentElement, String labelString, String initialText, int style){
|
590
|
TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, initialText, null, style);
|
591
|
adapt(element);
|
592
|
parentElement.addElement(element);
|
593
|
return element;
|
594
|
}
|
595
|
|
596
|
/**
|
597
|
* <p>createIntegerTextWithLabelElement</p>
|
598
|
*
|
599
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
600
|
* @param labelString a {@link java.lang.String} object.
|
601
|
* @param initialInteger a {@link java.lang.Integer} object.
|
602
|
* @param style a int.
|
603
|
* @return a {@link eu.etaxonomy.taxeditor.forms.NumberWithLabelElement} object.
|
604
|
*/
|
605
|
public NumberWithLabelElement createIntegerTextWithLabelElement(ICdmFormElement parentElement, String labelString, Integer initialInteger, int style){
|
606
|
NumberWithLabelElement element = new NumberWithLabelElement(this, parentElement, labelString, initialInteger, style);
|
607
|
adapt(element);
|
608
|
parentElement.addElement(element);
|
609
|
return element;
|
610
|
}
|
611
|
|
612
|
|
613
|
/**
|
614
|
* <p>createFloatTextWithLabelElement</p>
|
615
|
*
|
616
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
617
|
* @param labelString a {@link java.lang.String} object.
|
618
|
* @param initialFloat a float.
|
619
|
* @param style a int.
|
620
|
* @return a {@link eu.etaxonomy.taxeditor.forms.NumberWithLabelElement} object.
|
621
|
*/
|
622
|
public NumberWithLabelElement createFloatTextWithLabelElement(
|
623
|
ICdmFormElement parentElement, String labelString, float initialFloat,
|
624
|
int style) {
|
625
|
NumberWithLabelElement element = new NumberWithLabelElement(this, parentElement, labelString, initialFloat, style);
|
626
|
adapt(element);
|
627
|
parentElement.addElement(element);
|
628
|
return element;
|
629
|
}
|
630
|
|
631
|
/**
|
632
|
* <p>createLanguageStringWithLabelElement</p>
|
633
|
*
|
634
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
635
|
* @param labelString a {@link java.lang.String} object.
|
636
|
* @param languageString a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
|
637
|
* @param style a int.
|
638
|
* @return a {@link eu.etaxonomy.taxeditor.forms.LanguageStringWithLabelElement} object.
|
639
|
*/
|
640
|
public LanguageStringWithLabelElement createLanguageStringWithLabelElement(ICdmFormElement parentElement, String labelString, LanguageString languageString, int style){
|
641
|
LanguageStringWithLabelElement element = new LanguageStringWithLabelElement(this, parentElement, labelString, languageString, style);
|
642
|
adapt(element);
|
643
|
parentElement.addElement(element);
|
644
|
return element;
|
645
|
}
|
646
|
|
647
|
/**
|
648
|
* <p>createLanguageStringWithLabelElement</p>
|
649
|
*
|
650
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
651
|
* @param labelString a {@link java.lang.String} object.
|
652
|
* @param languageString a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
|
653
|
* @param height a int.
|
654
|
* @param style a int.
|
655
|
* @return a {@link eu.etaxonomy.taxeditor.forms.LanguageStringWithLabelElement} object.
|
656
|
*/
|
657
|
public LanguageStringWithLabelElement createLanguageStringWithLabelElement(ICdmFormElement parentElement, String labelString, LanguageString languageString, int height, int style){
|
658
|
LanguageStringWithLabelElement element = new LanguageStringWithLabelElement(this, parentElement, labelString, languageString, height, style);
|
659
|
adapt(element);
|
660
|
parentElement.addElement(element);
|
661
|
return element;
|
662
|
}
|
663
|
|
664
|
/**
|
665
|
* <p>createTextElement</p>
|
666
|
*
|
667
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
668
|
* @param initialText a {@link java.lang.String} object.
|
669
|
* @param style a int.
|
670
|
* @return a {@link eu.etaxonomy.taxeditor.forms.TextWithLabelElement} object.
|
671
|
*/
|
672
|
public TextWithLabelElement createTextElement(ICdmFormElement parentElement, String initialText, int style){
|
673
|
TextWithLabelElement element = new TextWithLabelElement(this, parentElement, null, initialText, null, style);
|
674
|
adapt(element);
|
675
|
parentElement.addElement(element);
|
676
|
return element;
|
677
|
}
|
678
|
|
679
|
/**
|
680
|
* <p>createKeyValueViewerElement</p>
|
681
|
*
|
682
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
683
|
* @param keyHeading a {@link java.lang.String} object.
|
684
|
* @param valueHeading a {@link java.lang.String} object.
|
685
|
* @param map a {@link java.util.Map} object.
|
686
|
* @return a {@link eu.etaxonomy.taxeditor.forms.KeyValueViewerElement} object.
|
687
|
*/
|
688
|
public KeyValueViewerElement createKeyValueViewerElement(ICdmFormElement parentElement, String keyHeading, String valueHeading, Map<Object, Object> map){
|
689
|
KeyValueViewerElement element = new KeyValueViewerElement(this, parentElement, keyHeading, valueHeading, map);
|
690
|
adapt(element);
|
691
|
parentElement.addElement(element);
|
692
|
return element;
|
693
|
}
|
694
|
|
695
|
|
696
|
public static enum TermComboType{
|
697
|
EXTENSIONTYPE,
|
698
|
LANGUAGE,
|
699
|
MARKERTYPE,
|
700
|
NOMENCLATURALSTATUSTYPE,
|
701
|
RANK,
|
702
|
RIGHTSTYPE,
|
703
|
NAMERELATIONSHIP,
|
704
|
NAMEDAREATYPE,
|
705
|
PRESENCEABSENCESTATUS,
|
706
|
ANNOTATIONTYPE,
|
707
|
NAMETYPEDESIGNATIONSTATUS,
|
708
|
SPECIMENTYPEDESIGNATIONSTATUS,
|
709
|
SEX,
|
710
|
STAGE,
|
711
|
PRESERVATION_METHOD,
|
712
|
MEASUREMENT_UNIT,
|
713
|
STATE,
|
714
|
MODIFIER,
|
715
|
STATISTICAL_MEASURE,
|
716
|
SCOPE,
|
717
|
EMPTY,
|
718
|
DETERMINATION_MODIFIER,
|
719
|
REFERENCE_SYSTEM
|
720
|
}
|
721
|
|
722
|
/**
|
723
|
* <p>createTermComboElement</p>
|
724
|
*
|
725
|
* @param termComboType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.TermComboType} object.
|
726
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
727
|
* @param labelString a {@link java.lang.String} object.
|
728
|
* @param selection a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase} object.
|
729
|
* @param style a int.
|
730
|
* @return a {@link eu.etaxonomy.taxeditor.forms.term.AbstractTermComboElement} object.
|
731
|
*/
|
732
|
public AbstractTermComboElement createTermComboElement(TermComboType termComboType, ICdmFormElement parentElement, String labelString, DefinedTermBase selection, int style){
|
733
|
AbstractTermComboElement element = null;
|
734
|
|
735
|
switch(termComboType){
|
736
|
case EMPTY:
|
737
|
element = new EmptyComboElement<DefinedTermBase>(this, parentElement, labelString, style);
|
738
|
break;
|
739
|
case EXTENSIONTYPE:
|
740
|
element = new ExtensionTypeComboElement(this, parentElement, labelString, (ExtensionType) selection, style);
|
741
|
break;
|
742
|
case LANGUAGE:
|
743
|
element = new LanguageComboElement(this, parentElement, labelString, (Language) selection, style);
|
744
|
break;
|
745
|
case MARKERTYPE:
|
746
|
element = new MarkerTypeComboElement(this, parentElement, labelString, (MarkerType) selection, style);
|
747
|
break;
|
748
|
case NOMENCLATURALSTATUSTYPE:
|
749
|
element = new NomenclaturalStatusTypeComboElement(this, parentElement, labelString, (NomenclaturalStatusType) selection, style);
|
750
|
break;
|
751
|
case RANK:
|
752
|
element = new RankComboElement(this, parentElement, labelString, (Rank) selection, style);
|
753
|
break;
|
754
|
case RIGHTSTYPE:
|
755
|
element = new RightsTypeComboElement(this, parentElement, labelString, (RightsTerm) selection, style);
|
756
|
break;
|
757
|
case NAMERELATIONSHIP:
|
758
|
element = new NameRelationshipTypeComboElement(this, parentElement, labelString, (NameRelationshipType) selection, style);
|
759
|
break;
|
760
|
case NAMEDAREATYPE:
|
761
|
element = new NamedAreaTypeComboElement(this, parentElement, labelString, (NamedAreaType) selection, style);
|
762
|
break;
|
763
|
case ANNOTATIONTYPE:
|
764
|
element = new AnnotationTypeComboElement(this, parentElement, labelString, (AnnotationType) selection, style);
|
765
|
break;
|
766
|
case PRESENCEABSENCESTATUS:
|
767
|
element = new PresenceAbsenceTermComboElement(this, parentElement, labelString, (PresenceAbsenceTermBase) selection, style);
|
768
|
break;
|
769
|
case NAMETYPEDESIGNATIONSTATUS:
|
770
|
element = new NameTypeDesignationStatusComboElement(this, parentElement, labelString, (NameTypeDesignationStatus) selection, style);
|
771
|
break;
|
772
|
case SPECIMENTYPEDESIGNATIONSTATUS:
|
773
|
element = new SpecimenTypeDesignationStatusComboElement(this, parentElement, labelString, (SpecimenTypeDesignationStatus) selection, style);
|
774
|
break;
|
775
|
case SEX:
|
776
|
element = new SexComboElement(this, parentElement, labelString, (Sex) selection, style);
|
777
|
break;
|
778
|
case STAGE:
|
779
|
element = new StageComboElement(this, parentElement, labelString, (Stage) selection, style);
|
780
|
break;
|
781
|
case PRESERVATION_METHOD:
|
782
|
element = new PreservationMethodComboElement(this, parentElement, labelString, (PreservationMethod) selection, style);
|
783
|
break;
|
784
|
case MEASUREMENT_UNIT:
|
785
|
element = new MeasurementUnitComboElement(this, parentElement, labelString, (MeasurementUnit) selection, style);
|
786
|
break;
|
787
|
case STATE:
|
788
|
element = new StateComboElement(this, parentElement, labelString, (State) selection, style);
|
789
|
break;
|
790
|
case SCOPE:
|
791
|
element = new ScopeComboElement(this, parentElement, labelString, (Scope) selection, style);
|
792
|
break;
|
793
|
case MODIFIER:
|
794
|
element = new ModifierComboElement(this, parentElement, labelString, (Modifier) selection, style);
|
795
|
break;
|
796
|
case STATISTICAL_MEASURE:
|
797
|
element = new StatisticalMeasureComboElement(this, parentElement, labelString, (StatisticalMeasure) selection, style);
|
798
|
break;
|
799
|
case DETERMINATION_MODIFIER:
|
800
|
element = new DeterminationModifierComboElement(this, parentElement, labelString, (DeterminationModifier) selection, style);
|
801
|
break;
|
802
|
case REFERENCE_SYSTEM:
|
803
|
element = new ReferenceSystemComboElement(this, parentElement, labelString, (ReferenceSystem) selection, style);
|
804
|
break;
|
805
|
}
|
806
|
|
807
|
adapt(element);
|
808
|
parentElement.addElement(element);
|
809
|
return element;
|
810
|
}
|
811
|
|
812
|
public static enum EnumComboType{
|
813
|
REFERENCETYPE,
|
814
|
NOMENCLATURALCODE
|
815
|
}
|
816
|
|
817
|
/**
|
818
|
* <p>createEnumComboElement</p>
|
819
|
*
|
820
|
* @param enumComboType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.EnumComboType} object.
|
821
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
822
|
* @param style a int.
|
823
|
* @return a {@link eu.etaxonomy.taxeditor.forms.term.AbstractEnumComboElement} object.
|
824
|
*/
|
825
|
public AbstractEnumComboElement createEnumComboElement(EnumComboType enumComboType, ICdmFormElement parentElement, int style){
|
826
|
AbstractEnumComboElement element = null;
|
827
|
|
828
|
switch(enumComboType){
|
829
|
case REFERENCETYPE:
|
830
|
element = new ReferenceTypeComboElement(this, parentElement, "Reference Type", null, style);
|
831
|
break;
|
832
|
case NOMENCLATURALCODE:
|
833
|
element = new NomenclaturalCodeComboElement(this, parentElement, "Nomenclatural Code", null, style);
|
834
|
break;
|
835
|
}
|
836
|
adapt(element);
|
837
|
parentElement.addElement(element);
|
838
|
return element;
|
839
|
}
|
840
|
|
841
|
/**
|
842
|
* <p>createBrowserElement</p>
|
843
|
*
|
844
|
* @param imageUri a {@link java.net.URI} object.
|
845
|
* @param style a int.
|
846
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
847
|
* @return a {@link eu.etaxonomy.taxeditor.forms.BrowserElement} object.
|
848
|
*/
|
849
|
public BrowserElement createBrowserElement(ICdmFormElement parentElement, URI imageUri, int style){
|
850
|
BrowserElement element = new BrowserElement(this, parentElement, imageUri, style);
|
851
|
adapt(element);
|
852
|
parentElement.addElement(element);
|
853
|
return element;
|
854
|
}
|
855
|
|
856
|
/**
|
857
|
* <p>createImageElement</p>
|
858
|
*
|
859
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
860
|
* @param imageUri a {@link java.net.URI} object.
|
861
|
* @param style a int.
|
862
|
* @return a {@link eu.etaxonomy.taxeditor.forms.ImageElement} object.
|
863
|
*/
|
864
|
public ImageElement createImageElement(ICdmFormElement parentElement, URI imageUri, int style) {
|
865
|
ImageElement element = new ImageElement(this, parentElement, imageUri, style);
|
866
|
adapt(element);
|
867
|
parentElement.addElement(element);
|
868
|
return element;
|
869
|
}
|
870
|
|
871
|
/**
|
872
|
* <p>createTextActionElement</p>
|
873
|
*
|
874
|
* @param labelString a {@link java.lang.String} object.
|
875
|
* @param initialText a {@link java.lang.String} object.
|
876
|
* @param style a int.
|
877
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
878
|
* @param buttonLabel a {@link java.lang.String} object.
|
879
|
* @return a {@link eu.etaxonomy.taxeditor.forms.TextActionElement} object.
|
880
|
*/
|
881
|
public TextActionElement createTextActionElement(ICdmFormElement parentElement, String labelString, String buttonLabel, String initialText, int style){
|
882
|
TextActionElement element = new TextActionElement(this, parentElement, labelString, buttonLabel, initialText, style);
|
883
|
adapt(element);
|
884
|
parentElement.addElement(element);
|
885
|
return element;
|
886
|
}
|
887
|
|
888
|
/**
|
889
|
*
|
890
|
* @author n.hoffmann
|
891
|
* @created Mar 5, 2010
|
892
|
* @version 1.0
|
893
|
*/
|
894
|
public static enum SelectionType{
|
895
|
AGENT,
|
896
|
INSTITUTION,
|
897
|
NAME,
|
898
|
REFERENCE,
|
899
|
TAXON_BASE,
|
900
|
TEAM,
|
901
|
AUTHOR_TEAM,
|
902
|
PERSON,
|
903
|
DERIVED_UNIT,
|
904
|
FIELD_OBSERVATION,
|
905
|
FEATURE_TREE,
|
906
|
CLASSIFICATION,
|
907
|
TAXON_NODE,
|
908
|
COLLECTION
|
909
|
}
|
910
|
|
911
|
/**
|
912
|
* <p>createCheckbox</p>
|
913
|
*
|
914
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
915
|
* @param label a {@link java.lang.String} object.
|
916
|
* @param initialState a boolean.
|
917
|
* @param style a int.
|
918
|
* @return a {@link eu.etaxonomy.taxeditor.forms.CheckboxElement} object.
|
919
|
*/
|
920
|
public CheckboxElement createCheckbox(ICdmFormElement parentElement, String label, boolean initialState, int style) {
|
921
|
CheckboxElement element = new CheckboxElement(this, parentElement, label, initialState, style | orientation);
|
922
|
adapt(element);
|
923
|
parentElement.addElement(element);
|
924
|
return element;
|
925
|
}
|
926
|
|
927
|
|
928
|
|
929
|
/**
|
930
|
* Creates a section as a part of the form.
|
931
|
*
|
932
|
* @return the section widget
|
933
|
* @param section a {@link eu.etaxonomy.taxeditor.forms.AbstractFormSection} object.
|
934
|
*/
|
935
|
public Section adapt(AbstractFormSection section) {
|
936
|
section.setMenu(section.getLayoutComposite().getMenu());
|
937
|
adapt(section, true, true);
|
938
|
|
939
|
// handle focus and property change events for cdm use
|
940
|
section.addFocusListener(selectionFocusHandler);
|
941
|
section.setPropertyChangeListeners(propertyChangeListeners);
|
942
|
|
943
|
if (section.getToggle() != null) {
|
944
|
section.getToggle().setHoverDecorationColor(getColors()
|
945
|
.getColor(IFormColors.TB_TOGGLE_HOVER));
|
946
|
section.getToggle().setDecorationColor(getColors()
|
947
|
.getColor(IFormColors.TB_TOGGLE));
|
948
|
}
|
949
|
|
950
|
section.setFont(boldFontHolder2.getBoldFont(section.getLayoutComposite().getFont()));
|
951
|
|
952
|
if ((section.getStyle() & Section.TITLE_BAR) != 0
|
953
|
|| (section.getStyle() & Section.SHORT_TITLE_BAR) != 0) {
|
954
|
getColors().initializeSectionToolBarColors();
|
955
|
section.setTitleBarBackground(getColors().getColor(IFormColors.TB_BG));
|
956
|
section.setTitleBarBorderColor(getColors()
|
957
|
.getColor(IFormColors.TB_BORDER));
|
958
|
}
|
959
|
// call setTitleBarForeground regardless as it also sets the label color
|
960
|
section.setTitleBarForeground(getColors()
|
961
|
.getColor(IFormColors.TB_TOGGLE));
|
962
|
return section;
|
963
|
}
|
964
|
|
965
|
private class BoldFontHolder2 {
|
966
|
private Font normalFont;
|
967
|
|
968
|
private Font boldFont;
|
969
|
|
970
|
public BoldFontHolder2() {
|
971
|
}
|
972
|
|
973
|
public Font getBoldFont(Font font) {
|
974
|
createBoldFont(font);
|
975
|
return boldFont;
|
976
|
}
|
977
|
|
978
|
private void createBoldFont(Font font) {
|
979
|
if (normalFont == null || !normalFont.equals(font)) {
|
980
|
normalFont = font;
|
981
|
dispose();
|
982
|
}
|
983
|
if (boldFont == null) {
|
984
|
boldFont = FormFonts.getInstance().getBoldFont(getColors().getDisplay(),
|
985
|
normalFont);
|
986
|
}
|
987
|
}
|
988
|
|
989
|
public void dispose() {
|
990
|
if (boldFont != null) {
|
991
|
FormFonts.getInstance().markFinished(boldFont, getColors().getDisplay());
|
992
|
boldFont = null;
|
993
|
}
|
994
|
}
|
995
|
}
|
996
|
|
997
|
/**
|
998
|
* <p>createToggleableTextField</p>
|
999
|
*
|
1000
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
1001
|
* @param labelString a {@link java.lang.String} object.
|
1002
|
* @param initialText a {@link java.lang.String} object.
|
1003
|
* @param initialState a boolean.
|
1004
|
* @param style a int.
|
1005
|
* @return a {@link eu.etaxonomy.taxeditor.forms.ToggleableTextElement} object.
|
1006
|
*/
|
1007
|
public ToggleableTextElement createToggleableTextField(ICdmFormElement parentElement,
|
1008
|
String labelString, String initialText, boolean initialState, int style) {
|
1009
|
ToggleableTextElement element = new ToggleableTextElement(this, parentElement,
|
1010
|
labelString, initialText, initialState, style | orientation);
|
1011
|
adapt(element);
|
1012
|
parentElement.addElement(element);
|
1013
|
return element;
|
1014
|
}
|
1015
|
|
1016
|
/**
|
1017
|
* <p>createTimePeriodElement</p>
|
1018
|
*
|
1019
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
1020
|
* @param labelString a {@link java.lang.String} object.
|
1021
|
* @param timePeriod a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
|
1022
|
* @param style a int.
|
1023
|
* @return a {@link eu.etaxonomy.taxeditor.forms.TimePeriodElement} object.
|
1024
|
*/
|
1025
|
public TimePeriodElement createTimePeriodElement(
|
1026
|
ICdmFormElement parentElement, String labelString, TimePeriod timePeriod, int style) {
|
1027
|
TimePeriodElement element = new TimePeriodElement(this, parentElement, labelString, timePeriod, style);
|
1028
|
adapt(element);
|
1029
|
parentElement.addElement(element);
|
1030
|
return element;
|
1031
|
}
|
1032
|
|
1033
|
|
1034
|
/**
|
1035
|
* <p>createPointElement</p>
|
1036
|
*
|
1037
|
* @param style a int.
|
1038
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
1039
|
* @param point a {@link eu.etaxonomy.cdm.model.location.Point} object.
|
1040
|
* @return a {@link eu.etaxonomy.taxeditor.forms.PointElement} object.
|
1041
|
*/
|
1042
|
public PointElement createPointElement(ICdmFormElement parentElement,
|
1043
|
Point point, int style) {
|
1044
|
PointElement element = new PointElement(this, parentElement, point, style);
|
1045
|
adapt(element);
|
1046
|
parentElement.addElement(element);
|
1047
|
return element;
|
1048
|
}
|
1049
|
|
1050
|
/**
|
1051
|
* <p>createDateDetailSection</p>
|
1052
|
*
|
1053
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
1054
|
* @param style a int.
|
1055
|
* @return a {@link eu.etaxonomy.taxeditor.forms.DateDetailSection} object.
|
1056
|
*/
|
1057
|
public DateDetailSection createDateDetailSection(ICdmFormElement parentElement, int style){
|
1058
|
DateDetailSection section = new DateDetailSection(this, parentElement, style);
|
1059
|
parentElement.addElement(section);
|
1060
|
adapt(section);
|
1061
|
return section;
|
1062
|
}
|
1063
|
|
1064
|
/**
|
1065
|
* <p>createPartialElement</p>
|
1066
|
*
|
1067
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
1068
|
* @param labelString a {@link java.lang.String} object.
|
1069
|
* @param partial a {@link org.joda.time.Partial} object.
|
1070
|
* @param style a int.
|
1071
|
* @return a {@link eu.etaxonomy.taxeditor.forms.PartialElement} object.
|
1072
|
*/
|
1073
|
public PartialElement createPartialElement(ICdmFormElement parentElement, String labelString, Partial partial, int style){
|
1074
|
PartialElement element = new PartialElement(this, parentElement, labelString, style);
|
1075
|
adapt(element);
|
1076
|
parentElement.addElement(element);
|
1077
|
return element;
|
1078
|
}
|
1079
|
|
1080
|
/**
|
1081
|
* <p>addSelectionListener</p>
|
1082
|
*
|
1083
|
* @param listener a {@link org.eclipse.swt.events.SelectionListener} object.
|
1084
|
*/
|
1085
|
public void addSelectionListener(SelectionListener listener){
|
1086
|
selectionListenerList.add(listener);
|
1087
|
}
|
1088
|
|
1089
|
/**
|
1090
|
* <p>removeSelectionListener</p>
|
1091
|
*
|
1092
|
* @param listener a {@link org.eclipse.swt.events.SelectionListener} object.
|
1093
|
*/
|
1094
|
public void removeSelectionListener(SelectionListener listener){
|
1095
|
if(listener == null){
|
1096
|
EditorUtil.error(this.getClass(), "Tried to remove a selection listener from this factories listeners but was null", null);
|
1097
|
}else{
|
1098
|
selectionListenerList.remove(listener);
|
1099
|
}
|
1100
|
}
|
1101
|
|
1102
|
/**
|
1103
|
* <p>addPropertyChangeListener</p>
|
1104
|
*
|
1105
|
* @param listener a {@link org.eclipse.jface.util.IPropertyChangeListener} object.
|
1106
|
*/
|
1107
|
public void addPropertyChangeListener(IPropertyChangeListener listener) {
|
1108
|
propertyChangeListeners.add(listener);
|
1109
|
}
|
1110
|
|
1111
|
/**
|
1112
|
* <p>removePropertyChangeListener</p>
|
1113
|
*
|
1114
|
* @param listener a {@link org.eclipse.jface.util.IPropertyChangeListener} object.
|
1115
|
*/
|
1116
|
public void removePropertyChangeListener(IPropertyChangeListener listener){
|
1117
|
propertyChangeListeners.remove(listener);
|
1118
|
}
|
1119
|
|
1120
|
|
1121
|
|
1122
|
/**
|
1123
|
* <p>createHorizontalSeparator</p>
|
1124
|
*
|
1125
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
1126
|
* @param style a int.
|
1127
|
* @return a {@link org.eclipse.swt.widgets.Label} object.
|
1128
|
*/
|
1129
|
public Label createHorizontalSeparator(ICdmFormElement parentElement, int style) {
|
1130
|
Label separator = this.createSeparator(parentElement.getLayoutComposite(), SWT.HORIZONTAL | style);
|
1131
|
separator.setLayoutData(FILL_HORIZONTALLY());
|
1132
|
return separator;
|
1133
|
}
|
1134
|
|
1135
|
/**
|
1136
|
* <p>createVersionElement</p>
|
1137
|
*
|
1138
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
1139
|
* @param entity a {@link eu.etaxonomy.cdm.model.common.VersionableEntity} object.
|
1140
|
* @param style a int.
|
1141
|
* @return a {@link eu.etaxonomy.taxeditor.section.supplemental.VersionElement} object.
|
1142
|
*/
|
1143
|
public VersionElement createVersionElement(ICdmFormElement parentElement, VersionableEntity entity,
|
1144
|
int style) {
|
1145
|
VersionElement element = new VersionElement(this, parentElement, entity, style);
|
1146
|
adapt(element);
|
1147
|
parentElement.addElement(element);
|
1148
|
return element;
|
1149
|
}
|
1150
|
|
1151
|
/**
|
1152
|
* <p>createVersionSection</p>
|
1153
|
*
|
1154
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
1155
|
* @param style a int.
|
1156
|
* @return a {@link eu.etaxonomy.taxeditor.section.supplemental.VersionSection} object.
|
1157
|
*/
|
1158
|
public VersionSection createVersionSection(ICdmFormElement parentElement, int style) {
|
1159
|
VersionSection section = new VersionSection(this, parentElement, style);
|
1160
|
parentElement.addElement(section);
|
1161
|
adapt(section);
|
1162
|
return section;
|
1163
|
}
|
1164
|
|
1165
|
/**
|
1166
|
* <p>createEmptyElement</p>
|
1167
|
*
|
1168
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
1169
|
* @return a {@link eu.etaxonomy.taxeditor.section.EmptyElement} object.
|
1170
|
*/
|
1171
|
public EmptyElement createEmptyElement(ICdmFormElement parentElement) {
|
1172
|
EmptyElement element = new EmptyElement(this, parentElement, null, SWT.NULL);
|
1173
|
adapt(element);
|
1174
|
parentElement.addElement(element);
|
1175
|
return element;
|
1176
|
}
|
1177
|
|
1178
|
/**
|
1179
|
* <p>createHeadlineSection</p>
|
1180
|
*
|
1181
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
1182
|
* @return a {@link eu.etaxonomy.taxeditor.section.supplemental.HeadlineSection} object.
|
1183
|
*/
|
1184
|
public HeadlineSection createHeadlineSection(ICdmFormElement parentElement) {
|
1185
|
HeadlineSection section = new HeadlineSection(this, parentElement, SWT.NULL);
|
1186
|
parentElement.addElement(section);
|
1187
|
adapt(section);
|
1188
|
return section;
|
1189
|
}
|
1190
|
|
1191
|
|
1192
|
/**
|
1193
|
* <p>createParsingMessageElement</p>
|
1194
|
*
|
1195
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
1196
|
* @param parserProblem a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem} object.
|
1197
|
* @param style a int.
|
1198
|
* @return a {@link eu.etaxonomy.taxeditor.section.taxon.ParsingMessageElement} object.
|
1199
|
*/
|
1200
|
public ParsingMessageElement createParsingMessageElement(
|
1201
|
ICdmFormElement parentElement, ParserProblem parserProblem, int style) {
|
1202
|
ParsingMessageElement element = new ParsingMessageElement(this, parentElement, parserProblem, style);
|
1203
|
adapt(element);
|
1204
|
parentElement.addElement(element);
|
1205
|
return element;
|
1206
|
}
|
1207
|
|
1208
|
|
1209
|
// SIMPLIFY
|
1210
|
|
1211
|
/**
|
1212
|
*
|
1213
|
*/
|
1214
|
public static enum DetailType{
|
1215
|
NONVIRALNAME,
|
1216
|
SCIENTIFICNAME,
|
1217
|
REFERENCEBASE,
|
1218
|
NOMENCLATURALREFERENCE,
|
1219
|
TAXONBASE,
|
1220
|
AUTHORSHIP,
|
1221
|
TEAM,
|
1222
|
PERSON,
|
1223
|
DESCRIPTION,
|
1224
|
DESCRIPTIONELEMENT,
|
1225
|
PARSINGMESSAGE,
|
1226
|
NAMERELATIONSHIP,
|
1227
|
TEAMORPERSONBASE,
|
1228
|
MEDIA,
|
1229
|
FIELD_OBSERVATION,
|
1230
|
DERIVED_UNIT_FACADE,
|
1231
|
GATHERING_EVENT,
|
1232
|
DERIVED_UNIT, NATURAL_LANGUAGE,
|
1233
|
FEATURE_DISTRIBUTION,
|
1234
|
CLASSIFICATION,
|
1235
|
TAXON_NODE,
|
1236
|
COLLECTION
|
1237
|
}
|
1238
|
|
1239
|
/**
|
1240
|
* <p>createCdmDetailSection</p>
|
1241
|
*
|
1242
|
* @param detailType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.DetailType} object.
|
1243
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
1244
|
* @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
|
1245
|
* @param style a int.
|
1246
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
1247
|
* @return a {@link eu.etaxonomy.taxeditor.forms.AbstractFormSection} object.
|
1248
|
*/
|
1249
|
public AbstractFormSection createCdmDetailSection(DetailType detailType, ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
|
1250
|
AbstractFormSection section = null;
|
1251
|
|
1252
|
switch(detailType){
|
1253
|
case SCIENTIFICNAME:
|
1254
|
section = new NameDetailSection(this, conversation, parentElement, selectionProvider, style);
|
1255
|
break;
|
1256
|
case REFERENCEBASE:
|
1257
|
section = new ReferenceBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
|
1258
|
break;
|
1259
|
case NOMENCLATURALREFERENCE:
|
1260
|
section = new NomenclaturalReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
|
1261
|
break;
|
1262
|
case TAXONBASE:
|
1263
|
section = new TaxonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
|
1264
|
break;
|
1265
|
case AUTHORSHIP:
|
1266
|
section = new AuthorshipDetailSection(this, conversation, parentElement, selectionProvider, style);
|
1267
|
break;
|
1268
|
case TEAMORPERSONBASE:
|
1269
|
section = new TeamOrPersonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
|
1270
|
break;
|
1271
|
case TEAM:
|
1272
|
section = new TeamDetailSection(this, conversation, parentElement, null, style);
|
1273
|
break;
|
1274
|
case PERSON:
|
1275
|
section = new PersonDetailSection(this, conversation, parentElement, null, style);
|
1276
|
break;
|
1277
|
case DESCRIPTION:
|
1278
|
section = new DescriptionDetailSection(this, conversation, parentElement, selectionProvider, style);
|
1279
|
break;
|
1280
|
case DESCRIPTIONELEMENT:
|
1281
|
section = new DescriptionElementDetailSection(this, conversation, parentElement, selectionProvider, style);
|
1282
|
break;
|
1283
|
case PARSINGMESSAGE:
|
1284
|
section = new ParsingMessagesSection(this, conversation, parentElement, selectionProvider, style);
|
1285
|
break;
|
1286
|
case NONVIRALNAME:
|
1287
|
section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, style);
|
1288
|
break;
|
1289
|
case MEDIA:
|
1290
|
section = new eu.etaxonomy.taxeditor.section.description.MediaDetailsSection(this, conversation, parentElement, selectionProvider, style);
|
1291
|
break;
|
1292
|
case DERIVED_UNIT_FACADE:
|
1293
|
section = new DerivedUnitFacadeDetailSection(this, conversation, parentElement, selectionProvider, style);
|
1294
|
break;
|
1295
|
case FIELD_OBSERVATION:
|
1296
|
section = new FieldObservationDetailSection(this, conversation, parentElement, selectionProvider, style);
|
1297
|
break;
|
1298
|
case GATHERING_EVENT:
|
1299
|
section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
|
1300
|
break;
|
1301
|
case DERIVED_UNIT:
|
1302
|
section = new DerivedUnitBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
|
1303
|
break;
|
1304
|
case NATURAL_LANGUAGE:
|
1305
|
section = new NaturalLanguageSection(this, conversation, parentElement, selectionProvider, style);
|
1306
|
break;
|
1307
|
case FEATURE_DISTRIBUTION:
|
1308
|
section = new FeatureDistributionDetailSection(this, conversation, parentElement, selectionProvider, style);
|
1309
|
break;
|
1310
|
case CLASSIFICATION:
|
1311
|
section = new ClassificationDetailSection(this, conversation, parentElement, selectionProvider, style);
|
1312
|
break;
|
1313
|
case TAXON_NODE:
|
1314
|
section = new TaxonNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
|
1315
|
break;
|
1316
|
}
|
1317
|
parentElement.addElement(section);
|
1318
|
adapt(section);
|
1319
|
return section;
|
1320
|
}
|
1321
|
|
1322
|
/**
|
1323
|
* <p>createCdmDetailElement</p>
|
1324
|
*
|
1325
|
* @param detailType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.DetailType} object.
|
1326
|
* @param style a int.
|
1327
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
1328
|
* @return a {@link eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement} object.
|
1329
|
*/
|
1330
|
public AbstractCdmDetailElement createCdmDetailElement(DetailType detailType, ICdmFormElement parentElement, int style){
|
1331
|
AbstractCdmDetailElement element = null;
|
1332
|
|
1333
|
switch(detailType){
|
1334
|
case SCIENTIFICNAME:
|
1335
|
element = new NameDetailElement(this, parentElement, style);
|
1336
|
break;
|
1337
|
case REFERENCEBASE:
|
1338
|
element = new ReferenceBaseDetailElement(this, parentElement, style);
|
1339
|
break;
|
1340
|
case NOMENCLATURALREFERENCE:
|
1341
|
element = new NomenclaturalReferenceDetailElement(this, parentElement, style);
|
1342
|
break;
|
1343
|
case TAXONBASE:
|
1344
|
element = new TaxonBaseDetailElement(this, parentElement, style);
|
1345
|
break;
|
1346
|
case AUTHORSHIP:
|
1347
|
element = new AuthorshipDetailElement(this, parentElement, style);
|
1348
|
break;
|
1349
|
case TEAM:
|
1350
|
element = new TeamDetailElement(this, parentElement, style);
|
1351
|
break;
|
1352
|
case PERSON:
|
1353
|
element = new PersonDetailElement(this, parentElement, style);
|
1354
|
break;
|
1355
|
case DESCRIPTION:
|
1356
|
element = new DescriptionDetailElement(this, parentElement, style);
|
1357
|
break;
|
1358
|
case DESCRIPTIONELEMENT:
|
1359
|
element = new DescriptionElementDetailElement(this, parentElement, style);
|
1360
|
break;
|
1361
|
case NONVIRALNAME:
|
1362
|
element = new NonViralNameDetailElement(this, parentElement);
|
1363
|
break;
|
1364
|
case DERIVED_UNIT_FACADE:
|
1365
|
element = new DerivedUnitFacadeDetailElement(this, parentElement);
|
1366
|
break;
|
1367
|
case FIELD_OBSERVATION:
|
1368
|
element = new FieldObservationDetailElement(this, parentElement);
|
1369
|
break;
|
1370
|
case GATHERING_EVENT:
|
1371
|
element = new GatheringEventDetailElement(this, parentElement);
|
1372
|
break;
|
1373
|
case DERIVED_UNIT:
|
1374
|
element = new DerivedUnitBaseDetailElement(this, parentElement);
|
1375
|
break;
|
1376
|
case NATURAL_LANGUAGE:
|
1377
|
element = new NaturalLanguageDetailElement(this, parentElement);
|
1378
|
break;
|
1379
|
case FEATURE_DISTRIBUTION:
|
1380
|
element = new FeatureDistributionDetailElement(this, parentElement);
|
1381
|
break;
|
1382
|
case CLASSIFICATION:
|
1383
|
element = new ClassificationDetailElement(this, parentElement);
|
1384
|
break;
|
1385
|
case TAXON_NODE:
|
1386
|
element = new TaxonNodeDetailElement(this, parentElement);
|
1387
|
break;
|
1388
|
case COLLECTION:
|
1389
|
element = new CollectionDetailElement(this, parentElement);
|
1390
|
break;
|
1391
|
}
|
1392
|
|
1393
|
if(element == null){
|
1394
|
EditorUtil.error(this.getClass(), "Detail element was not created. Seems like the case was not implemented for the requested detail type: " + detailType, null);
|
1395
|
}
|
1396
|
|
1397
|
adapt(element);
|
1398
|
parentElement.addElement(element);
|
1399
|
return element;
|
1400
|
}
|
1401
|
|
1402
|
/**
|
1403
|
*
|
1404
|
* @author n.hoffmann
|
1405
|
* @created Mar 5, 2010
|
1406
|
* @version 1.0
|
1407
|
*/
|
1408
|
public static enum EntityDetailType{
|
1409
|
TEAM,
|
1410
|
TEAMMEMBER,
|
1411
|
ANNOTATION,
|
1412
|
CREDIT,
|
1413
|
DESCRIPTIONELEMENTSOURCE,
|
1414
|
EXTENSION,
|
1415
|
MARKER,
|
1416
|
MEDIA,
|
1417
|
DESCRIPTIONELEMENTMEDIA,
|
1418
|
MEDIAREPRESENTATION,
|
1419
|
MEDIAREPRESENTATIONPART,
|
1420
|
MODIFIER,
|
1421
|
NOMENCLATURALSTATUS,
|
1422
|
NAME_RELATIONSHIP,
|
1423
|
PROTOLOG,
|
1424
|
RIGHTS,
|
1425
|
SOURCE,
|
1426
|
SCOPE,
|
1427
|
DESCRIPTIONSOURCE,
|
1428
|
TYPEDESIGNATION,
|
1429
|
STATE_DATA,
|
1430
|
STATISTICAL_MEASUREMENT_VALUE,
|
1431
|
DESCRIBED_SPECIMEN,
|
1432
|
COLLECTING_AREA,
|
1433
|
DETERMINATION_EVENT,
|
1434
|
SPECIMEN_COLLECTION,
|
1435
|
IDENTIFIABLE_SOURCE_COLLECTION
|
1436
|
}
|
1437
|
|
1438
|
/**
|
1439
|
* <p>createEntityDetailSection</p>
|
1440
|
*
|
1441
|
* @param entityDetailType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.EntityDetailType} object.
|
1442
|
* @param style a int.
|
1443
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
1444
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
1445
|
* @return a {@link eu.etaxonomy.taxeditor.forms.AbstractFormSection} object.
|
1446
|
*/
|
1447
|
public AbstractFormSection createEntityDetailSection(EntityDetailType entityDetailType, ConversationHolder conversation, ICdmFormElement parentElement, int style){
|
1448
|
AbstractFormSection section = null;
|
1449
|
|
1450
|
switch(entityDetailType){
|
1451
|
case TEAM:
|
1452
|
section = new TeamDetailSection(this, conversation, parentElement, null, style);
|
1453
|
break;
|
1454
|
case TEAMMEMBER:
|
1455
|
section = new TeamMemberSection(this, conversation, parentElement, style);
|
1456
|
break;
|
1457
|
case ANNOTATION:
|
1458
|
section = new AnnotationSection(this, conversation, parentElement, style);
|
1459
|
break;
|
1460
|
case CREDIT:
|
1461
|
section = new CreditSection(this, conversation, parentElement, style);
|
1462
|
break;
|
1463
|
case DESCRIPTIONELEMENTSOURCE:
|
1464
|
section = new DescriptionElementSourceSection(this, conversation, parentElement, style);
|
1465
|
break;
|
1466
|
case EXTENSION:
|
1467
|
section = new ExtensionSection(this, conversation, parentElement, style);
|
1468
|
break;
|
1469
|
case MARKER:
|
1470
|
section = new MarkerSection(this, conversation, parentElement, style);
|
1471
|
break;
|
1472
|
case MEDIA:
|
1473
|
section = new MediaSection(this, conversation, parentElement, style);
|
1474
|
break;
|
1475
|
case DESCRIPTIONELEMENTMEDIA:
|
1476
|
section = new DescriptionElementMediaSection(this, conversation, parentElement, style);
|
1477
|
break;
|
1478
|
case MEDIAREPRESENTATION:
|
1479
|
section = new MediaRepresentationSection(this, conversation, parentElement, style);
|
1480
|
break;
|
1481
|
case MEDIAREPRESENTATIONPART:
|
1482
|
section = new MediaRepresentationPartSection(this, conversation, parentElement, style);
|
1483
|
break;
|
1484
|
case MODIFIER:
|
1485
|
section = new ModifierSection(this, conversation, parentElement, style);
|
1486
|
break;
|
1487
|
case NOMENCLATURALSTATUS:
|
1488
|
section = new NomenclaturalStatusSection(this, conversation, parentElement, style);
|
1489
|
break;
|
1490
|
case NAME_RELATIONSHIP:
|
1491
|
section = new NameRelationshipDetailSection(this, conversation, parentElement, style);
|
1492
|
break;
|
1493
|
case PROTOLOG:
|
1494
|
section = new ProtologueSection(this, conversation, parentElement, style);
|
1495
|
break;
|
1496
|
case RIGHTS:
|
1497
|
section = new RightsSection(this, conversation, parentElement, style);
|
1498
|
break;
|
1499
|
case SOURCE:
|
1500
|
section = new SourceSection(this, conversation, parentElement, style);
|
1501
|
break;
|
1502
|
case SCOPE:
|
1503
|
section = new ScopeSection(this, conversation, parentElement, style);
|
1504
|
break;
|
1505
|
case DESCRIPTIONSOURCE:
|
1506
|
section = new DescriptionSourceSection(this, conversation, parentElement, style);
|
1507
|
break;
|
1508
|
case TYPEDESIGNATION:
|
1509
|
section = new TypeDesignationSection(this, conversation, parentElement, style);
|
1510
|
break;
|
1511
|
case STATE_DATA:
|
1512
|
section = new StateDataSection(this, conversation, parentElement, style);
|
1513
|
break;
|
1514
|
case STATISTICAL_MEASUREMENT_VALUE:
|
1515
|
section = new StatisticalMeasurementValueSection(this, conversation, parentElement, style);
|
1516
|
break;
|
1517
|
case DESCRIBED_SPECIMEN:
|
1518
|
section = new DescribedSpecimenSection(this, conversation, parentElement, style);
|
1519
|
break;
|
1520
|
case COLLECTING_AREA:
|
1521
|
section = new CollectingAreasDetailSection(this, conversation, parentElement, style);
|
1522
|
break;
|
1523
|
case DETERMINATION_EVENT:
|
1524
|
section = new DeterminationEventDetailSection(this, conversation, parentElement, style);
|
1525
|
break;
|
1526
|
case SPECIMEN_COLLECTION:
|
1527
|
section = new SpecimenCollectionDetailSection(this, conversation, parentElement, style);
|
1528
|
break;
|
1529
|
case IDENTIFIABLE_SOURCE_COLLECTION:
|
1530
|
section = new SourceCollectionDetailSection(this, conversation, parentElement, style);
|
1531
|
break;
|
1532
|
|
1533
|
}
|
1534
|
parentElement.addElement(section);
|
1535
|
adapt(section);
|
1536
|
return section;
|
1537
|
}
|
1538
|
|
1539
|
/**
|
1540
|
* <p>createEntityCollectionElement</p>
|
1541
|
*
|
1542
|
* @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
|
1543
|
* @param style a int.
|
1544
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.AbstractFormSection} object.
|
1545
|
* @param versionableEntity a {@link eu.etaxonomy.cdm.model.common.IVersionableEntity} object.
|
1546
|
* @param backgroundColor a {@link org.eclipse.swt.graphics.Color} object.
|
1547
|
* @return a {@link eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement} object.
|
1548
|
*/
|
1549
|
public AbstractEntityCollectionElement createEntityCollectionElement(AbstractFormSection parentElement, IVersionableEntity versionableEntity, SelectionListener removeListener, Color backgroundColor, int style){
|
1550
|
AbstractEntityCollectionElement element = null;
|
1551
|
|
1552
|
VersionableEntity entity = (VersionableEntity) HibernateProxyHelper.deproxy(versionableEntity);
|
1553
|
|
1554
|
if(entity instanceof Annotation){
|
1555
|
element = new AnnotationElement(this, parentElement, (Annotation) entity, removeListener, style);
|
1556
|
}
|
1557
|
else if(entity instanceof Person){
|
1558
|
element = new TeamMemberElement(this, parentElement, (Person) entity, removeListener, style);
|
1559
|
}
|
1560
|
else if(entity instanceof Credit){
|
1561
|
element = new CreditElement(this, parentElement, (Credit) entity, removeListener, style);
|
1562
|
}
|
1563
|
else if(entity instanceof Extension){
|
1564
|
element = new ExtensionElement(this, parentElement, (Extension) entity, removeListener, style);
|
1565
|
}
|
1566
|
else if(entity instanceof Marker){
|
1567
|
element = new MarkerElement(this, parentElement, (Marker) entity, removeListener, style);
|
1568
|
}
|
1569
|
else if(entity instanceof Media){
|
1570
|
element = new MediaElement(this, parentElement, (Media) entity, removeListener, style);
|
1571
|
}
|
1572
|
else if(entity instanceof MediaRepresentation){
|
1573
|
element = new MediaRepresentationElement(this, parentElement, (MediaRepresentation) entity, removeListener, style);
|
1574
|
}
|
1575
|
else if(entity instanceof ImageFile){
|
1576
|
element = new ImageFileElement(this, parentElement, (ImageFile) entity, removeListener, style);
|
1577
|
}
|
1578
|
else if(entity instanceof NomenclaturalStatus){
|
1579
|
element = new NomenclaturalStatusElement(this, parentElement, (NomenclaturalStatus) entity, removeListener, style);
|
1580
|
}
|
1581
|
else if(entity instanceof Rights){
|
1582
|
element = new RightsElement(this, parentElement, (Rights) entity, removeListener, style);
|
1583
|
}
|
1584
|
else if(entity instanceof DescriptionElementSource){
|
1585
|
element = new DescriptionElementSourceElement(this, parentElement, (DescriptionElementSource) entity, removeListener, style);
|
1586
|
}
|
1587
|
else if(entity instanceof IdentifiableSource){
|
1588
|
element = new IdentifiableSourceElement(this, parentElement, (IdentifiableSource) entity, removeListener, style);
|
1589
|
}
|
1590
|
else if(entity instanceof Scope){
|
1591
|
element = new ScopeElement(this, parentElement, (Scope) entity, removeListener, style);
|
1592
|
}
|
1593
|
else if(entity instanceof Modifier){
|
1594
|
element = new ModifierElement(this, parentElement, (Modifier) entity, removeListener, style);
|
1595
|
}
|
1596
|
else if(entity instanceof Reference){
|
1597
|
element = new DescriptionSourceElement(this, parentElement, (Reference) entity, removeListener, style);
|
1598
|
}
|
1599
|
else if(entity instanceof NameTypeDesignation){
|
1600
|
element = new NameTypeDesignationElement(this, parentElement, (NameTypeDesignation) entity, removeListener, style);
|
1601
|
}
|
1602
|
else if(entity instanceof NameRelationship){
|
1603
|
element = new NameRelationshipDetailElement(this, parentElement, (NameRelationship) entity, removeListener, style);
|
1604
|
}
|
1605
|
else if(entity instanceof SpecimenTypeDesignation){
|
1606
|
element = new SpecimenTypeDesignationElement(this, parentElement, (SpecimenTypeDesignation) entity, removeListener, style);
|
1607
|
}
|
1608
|
else if(entity instanceof StateData){
|
1609
|
element = new StateDataElement(this, parentElement, (StateData) entity, removeListener, style);
|
1610
|
}
|
1611
|
else if(entity instanceof StatisticalMeasurementValue){
|
1612
|
element = new StatisticalMeasurementValueElement(this, parentElement, (StatisticalMeasurementValue) entity, removeListener, style);
|
1613
|
}
|
1614
|
else if(entity instanceof DerivedUnit){
|
1615
|
element = new DerivedUnitElement(this, parentElement, (DerivedUnit) entity, removeListener, style);
|
1616
|
}
|
1617
|
else if(entity instanceof NamedArea){
|
1618
|
element = new CollectingAreasDetailElement(this, parentElement, (NamedArea) entity, removeListener, style);
|
1619
|
}
|
1620
|
else if(entity instanceof DeterminationEvent){
|
1621
|
element = new DeterminationEventDetailElement(this, parentElement, (DeterminationEvent) entity, removeListener, style);
|
1622
|
}
|
1623
|
else if(entity instanceof Specimen){
|
1624
|
element = new SpecimenCollectionDetailElement(this, parentElement, (Specimen) entity, removeListener, style);
|
1625
|
}
|
1626
|
|
1627
|
else if(entity instanceof DescriptionElementBase){
|
1628
|
// this is the special case for protologs, maybe we can do this differently when API improves
|
1629
|
DescriptionElementBase descriptionElement = (DescriptionElementBase) entity;
|
1630
|
if(descriptionElement.getFeature().equals(Feature.PROTOLOGUE())){
|
1631
|
element = new ProtologueElement(this, parentElement, descriptionElement, removeListener, style);
|
1632
|
}
|
1633
|
}
|
1634
|
|
1635
|
if(element == null){
|
1636
|
EditorUtil.errorDialog("No element for entity", this, "Could not generate element for entity. " +
|
1637
|
"Looks like the case is not handled already. Check implementation. Entity: " + entity, null);
|
1638
|
}
|
1639
|
|
1640
|
if(backgroundColor != null && !backgroundColor.isDisposed()){
|
1641
|
element.setBackgroundColor(backgroundColor);
|
1642
|
}
|
1643
|
|
1644
|
adapt(element);
|
1645
|
parentElement.addElement(element);
|
1646
|
return element;
|
1647
|
}
|
1648
|
|
1649
|
/**
|
1650
|
* <p>createSelectionElement</p>
|
1651
|
*
|
1652
|
* @param selectionType a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory.SelectionType} object.
|
1653
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
1654
|
* @param labelString a {@link java.lang.String} object.
|
1655
|
* @param selectionType
|
1656
|
* @param selection a {@link eu.etaxonomy.cdm.model.common.IAnnotatableEntity} object.
|
1657
|
* @param style a int.
|
1658
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
1659
|
* @return a {@link eu.etaxonomy.taxeditor.forms.selection.AbstractSelectionElement} object.
|
1660
|
*/
|
1661
|
public AbstractSelectionElement createSelectionElement(SelectionType selectionType, ConversationHolder conversation, ICdmFormElement parentElement, String labelString, IAnnotatableEntity selection, int style){
|
1662
|
AbstractSelectionElement element = null;
|
1663
|
|
1664
|
IAnnotatableEntity entity = (IAnnotatableEntity) HibernateProxyHelper.deproxy(selection);
|
1665
|
|
1666
|
switch (selectionType) {
|
1667
|
case AGENT:
|
1668
|
element = new AgentSelectionElement(this, conversation, parentElement, labelString, (TeamOrPersonBase) entity, style);
|
1669
|
break;
|
1670
|
case PERSON:
|
1671
|
element = new PersonSelectionElement(this, conversation, parentElement, labelString, (Person) entity, style);
|
1672
|
break;
|
1673
|
case TEAM:
|
1674
|
element = new TeamSelectionElement(this, conversation, parentElement, labelString, (Team) entity, style);
|
1675
|
break;
|
1676
|
case AUTHOR_TEAM:
|
1677
|
element = new NomenclaturalAuthorTeamSelectionElement(this, conversation, parentElement, labelString, (Team) entity, style);
|
1678
|
break;
|
1679
|
case INSTITUTION:
|
1680
|
element = new InstitutionSelectionElement(this, conversation, parentElement, labelString, (Institution) entity, style);
|
1681
|
break;
|
1682
|
case NAME:
|
1683
|
element = new NameSelectionElement(this, conversation, parentElement, labelString, (TaxonNameBase) entity, style);
|
1684
|
break;
|
1685
|
case REFERENCE:
|
1686
|
element = new ReferenceSelectionElement(this, conversation, parentElement, labelString, (Reference) entity, style);
|
1687
|
break;
|
1688
|
case TAXON_BASE:
|
1689
|
element = new TaxonBaseSelectionElement(this, conversation, parentElement, labelString, (TaxonBase) entity, style);
|
1690
|
break;
|
1691
|
case DERIVED_UNIT:
|
1692
|
element = new DerivedUnitBaseSelectionElement(this, conversation, parentElement, labelString, (DerivedUnitBase) entity, style);
|
1693
|
break;
|
1694
|
case FIELD_OBSERVATION:
|
1695
|
element = new FieldObservationSelectionElement(this, conversation, parentElement, labelString, (FieldObservation) entity, style);
|
1696
|
break;
|
1697
|
case FEATURE_TREE:
|
1698
|
element = new FeatureTreeSelectionElement(this, conversation, parentElement, labelString, (FeatureTree) entity, style);
|
1699
|
break;
|
1700
|
case CLASSIFICATION:
|
1701
|
element = new ClassificationSelectionElement(this, conversation, parentElement, labelString, (Classification) entity, style);
|
1702
|
break;
|
1703
|
case TAXON_NODE:
|
1704
|
element = new TaxonNodeSelectionElement(this, conversation, parentElement, labelString, (TaxonNode) entity, style);
|
1705
|
break;
|
1706
|
case COLLECTION:
|
1707
|
element = new CollectionSelectionElement(this, conversation, parentElement, labelString, (Collection) entity, style);
|
1708
|
break;
|
1709
|
default:
|
1710
|
new RuntimeException("There is no selection composite for the desired selection type.");
|
1711
|
break;
|
1712
|
}
|
1713
|
|
1714
|
adapt(element);
|
1715
|
parentElement.addElement(element);
|
1716
|
return element;
|
1717
|
}
|
1718
|
|
1719
|
/**
|
1720
|
* <p>createNamedAreaSelectionElement</p>
|
1721
|
*
|
1722
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
1723
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
1724
|
* @param labelString a {@link java.lang.String} object.
|
1725
|
* @param selection a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
|
1726
|
* @param style a int.
|
1727
|
* @return a {@link eu.etaxonomy.taxeditor.forms.selection.NamedAreaSelectionElement} object.
|
1728
|
*/
|
1729
|
public NamedAreaSelectionElement createNamedAreaSelectionElement(ICdmFormElement parentElement, ConversationHolder conversation, String labelString, NamedArea selection, int style){
|
1730
|
NamedAreaSelectionElement element = new NamedAreaSelectionElement(this, conversation, parentElement, labelString, selection, style);
|
1731
|
adapt(element);
|
1732
|
parentElement.addElement(element);
|
1733
|
return element;
|
1734
|
}
|
1735
|
|
1736
|
/** {@inheritDoc} */
|
1737
|
public LabelElement createLabel(ICdmFormElement parentElement, String text) {
|
1738
|
LabelElement labelElement = new LabelElement(this, parentElement, text);
|
1739
|
adapt(labelElement);
|
1740
|
parentElement.addElement(labelElement);
|
1741
|
return labelElement;
|
1742
|
}
|
1743
|
|
1744
|
/**
|
1745
|
* <p>Getter for the field <code>selectionProvider</code>.</p>
|
1746
|
*
|
1747
|
* @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
|
1748
|
*/
|
1749
|
public ISelectionProvider getSelectionProvider() {
|
1750
|
return selectionProvider;
|
1751
|
}
|
1752
|
|
1753
|
/**
|
1754
|
* <p>createDetailedDescriptionDetailElement</p>
|
1755
|
*
|
1756
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
1757
|
* @param entity a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
|
1758
|
* @param style a int.
|
1759
|
* @return a {@link eu.etaxonomy.taxeditor.section.description.detail.AbstractDetailedDescriptionDetailElement} object.
|
1760
|
*/
|
1761
|
public AbstractDetailedDescriptionDetailElement createDetailedDescriptionDetailElement(
|
1762
|
ICdmFormElement parentElement, DescriptionElementBase entity, int style) {
|
1763
|
AbstractDetailedDescriptionDetailElement detailedDescriptionElement = null;
|
1764
|
|
1765
|
|
1766
|
if(entity instanceof CategoricalData){
|
1767
|
detailedDescriptionElement = new CategoricalDataDetailElement(this, parentElement, (CategoricalData) entity, style);
|
1768
|
}
|
1769
|
else if(entity instanceof CommonTaxonName){
|
1770
|
detailedDescriptionElement = new CommonNameDetailElement(this, parentElement, (CommonTaxonName) entity, style);
|
1771
|
}
|
1772
|
else if(entity instanceof Distribution){
|
1773
|
detailedDescriptionElement = new DistributionDetailElement(this, parentElement, (Distribution) entity, style);
|
1774
|
}
|
1775
|
else if(entity instanceof IndividualsAssociation){
|
1776
|
detailedDescriptionElement = new IndividualsAssociationDetailElement(this, parentElement, (IndividualsAssociation) entity, style);
|
1777
|
}
|
1778
|
else if(entity instanceof QuantitativeData){
|
1779
|
detailedDescriptionElement = new QuantitativeDataDetailElement(this, parentElement, (QuantitativeData) entity, style);
|
1780
|
}
|
1781
|
else if(entity instanceof TaxonInteraction){
|
1782
|
detailedDescriptionElement = new TaxonInteractionDetailElement(this, parentElement, (TaxonInteraction) entity, style);
|
1783
|
}
|
1784
|
else if(entity instanceof TextData){
|
1785
|
detailedDescriptionElement = new TextDataDetailElement(this, parentElement, (TextData) entity, style);
|
1786
|
}
|
1787
|
else{
|
1788
|
throw new IllegalStateException("There is no interface for the given description element");
|
1789
|
}
|
1790
|
adapt(detailedDescriptionElement);
|
1791
|
parentElement.addElement(detailedDescriptionElement);
|
1792
|
return detailedDescriptionElement;
|
1793
|
|
1794
|
}
|
1795
|
|
1796
|
|
1797
|
/**
|
1798
|
* Creates a styled text as a part of the form.
|
1799
|
*
|
1800
|
* @param parent
|
1801
|
* the text parent
|
1802
|
* @param value
|
1803
|
* the text initial value
|
1804
|
* @param style
|
1805
|
* the text style
|
1806
|
* @return the text widget
|
1807
|
*/
|
1808
|
public StyledText createStyledText(Composite parent, String value, int style) {
|
1809
|
StyledText text = new StyledText(parent, getBorderStyle() | style | getOrientation());
|
1810
|
if (value != null)
|
1811
|
text.setText(value);
|
1812
|
text.setForeground(getColors().getForeground());
|
1813
|
text.setBackground(getColors().getBackground());
|
1814
|
// text.addFocusListener(visibilityHandler);
|
1815
|
return text;
|
1816
|
}
|
1817
|
}
|