Revision: 6697
http://squirrel-sql.svn.sourceforge.net/squirrel-sql/?rev=6697&view=rev
Author: gerdwagner
Date: 2012-10-24 18:36:55 +0000 (Wed, 24 Oct 2012)
Log Message:
-----------
Detached Windows:
- Fixed lost file button when detaching or dragging Session tabs
- Made more dialogs appear above the right window
Modified Paths:
--------------
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/DesktopTabbedPaneOutwardDndChanel.java
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/docktabdesktop/ButtonTabComponent.java
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/docktabdesktop/DockTabDesktopPane.java
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/SQLPanelAPI.java
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/SessionManager.java
Added Paths:
-----------
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/docktabdesktop/RemoveTabHandelResult.java
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/DesktopTabbedPaneOutwardDndChanel.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/DesktopTabbedPaneOutwardDndChanel.java 2012-10-23 20:46:46 UTC (rev 6696)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/DesktopTabbedPaneOutwardDndChanel.java 2012-10-24 18:36:55 UTC (rev 6697)
@@ -5,6 +5,7 @@
import net.sourceforge.squirrel_sql.client.gui.builders.dndtabbedpane.OutwardDndTabbedPaneChanel;
import net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.DockTabDesktopPane;
import net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.DockTabDesktopPaneHolder;
+import net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.RemoveTabHandelResult;
import net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.TabHandle;
import javax.swing.*;
@@ -67,11 +68,11 @@
DockTabDesktopPaneHolder sourceDesktopPaneHolder = _app.getMultipleWindowsHandler().getDockTabDesktopPaneOfTabbedPane(_dnDTabbedPaneData.getTabbedPane());
- TabHandle tabHandleToMove = sourceDesktopPaneHolder.getDockTabDesktopPane().removeTabHandel(_dnDTabbedPaneData.getDragTabIndex());
+ RemoveTabHandelResult moveTabHandelResult = sourceDesktopPaneHolder.getDockTabDesktopPane().removeTabHandel(_dnDTabbedPaneData.getDragTabIndex());
DockTabDesktopPaneHolder targetDesktopPaneHolder = _app.getMultipleWindowsHandler().getDockTabDesktopPaneOfTabbedPane(targetTabbedPane);
- targetDesktopPaneHolder.getDockTabDesktopPane().addTabWidgetAt(tabHandleToMove.getWidget(), targetTabIndex);
+ targetDesktopPaneHolder.getDockTabDesktopPane().addTabWidgetAt(moveTabHandelResult.getTabHandle().getWidget(), targetTabIndex, moveTabHandelResult.getRemovedButtonTabComponent().getExternalButtons());
sourceDesktopPaneHolder.tabDragedAndDroped();
targetDesktopPaneHolder.tabDragedAndDroped();
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/docktabdesktop/ButtonTabComponent.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/docktabdesktop/ButtonTabComponent.java 2012-10-23 20:46:46 UTC (rev 6696)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/docktabdesktop/ButtonTabComponent.java 2012-10-24 18:36:55 UTC (rev 6697)
@@ -1,13 +1,13 @@
package net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop;
import net.sourceforge.squirrel_sql.client.IApplication;
-import net.sourceforge.squirrel_sql.client.MultipleWindowsHandler;
import net.sourceforge.squirrel_sql.client.resources.SquirrelResources;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
import javax.swing.*;
import java.awt.*;
+import java.util.ArrayList;
public class ButtonTabComponent extends JPanel
@@ -17,16 +17,16 @@
private JLabel _label = new JLabel();
- private CloseTabButton _closeButton = new CloseTabButton();
+ private CloseTabButton _btnClose = new CloseTabButton();
private JPanel _pnlSmallTabButtons;
- private final SmallTabButton _toWindow;
+ private final SmallTabButton _btnToWindow;
public ButtonTabComponent(IApplication app, String title, Icon icon)
{
setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
setOpaque(false);
- add(_closeButton);
+ add(_btnClose);
_label.setText(title);
_label.setIcon(icon);
@@ -43,19 +43,19 @@
setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
- _toWindow = new SmallTabButton(s_stringMgr.getString("docktabdesktop.ButtonTabComponent.detachButtonTooltip"), app.getResources().getIcon(SquirrelResources.IImageNames.TAB_DETACH_SMALL));
+ _btnToWindow = new SmallTabButton(s_stringMgr.getString("docktabdesktop.ButtonTabComponent.detachButtonTooltip"), app.getResources().getIcon(SquirrelResources.IImageNames.TAB_DETACH_SMALL));
- addSmallTabButton(_toWindow);
+ _pnlSmallTabButtons.add(_btnToWindow);
}
public JButton getClosebutton()
{
- return _closeButton;
+ return _btnClose;
}
public JButton getToWindowButton()
{
- return _toWindow;
+ return _btnToWindow;
}
public void setIcon(Icon icon)
@@ -92,6 +92,23 @@
_pnlSmallTabButtons.remove(smallTabButton);
}
+ public ArrayList<SmallTabButton> getExternalButtons()
+ {
+ _pnlSmallTabButtons.getComponents();
+
+ ArrayList<SmallTabButton> ret = new ArrayList<SmallTabButton>();
+
+ for (Component cp : _pnlSmallTabButtons.getComponents())
+ {
+ if(cp instanceof SmallTabButton && cp != _btnToWindow)
+ {
+ ret.add((SmallTabButton) cp);
+ }
+ }
+
+ return ret;
+ }
+
private static class CloseTabButton extends SmallTabButton
{
private CloseTabButton()
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/docktabdesktop/DockTabDesktopPane.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/docktabdesktop/DockTabDesktopPane.java 2012-10-23 20:46:46 UTC (rev 6696)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/docktabdesktop/DockTabDesktopPane.java 2012-10-24 18:36:55 UTC (rev 6697)
@@ -166,10 +166,10 @@
public void addWidget(final TabWidget widget)
{
- addTabWidgetAt(widget, _tabbedPane.getTabCount());
+ addTabWidgetAt(widget, _tabbedPane.getTabCount(), new ArrayList<SmallTabButton>());
}
- public void addTabWidgetAt(TabWidget widget, int index)
+ public void addTabWidgetAt(TabWidget widget, int index, ArrayList<SmallTabButton> externalButtons)
{
final TabHandle tabHandle = new TabHandle(widget, this);
((TabDelegate) widget.getDelegate()).setTabHandle(tabHandle);
@@ -195,6 +195,12 @@
});
+ for (SmallTabButton externalButton : externalButtons)
+ {
+ btc.addSmallTabButton(externalButton);
+ }
+
+
_tabHandles.add(tabHandle);
tabHandle.fireAdded(_belongsToMainApplicationWindow);
_tabbedPane.setSelectedIndex(tabIx);
@@ -219,23 +225,24 @@
_app.getMultipleWindowsHandler().registerDesktop(tabWindowController);
- removeTabHandel(tabHandle);
+ RemoveTabHandelResult removeTabHandelResult = removeTabHandel(tabHandle);
- tabWindowController.getDockTabDesktopPane().addWidget(tabHandle.getWidget());
+ tabWindowController.getDockTabDesktopPane().addTabWidgetAt(tabHandle.getWidget(), _tabbedPane.getTabCount(), removeTabHandelResult.getRemovedButtonTabComponent().getExternalButtons());
}
- public TabHandle removeTabHandel(int tabIndex)
+ public RemoveTabHandelResult removeTabHandel(int tabIndex)
{
TabHandle tabHandle = ((TabPanel) _tabbedPane.getComponentAt(tabIndex)).getTabHandle();
return removeTabHandel(tabHandle);
}
- private TabHandle removeTabHandel(TabHandle tabHandle)
+ private RemoveTabHandelResult removeTabHandel(TabHandle tabHandle)
{
+ RemoveTabHandelResult ret = new RemoveTabHandelResult();
int tabIndex = getTabIndex(tabHandle);
if (-1 != tabIndex)
{
- removeTabFromTabbedPane(tabIndex);
+ ret.setRemovedButtonTabComponent(removeTabFromTabbedPane(tabIndex));
}
_tabHandles.remove(tabHandle);
tabHandle.removeTabHandleListener(_dockTabDesktopManager);
@@ -245,7 +252,9 @@
_app.getWindowManager().removeWidgetFromWindowMenu(tabHandle.getWidget());
}
- return tabHandle;
+ ret.setRemovedTabHandle(tabHandle);
+
+ return ret;
}
public boolean isMyTabbedPane(JTabbedPane tabbedPane)
@@ -452,10 +461,13 @@
}
}
- private void removeTabFromTabbedPane(int tabIndex)
+ private ButtonTabComponent removeTabFromTabbedPane(int tabIndex)
{
+ ButtonTabComponent ret = (ButtonTabComponent) _tabbedPane.getTabComponentAt(tabIndex);
_tabbedPane.remove(tabIndex);
_scrollableTabHandler.tabRemoved();
+
+ return ret;
}
Added: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/docktabdesktop/RemoveTabHandelResult.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/docktabdesktop/RemoveTabHandelResult.java (rev 0)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/docktabdesktop/RemoveTabHandelResult.java 2012-10-24 18:36:55 UTC (rev 6697)
@@ -0,0 +1,33 @@
+package net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: gerd
+ * Date: 24.10.12
+ * Time: 20:05
+ */
+public class RemoveTabHandelResult
+{
+ private ButtonTabComponent _removedButtonTabComponent;
+ private TabHandle _tabHandle;
+
+ public void setRemovedButtonTabComponent(ButtonTabComponent removedButtonTabComponent)
+ {
+ _removedButtonTabComponent = removedButtonTabComponent;
+ }
+
+ public void setRemovedTabHandle(TabHandle tabHandle)
+ {
+ _tabHandle = tabHandle;
+ }
+
+ public ButtonTabComponent getRemovedButtonTabComponent()
+ {
+ return _removedButtonTabComponent;
+ }
+
+ public TabHandle getTabHandle()
+ {
+ return _tabHandle;
+ }
+}
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/SQLPanelAPI.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/SQLPanelAPI.java 2012-10-23 20:46:46 UTC (rev 6696)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/SQLPanelAPI.java 2012-10-24 18:36:55 UTC (rev 6697)
@@ -740,7 +740,7 @@
s_stringMgr.getString("SQLPanelAPI.unsavedchangestitle",
": "+_panel.getSession().getAlias().getName());
- JFrame f = getSession().getApplication().getMainFrame();
+ JFrame f = (JFrame) SessionUtils.getOwningFrame(this);
int option =
JOptionPane.showConfirmDialog(f,
msg,
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/SessionManager.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/SessionManager.java 2012-10-23 20:46:46 UTC (rev 6696)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/SessionManager.java 2012-10-24 18:36:55 UTC (rev 6697)
@@ -533,7 +533,7 @@
final String msg = s_stringMgr.getString("SessionManager.confirmClose",
session.getTitle());
- if (!Dialogs.showYesNo(_app.getMainFrame(), msg)) {
+ if (!Dialogs.showYesNo(SessionUtils.getOwningFrame(session), msg)) {
return false;
} else {
return session.confirmClose();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|