fix #5379
authorKatja Luther <k.luther@bgbm.org>
Wed, 25 May 2016 10:57:54 +0000 (12:57 +0200)
committerKatja Luther <k.luther@bgbm.org>
Wed, 25 May 2016 10:57:54 +0000 (12:57 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PointElement.java

index 5ad3ae4ec606b017e8c9411aa79ece1672304b0b..1d3c646a80d3c8c2b46f8648da9a46216b0df48b 100644 (file)
@@ -12,6 +12,7 @@ package eu.etaxonomy.taxeditor.ui.element;
 
 import java.text.ParseException;
 
+import org.apache.commons.lang.StringUtils;
 import org.eclipse.jface.util.PropertyChangeEvent;
 
 import eu.etaxonomy.cdm.model.common.TermType;
@@ -102,11 +103,18 @@ public class PointElement extends AbstractCdmFormElement implements
                Object eventSource = event.getSource();
                if (eventSource == text_latitude) {
                        try {
-                               getPoint().setLatitudeByParsing(text_latitude.getText());
-                               text_latitudeParsed.setText(point.getLatitudeSexagesimal()
-                                               .toString(false));
-                               text_latitude
-                                               .setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+                           if (StringUtils.isBlank(text_latitude.getText())){
+                               getPoint().setLatitudeByParsing(null);
+                               text_latitudeParsed.setText(null);
+                               text_latitude
+                    .setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+                           }else{
+                               getPoint().setLatitudeByParsing(text_latitude.getText());
+                               text_latitudeParsed.setText(point.getLatitudeSexagesimal()
+                                               .toString(false));
+                               text_latitude
+                                               .setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+                           }
                                propagate = true;
                        } catch (ParseException e) {
                                text_latitude
@@ -114,11 +122,18 @@ public class PointElement extends AbstractCdmFormElement implements
                        }
                } else if (eventSource == text_longitude) {
                        try {
-                               getPoint().setLongitudeByParsing(text_longitude.getText());
-                               text_longitudeParsed.setText(point.getLongitudeSexagesimal()
-                                               .toString(false));
-                               text_longitude
-                                               .setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+                           if (StringUtils.isBlank(text_longitude.getText())){
+                    getPoint().setLongitudeByParsing(null);
+                    text_longitudeParsed.setText(null);
+                    text_longitude
+                    .setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+                }else{
+                               getPoint().setLongitudeByParsing(text_longitude.getText());
+                               text_longitudeParsed.setText(point.getLongitudeSexagesimal()
+                                               .toString(false));
+                               text_longitude
+                                               .setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+                }
                                propagate = true;
                        } catch (ParseException e) {
                                text_longitude