Author: jflesch
Date: 2007-04-30 16:23:13 +0000 (Mon, 30 Apr 2007)
New Revision: 13063
Added:
trunk/apps/Thaw/src/thaw/gui/FileChooser.java
Removed:
trunk/apps/Thaw/src/thaw/core/FileChooser.java
Modified:
trunk/apps/Thaw/src/thaw/plugins/IndexExporter.java
trunk/apps/Thaw/src/thaw/plugins/LogConsole.java
trunk/apps/Thaw/src/thaw/plugins/fetchPlugin/FetchPanel.java
trunk/apps/Thaw/src/thaw/plugins/index/FileManagementHelper.java
trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
trunk/apps/Thaw/src/thaw/plugins/insertPlugin/InsertPanel.java
trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java
Log:
Move FileChooser from thaw.core to thaw.gui
Deleted: trunk/apps/Thaw/src/thaw/core/FileChooser.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/FileChooser.java 2007-04-30 13:25:18 UTC
(rev 13062)
+++ trunk/apps/Thaw/src/thaw/core/FileChooser.java 2007-04-30 16:23:13 UTC
(rev 13063)
@@ -1,146 +0,0 @@
-package thaw.core;
-
-import java.io.File;
-import java.util.Vector;
-
-import javax.swing.JFileChooser;
-
-/**
- * FileChooser helps to create and use simple JFileChooser.
- * Don't block any swing component.
- */
-public class FileChooser {
- private JFileChooser fileChooser = null;
-
- private String finalDir = null;
-
- public FileChooser() {
- fileChooser = new JFileChooser();
- }
-
- public FileChooser(final String path) {
- fileChooser = new JFileChooser(path);
- fileChooser.setDragEnabled(true);
- }
-
- public void setTitle(final String title) {
- fileChooser.setDialogTitle(title);
- }
-
-
- public void setDirectoryOnly(final boolean v) {
- if(v)
-
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- else
-
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); /*
Directories -> Recursivity */
- }
-
- /**
- * @param type JFileChooser.OPEN_DIALOG / JFileChooser.SAVE_DIALOG
- * @see javax.swing.JFileChooser#setDialogType(int)
- */
- public void setDialogType(final int type) {
- fileChooser.setDialogType(type);
- }
-
- protected boolean showDialog() {
- int result = 0;
-
- if(fileChooser.getDialogType() == JFileChooser.OPEN_DIALOG) {
- result = fileChooser.showOpenDialog(null);
- }
-
- if(fileChooser.getDialogType() == JFileChooser.SAVE_DIALOG) {
- result = fileChooser.showSaveDialog(null);
- }
-
- if(result == JFileChooser.APPROVE_OPTION)
- return true;
- else
- return false;
-
- }
-
- /**
- * @return null if nothing choosed.
- */
- public File askOneFile() {
- File file;
-
- fileChooser.setMultiSelectionEnabled(false);
-
- if(!showDialog())
- return null;
-
- file = fileChooser.getSelectedFile();
-
- if (file != null) {
- finalDir = file.getParent();
- }
-
- return file;
- }
-
-
- protected void expandRecursivly(final File file, final Vector vec) {
- if (file.isFile()) {
- vec.add(file);
- return;
- }
-
- final File[] files = file.listFiles();
-
- if (files == null) {
- Logger.notice(this, "Unable to parse directory
'"+file.getPath()+"'");
- return;
- }
-
- for (int i=0; i < files.length; i++) {
- if (files[i].isFile())
- vec.add(files[i]);
- else
- this.expandRecursivly(files[i],vec);
- }
-
- }
-
- protected Vector expandRecursivly(final File[] selectedFiles)
- {
- final Vector files= new Vector();
-
- for (int i = 0 ; i < selectedFiles.length ; i++) {
- this.expandRecursivly(selectedFiles[i], files);
- }
-
- return files;
- }
-
- /**
- * @return null if nothing choosed.
- */
- public Vector askManyFiles() {
- File[] files;
-
- fileChooser.setMultiSelectionEnabled(true);
-
- if(!showDialog())
- return null;
-
- files = fileChooser.getSelectedFiles();
-
- if (files != null && files[0] != null) {
- finalDir = files[0].getParent();
- }
-
- return this.expandRecursivly(files);
- }
-
-
- /**
- * Return the main directory where the files where selected
- */
- public String getFinalDirectory() {
- return finalDir;
- }
-
-}
Copied: trunk/apps/Thaw/src/thaw/gui/FileChooser.java (from rev 13048,
trunk/apps/Thaw/src/thaw/core/FileChooser.java)
===================================================================
--- trunk/apps/Thaw/src/thaw/gui/FileChooser.java
(rev 0)
+++ trunk/apps/Thaw/src/thaw/gui/FileChooser.java 2007-04-30 16:23:13 UTC
(rev 13063)
@@ -0,0 +1,148 @@
+package thaw.gui;
+
+import java.io.File;
+import java.util.Vector;
+
+import javax.swing.JFileChooser;
+
+import thaw.core.Logger;
+
+
+/**
+ * FileChooser helps to create and use simple JFileChooser.
+ */
+public class FileChooser {
+ private JFileChooser fileChooser = null;
+
+ private String finalDir = null;
+
+ public FileChooser() {
+ fileChooser = new JFileChooser();
+ }
+
+ public FileChooser(final String path) {
+ fileChooser = new JFileChooser(path);
+ fileChooser.setDragEnabled(true);
+ }
+
+ public void setTitle(final String title) {
+ fileChooser.setDialogTitle(title);
+ }
+
+
+ public void setDirectoryOnly(final boolean v) {
+ if(v)
+
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ else
+
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); /*
Directories -> Recursivity */
+ }
+
+ /**
+ * @param type JFileChooser.OPEN_DIALOG / JFileChooser.SAVE_DIALOG
+ * @see javax.swing.JFileChooser#setDialogType(int)
+ */
+ public void setDialogType(final int type) {
+ fileChooser.setDialogType(type);
+ }
+
+ protected boolean showDialog() {
+ int result = 0;
+
+ if(fileChooser.getDialogType() == JFileChooser.OPEN_DIALOG) {
+ result = fileChooser.showOpenDialog(null);
+ }
+
+ if(fileChooser.getDialogType() == JFileChooser.SAVE_DIALOG) {
+ result = fileChooser.showSaveDialog(null);
+ }
+
+ if(result == JFileChooser.APPROVE_OPTION)
+ return true;
+ else
+ return false;
+
+ }
+
+ /**
+ * @return null if nothing choosed.
+ */
+ public File askOneFile() {
+ File file;
+
+ fileChooser.setMultiSelectionEnabled(false);
+
+ if(!showDialog())
+ return null;
+
+ file = fileChooser.getSelectedFile();
+
+ if (file != null) {
+ finalDir = file.getParent();
+ }
+
+ return file;
+ }
+
+
+ protected void expandRecursivly(final File file, final Vector vec) {
+ if (file.isFile()) {
+ vec.add(file);
+ return;
+ }
+
+ final File[] files = file.listFiles();
+
+ if (files == null) {
+ Logger.notice(this, "Unable to parse directory
'"+file.getPath()+"'");
+ return;
+ }
+
+ for (int i=0; i < files.length; i++) {
+ if (files[i].isFile())
+ vec.add(files[i]);
+ else
+ this.expandRecursivly(files[i],vec);
+ }
+
+ }
+
+ protected Vector expandRecursivly(final File[] selectedFiles)
+ {
+ final Vector files= new Vector();
+
+ for (int i = 0 ; i < selectedFiles.length ; i++) {
+ this.expandRecursivly(selectedFiles[i], files);
+ }
+
+ return files;
+ }
+
+ /**
+ * @return null if nothing choosed.
+ */
+ public Vector askManyFiles() {
+ File[] files;
+
+ fileChooser.setMultiSelectionEnabled(true);
+
+ if(!showDialog())
+ return null;
+
+ files = fileChooser.getSelectedFiles();
+
+ if (files != null && files[0] != null) {
+ finalDir = files[0].getParent();
+ }
+
+ return this.expandRecursivly(files);
+ }
+
+
+ /**
+ * Return the main directory where the files where selected
+ */
+ public String getFinalDirectory() {
+ return finalDir;
+ }
+
+}
Modified: trunk/apps/Thaw/src/thaw/plugins/IndexExporter.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/IndexExporter.java 2007-04-30 13:25:18 UTC
(rev 13062)
+++ trunk/apps/Thaw/src/thaw/plugins/IndexExporter.java 2007-04-30 16:23:13 UTC
(rev 13063)
@@ -8,7 +8,7 @@
import javax.swing.JMenuItem;
import thaw.core.Core;
-import thaw.core.FileChooser;
+import thaw.gui.FileChooser;
import thaw.core.I18n;
import thaw.gui.IconBox;
import thaw.core.Logger;
Modified: trunk/apps/Thaw/src/thaw/plugins/LogConsole.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/LogConsole.java 2007-04-30 13:25:18 UTC
(rev 13062)
+++ trunk/apps/Thaw/src/thaw/plugins/LogConsole.java 2007-04-30 16:23:13 UTC
(rev 13063)
@@ -13,7 +13,7 @@
import javax.swing.JTextArea;
import thaw.core.Core;
-import thaw.core.FileChooser;
+import thaw.gui.FileChooser;
import thaw.core.I18n;
import thaw.core.LogListener;
import thaw.core.Logger;
Modified: trunk/apps/Thaw/src/thaw/plugins/fetchPlugin/FetchPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/fetchPlugin/FetchPanel.java
2007-04-30 13:25:18 UTC (rev 13062)
+++ trunk/apps/Thaw/src/thaw/plugins/fetchPlugin/FetchPanel.java
2007-04-30 16:23:13 UTC (rev 13063)
@@ -21,7 +21,7 @@
import javax.swing.JTextField;
import thaw.core.Core;
-import thaw.core.FileChooser;
+import thaw.gui.FileChooser;
import thaw.gui.GUIHelper;
import thaw.core.I18n;
import thaw.core.Logger;
Modified: trunk/apps/Thaw/src/thaw/plugins/index/FileManagementHelper.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/FileManagementHelper.java
2007-04-30 13:25:18 UTC (rev 13062)
+++ trunk/apps/Thaw/src/thaw/plugins/index/FileManagementHelper.java
2007-04-30 16:23:13 UTC (rev 13063)
@@ -12,7 +12,7 @@
import javax.swing.JFileChooser;
import thaw.core.Config;
-import thaw.core.FileChooser;
+import thaw.gui.FileChooser;
import thaw.core.I18n;
import thaw.core.Logger;
import thaw.fcp.FCPQueueManager;
Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
2007-04-30 13:25:18 UTC (rev 13062)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
2007-04-30 16:23:13 UTC (rev 13063)
@@ -41,7 +41,7 @@
import thaw.gui.IconBox;
import thaw.core.Config;
-import thaw.core.FileChooser;
+import thaw.gui.FileChooser;
import thaw.core.MainWindow;
import thaw.fcp.FreenetURIHelper;
import thaw.core.I18n;
Modified: trunk/apps/Thaw/src/thaw/plugins/insertPlugin/InsertPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/insertPlugin/InsertPanel.java
2007-04-30 13:25:18 UTC (rev 13062)
+++ trunk/apps/Thaw/src/thaw/plugins/insertPlugin/InsertPanel.java
2007-04-30 16:23:13 UTC (rev 13063)
@@ -24,7 +24,7 @@
import javax.swing.JTextField;
import thaw.core.Config;
-import thaw.core.FileChooser;
+import thaw.gui.FileChooser;
import thaw.core.I18n;
import thaw.core.Logger;
import thaw.gui.WarningWindow;
Modified: trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
2007-04-30 13:25:18 UTC (rev 13062)
+++ trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
2007-04-30 16:23:13 UTC (rev 13063)
@@ -35,7 +35,7 @@
import javax.swing.table.JTableHeader;
import thaw.core.Core;
-import thaw.core.FileChooser;
+import thaw.gui.FileChooser;
import thaw.core.I18n;
import thaw.gui.IconBox;
import thaw.core.Logger;
Modified: trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java
2007-04-30 13:25:18 UTC (rev 13062)
+++ trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java
2007-04-30 16:23:13 UTC (rev 13063)
@@ -34,6 +34,7 @@
import thaw.gui.IconBox;
+
import thaw.plugins.Hsqldb;