diff --git a/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationReader.java b/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationReader.java
index 7df3b6e..5cb72d1 100644
--- a/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationReader.java
+++ b/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationReader.java
@@ -64,7 +64,7 @@ public class ConfigurationReader {
}
String outputFile = options.get("outputFile");
if (outputFile == null) {
- Debug.printLog("no output file set", context);
+ //Debug.printLog("no output file set", context);
} else {
options.remove("outputFile");
}
diff --git a/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationWindow.java b/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationWindow.java
index 6991d80..3c821e2 100644
--- a/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationWindow.java
+++ b/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationWindow.java
@@ -240,7 +240,7 @@ public class ConfigurationWindow extends JFrame {
btnChooseFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileDialog fileDialog = new FileDialog();
- String newFilePath = fileDialog.chooseFile(tf_inputFile.getText());
+ String newFilePath = fileDialog.chooseFile(tf_inputFile.getText(),"odt");
if (newFilePath != null && !newFilePath.isEmpty()) {
tf_inputFile.setText(newFilePath);
}
@@ -406,16 +406,34 @@ public class ConfigurationWindow extends JFrame {
configuration.put("targetFormat", lb_TargetFormat);
JLabel lb_TargetFormat_description = new JLabel("Target format");
- JButton btnChooseFile = new JButton("Choose file");
- btnChooseFile.addActionListener(new ActionListener() {
+ JButton btn_ChooseInputFile = new JButton("Choose");
+ btn_ChooseInputFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileDialog fileDialog = new FileDialog();
- String newFilePath = fileDialog.chooseFile(tf_inputFile.getText());
+ String newFilePath = fileDialog.chooseFile(tf_inputFile.getText(),"odt");
if (newFilePath != null && !newFilePath.isEmpty()) {
tf_inputFile.setText(newFilePath);
}
}
});
+
+ JLabel lb_OutFilePath = new JLabel("Output file path");
+
+ JTextField tf_OutputFile = new JTextField("");
+ configuration.put("outputFile", tf_OutputFile);
+
+ tf_OutputFile.setColumns(10);
+
+ JButton btn_ChooseOutputFile = new JButton("Choose");
+ btn_ChooseOutputFile.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ FileDialog fileDialog = new FileDialog();
+ String newFilePath = fileDialog.chooseFile(tf_OutputFile.getText(),"html");
+ if (newFilePath != null && !newFilePath.isEmpty()) {
+ tf_OutputFile.setText(newFilePath);
+ }
+ }
+ });
GroupLayout gl_panel_configHTML = new GroupLayout(panel_configHTML);
gl_panel_configHTML.setHorizontalGroup(
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
@@ -452,12 +470,20 @@ public class ConfigurationWindow extends JFrame {
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(lb_TargetFormat, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE))
.addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
+ .addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
+ .addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(tf_inputFile, GroupLayout.PREFERRED_SIZE, 616, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.UNRELATED)
- .addComponent(btnChooseFile)))
- .addContainerGap(68, Short.MAX_VALUE))
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING, false)
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addComponent(tf_OutputFile, GroupLayout.PREFERRED_SIZE, 616, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(ComponentPlacement.UNRELATED)
+ .addComponent(btn_ChooseOutputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addComponent(tf_inputFile, GroupLayout.PREFERRED_SIZE, 616, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(ComponentPlacement.UNRELATED)
+ .addComponent(btn_ChooseInputFile, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))
+ .addContainerGap(48, Short.MAX_VALUE))
);
gl_panel_configHTML.setVerticalGroup(
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
@@ -474,8 +500,13 @@ public class ConfigurationWindow extends JFrame {
.addGap(22)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
.addComponent(tf_inputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addComponent(btnChooseFile))))
- .addGap(46)
+ .addComponent(btn_ChooseInputFile))))
+ .addPreferredGap(ComponentPlacement.UNRELATED)
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
+ .addComponent(lb_OutFilePath)
+ .addComponent(tf_OutputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addComponent(btn_ChooseOutputFile))
+ .addGap(27)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_configHTML.createSequentialGroup()
.addGap(2)
@@ -518,7 +549,7 @@ public class ConfigurationWindow extends JFrame {
.addComponent(cb_SplitWholePagesOnly)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(cb_UseMathJax)
- .addContainerGap(282, Short.MAX_VALUE))
+ .addContainerGap(270, Short.MAX_VALUE))
);
panel_configHTML.setLayout(gl_panel_configHTML);
return panel_configHTML;
@@ -589,7 +620,7 @@ public class ConfigurationWindow extends JFrame {
btnChooseFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileDialog fileDialog = new FileDialog();
- String newFilePath = fileDialog.chooseFile(tf_inputFile.getText());
+ String newFilePath = fileDialog.chooseFile(tf_inputFile.getText(),"odt");
if (newFilePath != null && !newFilePath.isEmpty()) {
tf_inputFile.setText(newFilePath);
}
diff --git a/src/main/java/pro/litvinovg/w2phtml/gui/FileDialog.java b/src/main/java/pro/litvinovg/w2phtml/gui/FileDialog.java
index 89c621c..f9dba02 100644
--- a/src/main/java/pro/litvinovg/w2phtml/gui/FileDialog.java
+++ b/src/main/java/pro/litvinovg/w2phtml/gui/FileDialog.java
@@ -12,7 +12,7 @@ public class FileDialog extends JFrame {
*/
private static final long serialVersionUID = 1L;
- public static String chooseFile(String lastPath){
+ public static String chooseFile(String lastPath, String fileNameExtension){
File selected = null;
File currentDirectory = null;
if (lastPath != null && !lastPath.isEmpty()) {
@@ -31,7 +31,7 @@ public class FileDialog extends JFrame {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setPreferredSize(new Dimension(800,600));
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
- FileNameExtensionFilter filter = new FileNameExtensionFilter("ODT", "odt");
+ FileNameExtensionFilter filter = new FileNameExtensionFilter(fileNameExtension.toUpperCase(), fileNameExtension.toLowerCase());
fileChooser.setFileFilter(filter);
fileChooser.setCurrentDirectory(currentDirectory);
int result = fileChooser.showOpenDialog(null);