1 package org.glom.web.client;
3 import com.google.gwt.core.client.EntryPoint;
4 import com.google.gwt.core.client.GWT;
5 import com.google.gwt.user.client.rpc.AsyncCallback;
6 import com.google.gwt.user.client.ui.FlexTable;
7 import com.google.gwt.user.client.ui.RootPanel;
8 import com.google.gwt.user.client.ui.VerticalPanel;
11 * Entry point classes define <code>onModuleLoad()</code>.
13 public class OnlineGlom implements EntryPoint {
15 private VerticalPanel mainPanel = new VerticalPanel();
16 private FlexTable tablesFlexTable = new FlexTable();
17 private TableNameServiceAsync tableNameSvc = GWT
18 .create(TableNameService.class);
20 public void onModuleLoad() {
21 // create table to hold the table names
22 tablesFlexTable.setText(0, 0, "Tables");
25 tablesFlexTable.setCellPadding(6);
26 tablesFlexTable.getRowFormatter().addStyleName(0, "tablesHeader");
28 mainPanel.add(tablesFlexTable);
30 // associate the main panel with the HTML host page
31 RootPanel.get("tableList").add(mainPanel);
33 // initialize the service proxy.
34 if (tableNameSvc == null) {
35 tableNameSvc = GWT.create(TableNameService.class);
38 // set up the callback object.
39 AsyncCallback<GlomTable[]> callback = new AsyncCallback<GlomTable[]>() {
40 public void onFailure(Throwable caught) {
41 // FIXME: need to deal with failure
42 System.out.println("AsyncCallback Failed: TableNameService");
45 public void onSuccess(GlomTable[] result) {
46 for (int i = 0; i < result.length; i++) {
47 tablesFlexTable.setText(i + 1, 0, result[i].getName());
53 // make the call to get the names
54 tableNameSvc.getNames(callback);