|
29 | 29 |
|
30 | 30 | package org.scijava.widget; |
31 | 31 |
|
32 | | -import java.util.Arrays; |
33 | 32 | import java.util.List; |
34 | 33 | import java.util.Map; |
35 | 34 | import java.util.Objects; |
@@ -156,6 +155,7 @@ public void setValue(final Object value) { |
156 | 155 |
|
157 | 156 | // Pass the value through the convertService |
158 | 157 | convertedInput = convertService.convert(value, item.getType()); |
| 158 | + if (convertedInput == null) convertedInput = value; |
159 | 159 |
|
160 | 160 | // If we get a different (converted) value back, cache it weakly. |
161 | 161 | if (convertedInput != value) { |
@@ -218,17 +218,6 @@ public Number getStepSize() { |
218 | 218 | return NumberUtils.toNumber("1", item.getType()); |
219 | 219 | } |
220 | 220 |
|
221 | | - @Override |
222 | | - public String[] getChoices() { |
223 | | - final List<?> choicesList = item.getChoices(); |
224 | | - if (choicesList == null) return null; |
225 | | - final String[] choices = new String[choicesList.size()]; |
226 | | - for (int i = 0; i < choices.length; i++) { |
227 | | - choices[i] = objectService.getName(choicesList.get(i)); |
228 | | - } |
229 | | - return choices; |
230 | | - } |
231 | | - |
232 | 221 | @Override |
233 | 222 | public String getText() { |
234 | 223 | final Object value = getValue(); |
@@ -289,11 +278,10 @@ public boolean isInitialized() { |
289 | 278 | /** |
290 | 279 | * For multiple choice widgets, ensures the value is a valid choice. |
291 | 280 | * |
292 | | - * @see #getChoices() |
293 | 281 | * @see ChoiceWidget |
294 | 282 | */ |
295 | 283 | private Object ensureValidChoice(final Object value) { |
296 | | - return ensureValid(value, Arrays.asList(getChoices())); |
| 284 | + return ensureValid(value, getItem().getChoices()); |
297 | 285 | } |
298 | 286 |
|
299 | 287 | /** |
|
0 commit comments