You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2009/02/27 19:03:47 UTC

svn commit: r748620 - in /qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions: AddServer.java ReconnectServer.java

Author: robbie
Date: Fri Feb 27 18:03:47 2009
New Revision: 748620

URL: http://svn.apache.org/viewvc?rev=748620&view=rev
Log:
QPID-1590: make add server and reconnect dialogues centre within the app window to fix multimonitor issues

Modified:
    qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java
    qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java

Modified: qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java?rev=748620&r1=748619&r2=748620&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java (original)
+++ qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java Fri Feb 27 18:03:47 2009
@@ -103,6 +103,8 @@
      */
     private void createAddServerPopup()
     {
+        final Shell appShell = _window.getShell();
+
         Display display = Display.getCurrent();
         final Shell shell = new Shell(display, SWT.BORDER | SWT.CLOSE);
         shell.setText(ACTION_ADDSERVER);
@@ -112,9 +114,11 @@
         createWidgets(shell);
         shell.pack();
         
-        //get current size dialog, and screen size
-        int displayWidth = display.getBounds().width;
-        int displayHeight = display.getBounds().height;        
+        //get current size dialog, and application window size and location
+        int appWidth = appShell.getBounds().width;
+        int appHeight = appShell.getBounds().height;
+        int appLocX = appShell.getBounds().x;
+        int appLocY = appShell.getBounds().y;
         int currentShellWidth = shell.getSize().x;
         int currentShellHeight = shell.getSize().y;
         
@@ -125,8 +129,8 @@
         int newShellWidth =  currentShellWidth > minShellWidth ? currentShellWidth : minShellWidth;
         int newShellHeight = currentShellHeight > minShellHeight ? currentShellHeight : minShellHeight;
         
-        //set the final size and centre the dialog
-        shell.setBounds((displayWidth - newShellWidth)/2 , (displayHeight - newShellHeight)/2, newShellWidth, newShellHeight);
+        //set the final size and centre the dialog within the app window
+        shell.setBounds((appWidth - newShellWidth)/2  + appLocX, (appHeight - newShellHeight)/2 + appLocY, newShellWidth, newShellHeight);
         
         shell.open();
         _window.getShell().setEnabled(false);
@@ -228,7 +232,7 @@
                     if (event.character == SWT.ESC)
                     {
                       //Escape key acts as cancel on all widgets
-                        shell.close();
+                        shell.dispose();
                     }
                 }
             });
@@ -314,7 +318,7 @@
                     if (event.character == SWT.ESC)
                     {
                         //Escape key acts as cancel on all widgets
-                        shell.close();
+                        shell.dispose();
                     }
                 }
             });

Modified: qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java?rev=748620&r1=748619&r2=748620&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java (original)
+++ qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java Fri Feb 27 18:03:47 2009
@@ -99,6 +99,8 @@
     // Create the login popup fot th user to enter usernaem and password
     private void createLoginPopup()
     {
+        final Shell appShell = _window.getShell();
+
         Display display = Display.getCurrent();
         final Shell shell = new Shell(display, SWT.BORDER | SWT.CLOSE);
         shell.setText(_title);
@@ -108,9 +110,11 @@
         createWidgets(shell);        
         shell.pack();
         
-        //get current size dialog, and screen size
-        int displayWidth = display.getBounds().width;
-        int displayHeight = display.getBounds().height;        
+        //get current size dialog, and application window size and location
+        int appWidth = appShell.getBounds().width;
+        int appHeight = appShell.getBounds().height;
+        int appLocX = appShell.getBounds().x;
+        int appLocY = appShell.getBounds().y;
         int currentShellWidth = shell.getSize().x;
         int currentShellHeight = shell.getSize().y;
         
@@ -121,8 +125,8 @@
         int newShellWidth =  currentShellWidth > minShellWidth ? currentShellWidth : minShellWidth;
         int newShellHeight = currentShellHeight > minShellHeight ? currentShellHeight : minShellHeight;
         
-        //set the final size and centre the dialog
-        shell.setBounds((displayWidth - newShellWidth)/2 , (displayHeight - newShellHeight)/2, newShellWidth, newShellHeight);
+        //set the final size and centre the dialog within the app window
+        shell.setBounds((appWidth - newShellWidth)/2  + appLocX, (appHeight - newShellHeight)/2 + appLocY, newShellWidth, newShellHeight);
         
         shell.open();
         _window.getShell().setEnabled(false);
@@ -182,7 +186,7 @@
                     if (event.character == SWT.ESC)
                     {
                       //Escape key acts as cancel on all widgets
-                        shell.close();
+                        shell.dispose();
                     }
                 }
             });
@@ -248,7 +252,7 @@
                     if (event.character == SWT.ESC)
                     {
                         //Escape key acts as cancel on all widgets
-                        shell.close();
+                        shell.dispose();
                     }
                 }
             });



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org