Hi!
I give you an example:
public class MyPanel extends Composite implements Editor<Invoice> {
static MyPanelDriver myPanelDriver =
GWT.create(MyPanelDriver .class);
interface MyPanelDriver extends
SimpleBeanEditorDriver<Invoice, MyPanel > {}
@UiField // if you use declarative layout
MyCellTable myCellTable;
@Path("invoiceItems")
HasDataEditor<InvoiceItem> editor;
private final ListDataProvider<InvoiceItem>
chosenItemsDataProvider = new ListDataProvider<InvoiceItem>();
public MyPanel() {
myCellTable = new
CellTable<InvoiceItem>(invoiceItemsDataProvider); // see
http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTable
// initialize celltable
chosenItemsDataProvider.addDataDisplay(myCellTable);
editor = HasDataEditor.of(myCellTable); // adapt
invoiceItems-List to myCellTable
myPanelDriver.initialize(this); // initialize editor
framework
initWidget(uiBinder.createAndBindUi(this)); // if you
use declarative layout
}
public void edit(Invoice invoice) {
myPanelDriver.edit(invoice); // binding!
chosenItemsDataProvider.setList(editor.getList()); //
don't know whether this can be done better... only needed for editing!
}
// retrieve edited invoice, if you need this
public void save() {
Invoice invoice = myPanelDriver.flush();
//do something with invoice -> e.g. save to DB
}
}
If you just want to display data in celltable, that' it! Hope this
helps
--
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.