[Squirrel-sql-commits] sql12/app/src/net/sourceforge/squirrel_sql/client/gui/mainframe MainFrameTool
A Java SQL client for any JDBC compliant database
Brought to you by:
colbell,
gerdwagner
From: Colin B. <co...@us...> - 2004-08-30 11:59:10
|
Update of /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/gui/mainframe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13311/app/src/net/sourceforge/squirrel_sql/client/gui/mainframe Modified Files: MainFrameToolBar.java MainFrameMenuBar.java MainFrameActionBar.java Log Message: Ensure GUI updates occur on AWT thread. Index: MainFrameActionBar.java =================================================================== RCS file: /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/gui/mainframe/MainFrameActionBar.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MainFrameActionBar.java 22 Aug 2004 11:42:17 -0000 1.1 --- MainFrameActionBar.java 30 Aug 2004 11:58:42 -0000 1.2 *************** *** 18,21 **** --- 18,22 ---- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + import net.sourceforge.squirrel_sql.fw.gui.GUIUtils; import net.sourceforge.squirrel_sql.fw.gui.ToolBar; *************** *** 27,33 **** import net.sourceforge.squirrel_sql.client.session.event.SessionEvent; /** ! * Action Bar for <CODE>MainFrame</CODE>. * ! * @author <A HREF="mailto:jmh...@us...">Jason Height</A> */ class MainFrameActionBar extends ToolBar --- 28,34 ---- import net.sourceforge.squirrel_sql.client.session.event.SessionEvent; /** ! * Action Bar for <CODE>MainFrame</CODE>. * ! * @author <A HREF="mailto:jmh...@us...">Jason Height</A> */ class MainFrameActionBar extends ToolBar *************** *** 77,91 **** public void sessionClosing(SessionEvent evt) { ! ActionCollection actions = _app.getActionCollection(); ! actions.get(NewSQLWorksheetAction.class).setEnabled(false); ! actions.get(NewObjectTreeAction.class).setEnabled(false); } public void sessionActivated(SessionEvent evt) { ! ActionCollection actions = _app.getActionCollection(); ! actions.get(NewSQLWorksheetAction.class).setEnabled(true); ! actions.get(NewObjectTreeAction.class).setEnabled(true); } } ! } \ No newline at end of file --- 78,104 ---- public void sessionClosing(SessionEvent evt) { ! GUIUtils.processOnSwingEventThread(new Runnable() ! { ! public void run() ! { ! final ActionCollection actions = _app.getActionCollection(); ! actions.get(NewSQLWorksheetAction.class).setEnabled(false); ! actions.get(NewObjectTreeAction.class).setEnabled(false); ! } ! }); } public void sessionActivated(SessionEvent evt) { ! GUIUtils.processOnSwingEventThread(new Runnable() ! { ! public void run() ! { ! ActionCollection actions = _app.getActionCollection(); ! actions.get(NewSQLWorksheetAction.class).setEnabled(true); ! actions.get(NewObjectTreeAction.class).setEnabled(true); ! } ! }); } } ! } Index: MainFrameMenuBar.java =================================================================== RCS file: /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/gui/mainframe/MainFrameMenuBar.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MainFrameMenuBar.java 22 Aug 2004 11:42:17 -0000 1.1 --- MainFrameMenuBar.java 30 Aug 2004 11:58:42 -0000 1.2 *************** *** 1,5 **** package net.sourceforge.squirrel_sql.client.gui.mainframe; /* ! * Copyright (C) 2001-2003 Colin Bell * co...@us... * --- 1,5 ---- package net.sourceforge.squirrel_sql.client.gui.mainframe; /* ! * Copyright (C) 2001-2004 Colin Bell * co...@us... * Index: MainFrameToolBar.java =================================================================== RCS file: /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/gui/mainframe/MainFrameToolBar.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MainFrameToolBar.java 22 Aug 2004 11:42:17 -0000 1.1 --- MainFrameToolBar.java 30 Aug 2004 11:58:42 -0000 1.2 *************** *** 28,31 **** --- 28,32 ---- import javax.swing.JLabel; + import net.sourceforge.squirrel_sql.fw.gui.GUIUtils; import net.sourceforge.squirrel_sql.fw.gui.SortedComboBoxModel; import net.sourceforge.squirrel_sql.fw.gui.ToolBar; *************** *** 124,127 **** --- 125,129 ---- // Listen for changes to the active session. When active then // enable/disable the actions above + // JASON: Is this listener removed when session closed. _app.getSessionManager().addSessionListener(new SessionAdapter() { *************** *** 132,140 **** if (sess == _currentSession) { ! _currentSession = null; ! _sessionCommit.setSession(_currentSession); ! _sessionRollback.setSession(_currentSession); ! _sessionCommit.setEnabled(false); ! _sessionRollback.setEnabled(false); } } --- 134,148 ---- if (sess == _currentSession) { ! GUIUtils.processOnSwingEventThread(new Runnable() ! { ! public void run() ! { ! _currentSession = null; ! _sessionCommit.setSession(_currentSession); ! _sessionRollback.setSession(_currentSession); ! _sessionCommit.setEnabled(false); ! _sessionRollback.setEnabled(false); ! } ! }); } } *************** *** 143,150 **** { _currentSession = e.getSession(); ! _sessionCommit.setSession(_currentSession); ! _sessionRollback.setSession(_currentSession); ! _sessionCommit.setEnabled(true); ! _sessionRollback.setEnabled(true); } }); --- 151,165 ---- { _currentSession = e.getSession(); ! ! GUIUtils.processOnSwingEventThread(new Runnable() ! { ! public void run() ! { ! _sessionCommit.setSession(_currentSession); ! _sessionRollback.setSession(_currentSession); ! _sessionCommit.setEnabled(true); ! _sessionRollback.setEnabled(true); ! } ! }); } }); *************** *** 367,370 **** --- 382,386 ---- setMaximumSize(getPreferredSize()); + // JASON: Is this listner cleaned up when session closed? sessionManager.addSessionListener(new MySessionListener(model, this)); } *************** *** 449,456 **** { /** Model that is listening. */ ! private SessionDropDownModel _model; /** Control for _model. */ ! SessionDropDown _control; /** --- 465,472 ---- { /** Model that is listening. */ ! private final SessionDropDownModel _model; /** Control for _model. */ ! private final SessionDropDown _control; /** *************** *** 464,493 **** } ! public void sessionConnected(SessionEvent e) ! { ! _model.addSession(e.getSession()); ! _control.setEnabled(true); ! } ! ! public void sessionClosing(SessionEvent e) ! { ! _control.closing = true; ! _model.removeSession(e.getSession()); ! if (_model.getSize() == 0) ! _control.setEnabled(false); ! _control.closing = false; ! } ! ! public void allSessionsClosed() { } ! public void sessionClosed(SessionEvent e) { } ! public void sessionActivated(SessionEvent e) { ! _control.setSelectedItem(e.getSession()); } } --- 480,524 ---- } ! public void sessionConnected(SessionEvent evt) { + final ISession session = evt.getSession(); + GUIUtils.processOnSwingEventThread(new Runnable() + { + public void run() + { + _model.addSession(session); + _control.setEnabled(true); + } + }); } ! public void sessionClosing(SessionEvent evt) { + final ISession session = evt.getSession(); + GUIUtils.processOnSwingEventThread(new Runnable() + { + public void run() + { + _control.closing = true; + _model.removeSession(session); + if (_model.getSize() == 0) + { + _control.setEnabled(false); + } + _control.closing = false; + } + }); } ! public void sessionActivated(SessionEvent evt) { ! final ISession session = evt.getSession(); ! GUIUtils.processOnSwingEventThread(new Runnable() ! { ! public void run() ! { ! _control.setSelectedItem(session); ! } ! }); } } |