Lior Vernia has uploaded a new change for review.

Change subject: webadmin: Remove vNIC items changed listener before flush
......................................................................

webadmin: Remove vNIC items changed listener before flush

Upon flushing the AddRemoveRowWidget, it sets the backing ListModel's
items according to the entries in the widget. However, in the add/edit
VM dialog, since it is listening on the items changed event, this
re-initializes the widget just before it closes, thus adding a new
vNIC row. This patch removes the listener prior to flushing the
widget, in order to avoid that flicker.

Change-Id: I5f153a3b19e467d41131015c7e2819c3ce365c22
Bug-Url: https://bugzilla.redhat.com/1020755
Signed-off-by: Lior Vernia <[email protected]>
---
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java
1 file changed, 11 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/98/20398/1

diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java
index d0bde94..fde6d71 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java
@@ -183,6 +183,8 @@
     @WithElementId("vnicsEditor")
     public ProfilesInstanceTypeEditor profilesInstanceTypeEditor;
 
+    private IEventListener vnicsChangedListener;
+
     @UiField
     @Ignore
     Label generalWarningMessage;
@@ -1168,14 +1170,15 @@
         });
 
         profilesInstanceTypeEditor.edit(object.getNicsWithLogicalNetworks(), 
object.getVnicProfiles().getItems());
-        
object.getNicsWithLogicalNetworks().getItemsChangedEvent().addListener(new 
IEventListener() {
+        vnicsChangedListener = new IEventListener() {
 
             @Override
             public void eventRaised(Event ev, Object sender, EventArgs args) {
                 
profilesInstanceTypeEditor.edit(object.getNicsWithLogicalNetworks(), 
object.getVnicProfiles()
                         .getItems());
             }
-        });
+        };
+        
object.getNicsWithLogicalNetworks().getItemsChangedEvent().addListener(vnicsChangedListener);
     }
 
     /**
@@ -1333,9 +1336,13 @@
 
     @Override
     public UnitVmModel flush() {
-        priorityEditor.flush();
+        UnitVmModel model = driver.flush();
+
+        
model.getNicsWithLogicalNetworks().getItemsChangedEvent().removeListener(vnicsChangedListener);
         profilesInstanceTypeEditor.flush();
-        return driver.flush();
+
+        priorityEditor.flush();
+        return model;
     }
 
     @Override


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f153a3b19e467d41131015c7e2819c3ce365c22
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Lior Vernia <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to