你是对的...如果在验证期间(在 中execValidateValue(VALUE rawValue)
)按照 JavaDoc 的建议更改了值,则该值会正确存储在 Scout 模型中,但更改不会反映在 HTML-UI 中。
在 Samuel Renold 的帮助下,我向团队询问了这个问题:HTML-UI 将被修复以反映 UI 的变化。请参阅错误 493778。
演示小部件应用程序的测试代码。更改. DefaultField
_ListBoxForm
@Order(20)
public class DefaultField extends AbstractListBox<Color> {
@Override
protected Class<? extends ICodeType<?, Color>> getConfiguredCodeType() {
return ColorsCodeType.class;
}
@Override
protected Set<Color> execValidateValue(Set<Color> rawValue) {
System.out.println(">> execValidateValue");
printColors(rawValue);
if (rawValue != null && rawValue.contains(Color.RED)) {
return super.execValidateValue(Collections.singleton(Color.RED));
}
return super.execValidateValue(rawValue);
}
private void printColors(Set<Color> rawValue) {
if (rawValue != null) {
for (Color color : rawValue) {
System.out.print(color + ", ");
}
System.out.println("");
}
else {
System.out.println("null");
}
}
@Override
protected void execChangedValue() {
System.out.println(">> execValidateValue");
printColors(getValue());
}
@Override
protected int getConfiguredGridH() {
return 5;
}
@Override
protected String getConfiguredLabel() {
return TEXTS.get("Default");
}
}
错误行为也可以在 Scout 4 中重现(此版本已停产)