gcube-ckan-datacatalog/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GCubeCkanDataCatalog.java

60 lines
1.8 KiB
Java

package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.NotifyLogoutEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view.GCubeCkanDataCatalogPanel;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.Window.ClosingEvent;
import com.google.gwt.user.client.ui.RootPanel;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class GCubeCkanDataCatalog implements EntryPoint {
/**
* Create a remote service proxy to talk to the server-side Greeting
* service.
*/
public static final GcubeCkanDataCatalogServiceAsync service = GWT.create(GcubeCkanDataCatalogService.class);
private final String DIV_PORTLET_ID = "gCubeCkanDataCatalog";
private CkanEventHandlerManager eventManager = new CkanEventHandlerManager();
public static final String GET_PATH_PARAMETER = "path";
public static final String GET_QUERY_PARAMETER = "query";
/**
* This is the entry point method.
*/
public void onModuleLoad() {
// if (BrowserCloseDetector.get().wasClosed()) {
// GWT.log("Browser was closed.");
// }
// else {
// GWT.log("Refreshing or returning from another page.");
// }
// Window.addCloseHandler(new CloseHandler<Window>() {
//
// public void onClose(CloseEvent<Window> windowCloseEvent) {
//
// Window.alert("I'm closing");
// }
// });
Window.addWindowClosingHandler(new Window.ClosingHandler() {
@Override
public void onWindowClosing(ClosingEvent closingEvent) {
eventManager.getEventBus().fireEvent(new NotifyLogoutEvent());
}
});
GCubeCkanDataCatalogPanel panel = new GCubeCkanDataCatalogPanel(RootPanel.get(DIV_PORTLET_ID), eventManager.getEventBus());
eventManager.setPanel(panel);
}
}