tabular-data-mainbox-widget/src/main/java/org/gcube/portlets/user/td/mainboxwidget/client/MainBoxEntry.java

59 lines
1.5 KiB
Java

package org.gcube.portlets.user.td.mainboxwidget.client;
import org.gcube.portlets.user.td.mainboxwidget.client.rpc.TabularDataServiceAsync;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.UIStateEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.UIStateType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.SimpleEventBus;
public class MainBoxEntry implements EntryPoint {
public void onModuleLoad() {
TabularDataServiceAsync.INSTANCE.hello(new AsyncCallback<String>() {
@Override
public void onSuccess(String result) {
loadDataView();
}
@Override
public void onFailure(Throwable caught) {
caught.printStackTrace();
}
});
}
protected void loadDataView() {
// For example Tabular Resource 7 and table 402
TRId trId = new TRId("220", "3555");
EventBus eventBus = new SimpleEventBus();
try {
MainBoxPanel mainBoxPanel = new MainBoxPanel("MainBoxPanel",
eventBus);
RootPanel.get().add(mainBoxPanel);
UIStateEvent uiStateEvent = new UIStateEvent(UIStateType.TR_OPEN);
uiStateEvent.setTrId(trId);
eventBus.fireEvent(uiStateEvent);
Log.info("MainBoxPanel Added:" + mainBoxPanel);
} catch (Throwable e) {
e.printStackTrace();
}
}
}