This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jaxx. See http://git.nuiton.org/jaxx.git commit 8b0c3784c3ed0a28dd94873a20c1ba5c185307b0 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Nov 16 15:11:14 2014 +0100 fixes #3573: Add a keepCurrentDirectory option in JaxxFileChooser --- .../org/nuiton/jaxx/runtime/JaxxFileChooser.java | 28 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/JaxxFileChooser.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/JaxxFileChooser.java index 94f4c6c..46bb69b 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/JaxxFileChooser.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/JaxxFileChooser.java @@ -116,6 +116,8 @@ public class JaxxFileChooser { ToLoadFile setStartDirectory(File startDirectory); + ToLoadFile setKeepCurrentDirectory(boolean keepCurrentDirectory); + File choose(); } @@ -130,6 +132,8 @@ public class JaxxFileChooser { ToLoadDirectory setStartDirectory(File startDirectory); + ToLoadDirectory setKeepCurrentDirectory(boolean keepCurrentDirectory); + File choose(); } @@ -158,6 +162,8 @@ public class JaxxFileChooser { ToSave setStartDirectory(File startDirectory); + ToSave setKeepCurrentDirectory(boolean keepCurrentDirectory); + File choose(); } @@ -192,6 +198,8 @@ public class JaxxFileChooser { protected boolean useAcceptAllFileFilter; + protected boolean keepCurrentDirectory = true; + protected String filename; FileChooserBuilderImpl(ChooseMode chooseMode) { @@ -302,6 +310,12 @@ public class JaxxFileChooser { } @Override + public FileChooserBuilderImpl setKeepCurrentDirectory(boolean keepCurrentDirectory) { + this.keepCurrentDirectory = keepCurrentDirectory; + return this; + } + + @Override public File choose() { File result = null; @@ -328,7 +342,7 @@ public class JaxxFileChooser { File directory; if (startDirectory == null) { - directory = currentDirectory; + directory = getCurrentDirectory(); } else { directory = startDirectory; } @@ -362,7 +376,9 @@ public class JaxxFileChooser { if (returnVal == JFileChooser.APPROVE_OPTION) { File theFile = chooser.getSelectedFile(); if (theFile != null) { - currentDirectory = theFile; + if (keepCurrentDirectory) { + setCurrentDirectory(theFile); + } return theFile.getAbsoluteFile(); } } @@ -399,7 +415,9 @@ public class JaxxFileChooser { if (returnVal == JFileChooser.APPROVE_OPTION) { File theFile = chooser.getSelectedFile(); if (theFile != null) { - currentDirectory = theFile; + if (keepCurrentDirectory) { + setCurrentDirectory(theFile); + } if (theFile.isDirectory()) { return theFile; } @@ -445,7 +463,9 @@ public class JaxxFileChooser { if (returnVal == JFileChooser.APPROVE_OPTION) { result = chooser.getSelectedFile(); if (result != null) { - setCurrentDirectory(result); + if (keepCurrentDirectory) { + setCurrentDirectory(result); + } result = result.getAbsoluteFile(); } } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.