| Date |
Title |
Author |
| 1/23/1994 |
Design Patterns |
Erich Gamma |
| 5/19/2008 |
JavaScript: The good parts |
Douglas Crockford |
| 7/21/2009 |
Learning the Yahoo! User Interface Library |
Dan Wellman |
@MainPanel(name="index")
public class DemoPanel {
@Services(implementation=TimeServiceImpl.class, iface=TimeService.class)
protected static TimeServiceProxy service;
public DemoPanel () {
TextboxCellEditor editor = TextboxCellEditor.create(null);
Column.Conf[] myColumnDefs = new Column.Conf[] {
Column.Conf.newKey("DATE").setLabel("Date").setSortable(true).setResizeable(true),
Column.Conf.newKey("TITLE").setLabel("Book title").setSortable(true).setResizeable(true).setEditor(editor),
Column.Conf.newKey("AUTHOR").setLabel("Author(s)").setSortable(true).setResizeable(true)
};
DataSourceBase myDataSource = DataSource.createDataSource(Dom.get("book_table"), null);
myDataSource.setResponseType(DataSourceBase.TYPE_HTMLTABLE());
myDataSource.setResponseSchema(ResponseSchema.Conf.newFields(new ResponseField.Conf[] {
ResponseField.Conf.newKey("DATE"),
ResponseField.Conf.newKey("TITLE"),
ResponseField.Conf.newKey("AUTHOR")
}));
DataTable myDataTable = DataTable.create("book_div",
myColumnDefs,
myDataSource,
DataTable.Conf.newCaption("Enhance existing table").setDraggableColumns(true));
myDataTable.addCellClickEventListener(myDataTable.fn_onEventShowCellEditor());
// make a synchronous call to the server when the button is clicked
final Button syncButton = Button.create("syncButton");
syncButton.addClickListener(new Listener() {
public void perform () {
syncButton.setConfLabel("Sync: " + service.getTime());
}
});
// create a HTML button dynamically:
final DomUtil domUtil = Page.getInstance().getDomUtil();
HTMLButtonElement htmlButton = domUtil.createButton("asyncButton");
htmlButton.appendChild(domUtil.createText("Asynchronous Call"));
domUtil.getDivById("buttons").appendChild(htmlButton);
// make an asynchronous call to the server when the button is clicked
final Button asyncButton = Button.create("asyncButton");
asyncButton.addClickListener(new Listener() {
public void perform () {
service.getTime(new InvocationCallback<String>() {
@Override
public void onResult(String value) {
asyncButton.setConfLabel("Async: " + value);
}
});
}
});
}
}