@Test public void testCommaSeparatedValuesWithBracketsAndOneMultiValue() { final DropDownData downData = mock(DropDownData.class); doReturn(new String[]{"a", "\"b, c\"", "d"}).when(downData).getFixedList(); final ListBox listBox = mock(ListBox.class); new EnumDropDownUtilities().setDropDownData(" ( \"\"b, c\"\" )", downData, true, mock(Path.class), listBox); verify(listBox).clear(); verify(listBox).addItem("a"); verify(listBox).addItem("\"b, c\""); verify(listBox).addItem("d"); verify(listBox, never()).setItemSelected(0, true); verify(listBox).setItemSelected(1, true); verify(listBox, never()).setItemSelected(2, true); }
public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } }
EnumDropDownUtilities { public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } } }
EnumDropDownUtilities { public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } }  }
EnumDropDownUtilities { public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } }  void setDropDownData(final String value,
                                final DropDownData dropData,
                                final boolean isMultipleSelect,
                                final Path resource,
                                final ListBox listBox); }
EnumDropDownUtilities { public void setDropDownData(final String value, final DropDownData dropData, final boolean isMultipleSelect, final Path resource, final ListBox listBox) { if (dropData != null && dropData.getFixedList() == null && dropData.getQueryExpression() != null) { Scheduler.get().scheduleDeferred(new Command() { public void execute() { BusyPopup.showMessage(CommonConstants.INSTANCE.RefreshingList()); MessageBuilder.createCall(new RemoteCallback<String[]>() { public void callback(String[] response) { BusyPopup.close(); if (response.length == 0) { response = new String[]{CommonConstants.INSTANCE.UnableToLoadList()}; } fillDropDown(value, response, isMultipleSelect, listBox); } }, new BusErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { BusyPopup.close(); return false; } }, EnumDropdownService.class ).loadDropDownExpression(resource, dropData.getValuePairs(), dropData.getQueryExpression()); } }); } else { fillDropDown(value, dropData, isMultipleSelect, listBox); } }  void setDropDownData(final String value,
                                final DropDownData dropData,
                                final boolean isMultipleSelect,
                                final Path resource,
                                final ListBox listBox);  }