GWT编辑器框架-未发布嵌套实体的约束冲突
我对gwt的编辑器框架有问题。 执行editorDriver.SetConstraintViolationErrors时,不会将错误发布到使用嵌套实体的字段 首先,我有一个用户实体:GWT编辑器框架-未发布嵌套实体的约束冲突,gwt,editor,Gwt,Editor,我对gwt的编辑器框架有问题。 执行editorDriver.SetConstraintViolationErrors时,不会将错误发布到使用嵌套实体的字段 首先,我有一个用户实体: public class User extends BaseEntity { @OneToOne @JoinColumn(nullable = false) private Contact contact; @NotNull(message = "username must not be null") @Col
public class User extends BaseEntity {
@OneToOne
@JoinColumn(nullable = false)
private Contact contact;
@NotNull(message = "username must not be null")
@Column(nullable = false)
private String username;
....
现在在我的编辑器中,我有如下字段
@UiField
ValidationWidgetDecorator<String> username;
@Path("contact.title")
@UiField
ValidationWidgetDecorator<String> title;
ValidationWidgetDecorator类与ValueBoxEditorDecorator类几乎相同
现在如果我做什么
RequestContext context = editorDriver.flush();
context.fire(new Receiver<Void>() {
@Override
public void onConstraintViolation(Set<ConstraintViolation<?>> errors) {
editorDriver.setConstraintViolations(errors);
}
...
将显示UserProxyExample违反username的约束错误,并且一切正常,但是如果违反发生在contact中,例如在contact.title字段中,则错误不会发布在showErrorsList errors中的view errors容器中为空
现在我真的找不到有这个问题的其他人了,所以我猜问题出在我这边,可能是因为我的编辑器实现了editorThx我怀疑问题在于,onConstraintViolation没有为general context.fire调用,而是仅为保存项目的请求调用。将onConstrainViolation覆盖移动到接收者,当您在上下文中发出请求时,可能需要添加该接收者。错误列表是否包含contact.title.的错误。。如果是这样,您可以将断点放在ValidationWidgetDecorator中以查看如何将其视为错误吗?