Gilad Chaplik has uploaded a new change for review.

Change subject: webadmin: reset mouse cursor for resizable dialog
......................................................................

webadmin: reset mouse cursor for resizable dialog

Mouse-cursor stuck on resize-image after closing
a dialog while re-sizing it.

The fix ensures that when closing the dialog the cursor
resets back to default.

Change-Id: Ib7f8168690eabf7a3c29e412978122e4e90fc6fe
Bug-Url: https://bugzilla.redhat.com/894076
Signed-off-by: Gilad Chaplik <gchap...@redhat.com>
---
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/dialog/ResizableDialogBox.java
1 file changed, 18 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/56/22956/1

diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/dialog/ResizableDialogBox.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/dialog/ResizableDialogBox.java
index fcc6dad..b8bcec8 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/dialog/ResizableDialogBox.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/dialog/ResizableDialogBox.java
@@ -2,6 +2,8 @@
 
 import com.google.gwt.dom.client.Element;
 import com.google.gwt.dom.client.NodeList;
+import com.google.gwt.dom.client.Style;
+import com.google.gwt.dom.client.Style.Cursor;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Event;
 import com.google.gwt.user.client.ui.DialogBox;
@@ -17,6 +19,7 @@
     private static int EDGE_SIZE = 3;
     private static int EDGE_THRESHOLD = 10;
 
+    private Style parentElementStyle;
     private static String STYLE_RESIZE_POSTFIX = "resize"; //$NON-NLS-1$
 
     public ResizableDialogBox() {
@@ -146,7 +149,10 @@
         String cursor = bottomEdge && rightEdge ? "se-resize" : //$NON-NLS-1$
                 rightEdge ? "e-resize" : bottomEdge ? "n-resize" : "default"; 
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 
-        getElement().getParentElement().getStyle().setProperty("cursor", 
cursor); //$NON-NLS-1$
+        if (parentElementStyle == null) {
+            parentElementStyle = getElement().getParentElement().getStyle();
+        }
+        parentElementStyle.setProperty("cursor", cursor); //$NON-NLS-1$
 
         return rightEdge || bottomEdge;
     }
@@ -163,4 +169,15 @@
 
         return null;
     }
+
+    @Override
+    public void hide() {
+        super.hide();
+        // reset mouse cursor to default, when the dialog closes
+        if (resizeSupportEnabled
+                && parentElementStyle != null
+                && 
!Cursor.DEFAULT.getCssName().equals(parentElementStyle.getCursor())) {
+            parentElementStyle.setCursor(Cursor.DEFAULT);
+        }
+    }
 }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib7f8168690eabf7a3c29e412978122e4e90fc6fe
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Gilad Chaplik <gchap...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to