eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamMemberSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamOrPersonBaseDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamWizardPage.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/campanula/FieldObservationDetailsView.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/campanula/FieldObservationGeneralElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/campanula/GatheringEventDetailsElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/campanula/NumberFieldController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/campanula/TextFieldController.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/ClassificationDetailElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/ClassificationDetailSection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/ClassificationWizardPage.java -text
/** {@inheritDoc} */
@Override
public void firePropertyChangeEvent(CdmPropertyChangeEvent event) {
+ //TODO: replace propertyChangeListeners with formFactory.getPropertyChangeListeners() and remove member propertyChangeListeners from AbstractCdmFormElement
Assert.isNotNull(propertyChangeListeners, "Property change listeners are not present");
try{
import eu.etaxonomy.taxeditor.ui.section.agent.TeamMemberElement;
import eu.etaxonomy.taxeditor.ui.section.agent.TeamMemberSection;
import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.campanula.GatheringEventDetailsElement;
import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationDetailElement;
import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationDetailSection;
import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailElement;
}
public GatheringEventDetailElementComposite createGatheringEventDetailElementComposite(ICdmFormElement parentElement) {
- GatheringEventDetailElementComposite element = new GatheringEventDetailElementComposite(parentElement.getLayoutComposite(), this, parentElement, SWT.NONE);
+ GatheringEventDetailElementComposite element = new GatheringEventDetailElementComposite(parentElement.getLayoutComposite(), new GatheringEventDetailsElement(parentElement.getLayoutComposite(), SWT.NONE), this, parentElement, SWT.NONE);
adapt(element);
parentElement.addElement(element);
return element;
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2013 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.ui.section.campanula;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import org.eclipse.wb.swt.SWTResourceManager;
+
+/**
+ * @author pplitzner
+ * @date 07.08.2013
+ *
+ */
+public class FieldObservationDetailsView extends Composite {
+ private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public FieldObservationDetailsView(Composite parent, int style) {
+ super(parent, style);
+ setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+ {
+ TableWrapLayout tableWrapLayout = new TableWrapLayout();
+ tableWrapLayout.numColumns = 1;
+ setLayout(tableWrapLayout);
+ }
+
+ ExpandableComposite xpndblcmpstNewExpandablecomposite = formToolkit.createExpandableComposite(this, ExpandableComposite.TWISTIE);
+ TableWrapData twd_xpndblcmpstNewExpandablecomposite = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
+ twd_xpndblcmpstNewExpandablecomposite.grabHorizontal = true;
+ xpndblcmpstNewExpandablecomposite.setLayoutData(twd_xpndblcmpstNewExpandablecomposite);
+ formToolkit.paintBordersFor(xpndblcmpstNewExpandablecomposite);
+ xpndblcmpstNewExpandablecomposite.setText("FieldObservation");
+ xpndblcmpstNewExpandablecomposite.setExpanded(true);
+
+ FieldObservationGeneralElement fieldObservationGeneralElement = new FieldObservationGeneralElement(xpndblcmpstNewExpandablecomposite, SWT.NONE);
+ formToolkit.adapt(fieldObservationGeneralElement);
+ formToolkit.paintBordersFor(fieldObservationGeneralElement);
+ xpndblcmpstNewExpandablecomposite.setClient(fieldObservationGeneralElement);
+
+ ExpandableComposite xpndblcmpstNewExpandablecomposite_1 = formToolkit.createExpandableComposite(this, ExpandableComposite.TWISTIE);
+ TableWrapData twd_xpndblcmpstNewExpandablecomposite_1 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
+ twd_xpndblcmpstNewExpandablecomposite_1.grabHorizontal = true;
+ xpndblcmpstNewExpandablecomposite_1.setLayoutData(twd_xpndblcmpstNewExpandablecomposite_1);
+ formToolkit.paintBordersFor(xpndblcmpstNewExpandablecomposite_1);
+ xpndblcmpstNewExpandablecomposite_1.setText("Gathering Event Details");
+ xpndblcmpstNewExpandablecomposite_1.setExpanded(true);
+
+ GatheringEventDetailsElement gatheringEventDetailsElement = new GatheringEventDetailsElement(xpndblcmpstNewExpandablecomposite_1, SWT.NONE);
+ formToolkit.adapt(gatheringEventDetailsElement);
+ formToolkit.paintBordersFor(gatheringEventDetailsElement);
+ xpndblcmpstNewExpandablecomposite_1.setClient(gatheringEventDetailsElement);
+
+ ExpandableComposite xpndblcmpstNewExpandablecomposite_2 = formToolkit.createExpandableComposite(this, ExpandableComposite.TWISTIE);
+ TableWrapData twd_xpndblcmpstNewExpandablecomposite_2 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
+ twd_xpndblcmpstNewExpandablecomposite_2.grabHorizontal = true;
+ xpndblcmpstNewExpandablecomposite_2.setLayoutData(twd_xpndblcmpstNewExpandablecomposite_2);
+ formToolkit.paintBordersFor(xpndblcmpstNewExpandablecomposite_2);
+ xpndblcmpstNewExpandablecomposite_2.setText("Collecting Areas");
+
+ ExpandableComposite xpndblcmpstFieldObservationDetails = formToolkit.createExpandableComposite(this, ExpandableComposite.TWISTIE);
+ TableWrapData twd_xpndblcmpstFieldObservationDetails = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
+ twd_xpndblcmpstFieldObservationDetails.grabHorizontal = true;
+ xpndblcmpstFieldObservationDetails.setLayoutData(twd_xpndblcmpstFieldObservationDetails);
+ formToolkit.paintBordersFor(xpndblcmpstFieldObservationDetails);
+ xpndblcmpstFieldObservationDetails.setText("Field Observation Details");
+
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2013 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.ui.section.campanula;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import org.eclipse.wb.swt.SWTResourceManager;
+
+/**
+ * @author pplitzner
+ * @date 07.08.2013
+ *
+ */
+public class FieldObservationGeneralElement extends Composite {
+ private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
+ private final Text text;
+ private final Text text_1;
+ private final Text text_2;
+ private final Text text_3;
+ private final Text text_4;
+ private final Text text_5;
+ private final Text text_6;
+ private final Text text_7;
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public FieldObservationGeneralElement(Composite parent, int style) {
+ super(parent, style);
+ setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+ {
+ TableWrapLayout tableWrapLayout = new TableWrapLayout();
+ tableWrapLayout.numColumns = 2;
+ setLayout(tableWrapLayout);
+ }
+
+ Label lblTitleCache = formToolkit.createLabel(this, "Title Cache", SWT.NONE);
+
+ text = formToolkit.createText(this, "New Text", SWT.NONE);
+ text.setText("");
+ text.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblNewLabel = new Label(this, SWT.NONE);
+ formToolkit.adapt(lblNewLabel, true, true);
+ lblNewLabel.setText("Country");
+ new Label(this, SWT.NONE);
+
+ Label lblLocality = formToolkit.createLabel(this, "Locality", SWT.NONE);
+
+ text_1 = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_1.setText("");
+ text_1.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblLatitude = formToolkit.createLabel(this, "Latitude", SWT.NONE);
+
+ text_2 = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_2.setText("");
+ text_2.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblLongitude = formToolkit.createLabel(this, "Longitude", SWT.NONE);
+
+ text_3 = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_3.setText("");
+ text_3.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblErrorRadiusm = formToolkit.createLabel(this, "Error Radius (m)", SWT.NONE);
+
+ text_4 = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_4.setText("");
+ text_4.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblReferenceSystem = formToolkit.createLabel(this, "Reference System", SWT.NONE);
+ new Label(this, SWT.NONE);
+
+ Label lblAbsoluteElevationm = formToolkit.createLabel(this, "Absolute Elevation (m)", SWT.NONE);
+
+ text_5 = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_5.setText("");
+ text_5.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblDate = formToolkit.createLabel(this, "Date", SWT.NONE);
+ new Label(this, SWT.NONE);
+
+ Label lblCollector = formToolkit.createLabel(this, "Collector", SWT.NONE);
+
+ text_6 = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_6.setText("");
+ text_6.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblCollectingNumber = formToolkit.createLabel(this, "Collecting Number", SWT.NONE);
+
+ text_7 = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_7.setText("");
+ text_7.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2013 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.ui.section.campanula;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import org.eclipse.wb.swt.SWTResourceManager;
+
+/**
+ * @author pplitzner
+ * @date 07.08.2013
+ *
+ */
+public class GatheringEventDetailsElement extends Composite {
+ private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
+ private final Text textElevationError;
+ private final Text text_ElevationMinimum;
+ private final Text text_ElevationMaximum;
+ private final Text text_CollectingMethod;
+ private final Text text_DistanceToGround;
+ private final Text text_DistanceToWaterSurface;
+ private final Text text_GatheringEventDescription;
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public GatheringEventDetailsElement(Composite parent, int style) {
+ super(parent, style);
+ setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+ {
+ TableWrapLayout tableWrapLayout = new TableWrapLayout();
+ tableWrapLayout.numColumns = 2;
+ setLayout(tableWrapLayout);
+ }
+
+ Label lblElevationError = formToolkit.createLabel(this, "Elevation Error", SWT.NONE);
+
+ textElevationError = formToolkit.createText(this, "New Text", SWT.NONE);
+ textElevationError.setText("");
+ textElevationError.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblElevationMinimumm = formToolkit.createLabel(this, "Elevation Minimum (m)", SWT.NONE);
+
+ text_ElevationMinimum = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_ElevationMinimum.setText("");
+ text_ElevationMinimum.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblElevationMaximumm = formToolkit.createLabel(this, "Elevation Maximum (m)", SWT.NONE);
+
+ text_ElevationMaximum = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_ElevationMaximum.setText("");
+ text_ElevationMaximum.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblCollectingMethod = formToolkit.createLabel(this, "Collecting Method", SWT.NONE);
+
+ text_CollectingMethod = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_CollectingMethod.setText("");
+ text_CollectingMethod.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblDistanceToGround = formToolkit.createLabel(this, "Distance To Ground (m)", SWT.NONE);
+
+ text_DistanceToGround = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_DistanceToGround.setText("");
+ text_DistanceToGround.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblDistanceToWater = formToolkit.createLabel(this, "Distance To Water Surface (m)", SWT.NONE);
+
+ text_DistanceToWaterSurface = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_DistanceToWaterSurface.setText("");
+ text_DistanceToWaterSurface.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ Label lblGatheringEventDescription = formToolkit.createLabel(this, "Gathering Event Description", SWT.NONE);
+
+ text_GatheringEventDescription = formToolkit.createText(this, "New Text", SWT.NONE);
+ text_GatheringEventDescription.setText("");
+ text_GatheringEventDescription.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+ public Text getTextElevationError() {
+ return textElevationError;
+ }
+ public Text getText_ElevationMinimum() {
+ return text_ElevationMinimum;
+ }
+ public Text getText_ElevationMaximum() {
+ return text_ElevationMaximum;
+ }
+ public Text getText_CollectingMethod() {
+ return text_CollectingMethod;
+ }
+ public Text getText_DistanceToGround() {
+ return text_DistanceToGround;
+ }
+ public Text getText_DistanceToWaterSurface() {
+ return text_DistanceToWaterSurface;
+ }
+ public Text getText_GatheringEventDescription() {
+ return text_GatheringEventDescription;
+ }
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2013 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.ui.section.campanula;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Text;
+
+import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+
+/**
+ * @author pplitzner
+ * @date 12.08.2013
+ *
+ */
+public class NumberFieldController extends TextFieldController {
+ private Float start;
+ private Float end;
+
+ private NumberFormatException exception;
+
+ /**
+ * <p>Constructor for NumberWithLabelElement.</p>
+ *
+ * @param toolkit a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
+ * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
+ * @param labelString a {@link java.lang.String} object.
+ * @param initialInteger a {@link java.lang.Integer} object.
+ * @param style a int.
+ */
+ public NumberFieldController(Composite parent, Text controlledText, CdmFormFactory formFactory, ICdmFormElement parentElement, Integer initialInteger, int style){
+ super(parent, controlledText, formFactory, parentElement, null, null, style);
+ //WindowBuilder exception handling
+ if(initialInteger==null){
+ initialInteger = 0;
+ }
+ setInteger(initialInteger);
+ }
+
+ /**
+ * <p>Constructor for NumberWithLabelElement.</p>
+ *
+ * @param toolkit a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
+ * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
+ * @param labelString a {@link java.lang.String} object.
+ * @param initialFloat a {@link java.lang.Float} object.
+ * @param style a int.
+ * @wbp.parser.constructor
+ */
+ public NumberFieldController(Composite parent, Text controlledText, CdmFormFactory formFactory,
+ ICdmFormElement parentElement, Float initialFloat, int style) {
+ super(parent, controlledText, formFactory, parentElement, null, null, style);
+ //WindowBuilder exception handling
+ if(initialFloat==null){
+ initialFloat = 0f;
+ }
+ setFloat(initialFloat);
+ }
+
+ /**
+ * <p>setInteger</p>
+ *
+ * @param number a {@link java.lang.Integer} object.
+ */
+ public void setInteger(Integer number) {
+ super.setText(getStringRepresentation(number));
+ }
+
+ /**
+ * <p>setFloat</p>
+ *
+ * @param number a {@link java.lang.Float} object.
+ */
+ public void setFloat(Float number) {
+ super.setText(getStringRepresentation(number));
+ }
+
+ /**
+ * <p>getInteger</p>
+ *
+ * @return a {@link java.lang.Integer} object.
+ */
+ public Integer getInteger() {
+ String text = super.getText().trim();
+ return text.equals("") ? 0 : new Integer(text);
+ }
+
+ /**
+ * <p>getFloat</p>
+ *
+ * @return a {@link java.lang.Float} object.
+ */
+ public Float getFloat(){
+ String text = super.getText();
+ return new Float(text);
+ }
+
+ private String getStringRepresentation(Object number){
+ if(number != null){
+ return number.toString();
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void modifyText(ModifyEvent event) {
+ String value = text.getText();
+ if(CdmUtils.isEmpty(value)){
+ text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+ return;
+ }
+
+ try{
+
+ Float number = Float.parseFloat(value);
+
+ if((start != null && number < start) || (end != null && number > end)){
+ throw new NumberFormatException("You entered a number that is not within the allowed bounds.");
+ }
+
+ }catch(NumberFormatException e){
+ text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
+ exception = e;
+ return;
+ }
+
+ exception = null;
+ text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+
+ super.modifyText(event);
+ }
+
+ /**
+ * <p>setLimits</p>
+ *
+ * @param numberOfDigits a int.
+ * @param start a {@link java.lang.Integer} object.
+ * @param end a {@link java.lang.Integer} object.
+ */
+ public void setLimits(int numberOfDigits, Integer start, Integer end){
+ setLimits(numberOfDigits, start.floatValue(), end.floatValue());
+ }
+
+ /**
+ * <p>setLimits</p>
+ *
+ * @param numberOfDigits a int.
+ * @param start a {@link java.lang.Float} object.
+ * @param end a {@link java.lang.Float} object.
+ */
+ public void setLimits(int numberOfDigits, Float start, Float end){
+ text.setTextLimit(numberOfDigits);
+ this.start = start;
+ this.end = end;
+ }
+
+ /**
+ * <p>Getter for the field <code>exception</code>.</p>
+ *
+ * @return the exception
+ */
+ public NumberFormatException getException() {
+ return exception;
+ }
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2013 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.ui.section.campanula;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.wb.swt.SWTResourceManager;
+
+import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
+import eu.etaxonomy.taxeditor.ui.element.ISelectable;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+
+/**
+ * @author pplitzner
+ * @date 09.08.2013
+ *
+ */
+public class TextFieldController extends AbstractCdmFormElement implements ModifyListener, IEnableableFormElement, ISelectable{
+
+ protected Text text;
+
+ /** Constant <code>MAX_HEIGHT=0</code> */
+ public static final int MAX_HEIGHT = 0;
+ /** Constant <code>SINGLE=-1</code> */
+ public static final int SINGLE = -1;
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ * @param initialText
+ * @param textHeight
+ */
+ public TextFieldController(Composite parent, Text controlledText, CdmFormFactory formFactory, ICdmFormElement parentFormElement, String initialText, Integer textHeight, int style) {
+ super(formFactory, parentFormElement);
+ setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+
+ //vvvvvvvvvvvvv
+
+ setPropertyChangeListeners(formFactory.getPropertyChangeListeners());
+
+ initialText = initialText==null?"":initialText;
+
+ int scrollStyle = textHeight == null ? SWT.NULL : (SWT.V_SCROLL | SWT.MULTI);
+
+ int combinedStyle = style | SWT.BORDER | scrollStyle;
+
+ // SWT.PASSWORD does not work when SWT.WRAP is set.
+ if (style != SWT.PASSWORD) {
+ combinedStyle = combinedStyle | SWT.WRAP;
+ }
+ //^^^^^^^^^^^^^^
+
+ this.text = controlledText;
+ TableWrapData twd_text_1 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP);
+ twd_text_1.grabHorizontal = true;
+ text.setText(initialText);
+ text.setLayoutData(twd_text_1);
+
+
+ //vvvvvvvvvvvvvvvvvv
+ if (textHeight == null) {
+ text.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.character == SWT.CR) {
+ // Don't accept carriage returns as input when in single
+ // line mode
+ e.doit = false;
+ } else if (e.character == SWT.TAB) {
+ // traverse is not working for wrapped text widgets so
+ // we reintroduce it here
+ e.doit = false;
+ TextFieldController.this.text.traverse(SWT.TRAVERSE_TAB_NEXT);
+ }
+ }
+ });
+ }
+
+ TableWrapData layoutData = LayoutConstants.FILL();
+ if (textHeight != null && textHeight > 0) {
+ (layoutData).heightHint = textHeight;
+ }
+
+ text.setLayoutData(layoutData);
+
+ text.addModifyListener(this);
+
+ addControl(text);
+
+ }
+
+ /**
+ * Get the text of this composites text composite
+ *
+ * @return a {@link java.lang.String} object.
+ */
+ public String getText() {
+ return text.getText();
+ }
+
+ /**
+ * Set the text of this composites text composite
+ *
+ * @param string
+ * a {@link java.lang.String} object.
+ */
+ public void setText(String string) {
+ Listener[] listeners = text.getListeners(SWT.Modify);
+
+ for (Listener listener : listeners) {
+ text.removeListener(SWT.Modify, listener);
+ }
+
+ text.setText(CdmUtils.Nz(string));
+
+ for (Listener listener : listeners) {
+ text.addListener(SWT.Modify, listener);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events
+ * .ModifyEvent)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void modifyText(ModifyEvent e) {
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setEnabled(boolean enabled) {
+ text.setEnabled(enabled);
+ String symbolicName = enabled ? Resources.COLOR_FONT_DEFAULT : Resources.COLOR_TEXT_DISABLED;
+ text.setForeground(getColor(symbolicName));
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setIrrelevant(boolean irrelevant) {
+ String colorId = irrelevant ? Resources.COLOR_COMPOSITE_IRRELEVANT : Resources.COLOR_COMPOSITE_BACKGROUND;
+
+ Color color = getColor(colorId);
+ text.setBackground(color);
+ }
+
+ @Override
+ public void setSelected(boolean selected) {
+ setBackground(selected ? SELECTED : getPersistentBackground());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#setFocus()
+ */
+ /** {@inheritDoc}
+ * @return */
+ @Override
+ public void setFocus() {
+ text.setFocus();
+ }
+
+ /**
+ * <p>
+ * getMainControl
+ * </p>
+ *
+ * @return a {@link org.eclipse.swt.widgets.Control} object.
+ */
+ public Control getMainControl() {
+ return text;
+ }
+
+ /**
+ * <p>
+ * setTextLimit
+ * </p>
+ *
+ * @param limit
+ * a int.
+ */
+ public void setTextLimit(int limit) {
+ text.setTextLimit(limit);
+ }
+}
*/
package eu.etaxonomy.taxeditor.ui.section.occurrence;
-import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.TableWrapData;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.preference.Resources;
-import eu.etaxonomy.taxeditor.ui.element.CdmElementFactory;
-import eu.etaxonomy.taxeditor.ui.element.CdmNumberField;
-import eu.etaxonomy.taxeditor.ui.element.CdmTextField;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElementComposite;
+import eu.etaxonomy.taxeditor.ui.section.campanula.GatheringEventDetailsElement;
+import eu.etaxonomy.taxeditor.ui.section.campanula.NumberFieldController;
+import eu.etaxonomy.taxeditor.ui.section.campanula.TextFieldController;
/**
* @author pplitzner
- private final CdmNumberField absoluteElevationError;
- private final CdmNumberField number_absoluteElevationMinimum;
- private final CdmNumberField number_absoluteElevationMaximum;
- private final CdmTextField collectingMethod;
- private final CdmNumberField number_distanceToGround;
- private final CdmNumberField number_distanceToWaterSurface;
- private final CdmTextField gatheringEventDescription;
+ private final NumberFieldController absoluteElevationError;
+ private final NumberFieldController number_absoluteElevationMinimum;
+ private final NumberFieldController number_absoluteElevationMaximum;
+ private final TextFieldController collectingMethod;
+ private final NumberFieldController number_distanceToGround;
+ private final NumberFieldController number_distanceToWaterSurface;
+ private final TextFieldController gatheringEventDescription;
private CollectingAreasDetailSection section_collectingAreas;
+ public GatheringEventDetailElementComposite(Composite parent, CdmFormFactory formFactory, ICdmFormElement parentFormElement, int style) {
+ this(parent, null, formFactory, parentFormElement, style);
+ }
/**
* <p>
* Constructor for GatheringEventDetailElement.
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
*/
- public GatheringEventDetailElementComposite(Composite parent, FormToolkit formFactory, ICdmFormElement parentFormElement, int style) {
+ public GatheringEventDetailElementComposite(Composite parent, GatheringEventDetailsElement controlledComposite, CdmFormFactory formFactory, ICdmFormElement parentFormElement, int style) {
super(parent, formFactory, parentFormElement, style);
- Label lblNewLabel_4 = new Label(this, SWT.NONE);
- formFactory.adapt(lblNewLabel_4, true, true);
- lblNewLabel_4.setText("Elevation Error");
-
- absoluteElevationError = CdmElementFactory.createCdmNumberField(getLayoutComposite(), formFactory, this, (Integer) null, 0);
- ((TableWrapData) absoluteElevationError.getMainControl().getLayoutData()).grabVertical = false;
- TableWrapData twd_cdmNumberField = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
- twd_cdmNumberField.grabHorizontal = true;
- absoluteElevationError.setLayoutData(twd_cdmNumberField);
- formFactory.adapt(absoluteElevationError);
- formFactory.paintBordersFor(absoluteElevationError);
-
- Label lblNewLabel_3 = new Label(this, SWT.NONE);
- formFactory.adapt(lblNewLabel_3, true, true);
- lblNewLabel_3.setText("Elevation Error Minumum (m)");
-
- number_absoluteElevationMinimum = CdmElementFactory.createCdmNumberField(getLayoutComposite(), formFactory, this, (Integer) null, 0);
- TableWrapData tableWrapData = (TableWrapData) number_absoluteElevationMinimum.getMainControl().getLayoutData();
- tableWrapData.valign = TableWrapData.TOP;
- tableWrapData.grabVertical = false;
- TableWrapData twd_cdmNumberField_1 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
- twd_cdmNumberField_1.grabHorizontal = true;
- number_absoluteElevationMinimum.setLayoutData(twd_cdmNumberField_1);
- formFactory.paintBordersFor(number_absoluteElevationMinimum);
-
- Label lblNewLabel_2 = new Label(this, SWT.NONE);
- formFactory.adapt(lblNewLabel_2, true, true);
- lblNewLabel_2.setText("Elevation Maximum (m)");
-
- number_absoluteElevationMaximum = CdmElementFactory.createCdmNumberField(getLayoutComposite(), formFactory, this, (Integer) null, 0);
- TableWrapData twd_cdmNumberField_2 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
- twd_cdmNumberField_2.grabHorizontal = true;
- number_absoluteElevationMaximum.setLayoutData(twd_cdmNumberField_2);
- formFactory.adapt(number_absoluteElevationMaximum);
- formFactory.paintBordersFor(number_absoluteElevationMaximum);
-
- Label lblTestLabel = new Label(this, SWT.NONE);
- formFactory.adapt(lblTestLabel, true, true);
- lblTestLabel.setText("Collecting Method");
-
- collectingMethod = CdmElementFactory.createCdmTextField(getLayoutComposite(), formFactory, this, (String) null, (Integer) null, 0);
- TableWrapData twd_cdmTextField_1 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
- twd_cdmTextField_1.grabHorizontal = true;
- collectingMethod.setLayoutData(twd_cdmTextField_1);
- formFactory.adapt(collectingMethod);
- formFactory.paintBordersFor(collectingMethod);
-
- Label lblNewLabel_5 = new Label(this, SWT.NONE);
- formFactory.adapt(lblNewLabel_5, true, true);
- lblNewLabel_5.setText("Distance To Ground (m)");
-
- number_distanceToGround = CdmElementFactory.createCdmNumberField(getLayoutComposite(), formFactory, this, (Integer) null, 0);
- TableWrapData twd_cdmNumberField_3 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
- twd_cdmNumberField_3.grabHorizontal = true;
- number_distanceToGround.setLayoutData(twd_cdmNumberField_3);
- formFactory.adapt(number_distanceToGround);
- formFactory.paintBordersFor(number_distanceToGround);
-
- Label lblNewLabel_6 = new Label(this, SWT.NONE);
- formFactory.adapt(lblNewLabel_6, true, true);
- lblNewLabel_6.setText("Distance To Water Surface");
-
- number_distanceToWaterSurface = CdmElementFactory.createCdmNumberField(getLayoutComposite(), formFactory, this, (Integer) null, 0);
- TableWrapData twd_cdmNumberField_4 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
- twd_cdmNumberField_4.grabHorizontal = true;
- number_distanceToWaterSurface.setLayoutData(twd_cdmNumberField_4);
- formFactory.adapt(number_distanceToWaterSurface);
- formFactory.paintBordersFor(number_distanceToWaterSurface);
-
- Label lblNewLabel = new Label(this, SWT.NONE);
- formFactory.adapt(lblNewLabel, true, true);
- lblNewLabel.setText("Gathering Event Description");
-
- gatheringEventDescription = CdmElementFactory.createCdmTextField(getLayoutComposite(), formFactory, this, (String) null, (Integer) null, 0);
- TableWrapData twd_cdmTextField_2 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
- twd_cdmTextField_2.grabHorizontal = true;
- gatheringEventDescription.setLayoutData(twd_cdmTextField_2);
- formFactory.adapt(gatheringEventDescription);
- formFactory.paintBordersFor(gatheringEventDescription);
-
+ absoluteElevationError = new NumberFieldController(getLayoutComposite(), controlledComposite.getTextElevationError(), formFactory, this, (Integer)null, 0);
+ number_absoluteElevationMinimum = new NumberFieldController(getLayoutComposite(), controlledComposite.getText_ElevationMinimum(), formFactory, this, (Integer)null, 0);
+ number_absoluteElevationMaximum = new NumberFieldController(getLayoutComposite(), controlledComposite.getText_ElevationMaximum(), formFactory, this, (Integer)null, 0);
+ collectingMethod = new TextFieldController(getLayoutComposite(), controlledComposite.getText_CollectingMethod(), formFactory, this, null, null, 0);
+ number_distanceToGround = new NumberFieldController(getLayoutComposite(), controlledComposite.getText_DistanceToGround(), formFactory, this, (Integer)null, 0);
+ number_distanceToWaterSurface = new NumberFieldController(getLayoutComposite(), controlledComposite.getText_DistanceToWaterSurface(), formFactory, this, (Integer)null, 0);
+ gatheringEventDescription = new TextFieldController(getLayoutComposite(), controlledComposite.getText_GatheringEventDescription(), formFactory, this, null, null, 0);
}
/** {@inheritDoc} */
absoluteElevationError.setText(String.valueOf(entity.getAbsoluteElevation()));
number_absoluteElevationMinimum.setText(String.valueOf(entity.getAbsoluteElevationMinimum()));
number_absoluteElevationMaximum.setText(String.valueOf(entity.getAbsoluteElevationMaximum()));
+
collectingMethod.setText(entity.getCollectingMethod());
+
number_distanceToGround.setText(String.valueOf(entity.getDistanceToGround()));
number_distanceToWaterSurface.setText(String.valueOf(entity.getDistanceToWaterSurface()));
gatheringEventDescription.setText(entity.getGatheringEventDescription());