Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 1 month ago
OptionGroup - setPropertyDataSource -com.vaadin.data.util.converter.Convert
Hi ,
When a radio button is selected , i get the following error. The values for the Radio button are 01,02 and description can be abc , def.
When the dependent componets are not listning on the radio button , and we click on button the values are bound correctly.
Apr 21, 2016 1:00:04 PM com.vaadin.server.DefaultErrorHandler doDefault
SEVERE:
com.vaadin.data.util.converter.Converter$ConversionException: Unable to convert value of type java.lang.String to presentation type class java.lang.Boolean. No converter is set and the types are not compatible.
at com.vaadin.data.util.converter.ConverterUtil.convertFromModel(ConverterUtil.java:116)
at com.vaadin.ui.AbstractField.convertFromModel(AbstractField.java:736)
at com.vaadin.ui.AbstractField.convertFromModel(AbstractField.java:721)
at com.vaadin.ui.AbstractField.readValueFromProperty(AbstractField.java:1315)
at com.vaadin.ui.AbstractField.valueChange(AbstractField.java:1308)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:508)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:198)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:161)
at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1008)
at com.vaadin.ui.AbstractField.fireValueChange(AbstractField.java:1159)
at com.vaadin.ui.AbstractField.setValue(AbstractField.java:570)
at com.vaadin.ui.AbstractSelect.setValue(AbstractSelect.java:732)
at com.vaadin.ui.AbstractField.setValue(AbstractField.java:468)
at com.vaadin.ui.OptionGroup.setValue(OptionGroup.java:193)
at com.vaadin.ui.AbstractSelect.changeVariables(AbstractSelect.java:541)
at com.vaadin.ui.OptionGroup.changeVariables(OptionGroup.java:86)
public class QuestionnaireRadioGroup extends OptionGroup implements BaseUIComponent {
private com.lean.lpres.widget.questionnaire.QuestionnaireListBox widgetModel;
private IndexedValueCollection valColl;
public QuestionnaireRadioGroup(QuestionnaireWidgetModel box) {
this.widgetModel = (com.lean.lpres.widget.questionnaire.QuestionnaireRadioGroup) box;
}
@Override
public List<Component> getWidget(Object... str) {
valColl = (IndexedValueCollection) str[0];
List<Component> searchList = new ArrayList<Component>();
//setId(widgetModel.getId());
try {
List<QuestionnaireListBoxEntry> dataList = widgetModel.getChildList();
for (QuestionnaireListBoxEntry next : dataList ) {
addItem(next.getCode());
setItemCaption(next.getCode(), next.getDisplayText());
}
} catch (Exception ignore) {
}
setImmediate(true);
setNullSelectionAllowed(false);
refreshFromModel();
setRequiredError("MSG_VALUE_REQUIRED");
addValueChangeListener(event -> refreshFromModel());
IndexedValueCollectionProperty newDataSource = new IndexedValueCollectionProperty(valColl, widgetModel.getIExprValue());
setPropertyDataSource(newDataSource);
searchList.add(this);
return searchList;
}
@Override
public void refreshFromModel() {
// logger.logDebug("refershFromModel");
setCaption(valColl.getString(widgetModel.getIExprLabel()));
setRequired(valColl.getBoolean(widgetModel.getIExprRequired()));
setVisible(valColl.getBoolean(widgetModel.getIExprApplicable()));
}
}
public class IndexedValueCollectionProperty extends AbstractProperty<Object> {
private IndexedValueCollection valColl;
private int position = -1;
public IndexedValueCollectionProperty(IndexedValueCollection valColl, int position) {
super();
this.valColl = valColl;
this.position = position;
}
@Override
public Object getValue() {
if (valColl == null) {
return null;
}
// logger.logDebug("getValue valColl.getValue(" + position + ") " + valColl.getValue(position));
return valColl.getObject(position);
}
@Override
public void setValue(Object newValue) throws ReadOnlyException {
if (valColl == null) {
return;
}
valColl.getNode(position).set(newValue);
fireValueChange();
}
@Override
public Class<? extends Object> getType() {
return Object.class;
}
}
Last updated on
You cannot reply to this thread.