Commit 4c21e82e authored by Stephan Kreutzer's avatar Stephan Kreutzer

file_picker_1: Dialog title can be set from the jobfile.

parent dcd85c5e
/* Copyright (C) 2014-2018 Stephan Kreutzer
/* Copyright (C) 2014-2019 Stephan Kreutzer
*
* This file is part of file_picker_1, a submodule of the
* digital_publishing_workflow_tools package.
......@@ -62,7 +62,7 @@ public class file_picker_1
{
public static void main(String[] args)
{
System.out.print("file_picker_1 Copyright (C) 2014-2018 Stephan Kreutzer\n" +
System.out.print("file_picker_1 Copyright (C) 2014-2019 Stephan Kreutzer\n" +
"This program comes with ABSOLUTELY NO WARRANTY.\n" +
"This is free software, and you are welcome to redistribute it\n" +
"under certain conditions. See the GNU Affero General Public License 3\n" +
......@@ -327,6 +327,7 @@ public class file_picker_1
File startDirectory = null;
Map<String, String> fileExtensions = new LinkedHashMap<String, String>();
boolean directoriesOnly = false;
String dialogTitle = null;
try
{
......@@ -431,6 +432,27 @@ public class file_picker_1
{
directoriesOnly = true;
}
else if (tagName.equals("dialog-title") == true)
{
dialogTitle = new String();
while (eventReader.hasNext() == true)
{
event = eventReader.nextEvent();
if (event.isCharacters() == true)
{
dialogTitle += event.asCharacters();
}
else if (event.isEndElement() == true)
{
if (event.asEndElement().getName().getLocalPart().equals("dialog-title") == true)
{
break;
}
}
}
}
}
}
}
......@@ -447,9 +469,18 @@ public class file_picker_1
throw constructTermination("messageJobFileErrorWhileReading", ex, null, jobFile.getAbsolutePath());
}
final JFileChooser chooser = new JFileChooser(getI10nString("windowCaptionSelectFile"));
final JFileChooser chooser = new JFileChooser();
chooser.setDialogType(JFileChooser.OPEN_DIALOG);
if (dialogTitle != null)
{
chooser.setDialogTitle(dialogTitle);
}
else
{
chooser.setDialogTitle(getI10nString("windowCaptionSelectFile"));
}
if (directoriesOnly == true)
{
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2014-2017 Stephan Kreutzer
Copyright (C) 2014-2019 Stephan Kreutzer
This file is part of file_picker_1, a submodule of the
digital_publishing_workflow_tools package.
......@@ -21,4 +21,5 @@ along with file_picker_1. If not, see <http://www.gnu.org/licenses/>.
<start-directory path="."/>
<!-- file-type extension="txt">Plain text file (.txt)</file-type -->
<!-- directories-only/ -->
<!-- dialog-title>Select File</dialog-title -->
</file-picker-1-jobfile>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment