Added csv metadata option for RDF conversion

This commit is contained in:
Georgy Litvinov 2020-08-11 14:30:05 +02:00
parent f5de65b8eb
commit 8f1d716fe0
2 changed files with 71 additions and 37 deletions

View file

@ -291,17 +291,17 @@ public class ConfigurationWindow extends JFrame {
.addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE)
.addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 156, GroupLayout.PREFERRED_SIZE)
.addGroup(gl_panel_configHTML.createSequentialGroup()
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
.addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE)
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE))
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
.addGap(32)
.addComponent(tf_inputFile, GroupLayout.PREFERRED_SIZE, 616, GroupLayout.PREFERRED_SIZE)
.addGap(12)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
.addComponent(tf_inputFile, GroupLayout.PREFERRED_SIZE, 616, GroupLayout.PREFERRED_SIZE)
.addComponent(tf_OutputFile, GroupLayout.PREFERRED_SIZE, 616, GroupLayout.PREFERRED_SIZE))
.addComponent(btnChooseFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))
.addGroup(gl_panel_configHTML.createSequentialGroup()
.addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE)
.addGap(12)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
.addComponent(btnChooseFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)
.addComponent(btn_ChooseOutputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))))
.addComponent(tf_OutputFile, GroupLayout.PREFERRED_SIZE, 616, GroupLayout.PREFERRED_SIZE)
.addGap(12)
.addComponent(btn_ChooseOutputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)))
.addGap(48))
);
gl_panel_configHTML.setVerticalGroup(
@ -320,7 +320,7 @@ public class ConfigurationWindow extends JFrame {
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
.addComponent(tf_inputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(btnChooseFile))))
.addPreferredGap(ComponentPlacement.UNRELATED)
.addGap(48)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_configHTML.createSequentialGroup()
.addGap(5)
@ -329,7 +329,7 @@ public class ConfigurationWindow extends JFrame {
.addGap(3)
.addComponent(tf_OutputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addComponent(btn_ChooseOutputFile))
.addGap(42)
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_configHTML.createSequentialGroup()
.addGap(2)
@ -357,7 +357,7 @@ public class ConfigurationWindow extends JFrame {
.addComponent(cb_IgnoreEmptyParagraphs)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(cb_UseMathJax)
.addContainerGap(347, Short.MAX_VALUE))
.addContainerGap(299, Short.MAX_VALUE))
);
panel_configHTML.setLayout(gl_panel_configHTML);
return panel_configHTML;
@ -680,12 +680,40 @@ public class ConfigurationWindow extends JFrame {
JComboBox cbox_type = new JComboBox(types);
JLabel lb_type = new JLabel("Type");
JLabel lb_metadataFilePath = new JLabel("Metadata path");
JTextField tf_metadataPath = new JTextField("");
configuration.put("csv_metadata", tf_metadataPath);
tf_metadataPath.setColumns(10);
JButton btn_metadataChoose = new JButton("Choose");
btn_metadataChoose.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileDialog fileDialog = new FileDialog();
String newFilePath = fileDialog.chooseFile(tf_metadataPath.getText(),"csv");
if (newFilePath != null && !newFilePath.isEmpty()) {
tf_metadataPath.setText(newFilePath);
}
}
});
GroupLayout gl_panel_configHTML = new GroupLayout(panel_configHTML);
gl_panel_configHTML.setHorizontalGroup(
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_configHTML.createSequentialGroup()
.addGap(32)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_configHTML.createSequentialGroup()
.addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 125, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(tf_OutputFile, 600, 600, 600)
.addGap(6)
.addComponent(btn_ChooseOutputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))
.addGroup(gl_panel_configHTML.createSequentialGroup()
.addComponent(lb_type, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(cbox_type, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGroup(gl_panel_configHTML.createSequentialGroup()
.addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
@ -706,22 +734,20 @@ public class ConfigurationWindow extends JFrame {
.addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE)
.addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 156, GroupLayout.PREFERRED_SIZE)
.addGroup(gl_panel_configHTML.createSequentialGroup()
.addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 125, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(tf_OutputFile, 600, 600, 600)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.TRAILING, false)
.addGroup(Alignment.LEADING, gl_panel_configHTML.createSequentialGroup()
.addComponent(lb_metadataFilePath, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(tf_metadataPath))
.addGroup(Alignment.LEADING, gl_panel_configHTML.createSequentialGroup()
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
.addGap(32)
.addComponent(tf_inputFile, GroupLayout.PREFERRED_SIZE, 600, GroupLayout.PREFERRED_SIZE)))
.addGap(6)
.addComponent(btn_ChooseOutputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))
.addGroup(gl_panel_configHTML.createSequentialGroup()
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
.addGap(32)
.addComponent(tf_inputFile, GroupLayout.PREFERRED_SIZE, 600, GroupLayout.PREFERRED_SIZE)
.addGap(6)
.addComponent(btnChooseFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))
.addGroup(gl_panel_configHTML.createSequentialGroup()
.addComponent(lb_type, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(cbox_type, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
.addContainerGap(70, Short.MAX_VALUE))
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
.addComponent(btn_metadataChoose, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)
.addComponent(btnChooseFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))))
.addGap(48))
);
gl_panel_configHTML.setVerticalGroup(
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
@ -739,7 +765,16 @@ public class ConfigurationWindow extends JFrame {
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
.addComponent(tf_inputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(btnChooseFile))))
.addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_configHTML.createSequentialGroup()
.addGap(23)
.addComponent(lb_metadataFilePath))
.addGroup(gl_panel_configHTML.createSequentialGroup()
.addGap(21)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
.addComponent(tf_metadataPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(btn_metadataChoose))))
.addGap(29)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
.addComponent(tf_OutputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
@ -747,18 +782,18 @@ public class ConfigurationWindow extends JFrame {
.addGroup(gl_panel_configHTML.createSequentialGroup()
.addGap(2)
.addComponent(lb_OutFilePath)))
.addGap(24)
.addGap(18)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
.addComponent(lb_type)
.addComponent(cbox_type, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(18)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
.addComponent(lb_Scale)
.addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(18)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_configHTML.createSequentialGroup()
.addGap(8)
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
.addComponent(lb_Scale)
.addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(lb_FilterLetterSpacing)
.addGap(4)
.addComponent(cb_InlineStyles)
@ -777,7 +812,7 @@ public class ConfigurationWindow extends JFrame {
.addComponent(cb_IgnoreEmptyParagraphs)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(cb_UseMathJax)
.addContainerGap(311, Short.MAX_VALUE))
.addContainerGap(294, Short.MAX_VALUE))
);
panel_configHTML.setLayout(gl_panel_configHTML);
return panel_configHTML;

View file

@ -108,7 +108,6 @@ public class Document {
}
} catch (Throwable e) {
System.out.println("xDesktop inaccessible. Can not proceed.");
Debug.printLog(e.getStackTrace().toString(), componentContext);
return;
}