Hello Vojtech Szocs,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/12104

to review the following change.

Change subject: userportal: stop basic list provider on extended tab.
......................................................................

userportal: stop basic list provider on extended tab.

- Modified how listener is attached.
- Fix UserPortalConfigurator getSpiceFullScreen

Change-Id: I18e24cfcb5a477df3d3017b2f72409a37162ea64
Signed-off-by: Vojtech Szocs <[email protected]>
---
M 
frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/place/UserPortalPlaceManager.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/AbstractModelActivationPresenter.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/UserPortalConfigurator.java
3 files changed, 23 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/04/12104/1

diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/place/UserPortalPlaceManager.java
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/place/UserPortalPlaceManager.java
index f21562b..2f4f986 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/place/UserPortalPlaceManager.java
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/place/UserPortalPlaceManager.java
@@ -36,4 +36,9 @@
         return userRole.isBasicUser() ? defaultMainSectionRequest : 
defaultMainSectionExtendedRequest;
     }
 
+    public boolean isMainSectionBasicPlaceVisible() {
+        return defaultMainSectionRequest.getNameToken().equals(
+                getCurrentPlaceRequest().getNameToken());
+    }
+
 }
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/AbstractModelActivationPresenter.java
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/AbstractModelActivationPresenter.java
index d596062..38bbb30 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/AbstractModelActivationPresenter.java
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/AbstractModelActivationPresenter.java
@@ -2,11 +2,11 @@
 
 import org.ovirt.engine.ui.common.uicommon.model.SearchableModelProvider;
 import org.ovirt.engine.ui.uicommonweb.models.SearchableListModel;
-import 
org.ovirt.engine.ui.userportal.section.main.presenter.SearchableModelActivationEvent.SearchableModelActivationHandler;
 
 import com.google.gwt.event.shared.EventBus;
 import com.gwtplatform.mvp.client.Presenter;
 import com.gwtplatform.mvp.client.View;
+import com.gwtplatform.mvp.client.annotations.ProxyEvent;
 import com.gwtplatform.mvp.client.proxy.Proxy;
 
 /**
@@ -32,22 +32,20 @@
             final SearchableModelProvider<T, M> modelProvider) {
         super(eventBus, view, proxy);
         this.modelProvider = modelProvider;
+    }
 
-        // Add handler for list model activation requests
-        eventBus.addHandler(SearchableModelActivationEvent.getType(), new 
SearchableModelActivationHandler() {
-            @Override
-            public void 
onSearchableModelActivation(SearchableModelActivationEvent event) {
-                SearchableListModel currentModel = modelProvider.getModel();
+    @ProxyEvent
+    public void onSearchableModelActivation(SearchableModelActivationEvent 
event) {
+        SearchableListModel currentModel = modelProvider.getModel();
 
-                if (event.getListModel() == currentModel) {
-                    // Activate model
-                    currentModel.getSearchCommand().Execute();
-                } else {
-                    // Stop model
-                    currentModel.EnsureAsyncSearchStopped();
-                }
-            }
-        });
+        if (event.getListModel() == currentModel) {
+            // Activate model
+            currentModel.getSearchCommand().Execute();
+        } else {
+            // Stop model
+            currentModel.setItems(null);
+            currentModel.EnsureAsyncSearchStopped();
+        }
     }
 
     @Override
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/UserPortalConfigurator.java
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/UserPortalConfigurator.java
index 86ce7f1..ab6e546 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/UserPortalConfigurator.java
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/UserPortalConfigurator.java
@@ -18,11 +18,10 @@
 import org.ovirt.engine.ui.uicompat.EventArgs;
 import org.ovirt.engine.ui.uicompat.EventDefinition;
 import org.ovirt.engine.ui.uicompat.IEventListener;
-import 
org.ovirt.engine.ui.userportal.section.main.presenter.tab.MainTabBasicPresenter;
+import org.ovirt.engine.ui.userportal.place.UserPortalPlaceManager;
 
 import com.google.gwt.event.shared.EventBus;
 import com.google.inject.Inject;
-import com.google.inject.Provider;
 
 public class UserPortalConfigurator extends Configurator implements 
IEventListener, UiCommonInitHandler {
 
@@ -40,14 +39,14 @@
             new EventDefinition("usbFilterFileFetched", 
UserPortalConfigurator.class); //$NON-NLS-1$
     public Event usbFilterFileFetchedEvent = new 
Event(usbFilterFileFetchedEvent_Definition);
 
-    private final Provider<MainTabBasicPresenter> basicPresenter;
+    private final UserPortalPlaceManager placeManager;
 
     private static final ClientAgentType clientAgentType = new 
ClientAgentType();
 
     @Inject
-    public UserPortalConfigurator(Provider<MainTabBasicPresenter> 
basicPresenter, EventBus eventBus) {
+    public UserPortalConfigurator(UserPortalPlaceManager placeManager, 
EventBus eventBus) {
         super();
-        this.basicPresenter = basicPresenter;
+        this.placeManager = placeManager;
         eventBus.addHandler(UiCommonInitEvent.getType(), this);
 
         // This means that it is UserPortal application.
@@ -116,7 +115,7 @@
      */
     @Override
     public boolean getSpiceFullScreen() {
-        return basicPresenter.get().isVisible();
+        return placeManager.isMainSectionBasicPlaceVisible();
     }
 
     @Override


--
To view, visit http://gerrit.ovirt.org/12104
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I18e24cfcb5a477df3d3017b2f72409a37162ea64
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alexander Wels <[email protected]>
Gerrit-Reviewer: Vojtech Szocs <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to