Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GWT编辑器框架-未发布嵌套实体的约束冲突_Gwt_Editor - Fatal编程技术网

GWT编辑器框架-未发布嵌套实体的约束冲突

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

我对gwt的编辑器框架有问题。 执行editorDriver.SetConstraintViolationErrors时,不会将错误发布到使用嵌套实体的字段

首先,我有一个用户实体:

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容器中为空

现在我真的找不到有这个问题的其他人了,所以我猜问题出在我这边,可能是因为我的编辑器实现了editor,而联系人是ContactProxy

其他一切似乎都正常

希望它的代码足够多,否则我会发布更多


Thx

我怀疑问题在于,onConstraintViolation没有为general context.fire调用,而是仅为保存项目的请求调用。将onConstrainViolation覆盖移动到接收者,当您在上下文中发出请求时,可能需要添加该接收者。

错误列表是否包含contact.title.的错误。。如果是这样,您可以将断点放在ValidationWidgetDecorator中以查看如何将其视为错误吗?