Revision: 6351
http://squirrel-sql.svn.sourceforge.net/squirrel-sql/?rev=6351&view=rev
Author: gerdwagner
Date: 2011-08-09 18:44:59 +0000 (Tue, 09 Aug 2011)
Log Message:
-----------
Made several dialogs open above the right window when detached frames are use (e.g. Graph frames can be detached)
Modified Paths:
--------------
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/DesktopContainerFactory.java
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/DialogDelegate.java
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/DialogWidget.java
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/mainpanel/overview/OverviewFrame.java
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/mainpanel/overview/OverwiewCtrl.java
trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/datasetviewer/CellDataPopup.java
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/DesktopContainerFactory.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/DesktopContainerFactory.java 2011-08-09 18:41:59 UTC (rev 6350)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/DesktopContainerFactory.java 2011-08-09 18:44:59 UTC (rev 6351)
@@ -4,6 +4,8 @@
import net.sourceforge.squirrel_sql.client.gui.desktopcontainer.ScrollableDesktopPane;
import net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.DockTabDesktopPane;
+import java.awt.*;
+
public class DesktopContainerFactory
{
public static IDesktopContainer createDesktopContainer(IApplication app)
@@ -19,11 +21,11 @@
}
- public static IDialogDelegate createDialogDelegate(IApplication app, String title, boolean resizeable, boolean closeable, boolean maximizeable, boolean iconifiable, DialogWidget dialogClient)
+ public static IDialogDelegate createDialogDelegate(IApplication app, Window parent, String title, boolean resizeable, boolean closeable, boolean maximizeable, boolean iconifiable, DialogWidget dialogClient)
{
if(app.getDesktopStyle().isDockTabStyle())
{
- return new DialogDelegate(title, resizeable, closeable, maximizeable, iconifiable, dialogClient, app.getMainFrame());
+ return new DialogDelegate(title, resizeable, closeable, maximizeable, iconifiable, dialogClient, parent);
}
else
{
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/DialogDelegate.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/DialogDelegate.java 2011-08-09 18:41:59 UTC (rev 6350)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/DialogDelegate.java 2011-08-09 18:44:59 UTC (rev 6351)
@@ -24,9 +24,10 @@
private boolean _isToolWindow;
- public DialogDelegate(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable, IWidget widget, MainFrame mainFrame)
+ public DialogDelegate(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable, IWidget widget, Window parent)
{
- super(mainFrame, title, false);
+ super(parent, title);
+
setResizable(resizable);
_widget = widget;
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/DialogWidget.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/DialogWidget.java 2011-08-09 18:41:59 UTC (rev 6350)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/DialogWidget.java 2011-08-09 18:44:59 UTC (rev 6351)
@@ -13,14 +13,21 @@
public DialogWidget(String title, boolean resizeable, boolean closeable, boolean maximizeable, boolean iconifiable, IApplication app)
{
- _delegate = DesktopContainerFactory.createDialogDelegate(app, title, resizeable, closeable, maximizeable, iconifiable, this);
+ this(title, resizeable, closeable, maximizeable, iconifiable, app, app.getMainFrame());
}
+ public DialogWidget(String title, boolean resizeable, boolean closeable, boolean maximizeable, boolean iconifiable, IApplication app, Window parent)
+ {
+ _delegate = DesktopContainerFactory.createDialogDelegate(app, parent, title, resizeable, closeable, maximizeable, iconifiable, this);
+ }
+
+
public DialogWidget(String title, boolean resizeable, IApplication app)
{
this(title, resizeable, true, false, false, app);
}
+
public boolean isVisible()
{
return _delegate.isVisible();
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/mainpanel/overview/OverviewFrame.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/mainpanel/overview/OverviewFrame.java 2011-08-09 18:41:59 UTC (rev 6350)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/mainpanel/overview/OverviewFrame.java 2011-08-09 18:44:59 UTC (rev 6351)
@@ -24,9 +24,9 @@
private JCheckBox _chkOnTop;
- public OverviewFrame(DataSetViewerTablePanel simpleTable, IApplication app)
+ public OverviewFrame(DataSetViewerTablePanel simpleTable, IApplication app, Window parent)
{
- super(s_stringMgr.getString("OverviewFrame.title"), true, true, true, true, app);
+ super(s_stringMgr.getString("OverviewFrame.title"), true, true, true, true, app, parent);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/mainpanel/overview/OverwiewCtrl.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/mainpanel/overview/OverwiewCtrl.java 2011-08-09 18:41:59 UTC (rev 6350)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/mainpanel/overview/OverwiewCtrl.java 2011-08-09 18:44:59 UTC (rev 6351)
@@ -92,7 +92,9 @@
private void openWindowForTable(DataSetViewerTablePanel simpleTable)
{
- OverviewFrame overviewFrame = new OverviewFrame(simpleTable, _app);
+ Window parent = SwingUtilities.windowForComponent(_overwiewPanel.btnShowInTableWin);
+
+ OverviewFrame overviewFrame = new OverviewFrame(simpleTable, _app, parent);
_app.getMainFrame().addWidget(overviewFrame);
overviewFrame.setLayer(JLayeredPane.PALETTE_LAYER);
overviewFrame.setVisible(true);
Modified: trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/datasetviewer/CellDataPopup.java
===================================================================
--- trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/datasetviewer/CellDataPopup.java 2011-08-09 18:41:59 UTC (rev 6350)
+++ trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/datasetviewer/CellDataPopup.java 2011-08-09 18:44:59 UTC (rev 6351)
@@ -68,7 +68,7 @@
if (editor != null)
editor.cancelCellEditing();
- Component comp = SwingUtilities.getRoot(table);
+ Component parent = SwingUtilities.windowForComponent(table);
Component newComp = null;
TextAreaInternalFrame taif =
@@ -104,54 +104,15 @@
{
newComp.setSize(dim);
}
- if (comp instanceof IMainFrame)
- {
- pt = SwingUtilities.convertPoint((Component) evt.getSource(), pt, comp);
- pt.y -= dim.height;
- }
- else
- {
- // getRoot() doesn't appear to return the deepest Window, but the first one.
- // If you have a dialog owned by a window you get the dialog, not the window.
- Component parent = SwingUtilities.windowForComponent(comp);
- while ((parent != null) &&
- !(parent instanceof IMainFrame) &&
- !(parent.equals(comp)))
- {
- comp = parent;
- parent = SwingUtilities.windowForComponent(comp);
- }
- comp = (parent != null) ? parent : comp;
- pt = SwingUtilities.convertPoint((Component) evt.getSource(), pt, comp);
- }
- if (pt.y < 0)
- {
- pt.y = 0; // fudge for larger inset windows
- }
+ Point parentBounds = parent.getLocation();
- // Determine the position to place the new internal frame. Ensure that the right end
- // of the internal frame doesn't exend past the right end the parent frame. Use a
- // fudge factor as the dim.width doesn't appear to get the final width of the internal
- // frame (e.g. where pt.x + dim.width == parentBounds.width, the new internal frame
- // still extends past the right end of the parent frame).
- int fudgeFactor = 100;
- Rectangle parentBounds = comp.getBounds();
- if (parentBounds.width <= (dim.width + fudgeFactor))
- {
- dim.width = parentBounds.width - fudgeFactor;
- pt.x = fudgeFactor / 2;
- newComp.setSize(dim);
- }
- else
- {
- if ((pt.x + dim.width + fudgeFactor) > (parentBounds.width))
- {
- pt.x -= (pt.x + dim.width + fudgeFactor) - parentBounds.width;
- }
- }
+ parentBounds.x += SwingUtilities.convertPoint((Component) evt.getSource(), pt, parent).x;
+ parentBounds.y += SwingUtilities.convertPoint((Component) evt.getSource(), pt, parent).y;
- newComp.setLocation(pt);
+ newComp.setLocation(parentBounds);
+ newComp.setSize(dim);
+
newComp.setVisible(true);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|