Revision 7158c91c
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PartialElement.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.ui.element; |
11 | 11 |
|
12 | 12 |
import org.eclipse.jface.util.PropertyChangeEvent; |
13 |
import org.eclipse.swt.SWT; |
|
13 | 14 |
import org.eclipse.swt.graphics.Color; |
15 |
import org.eclipse.swt.widgets.Display; |
|
14 | 16 |
import org.eclipse.swt.widgets.Label; |
15 | 17 |
import org.eclipse.ui.forms.widgets.TableWrapLayout; |
18 |
import org.joda.time.IllegalFieldValueException; |
|
16 | 19 |
import org.joda.time.Partial; |
17 | 20 |
|
18 | 21 |
import eu.etaxonomy.cdm.model.common.TimePeriod; |
... | ... | |
115 | 118 |
} |
116 | 119 |
|
117 | 120 |
private void handleEvent(Object eventSource){ |
118 |
if(eventSource == number_month && number_month.getException()==null){ |
|
119 |
if (number_month.getInteger() == null || number_month.getInteger() == 0){ |
|
120 |
partial = TimePeriod.setPartialField(partial, null, TimePeriod.MONTH_TYPE); |
|
121 |
} else{ |
|
122 |
partial = TimePeriod.setPartialField(partial, number_month.getInteger(), TimePeriod.MONTH_TYPE); |
|
123 |
} |
|
124 |
|
|
125 |
}else if(eventSource == number_day && number_day.getException()==null){ |
|
126 |
if (number_day.getInteger() == null || number_day.getInteger() == 0){ |
|
127 |
partial = TimePeriod.setPartialField(partial, null, TimePeriod.DAY_TYPE); |
|
128 |
} else{ |
|
129 |
partial = TimePeriod.setPartialField(partial, number_day.getInteger(), TimePeriod.DAY_TYPE); |
|
130 |
} |
|
131 |
|
|
132 |
|
|
133 |
}else if(eventSource == number_year && number_year.getException()==null){ |
|
134 |
if (number_year.getInteger() == null || number_year.getInteger() == 0){ |
|
135 |
partial = TimePeriod.setPartialField(partial, null, TimePeriod.YEAR_TYPE); |
|
136 |
} else{ |
|
137 |
partial = TimePeriod.setPartialField(partial, number_year.getInteger(), TimePeriod.YEAR_TYPE); |
|
138 |
} |
|
139 |
|
|
140 |
} |
|
141 |
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null)); |
|
121 |
if(eventSource == number_month && number_month.getException()==null){ |
|
122 |
if (number_month.getInteger() == null || number_month.getInteger() == 0){ |
|
123 |
partial = TimePeriod.setPartialField(partial, null, TimePeriod.MONTH_TYPE); |
|
124 |
} else{ |
|
125 |
partial = TimePeriod.setPartialField(partial, number_month.getInteger(), TimePeriod.MONTH_TYPE); |
|
126 |
} |
|
127 |
|
|
128 |
}else if(eventSource == number_day && number_day.getException()==null){ |
|
129 |
try{ |
|
130 |
if (number_day.getInteger() == null || number_day.getInteger() == 0){ |
|
131 |
partial = TimePeriod.setPartialField(partial, null, TimePeriod.DAY_TYPE); |
|
132 |
} else{ |
|
133 |
partial = TimePeriod.setPartialField(partial, number_day.getInteger(), TimePeriod.DAY_TYPE); |
|
134 |
} |
|
135 |
} |
|
136 |
catch (IndexOutOfBoundsException | IllegalFieldValueException e) { |
|
137 |
number_day.text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); |
|
138 |
} |
|
139 |
|
|
140 |
}else if(eventSource == number_year && number_year.getException()==null){ |
|
141 |
if (number_year.getInteger() == null || number_year.getInteger() == 0){ |
|
142 |
partial = TimePeriod.setPartialField(partial, null, TimePeriod.YEAR_TYPE); |
|
143 |
} else{ |
|
144 |
partial = TimePeriod.setPartialField(partial, number_year.getInteger(), TimePeriod.YEAR_TYPE); |
|
145 |
} |
|
146 |
|
|
147 |
} |
|
148 |
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null)); |
|
142 | 149 |
} |
143 | 150 |
|
144 | 151 |
/** {@inheritDoc} */ |
Also available in: Unified diff
ref #6466 Fixed special case for day number of february