use of com.vaadin.flow.component.AbstractSinglePropertyField in project linkki by linkki-framework.
the class TestUiUtil method setUserOriginatedValue.
public static <T> void setUserOriginatedValue(AbstractSinglePropertyField<?, T> field, T value) {
try {
Field fieldSupportField = AbstractField.class.getDeclaredField("fieldSupport");
fieldSupportField.setAccessible(true);
AbstractFieldSupport<?, ?> fieldSupport = (AbstractFieldSupport<?, ?>) fieldSupportField.get(field);
Method valueSetter = AbstractFieldSupport.class.getDeclaredMethod("setValue", Object.class, boolean.class, boolean.class);
valueSetter.setAccessible(true);
valueSetter.invoke(fieldSupport, value, false, true);
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
throw new RuntimeException("Failed to set user-originated value", e.getCause());
}
}
Aggregations