[freenet-cvs] r11230 - in trunk/apps/Thaw/src/thaw: core plugins plugins/index

cvs at freenetproject.org cvs at freenetproject.org
Tue Dec 5 18:32:59 UTC 2006


Author: jflesch
Date: 2006-12-04 22:59:48 +0000 (Mon, 04 Dec 2006)
New Revision: 11230

Modified:
   trunk/apps/Thaw/src/thaw/core/ConfigWindow.java
   trunk/apps/Thaw/src/thaw/core/Core.java
   trunk/apps/Thaw/src/thaw/core/SplashScreen.java
   trunk/apps/Thaw/src/thaw/plugins/IndexBrowser.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexSelecter.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
Log:
Should fix popup behavior

Modified: trunk/apps/Thaw/src/thaw/core/ConfigWindow.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/ConfigWindow.java	2006-12-04 22:33:12 UTC (rev 11229)
+++ trunk/apps/Thaw/src/thaw/core/ConfigWindow.java	2006-12-04 22:59:48 UTC (rev 11230)
@@ -1,6 +1,7 @@
 package thaw.core;
 
 import javax.swing.JFrame;
+import javax.swing.JDialog;
 import javax.swing.JPanel;
 import javax.swing.JTabbedPane;
 import java.awt.BorderLayout;
@@ -22,7 +23,7 @@
  *  window is set visible (arg == null).
  */
 public class ConfigWindow extends Observable implements ActionListener, java.awt.event.WindowListener {
-	private JFrame configWin;
+	private JDialog configWin;
 	private JTabbedPane tabs;
 
 	private JPanel buttons;
@@ -45,7 +46,7 @@
 
 		this.advancedMode = Boolean.valueOf(core.getConfig().getValue("advancedMode")).booleanValue();
 
-		this.configWin = new JFrame(I18n.getMessage("thaw.config.windowName"));
+		this.configWin = new JDialog(core.getMainWindow().getMainFrame(), I18n.getMessage("thaw.config.windowName"));
 
 		this.tabs = new JTabbedPane();
 
@@ -126,7 +127,7 @@
 	/**
 	 * Get a ref to the JFrame.
 	 */
-	public JFrame getFrame() {
+	public JDialog getFrame() {
 		return this.configWin;
 	}
 

Modified: trunk/apps/Thaw/src/thaw/core/Core.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/Core.java	2006-12-04 22:33:12 UTC (rev 11229)
+++ trunk/apps/Thaw/src/thaw/core/Core.java	2006-12-04 22:59:48 UTC (rev 11230)
@@ -407,14 +407,12 @@
 
 			int nmbReconnect = 0;
 
-			JDialog warningDialog = new JDialog();
-			warningDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
+			JDialog warningDialog = new JDialog(getMainWindow().getMainFrame());
 			warningDialog.setTitle("Thaw - reconnection");
 			warningDialog.setModal(false);
 			warningDialog.setSize(500, 40);
+			warningDialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
 
-			warningDialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
-
 			JPanel warningPanel = new JPanel();
 
 			JLabel warningLabel = new JLabel(I18n.getMessage("thaw.warning.autoreconnecting"),

Modified: trunk/apps/Thaw/src/thaw/core/SplashScreen.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/SplashScreen.java	2006-12-04 22:33:12 UTC (rev 11229)
+++ trunk/apps/Thaw/src/thaw/core/SplashScreen.java	2006-12-04 22:59:48 UTC (rev 11230)
@@ -92,9 +92,10 @@
 
 
 	public void hide() {
-		this.splashScreen.setVisible(false);
-		this.splashScreen = null;
-		this.progressBar = null;
+		splashScreen.setVisible(false);
+		splashScreen.dispose();
+		splashScreen = null;
+		progressBar = null;
 	}
 
 }

Modified: trunk/apps/Thaw/src/thaw/plugins/IndexBrowser.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/IndexBrowser.java	2006-12-04 22:33:12 UTC (rev 11229)
+++ trunk/apps/Thaw/src/thaw/plugins/IndexBrowser.java	2006-12-04 22:59:48 UTC (rev 11230)
@@ -48,7 +48,7 @@
 			core.getConfig().setValue("indexDatabaseVersion", "1");
 		}
 
-		browserPanel = new IndexBrowserPanel(hsqldb, core.getQueueManager(), core.getConfig());
+		browserPanel = new IndexBrowserPanel(hsqldb, core.getQueueManager(), core.getConfig(), core.getMainWindow());
 
 		setMainWindow(core.getMainWindow());
 		core.getMainWindow().getTabbedPane().addChangeListener(this);
@@ -70,7 +70,7 @@
 
 		button = new JButton(IconBox.indexReuse);
 		button.setToolTipText(I18n.getMessage("thaw.plugin.index.addAlreadyExistingIndex"));
-		action = new IndexManagementHelper.IndexReuser(hsqldb, core.getQueueManager(), browserPanel.getUnknownIndexList(), browserPanel.getIndexTree(), button);
+		action = new IndexManagementHelper.IndexReuser(hsqldb, core.getQueueManager(), browserPanel.getUnknownIndexList(), browserPanel.getIndexTree(), core.getMainWindow(), button);
 		action.setTarget(browserPanel.getIndexTree().getRoot());
 		addButtonToTheToolbar(button);
 

Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java	2006-12-04 22:33:12 UTC (rev 11229)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java	2006-12-04 22:59:48 UTC (rev 11230)
@@ -32,13 +32,13 @@
 
 
 
-	public IndexBrowserPanel(Hsqldb db, FCPQueueManager queueManager, Config config) {
+	public IndexBrowserPanel(Hsqldb db, FCPQueueManager queueManager, Config config, MainWindow mainWindow) {
 		this.db = db;
 		this.queueManager = queueManager;
 		this.config = config;
 
 		unknownList = new UnknownIndexList(db, queueManager);
-		indexTree = new IndexTree(I18n.getMessage("thaw.plugin.index.indexes"), false, queueManager, unknownList, db);
+		indexTree = new IndexTree(I18n.getMessage("thaw.plugin.index.indexes"), false, queueManager, unknownList, mainWindow, db);
 		unknownList.setIndexTree(indexTree); /* TODO: dirty => find a better way */
 
 		leftSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT,

Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java	2006-12-04 22:33:12 UTC (rev 11229)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java	2006-12-04 22:59:48 UTC (rev 11230)
@@ -11,9 +11,9 @@
 import javax.swing.tree.DefaultMutableTreeNode;
 
 import javax.swing.JFrame;
+import javax.swing.JDialog;
 import javax.swing.JFileChooser;
 import javax.swing.JOptionPane;
-import javax.swing.JDialog;
 import javax.swing.JButton;
 import javax.swing.JPanel;
 import javax.swing.JTextField;
@@ -40,6 +40,7 @@
 
 import thaw.fcp.*;
 import thaw.core.Logger;
+import thaw.core.MainWindow;
 
 /**
  * Index.java, IndexCategory.java and IndexTree.java must NEVER use this helper (to avoid loops).
@@ -175,13 +176,15 @@
 		 */
 		public static String[] askKeys(boolean askPrivateKey,
 					       String defaultPublicKey,
-					       String defaultPrivateKey) {
-			return ((new KeyAsker()).askKeysBis(askPrivateKey, defaultPublicKey, defaultPrivateKey));
+					       String defaultPrivateKey,
+					       MainWindow mainWindow) {
+			return ((new KeyAsker()).askKeysBis(askPrivateKey, defaultPublicKey, defaultPrivateKey, mainWindow));
 		}
 
 		public String[] askKeysBis(boolean askPrivateKey,
 					   String defaultPublicKey,
-					   String defaultPrivateKey) {
+					   String defaultPrivateKey,
+					   MainWindow mainWindow) {
 			formState = 0;
 
 			if (defaultPublicKey == null)
@@ -190,7 +193,7 @@
 			if (defaultPrivateKey == null)
 				defaultPrivateKey = "SSK@";
 
-			JFrame frame = new JFrame(I18n.getMessage("thaw.plugin.index.indexKey"));
+			JDialog frame = new JDialog(mainWindow.getMainFrame(), I18n.getMessage("thaw.plugin.index.indexKey"));
 
 			frame.getContentPane().setLayout(new BorderLayout());
 
@@ -309,8 +312,11 @@
 	}
 
 	public static class IndexKeyModifier extends BasicIndexAction implements Runnable {
-		public IndexKeyModifier(AbstractButton actionSource) {
+		private MainWindow mainWindow;
+
+		public IndexKeyModifier(MainWindow mainWindow, AbstractButton actionSource) {
 			super(null, null, null, null, actionSource);
+			this.mainWindow = mainWindow;
 		}
 
 		public void setTarget(IndexTreeNode node) {
@@ -321,7 +327,7 @@
 		public void run() {
 			Index index = ((Index)getTarget());
 
-			String[] keys = KeyAsker.askKeys(true, index.getPublicKey(), index.getPrivateKey());
+			String[] keys = KeyAsker.askKeys(true, index.getPublicKey(), index.getPrivateKey(), mainWindow);
 
 			if (keys == null)
 				return;
@@ -340,8 +346,11 @@
 
 
 	public static class IndexReuser extends BasicIndexAction implements Runnable {
-		public IndexReuser(Hsqldb db, FCPQueueManager queueManager, UnknownIndexList uIndexList, IndexTree tree, AbstractButton actionSource) {
+		private MainWindow mainWindow;
+
+		public IndexReuser(Hsqldb db, FCPQueueManager queueManager, UnknownIndexList uIndexList, IndexTree tree, MainWindow mainWindow, AbstractButton actionSource) {
 			super(db, queueManager, uIndexList, tree, actionSource);
+			this.mainWindow = mainWindow;
 		}
 
 		public void setTarget(IndexTreeNode node) {
@@ -354,7 +363,7 @@
 			String publicKey = null;
 			String privateKey = null;
 
-			keys = KeyAsker.askKeys(true, "USK@", "SSK@");
+			keys = KeyAsker.askKeys(true, "USK@", "SSK@", mainWindow);
 
 			if (keys == null)
 				return;
@@ -726,12 +735,14 @@
 		private JButton cancelButton = null;
 		private JButton okButton = null;
 		private JTextArea textArea = null;
-		private JFrame frame = null;
+		private JDialog frame = null;
 
 		private JPopupMenu popupMenu = null;
+		private MainWindow mainWindow;
 
-		public KeyAdder(Hsqldb db, AbstractButton actionSource) {
+		public KeyAdder(Hsqldb db, MainWindow win, AbstractButton actionSource) {
 			super(db, null, null, null, actionSource);
+			this.mainWindow = win;
 		}
 
 		public void setTarget(IndexTreeNode node) {
@@ -743,7 +754,7 @@
 			JLabel header = null;
 			JPanel buttonPanel = null;
 
-			frame = new JFrame(I18n.getMessage("thaw.plugins.index.addKeys"));
+			frame = new JDialog(mainWindow.getMainFrame(), I18n.getMessage("thaw.plugins.index.addKeys"));
 			frame.setVisible(false);
 
 			header = new JLabel(I18n.getMessage("thaw.plugin.fetch.keyList"));

Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexSelecter.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexSelecter.java	2006-12-04 22:33:12 UTC (rev 11229)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexSelecter.java	2006-12-04 22:59:48 UTC (rev 11230)
@@ -68,7 +68,7 @@
 
 		upPanel = new JPanel();
 		Logger.info(this, "indexes");
-		indexTree = new IndexTree(I18n.getMessage("thaw.plugin.index.yourIndexes"), true, null, null, db);
+		indexTree = new IndexTree(I18n.getMessage("thaw.plugin.index.yourIndexes"), true, null, null, null, db);
 		Logger.info(this, "plus indexes");
 
 		fieldPanel = new JPanel();

Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java	2006-12-04 22:33:12 UTC (rev 11229)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java	2006-12-04 22:59:48 UTC (rev 11230)
@@ -114,6 +114,7 @@
 			 boolean selectionOnly,
 			 FCPQueueManager queueManager,
 			 UnknownIndexList uIndexList,
+			 MainWindow mainWindow,
 			 Hsqldb db) {
 		this.uIndexList = uIndexList;
 		this.queueManager = queueManager;
@@ -170,7 +171,7 @@
 
 		item = new JMenuItem(I18n.getMessage("thaw.plugin.index.addAlreadyExistingIndex"));
 		indexCategoryMenu.add(item);
-		indexCategoryActions.add(new IndexManagementHelper.IndexReuser(db, queueManager, uIndexList, this, item));
+		indexCategoryActions.add(new IndexManagementHelper.IndexReuser(db, queueManager, uIndexList, this, mainWindow, item));
 
 		item = new JMenuItem(I18n.getMessage("thaw.plugin.index.addCategory"));
 		indexCategoryMenu.add(item);
@@ -212,7 +213,7 @@
 
 		item = new JMenuItem(I18n.getMessage("thaw.plugin.index.changeIndexKeys"));
 		indexMenu.add(item);
-		indexAndFileActions.add(new IndexManagementHelper.IndexKeyModifier(item));
+		indexAndFileActions.add(new IndexManagementHelper.IndexKeyModifier(mainWindow, item));
 
 		item = new JMenuItem(I18n.getMessage("thaw.plugin.index.copyPrivateKey"));
 		indexMenu.add(item);
@@ -235,7 +236,7 @@
 
 		item = new JMenuItem(I18n.getMessage("thaw.plugin.index.addKeys"));
 		fileMenu.add(item);
-		indexAndFileActions.add(new IndexManagementHelper.KeyAdder(db, item));
+		indexAndFileActions.add(new IndexManagementHelper.KeyAdder(db, mainWindow, item));
 
 		// Link menu
 		item = new JMenuItem(I18n.getMessage("thaw.plugin.index.addLink"));




More information about the cvs mailing list