package org.jboss.as.console.client.rbac;

import com.google.gwt.user.client.History;
import com.google.web.bindery.event.shared.EventBus;
import com.gwtplatform.mvp.client.PopupView;
import com.gwtplatform.mvp.client.PresenterWidget;
import com.gwtplatform.mvp.client.proxy.PlaceRequest;
import org.jboss.ballroom.client.layout.LHSHighlightEvent;
import org.jboss.ballroom.client.rbac.AuthorisationDecision;

import javax.inject.Inject;

/**
 * @author Heiko Braun
 * @date 7/24/13
 */
public class UnauthorisedPresenter extends PresenterWidget<UnauthorisedPresenter.MyView>
    implements AuthDecisionEvent.AuthDecisionHandler {


    /**
     * {@link UnauthorisedPresenter}'s view.
     */
    public interface MyView extends PopupView {
        void setPresenter(UnauthorisedPresenter unauthorisedPresenter);

        void setLastDecision(AuthorisationDecision decision);
    }

    @Inject
    public UnauthorisedPresenter(EventBus eventBus, MyView view) {
        super(eventBus, view);
        view.setPresenter(this);
        eventBus.addHandler(AuthDecisionEvent.TYPE, this);
    }

    public void onConfirmation() {
        History.back();
    }

    @Override
    public void onAuthDescision(AuthDecisionEvent event) {
        getView().setLastDecision(event.getDecision());
    }
}

@@ -40,51 +40,8 @@
 c;%0A%0A
-import com.google.gwt.user.client.History;%0A
 impo
@@ -89,16 +89,16 @@
 entBus;%0A
+
 import c
@@ -196,112 +196,43 @@
 ort 
-com.gwtplatform.mvp.client.proxy.PlaceRequest;%0Aimport org.jboss.ballroom.client.layout.LHSHighlightEvent
+org.jboss.as.console.client.Console
 ;%0Aim
@@ -457,16 +457,20 @@
 MyView%3E%0A
+    
     impl
@@ -1025,20 +1025,60 @@
     
-History.back
+Console.MODULES.getPlaceManager().revealDefaultPlace
 ();%0A

Disable History.back() upon auth errors