When You click the save button bean value should be set. It is
important that Bean class domain variable name should be same as
ui:field name in Editor class.
I have given below a simple program.
Hope it helps.
S.Abraham
www.DataStoreGwt.com
------------------- sample program
--------------------------------------
<<Editor class>>
public class MyEditorWorkFlow extends Composite {
interface Binder extends UiBinder<Widget, MyEditorWorkFlow>{}
Binder binder = GWT.create(Binder.class);
interface Driver extends SimpleBeanEditorDriver<MyData,MyEditor>
{}
private Driver driver = GWT.create(Driver.class);
@UiField (provided = true)
MyEditor editor;
MyData myData_ = null;
public MyEditorWorkFlow(MyData myData)
{
this.myData_ = myData;
editor = new MyEditor(myData_);
initWidget(binder.createAndBindUi(this));
edit(myData_);
}
@UiHandler("save")
void onSave(ClickEvent event)
{
MyData myData = driver.flush();
Window.alert("Name=" + myData.getName() );
}
public void edit(MyData myData)
{
driver.initialize(editor);
driver.edit(myData);
}
}
<<Bean class>>
public class MyData implements Serializable
{
public String name;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
}
<<ui.xml>>
<!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">
<g:FlowPanel>
<g:TextBox ui:field="name"/>
</g:FlowPanel>
</ui:UiBinder>
On Aug 18, 4:27 am, "P.G.Taboada" <[email protected]> wrote:
> hi,
>
> Not sure what I am doing wrong.
>
> I did build a form with uibinder and I am populating a few TextBoxes
> with an editor:
>
> mydriver.initialize( this );
> mydriver.edit( somebean );
>
> ... User edits data ...
>
> changedBean = myeditor.flush();
>
> When I look at the changedBean, all empty string properties became
> null. Not what I or the database did expect.
>
> I am using gwt build from trunk.
>
> Brgds,
>
> Papick
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.