103 lines
3.1 KiB
Java
103 lines
3.1 KiB
Java
package org.gcube.portlets.user.dataminermanagertester.client.application;
|
|
|
|
import org.gcube.portlets.user.dataminermanagertester.client.application.menu.MenuPresenter;
|
|
import org.gcube.portlets.user.dataminermanagertester.client.rpc.DataMinerTesterServiceAsync;
|
|
***REMOVED***
|
|
import org.gcube.portlets.user.dataminermanagertester.shared.session.UserInfo;
|
|
|
|
import com.google.gwt.core.shared.GWT;
|
|
import com.google.gwt.user.client.Window;
|
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
import com.google.inject.Inject;
|
|
import com.google.web.bindery.event.shared.EventBus;
|
|
import com.gwtplatform.mvp.client.Presenter;
|
|
import com.gwtplatform.mvp.client.View;
|
|
import com.gwtplatform.mvp.client.annotations.ProxyStandard;
|
|
import com.gwtplatform.mvp.client.presenter.slots.NestedSlot;
|
|
import com.gwtplatform.mvp.client.presenter.slots.PermanentSlot;
|
|
import com.gwtplatform.mvp.client.proxy.NavigationEvent;
|
|
import com.gwtplatform.mvp.client.proxy.NavigationHandler;
|
|
import com.gwtplatform.mvp.client.proxy.Proxy;
|
|
|
|
import gwt.material.design.client.ui.MaterialLoader;
|
|
|
|
/**
|
|
*
|
|
* @author Giancarlo Panichi
|
|
*
|
|
*/
|
|
public class ApplicationPresenter
|
|
extends Presenter<ApplicationPresenter.PresenterView, ApplicationPresenter.PresenterProxy>
|
|
implements NavigationHandler {
|
|
interface PresenterView extends View {
|
|
***REMOVED***
|
|
|
|
@ProxyStandard
|
|
interface PresenterProxy extends Proxy<ApplicationPresenter> {
|
|
***REMOVED***
|
|
|
|
public static final PermanentSlot<MenuPresenter> SLOT_MENU = new PermanentSlot<>();
|
|
public static final NestedSlot SLOT_MAIN = new NestedSlot();
|
|
|
|
private MenuPresenter menuPresenter;
|
|
private DataMinerTesterServiceAsync service;
|
|
|
|
@Inject
|
|
ApplicationPresenter(EventBus eventBus, PresenterView view, PresenterProxy proxy, MenuPresenter menuPresenter,
|
|
DataMinerTesterServiceAsync service) {
|
|
super(eventBus, view, proxy, RevealType.Root);
|
|
this.menuPresenter = menuPresenter;
|
|
this.service = service;
|
|
callHello();
|
|
***REMOVED***
|
|
|
|
@Override
|
|
protected void onBind() {
|
|
super.onBind();
|
|
|
|
setInSlot(SLOT_MENU, menuPresenter);
|
|
addRegisteredHandler(NavigationEvent.getType(), this);
|
|
|
|
***REMOVED***
|
|
|
|
@Override
|
|
protected void onReveal() {
|
|
super.onReveal();
|
|
***REMOVED***
|
|
|
|
@Override
|
|
public void onNavigation(NavigationEvent navigationEvent) {
|
|
Window.scrollTo(0, 0);
|
|
// PlaceRequest placeRequest=navigationEvent.getRequest();
|
|
// placeManager.revealPlace(placeRequest);
|
|
|
|
***REMOVED***
|
|
|
|
private void callHello() {
|
|
/* String groupId= GCubeClientContext.getCurrentContextId(); */
|
|
|
|
String token = Window.Location.getParameter(Constants.TOKEN);
|
|
GWT.log("Token: " + token);
|
|
|
|
MaterialLoader.loading(true);
|
|
service.hello(token,new AsyncCallback<UserInfo>() {
|
|
|
|
@Override
|
|
public void onFailure(Throwable caught) {
|
|
MaterialLoader.loading(false);
|
|
GWT.log("Error in Hello: ", caught);
|
|
|
|
***REMOVED***
|
|
|
|
@Override
|
|
public void onSuccess(UserInfo result) {
|
|
GWT.log("Hello: " + result.getUsername());
|
|
MaterialLoader.loading(false);
|
|
***REMOVED***
|
|
|
|
***REMOVED***);
|
|
|
|
***REMOVED***
|
|
|
|
***REMOVED***
|