fixing #5319
authorKatja Luther <k.luther@bgbm.org>
Tue, 10 Nov 2015 09:34:26 +0000 (10:34 +0100)
committerKatja Luther <k.luther@bgbm.org>
Tue, 10 Nov 2015 09:34:26 +0000 (10:34 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/NumberWithLabelElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PartialElement.java

index 26e410dfb1973709d98a21f6a2265984223ac6de..72cc267f39235518d477ffa8715b0502f82a9744 100644 (file)
@@ -64,7 +64,7 @@ public class NumberWithLabelElement extends TextWithLabelElement {
            if(super.getText()!=null){
                String text = super.getText().trim();
                try {
-                   return StringUtils.isBlank(text) ? null : new Integer(text);
+                   return StringUtils.isBlank(text) ? 0 : new Integer(text);
                } catch (NumberFormatException e) {
                    exception = e;
                }
index 54c595239076d627ab43ea38e11052c207b7116b..f448fe3c415c2f268b63b9067288aa7aadfc2a1f 100644 (file)
@@ -118,13 +118,27 @@ public class PartialElement extends AbstractCdmFormElement implements ISelectabl
 
        private void handleEvent(Object eventSource){
                if(eventSource == number_month){
-                       partial = TimePeriod.setPartialField(partial, number_month.getInteger(), TimePeriod.MONTH_TYPE);
+                       if (number_month.getInteger() == 0){
+                               partial = TimePeriod.setPartialField(partial, null, TimePeriod.MONTH_TYPE);
+                       } else{
+                               partial = TimePeriod.setPartialField(partial, number_month.getInteger(), TimePeriod.MONTH_TYPE);
+                       }
                        
                }else if(eventSource == number_day){
-                       partial = TimePeriod.setPartialField(partial, number_day.getInteger(), TimePeriod.DAY_TYPE);
+                       if (number_day.getInteger() == 0){
+                               partial = TimePeriod.setPartialField(partial, null, TimePeriod.DAY_TYPE);
+                       } else{
+                               partial = TimePeriod.setPartialField(partial, number_day.getInteger(), TimePeriod.DAY_TYPE);
+                       }
+                       
                        
                }else if(eventSource == number_year){
-                       partial = TimePeriod.setPartialField(partial, number_year.getInteger(), TimePeriod.YEAR_TYPE);
+                       if (number_year.getInteger() == 0){
+                               partial = TimePeriod.setPartialField(partial, null, TimePeriod.YEAR_TYPE);
+                       } else{
+                               partial = TimePeriod.setPartialField(partial, number_year.getInteger(), TimePeriod.YEAR_TYPE);
+                       }
+                       
                }
                firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
        }