我试图与GWT 2.1.0的新GWT编辑器框架集成。我也想将我的验证检查添加到框架中。然而,我正在努力寻找一个体面的例子如何做到这一点。如何使用GWT编辑器框架进行验证?
目前我有以下代码:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:e="urn:import:com.google.gwt.editor.ui.client">
<ui:with type="be.credoc.iov.webapp.client.MessageConstants"
field="msg" />
<g:HTMLPanel>
<e:ValueBoxEditorDecorator ui:field="personalReference">
<e:valuebox>
<g:TextBox />
</e:valuebox>
</e:ValueBoxEditorDecorator>
</g:HTMLPanel>
</ui:UiBinder>
而对于我的编辑:
public class GarageEditor extends Composite implements Editor<Garage> {
@UiField
ValueBoxEditorDecorator<String> personalReference;
interface GarageEditorUiBinder extends UiBinder<Widget, GarageEditor> {
}
private static GarageEditorUiBinder uiBinder = GWT.create(GarageEditorUiBinder.class);
public GarageEditor() {
initWidget(uiBinder.createAndBindUi(this));
}
}
在哪一点我有打电话给我验证,我如何与它进行集成?
更新:
我实际上是寻找一种方法来检索与关键属性路径地图,和值编辑器。代理上有一个路径字段,但这不是编辑对象中的路径,而是编辑器类中的路径。
有谁知道是否有可能做这样的事情?
太糟糕了,这还没有绑定到编辑框架,以提供验证消息旁边的输入字段。 – Jan 2011-03-30 12:48:39
从gwt-2.4.0-rc1开始已经尝试:请参阅com.google.gwt.editor.client.impl.BaseEditorDriver.setConstraintViolations(...) 尽管由于奇怪的泛型而无法在客户端使用在方法参数中。 – 2011-08-20 10:10:16