Project

General

Profile

« Previous | Next » 

Revision 3e0994b1

Added by Patrick Plitzner over 10 years ago

  • created specimen general element
    • copied&adapted field observation and specimen section to campanula package

View differences:

.gitattributes
1247 1247
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationDetailsView.java -text
1248 1248
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationGeneralElement.java -text
1249 1249
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationGeneralElementController.java -text
1250
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationSection.java -text
1250 1251
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/GatheringEventDetailsElement.java -text
1251 1252
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/GatheringEventDetailsElementController.java -text
1253
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenGeneralElement.java -text
1254
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenGeneralElementController.java -text
1255
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenSection.java -text
1252 1256
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EnumComboElement.java -text
1253 1257
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java -text
1254 1258
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/LoginDialog.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationSection.java
1
// $Id$
2
/**
3
* Copyright (C) 2013 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation;
11

  
12
import org.eclipse.jface.viewers.ISelectionProvider;
13

  
14
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
15
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
16
import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
17
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
19
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
20
import eu.etaxonomy.taxeditor.ui.section.occurrence.IDerivedUnitFacadeDetailSection;
21

  
22
/**
23
 * @author pplitzner
24
 * @date 16.08.2013
25
 *
26
 */
27
public class FieldObservationSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
28

  
29
    /**
30
     * <p>Constructor for FieldObservationDetailSection.</p>
31
     *
32
     * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
33
     * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
34
     * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
35
     * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
36
     * @param style a int.
37
     */
38
    public FieldObservationSection(CdmFormFactory formFactory, ConversationHolder conversation,
39
            ICdmFormElement parentElement,
40
            ISelectionProvider selectionProvider, int style) {
41
        super(formFactory, conversation, parentElement, selectionProvider, style);
42
    }
43

  
44
    /** {@inheritDoc} */
45
    @Override
46
    public String getHeading() {
47
        return "Field Observation";
48
    }
49

  
50
    /* (non-Javadoc)
51
     * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
52
     */
53
    @Override
54
    protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
55
        return formFactory.createFieldObservationGeneralElement(parentElement);
56
    }
57
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenGeneralElement.java
1
// $Id$
2
/**
3
* Copyright (C) 2013 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen;
11

  
12
import org.eclipse.swt.SWT;
13
import org.eclipse.swt.widgets.Composite;
14
import org.eclipse.swt.widgets.Display;
15
import org.eclipse.swt.widgets.Label;
16
import org.eclipse.swt.widgets.Text;
17
import org.eclipse.ui.forms.widgets.FormToolkit;
18
import org.eclipse.ui.forms.widgets.TableWrapData;
19
import org.eclipse.ui.forms.widgets.TableWrapLayout;
20
import org.eclipse.wb.swt.SWTResourceManager;
21

  
22
import eu.etaxonomy.taxeditor.ui.campanula.basicFields.EntitySelectionField;
23
import eu.etaxonomy.taxeditor.ui.campanula.basicFields.PointField;
24
import eu.etaxonomy.taxeditor.ui.campanula.basicFields.ToggleableTextField;
25

  
26

  
27
/**
28
 * @author pplitzner
29
 * @date 16.08.2013
30
 *
31
 */
32
public class SpecimenGeneralElement extends Composite{
33
    private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
34
    private final Text textLocality;
35
    private final Text textElevation;
36
    private final Text textCollectingNumber;
37
    private EntitySelectionField countrySelectionField;
38
    private EntitySelectionField collectorSelectionField;
39
    private ToggleableTextField toggleableTextField;
40
    private PointField pointField;
41
    private Label lblTitleCache;
42
    private Label lblCountry;
43
    private Label lblLocality;
44
    private Label lblLatitude;
45
    private Label lblLongitude;
46
    private Label lblErrorRadiusm;
47
    private Label lblReferenceSystem;
48
    private Label lblAbsoluteElevationm;
49
    private Label lblDate;
50
    private Label lblCollector;
51
    private Label lblCollectingNumber;
52
    private Label lblCollection;
53
    private Label lblAccessionNumber;
54
    private Text textAccessionNumber;
55
    private EntitySelectionField collectionSelectionField;
56

  
57
    /**
58
     * @param parent
59
     * @param style
60
     */
61
    public SpecimenGeneralElement(Composite parent, int style) {
62
        super(parent, style);
63
        setEnabled(false);
64
        setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
65
        {
66
            TableWrapLayout tableWrapLayout = new TableWrapLayout();
67
            tableWrapLayout.numColumns = 2;
68
            setLayout(tableWrapLayout);
69
        }
70

  
71
        lblTitleCache = formToolkit.createLabel(this, "Title Cache", SWT.NONE);
72
        lblTitleCache.setEnabled(false);
73

  
74
        toggleableTextField = new ToggleableTextField(this, SWT.NONE);
75
        toggleableTextField.getText().setEnabled(false);
76
        toggleableTextField.getEditButton().setEnabled(false);
77
        toggleableTextField.setEnabled(false);
78
        TableWrapData twd_toggleableTextField = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
79
        twd_toggleableTextField.grabHorizontal = true;
80
        toggleableTextField.setLayoutData(twd_toggleableTextField);
81
        formToolkit.adapt(toggleableTextField);
82
        formToolkit.paintBordersFor(toggleableTextField);
83

  
84
        lblCountry = new Label(this, SWT.NONE);
85
        lblCountry.setEnabled(false);
86
        formToolkit.adapt(lblCountry, true, true);
87
        lblCountry.setText("Country");
88

  
89
        countrySelectionField = new EntitySelectionField(this, SWT.NONE);
90
        countrySelectionField.getText().setEnabled(false);
91
        countrySelectionField.getButton_selection().setEnabled(false);
92
        countrySelectionField.getButton_edit().setEnabled(false);
93
        countrySelectionField.getButton_remove().setEnabled(false);
94
        countrySelectionField.setEnabled(false);
95
        countrySelectionField.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
96
        formToolkit.adapt(countrySelectionField);
97
        formToolkit.paintBordersFor(countrySelectionField);
98

  
99
        lblLocality = formToolkit.createLabel(this, "Locality", SWT.NONE);
100
        lblLocality.setEnabled(false);
101

  
102
        textLocality = formToolkit.createText(this, "New Text", SWT.NONE);
103
        textLocality.setEnabled(false);
104
        textLocality.setEditable(false);
105
        textLocality.setText("");
106
        textLocality.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
107

  
108
        lblLatitude = formToolkit.createLabel(this, "Latitude", SWT.NONE);
109
        lblLatitude.setEnabled(false);
110

  
111
        pointField = new PointField(this, SWT.NONE);
112
        pointField.getCombo_referenceSystem().setEnabled(false);
113
        pointField.getNumber_errorRadius().setEnabled(false);
114
        pointField.getNumber_errorRadius().setEditable(false);
115
        pointField.getText_longitudeParsed().setEditable(false);
116
        pointField.getText_longitude().setEnabled(false);
117
        pointField.getText_longitude().setEditable(false);
118
        pointField.getText_latitudeParsed().setEditable(false);
119
        pointField.getText_latitude().setEditable(false);
120
        pointField.getText_latitude().setEnabled(false);
121
        pointField.setEnabled(false);
122
        TableWrapLayout twl_pointField = (TableWrapLayout) pointField.getLayout();
123
        twl_pointField.verticalSpacing = 0;
124
        twl_pointField.topMargin = 0;
125
        twl_pointField.rightMargin = 0;
126
        twl_pointField.leftMargin = 0;
127
        twl_pointField.horizontalSpacing = 0;
128
        twl_pointField.bottomMargin = 0;
129
        pointField.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 6, 1));
130
        formToolkit.adapt(pointField);
131
        formToolkit.paintBordersFor(pointField);
132
        new Label(this, SWT.NONE);
133

  
134
        lblLongitude = formToolkit.createLabel(this, "Longitude", SWT.NONE);
135
        lblLongitude.setEnabled(false);
136
        new Label(this, SWT.NONE);
137

  
138
        lblErrorRadiusm = formToolkit.createLabel(this, "Error Radius (m)", SWT.NONE);
139
        lblErrorRadiusm.setEnabled(false);
140

  
141
        lblReferenceSystem = formToolkit.createLabel(this, "Reference System", SWT.NONE);
142
        lblReferenceSystem.setEnabled(false);
143

  
144
        lblAbsoluteElevationm = formToolkit.createLabel(this, "Absolute Elevation (m)", SWT.NONE);
145
        lblAbsoluteElevationm.setEnabled(false);
146

  
147
        textElevation = formToolkit.createText(this, "New Text", SWT.NONE);
148
        textElevation.setEditable(false);
149
        textElevation.setEnabled(false);
150
        textElevation.setText("");
151
        textElevation.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
152

  
153
        lblDate = formToolkit.createLabel(this, "Date", SWT.NONE);
154
        lblDate.setEnabled(false);
155
        new Label(this, SWT.NONE);
156

  
157
        lblCollector = formToolkit.createLabel(this, "Collector", SWT.NONE);
158
        lblCollector.setEnabled(false);
159

  
160
        collectorSelectionField = new EntitySelectionField(this, SWT.NONE);
161
        collectorSelectionField.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
162
        collectorSelectionField.getButton_selection().setEnabled(false);
163
        collectorSelectionField.getButton_edit().setEnabled(false);
164
        collectorSelectionField.getButton_remove().setEnabled(false);
165
        collectorSelectionField.getText().setEnabled(false);
166
        formToolkit.adapt(collectorSelectionField);
167
        formToolkit.paintBordersFor(collectorSelectionField);
168

  
169
        lblCollectingNumber = formToolkit.createLabel(this, "Collecting Number", SWT.NONE);
170
        lblCollectingNumber.setEnabled(false);
171

  
172
        textCollectingNumber = formToolkit.createText(this, "New Text", SWT.NONE);
173
        textCollectingNumber.setEditable(false);
174
        textCollectingNumber.setEnabled(false);
175
        textCollectingNumber.setText("");
176
        textCollectingNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
177

  
178
        lblCollection = formToolkit.createLabel(this, "Collection", SWT.NONE);
179

  
180
        collectionSelectionField = new EntitySelectionField(this, SWT.NONE);
181
        formToolkit.adapt(collectionSelectionField);
182
        formToolkit.paintBordersFor(collectionSelectionField);
183

  
184
        lblAccessionNumber = formToolkit.createLabel(this, "Accession Number", SWT.NONE);
185

  
186
        textAccessionNumber = formToolkit.createText(this, "New Text", SWT.NONE);
187
        textAccessionNumber.setText("");
188
        textAccessionNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
189

  
190
    }
191

  
192
    @Override
193
    protected void checkSubclass() {
194
        // Disable the check that prevents subclassing of SWT components
195
    }
196

  
197
    public EntitySelectionField getCountrySelectionField() {
198
        return countrySelectionField;
199
    }
200

  
201
    public EntitySelectionField getCollectorSelectionField() {
202
        return collectorSelectionField;
203
    }
204

  
205
    public Text getTextElevation() {
206
        return textElevation;
207
    }
208

  
209
    public Text getTextLocality() {
210
        return textLocality;
211
    }
212

  
213
    public Text getTextCollectingNumber() {
214
        return textCollectingNumber;
215
    }
216

  
217
    public ToggleableTextField getToggleableTextField() {
218
        return toggleableTextField;
219
    }
220

  
221
    public PointField getPointField() {
222
        return pointField;
223
    }
224
    public Label getLblTitleCache() {
225
        return lblTitleCache;
226
    }
227
    public Label getLblCountry() {
228
        return lblCountry;
229
    }
230
    public Label getLblLocality() {
231
        return lblLocality;
232
    }
233
    public Label getLblLatitude() {
234
        return lblLatitude;
235
    }
236
    public Label getLblLongitude() {
237
        return lblLongitude;
238
    }
239
    public Label getLblErrorRadiusm() {
240
        return lblErrorRadiusm;
241
    }
242
    public Label getLblReferenceSystem() {
243
        return lblReferenceSystem;
244
    }
245
    public Label getLblAbsoluteElevationm() {
246
        return lblAbsoluteElevationm;
247
    }
248
    public Label getLblDate() {
249
        return lblDate;
250
    }
251
    public Label getLblCollector() {
252
        return lblCollector;
253
    }
254
    public Label getLblCollectingNumber() {
255
        return lblCollectingNumber;
256
    }
257
    public Text getTextAccessionNumber() {
258
        return textAccessionNumber;
259
    }
260
    public EntitySelectionField getCollectionSelectionField() {
261
        return collectionSelectionField;
262
    }
263
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenGeneralElementController.java
1
// $Id$
2
/**
3
* Copyright (C) 2013 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen;
11

  
12
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
13
import eu.etaxonomy.cdm.model.agent.AgentBase;
14
import eu.etaxonomy.cdm.model.common.LanguageString;
15
import eu.etaxonomy.cdm.model.location.NamedArea;
16
import eu.etaxonomy.cdm.model.occurrence.Collection;
17
import eu.etaxonomy.taxeditor.ui.campanula.basicFields.EntitySelectionFieldController;
18
import eu.etaxonomy.taxeditor.ui.campanula.basicFields.LanguageTextFieldController;
19
import eu.etaxonomy.taxeditor.ui.campanula.basicFields.NumberFieldController;
20
import eu.etaxonomy.taxeditor.ui.campanula.basicFields.PointFieldController;
21
import eu.etaxonomy.taxeditor.ui.campanula.basicFields.TextFieldController;
22
import eu.etaxonomy.taxeditor.ui.campanula.basicFields.ToggleableTextFieldController;
23
import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
24
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
25
import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
26
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
27
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
28

  
29
/**
30
 * @author pplitzner
31
 * @date 16.08.2013
32
 *
33
 */
34
public class SpecimenGeneralElementController extends AbstractCdmDetailElement<DerivedUnitFacade>  {
35

  
36
    private SpecimenGeneralElement specimenGeneralElement;
37

  
38
    private ToggleableTextFieldController toggleableText_titleCache;
39
    private EntitySelectionFieldController<NamedArea> selection_country;
40
    private LanguageTextFieldController languageText_locality;
41
    private PointFieldController element_point;
42
    private NumberFieldController number_elevation;
43
    private TimePeriodElement element_date;//TODO convert
44
    private EntitySelectionFieldController<AgentBase> selection_collector;
45
    private TextFieldController text_collectingNumber;
46
    private EntitySelectionFieldController<Collection> selectionCollection;
47
    private TextFieldController textAccessionNumber;
48

  
49
    /**
50
     * @param fieldObservationGeneralElement
51
     * @param formFactory
52
     * @param formElement
53
     */
54
    public SpecimenGeneralElementController(SpecimenGeneralElement specimenGeneralElement, CdmFormFactory formFactory, ICdmFormElement formElement) {
55
        super(formFactory, formElement);
56
        this.specimenGeneralElement = specimenGeneralElement;
57
        setPropertyChangeListeners(formFactory.getPropertyChangeListeners());
58
        formFactory.addPropertyChangeListener(this);
59
    }
60

  
61

  
62
    @Override
63
    protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
64
        toggleableText_titleCache = new ToggleableTextFieldController(specimenGeneralElement.getToggleableTextField(), getFormFactory(), formElement, entity.getTitleCache(), entity.isProtectedTitleCache(), style);
65

  
66
        selection_country = new EntitySelectionFieldController<NamedArea>(specimenGeneralElement.getCountrySelectionField(), getFormFactory(), getConversationHolder(), formElement, NamedArea.class, entity.getCountry(), EntitySelectionElement.NOTHING);
67
        languageText_locality = new LanguageTextFieldController(specimenGeneralElement.getTextLocality(), getFormFactory(), formElement, entity.getLocality());
68
        element_point = new PointFieldController(specimenGeneralElement.getPointField(),getFormFactory(), formElement, entity.getExactLocation(), style);
69
        number_elevation = new NumberFieldController(specimenGeneralElement.getTextElevation(), getFormFactory(), formElement, entity.getAbsoluteElevation());
70
//        element_date = formFactory.createTimePeriodElement(formElement, "Date", entity.getGatheringPeriod(), style);
71
        selection_collector = new EntitySelectionFieldController<AgentBase>(specimenGeneralElement.getCollectorSelectionField(), getFormFactory(), getConversationHolder(), formElement, AgentBase.class, entity.getCollector(), EntitySelectionElement.ALL);
72
        text_collectingNumber = new TextFieldController(specimenGeneralElement.getTextCollectingNumber(), getFormFactory(), formElement, entity.getFieldNumber(), null);
73
        selectionCollection = new EntitySelectionFieldController<Collection>(specimenGeneralElement.getCollectionSelectionField(), getFormFactory(), getConversationHolder(), formElement, Collection.class, entity.getCollection(), EntitySelectionElement.ALL);
74
        textAccessionNumber = new TextFieldController(specimenGeneralElement.getTextAccessionNumber(), getFormFactory(), formElement, entity.getAccessionNumber(), null);
75
    }
76

  
77
    @Override
78
    public void handleEvent(Object eventSource) {
79
        if (eventSource == toggleableText_titleCache) {
80
            getEntity().setTitleCache(toggleableText_titleCache.getText(), toggleableText_titleCache.getState());
81
        } else if (eventSource == selection_country) {
82
            getEntity().setCountry(selection_country.getSelection());
83
        } else if (eventSource == languageText_locality) {
84
            LanguageString locality = languageText_locality.getLanguageString();
85
            getEntity().setLocality(locality);
86
        } else if (eventSource == element_point) {
87
            getEntity().setExactLocation(element_point.getPoint());
88
        } else if (eventSource == number_elevation) {
89
            getEntity().setAbsoluteElevation(number_elevation.getInteger());
90
        } else if (eventSource == element_date) {
91
            getEntity().setGatheringPeriod(element_date.getTimePeriod());
92
        } else if (eventSource == selection_collector) {
93
            getEntity().setCollector(selection_collector.getSelection());
94
        } else if (eventSource == text_collectingNumber) {
95
            getEntity().setFieldNumber(text_collectingNumber.getText());
96
        }
97
        else if (eventSource == selectionCollection) {
98
            getEntity().setCollection(selectionCollection.getSelection());
99
        } else if (eventSource == textAccessionNumber) {
100
            getEntity().setAccessionNumber(textAccessionNumber.getText());
101
        }
102
        if (eventSource != toggleableText_titleCache) {
103
            toggleableText_titleCache.setText(getEntity().getTitleCache());
104
        }
105
    }
106

  
107
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenSection.java
1
// $Id$
2
/**
3
* Copyright (C) 2013 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen;
11

  
12
import org.eclipse.jface.viewers.ISelectionProvider;
13

  
14
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
15
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
16
import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
17
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
19
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
20
import eu.etaxonomy.taxeditor.ui.section.occurrence.IDerivedUnitFacadeDetailSection;
21

  
22
/**
23
 * @author pplitzner
24
 * @date 16.08.2013
25
 *
26
 */
27
public class SpecimenSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
28

  
29
    /**
30
     * <p>Constructor for FieldObservationDetailSection.</p>
31
     *
32
     * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
33
     * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
34
     * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
35
     * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
36
     * @param style a int.
37
     */
38
    public SpecimenSection(CdmFormFactory formFactory, ConversationHolder conversation,
39
            ICdmFormElement parentElement,
40
            ISelectionProvider selectionProvider, int style) {
41
        super(formFactory, conversation, parentElement, selectionProvider, style);
42
    }
43

  
44
    /** {@inheritDoc} */
45
    @Override
46
    public String getHeading() {
47
        return "Specimen";
48
    }
49

  
50
    /* (non-Javadoc)
51
     * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
52
     */
53
    @Override
54
    protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
55
        return formFactory.createSpecimenGeneralElementController(parentElement);
56
    }
57
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
101 101
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationDetailsElementController;
102 102
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationGeneralElement;
103 103
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationGeneralElementController;
104
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationSection;
104 105
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.GatheringEventDetailsElement;
105 106
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.GatheringEventDetailsElementController;
107
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenGeneralElement;
108
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenGeneralElementController;
109
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenSection;
106 110
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
107 111
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
108 112
import eu.etaxonomy.taxeditor.ui.openurl.IOpenUrlEnabled;
......
1755 1759
        return element;
1756 1760
    }
1757 1761

  
1758
    public FieldObservationGeneralElementController createFieldObservationGeneralElement(ICdmFormElement parentElement){
1759
        FieldObservationGeneralElement fieldObservationGeneralElement = new FieldObservationGeneralElement(parentElement.getLayoutComposite(), SWT.NONE);
1760
        fieldObservationGeneralElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
1761
        FieldObservationGeneralElementController element = new FieldObservationGeneralElementController(fieldObservationGeneralElement, this, parentElement);
1762
        addAndAdaptElement(parentElement, element);
1763
        return element;
1764
    }
1765 1762

  
1766 1763
    public GatheringEventDetailElement createGatheringEventDetailElement(ICdmFormElement parentElement) {
1767 1764
        GatheringEventDetailElement element = new GatheringEventDetailElement(this, parentElement);
......
1769 1766
        return element;
1770 1767
    }
1771 1768

  
1772
    public GatheringEventDetailsElementController createGatheringEventDetailsElementController(ICdmFormElement parentElement) {
1773
        GatheringEventDetailsElement gatheringEventDetailsElement = new GatheringEventDetailsElement(parentElement.getLayoutComposite(), SWT.NONE);
1774
        gatheringEventDetailsElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
1775
        GatheringEventDetailsElementController element = new GatheringEventDetailsElementController(gatheringEventDetailsElement, this, parentElement);
1776
        adapt(element);
1777
        parentElement.addElement(element);
1778
        return element;
1779
    }
1780

  
1781 1769
    public FieldObservationDetailElement createFieldObservationDetailElement(ICdmFormElement parentElement) {
1782 1770
        FieldObservationDetailElement element = new FieldObservationDetailElement(this, parentElement);
1783 1771
        addAndAdaptElement(parentElement, element);
1784 1772
        return element;
1785 1773
    }
1786 1774

  
1787
    public FieldObservationDetailsElementController createFieldObservationDetailsElementController(ICdmFormElement parentElement) {
1788
        FieldObservationDetailsElement fieldObservationDetailsElement = new FieldObservationDetailsElement(parentElement.getLayoutComposite(), SWT.NONE);
1789
        fieldObservationDetailsElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
1790
        FieldObservationDetailsElementController element = new FieldObservationDetailsElementController(fieldObservationDetailsElement, this, parentElement);
1791
        addAndAdaptElement(parentElement, element);
1792
        return element;
1793
    }
1794 1775

  
1795 1776
    public DerivedUnitBaseDetailElement createDerivedUnitBaseDetailElement(ICdmFormElement parentElement) {
1796 1777
        DerivedUnitBaseDetailElement element = new DerivedUnitBaseDetailElement(this, parentElement);
......
2292 2273
        return text;
2293 2274
    }
2294 2275

  
2276

  
2277

  
2278
    /**
2279
     * @param conversationHolder
2280
     * @param parent
2281
     * @param detailsViewer
2282
     * @param i
2283
     * @return
2284
     */
2285
    public FieldObservationSection createFieldObservationSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
2286
        FieldObservationSection section = new FieldObservationSection(this, conversation, parentElement, selectionProvider, style);
2287
        addAndAdaptSection(parentElement, section);
2288
        return section;
2289
    }
2290

  
2291
    /**
2292
     * @param conversationHolder
2293
     * @param parent
2294
     * @param detailsViewer
2295
     * @param i
2296
     * @return
2297
     */
2298
    public SpecimenSection createSpecimenSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
2299
        SpecimenSection section = new SpecimenSection(this, conversation, parentElement, selectionProvider, style);
2300
        addAndAdaptSection(parentElement, section);
2301
        return section;
2302
    }
2303

  
2304
    public SpecimenGeneralElementController createSpecimenGeneralElementController(ICdmFormElement parentElement){
2305
        SpecimenGeneralElement specimenGeneralElement = new SpecimenGeneralElement(parentElement.getLayoutComposite(), SWT.NONE);
2306
        specimenGeneralElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
2307
        SpecimenGeneralElementController element = new SpecimenGeneralElementController(specimenGeneralElement, this, parentElement);
2308
        addAndAdaptElement(parentElement, element);
2309
        return element;
2310
    }
2311

  
2312
    public FieldObservationGeneralElementController createFieldObservationGeneralElement(ICdmFormElement parentElement){
2313
        FieldObservationGeneralElement fieldObservationGeneralElement = new FieldObservationGeneralElement(parentElement.getLayoutComposite(), SWT.NONE);
2314
        fieldObservationGeneralElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
2315
        FieldObservationGeneralElementController element = new FieldObservationGeneralElementController(fieldObservationGeneralElement, this, parentElement);
2316
        addAndAdaptElement(parentElement, element);
2317
        return element;
2318
    }
2319

  
2320
    public GatheringEventDetailsElementController createGatheringEventDetailsElementController(ICdmFormElement parentElement) {
2321
        GatheringEventDetailsElement gatheringEventDetailsElement = new GatheringEventDetailsElement(parentElement.getLayoutComposite(), SWT.NONE);
2322
        gatheringEventDetailsElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
2323
        GatheringEventDetailsElementController element = new GatheringEventDetailsElementController(gatheringEventDetailsElement, this, parentElement);
2324
        adapt(element);
2325
        parentElement.addElement(element);
2326
        return element;
2327
    }
2328

  
2329
    public FieldObservationDetailsElementController createFieldObservationDetailsElementController(ICdmFormElement parentElement) {
2330
        FieldObservationDetailsElement fieldObservationDetailsElement = new FieldObservationDetailsElement(parentElement.getLayoutComposite(), SWT.NONE);
2331
        fieldObservationDetailsElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
2332
        FieldObservationDetailsElementController element = new FieldObservationDetailsElementController(fieldObservationDetailsElement, this, parentElement);
2333
        addAndAdaptElement(parentElement, element);
2334
        return element;
2335
    }
2336

  
2295 2337
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationDetailSection.java
54 54
	 */
55 55
	@Override
56 56
	protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
57
	    return formFactory.createFieldObservationDetailsElementController(parentElement);
57
	    return formFactory.createFieldObservationDetailElement(parentElement);
58 58
	}
59 59
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
47 47
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
48 48
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
49 49
import eu.etaxonomy.taxeditor.store.CdmStore;
50
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationSection;
51
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenSection;
50 52
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
51 53
import eu.etaxonomy.taxeditor.ui.element.RootElement;
52 54
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
......
76 78
import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
77 79
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationDetailSection;
78 80
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
79
import eu.etaxonomy.taxeditor.ui.section.occurrence.GeneralDetailSection;
80 81
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
81 82
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
82 83
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
......
539 540
    private void createDerivedUnitBaseElementSection(RootElement parent) {
540 541
        destroySections();
541 542

  
542
        GeneralDetailSection generalDetailSection = formFactory.createGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
543
        FieldObservationSection fieldObservationSection = formFactory.createFieldObservationSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
543 544

  
544 545
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
545 546

  
......
551 552

  
552 553
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
553 554

  
555
        SpecimenSection specimenSection = formFactory.createSpecimenSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
556

  
557
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
558

  
559

  
554 560
//        DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
555 561
//
556 562
//        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
557 563
//
558 564
//        DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
559 565

  
560
        addPart(generalDetailSection);
566
        addPart(fieldObservationSection);
561 567
        addPart(gatheringEventDetailSection);
562 568
        addPart(fieldObservationDetailSection);
569
        addPart(specimenSection);
563 570
//        addPart(derivedUnitBaseDetailSection);
564 571
//        addPart(determinationDetailSection);
565 572
    }

Also available in: Unified diff