diff --git a/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationWindow.java b/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationWindow.java index 849f039..e74d895 100644 --- a/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationWindow.java +++ b/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationWindow.java @@ -20,6 +20,8 @@ import javax.swing.JCheckBox; import javax.swing.JTextField; import javax.swing.GroupLayout; import javax.swing.GroupLayout.Alignment; +import javax.swing.GroupLayout.ParallelGroup; +import javax.swing.GroupLayout.SequentialGroup; import javax.swing.LayoutStyle.ComponentPlacement; import javax.swing.JRadioButton; import javax.swing.JButton; @@ -29,10 +31,6 @@ import javax.swing.JSplitPane; import java.awt.BorderLayout; import javax.swing.JDesktopPane; import javax.swing.BoxLayout; -import com.jgoodies.forms.layout.FormLayout; -import com.jgoodies.forms.layout.ColumnSpec; -import com.jgoodies.forms.layout.RowSpec; -import com.jgoodies.forms.layout.FormSpecs; import javax.swing.SpringLayout; import java.awt.FlowLayout; import java.awt.CardLayout; @@ -51,21 +49,18 @@ public class ConfigurationWindow extends JFrame { * Launch the application. */ public static void main(String[] args) { + runGUI(null); } private XComponentContext context; - private JTextField tf_MaxWidth; - private JTextField tf_FilterLetterSpacing; - private JTextField textField_1; - private JTextField textField; /** * Create the application. */ public ConfigurationWindow() { setTitle("Converter from ODT to HTML, ePub and RDF"); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setIconImage(Toolkit.getDefaultToolkit().getImage(ConfigurationWindow.class.getResource("/pro/litvinovg/w2phtml/gui/resources/w2phtml.png"))); initComponents(); createEvents(); @@ -74,7 +69,7 @@ public class ConfigurationWindow extends JFrame { public ConfigurationWindow(XComponentContext context) { this.context = context; setTitle("Converter from ODT to HTML, ePub and RDF"); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setIconImage(Toolkit.getDefaultToolkit().getImage(ConfigurationWindow.class.getResource("/pro/litvinovg/w2phtml/gui/resources/w2phtml.png"))); initComponents(); createEvents(); @@ -86,85 +81,103 @@ public class ConfigurationWindow extends JFrame { } private void initComponents() { + getContentPane().setLayout(new GridLayout(1, 0, 0, 0)); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.LEFT); getContentPane().add(tabbedPane); - JPanel panel_rdf = createRDFPanel(); - - JPanel panel_epub = createEpubPanel(); - + //JPanel panel_rdf = createRDFPanel(); + //JPanel panel_epub = createEpubPanel(); JPanel panel_html = createHTMLPanel(); + tabbedPane.addTab("HTML", null, panel_html, null); - tabbedPane.addTab("RDF", null, panel_rdf, null); - tabbedPane.addTab("ePub", null, panel_epub, null); - - + //tabbedPane.addTab("RDF", null, panel_rdf, null); + //tabbedPane.addTab("ePub", null, panel_epub, null); + } private JPanel createEpubPanel() { JPanel panel_epub = new JPanel(); - GroupLayout gl_panel_epub = new GroupLayout(panel_epub); - gl_panel_epub.setHorizontalGroup( - gl_panel_epub.createParallelGroup(Alignment.LEADING) - .addGap(0, 968, Short.MAX_VALUE) - ); - gl_panel_epub.setVerticalGroup( - gl_panel_epub.createParallelGroup(Alignment.TRAILING) - .addGap(0, 745, Short.MAX_VALUE) - ); - panel_epub.setLayout(gl_panel_epub); + + JPanel panel_control = createControlPanel(panel_epub); + + JPanel panel_configEpub = createConfigEpubPanel(); + + applyDefaultLayout(panel_epub, panel_configEpub, panel_control); + return panel_epub; } private JPanel createRDFPanel() { JPanel panel_rdf = new JPanel(); - GroupLayout gl_panel_rdf = new GroupLayout(panel_rdf); - gl_panel_rdf.setHorizontalGroup( - gl_panel_rdf.createParallelGroup(Alignment.LEADING) - .addGap(0, 968, Short.MAX_VALUE) - ); - gl_panel_rdf.setVerticalGroup( - gl_panel_rdf.createParallelGroup(Alignment.LEADING) - .addGap(0, 745, Short.MAX_VALUE) - ); - panel_rdf.setLayout(gl_panel_rdf); + + JPanel panel_control = createControlPanel(panel_rdf); + + JPanel panel_configRDF = createConfigRDFPanel(); + + applyDefaultLayout2(panel_rdf, panel_configRDF, panel_control); + return panel_rdf; } private JPanel createHTMLPanel() { JPanel panel_html = new JPanel(); - JPanel panel_control = createControlPanel(); - JPanel panel_configHTML = createConfigHTMLPanel(); - GroupLayout gl_panel_html = new GroupLayout(panel_html); - gl_panel_html.setHorizontalGroup(gl_panel_html.createParallelGroup(Alignment.TRAILING) - .addGroup(gl_panel_html.createSequentialGroup().addGroup(gl_panel_html.createParallelGroup(Alignment.TRAILING).addComponent(panel_configHTML, GroupLayout.DEFAULT_SIZE, 852, Short.MAX_VALUE).addComponent(panel_control, GroupLayout.DEFAULT_SIZE, 852, Short.MAX_VALUE)).addGap(4))); - gl_panel_html.setVerticalGroup(gl_panel_html.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, - gl_panel_html.createSequentialGroup().addComponent(panel_configHTML, GroupLayout.DEFAULT_SIZE, 691, Short.MAX_VALUE).addPreferredGap(ComponentPlacement.RELATED).addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE))); + JPanel panel_control = createControlPanel(panel_configHTML); - - panel_html.setLayout(gl_panel_html); + applyDefaultLayout3(panel_html, panel_configHTML, panel_control); + return panel_html; } - private JPanel createConfigHTMLPanel() { + private void applyDefaultLayout(JPanel tabbedPanel, JPanel configPanel, JPanel controlPanel) { + + GroupLayout gl_panel_html = new GroupLayout(tabbedPanel); + gl_panel_html.setHorizontalGroup(gl_panel_html.createParallelGroup(Alignment.TRAILING) + .addGroup(gl_panel_html.createSequentialGroup().addGroup(gl_panel_html.createParallelGroup(Alignment.TRAILING) + .addComponent(configPanel, GroupLayout.DEFAULT_SIZE, 852, Short.MAX_VALUE).addComponent(controlPanel, GroupLayout.DEFAULT_SIZE, 852, Short.MAX_VALUE)).addGap(4))); + gl_panel_html.setVerticalGroup(gl_panel_html.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, + gl_panel_html.createSequentialGroup() + .addComponent(configPanel, GroupLayout.DEFAULT_SIZE, 691, Short.MAX_VALUE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(controlPanel, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE))); + tabbedPanel.setLayout(gl_panel_html); + } + private void applyDefaultLayout2(JPanel tabbedPanel, JPanel configPanel, JPanel controlPanel) { + + GroupLayout gl_panel_html = new GroupLayout(tabbedPanel); + gl_panel_html.setHorizontalGroup(gl_panel_html.createParallelGroup(Alignment.TRAILING) + .addGroup(gl_panel_html.createSequentialGroup().addGroup(gl_panel_html.createParallelGroup(Alignment.TRAILING) + .addComponent(configPanel, GroupLayout.DEFAULT_SIZE, 852, Short.MAX_VALUE).addComponent(controlPanel, GroupLayout.DEFAULT_SIZE, 852, Short.MAX_VALUE)).addGap(4))); + gl_panel_html.setVerticalGroup(gl_panel_html.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, + gl_panel_html.createSequentialGroup() + .addComponent(configPanel, GroupLayout.DEFAULT_SIZE, 691, Short.MAX_VALUE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(controlPanel, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE))); + tabbedPanel.setLayout(gl_panel_html); + } + private void applyDefaultLayout3(JPanel tabbedPanel, JPanel configPanel, JPanel controlPanel) { + + GroupLayout gl_panel_html = new GroupLayout(tabbedPanel); + gl_panel_html.setHorizontalGroup(gl_panel_html.createParallelGroup(Alignment.TRAILING) + .addGroup(gl_panel_html.createSequentialGroup().addGroup(gl_panel_html.createParallelGroup(Alignment.TRAILING) + .addComponent(configPanel, GroupLayout.DEFAULT_SIZE, 852, Short.MAX_VALUE).addComponent(controlPanel, GroupLayout.DEFAULT_SIZE, 852, Short.MAX_VALUE)).addGap(4))); + gl_panel_html.setVerticalGroup(gl_panel_html.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, + gl_panel_html.createSequentialGroup() + .addComponent(configPanel, GroupLayout.DEFAULT_SIZE, 691, Short.MAX_VALUE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(controlPanel, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE))); + tabbedPanel.setLayout(gl_panel_html); + } + + private JPanel createConfigRDFPanel() { JPanel panel_configHTML = new JPanel(); - JCheckBox cb_IgnoreEmptyParagraphs_2_1_1 = new JCheckBox("Use MathJax"); - - JCheckBox cb_IgnoreEmptyParagraphs_2 = new JCheckBox("Split on whole pages only"); - - JLabel lb_FilterLetterSpacing_1 = new JLabel("Split into multiple files by heading level"); - - textField = new JTextField(); - textField.setColumns(10); - - JCheckBox cb_IgnoreEmptyParagraphs_1 = new JCheckBox("Split document into subsections for Greenstone digital library"); + JCheckBox cb_UseMathJax = new JCheckBox("Use MathJax"); JCheckBox cb_IgnoreEmptyParagraphs = new JCheckBox("Filter empty paragraphs"); @@ -172,7 +185,91 @@ public class ConfigurationWindow extends JFrame { JLabel lb_FilterLetterSpacing = new JLabel("Filter letter spacing less than"); - tf_FilterLetterSpacing = new JTextField(); + JTextField tf_FilterLetterSpacing = new JTextField(); + tf_FilterLetterSpacing.setColumns(10); + + JCheckBox cb_InlineStyles = new JCheckBox("Inline styles1"); + + JCheckBox cb_EmbedVectorImages = new JCheckBox("Embed vector images"); + + JCheckBox cb_EmbedRaster = new JCheckBox("Embed raster images"); + + JLabel lb_MaxWidth_1 = new JLabel("Scale"); + + JTextField tf_Scale = new JTextField(); + tf_Scale.setColumns(10); + + JCheckBox cb_ConversionToRem = new JCheckBox("Convert dimensions to REM"); + GroupLayout gl_panel_configHTML = new GroupLayout(panel_configHTML); + gl_panel_configHTML.setHorizontalGroup( + gl_panel_configHTML.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addGap(40) + .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING) + .addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addComponent(lb_MaxWidth_1, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE) + .addGap(18) + .addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 253, GroupLayout.PREFERRED_SIZE) + .addGap(18) + .addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)) + .addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE) + .addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE) + .addComponent(cb_EmbedRaster, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE) + .addComponent(cb_ConversionToRem, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE) + .addComponent(cb_IgnoreHardLineBreaks, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE) + .addComponent(cb_IgnoreEmptyParagraphs, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)) + .addContainerGap(332, Short.MAX_VALUE)) + ); + gl_panel_configHTML.setVerticalGroup( + gl_panel_configHTML.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addGap(38) + .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addGap(2) + .addComponent(lb_MaxWidth_1)) + .addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(31) + .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addGap(2) + .addComponent(lb_FilterLetterSpacing)) + .addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(2) + .addComponent(cb_InlineStyles) + .addGap(7) + .addComponent(cb_EmbedVectorImages) + .addGap(7) + .addComponent(cb_EmbedRaster) + .addGap(7) + .addComponent(cb_ConversionToRem) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(cb_IgnoreHardLineBreaks) + .addGap(7) + .addComponent(cb_IgnoreEmptyParagraphs) + .addGap(83) + .addComponent(cb_UseMathJax) + .addContainerGap(310, Short.MAX_VALUE)) + ); + panel_configHTML.setLayout(gl_panel_configHTML); + return panel_configHTML; + } + + private JPanel createConfigEpubPanel() { + JPanel panel_configHTML = new JPanel(); + + JCheckBox cb_UseMathJax = new JCheckBox("Use MathJax"); + + JCheckBox cb_IgnoreEmptyParagraphs = new JCheckBox("Filter empty paragraphs"); + + JCheckBox cb_IgnoreHardLineBreaks = new JCheckBox("Filter hard line breaks"); + + JLabel lb_FilterLetterSpacing = new JLabel("Filter letter spacing less than"); + + JTextField tf_FilterLetterSpacing = new JTextField(); tf_FilterLetterSpacing.setColumns(10); JCheckBox cb_InlineStyles = new JCheckBox("Inline styles"); @@ -183,61 +280,237 @@ public class ConfigurationWindow extends JFrame { JLabel lb_MaxWidth_1 = new JLabel("Scale"); - textField_1 = new JTextField(); - textField_1.setColumns(10); + JTextField tf_Scale = new JTextField(); + tf_Scale.setColumns(10); + + JCheckBox cb_ConversionToRem = new JCheckBox("Convert dimensions to REM"); + GroupLayout gl_panel_configHTML = new GroupLayout(panel_configHTML); + gl_panel_configHTML.setHorizontalGroup( + gl_panel_configHTML.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addGap(40) + .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING) + .addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addComponent(lb_MaxWidth_1, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE) + .addGap(18) + .addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 253, GroupLayout.PREFERRED_SIZE) + .addGap(18) + .addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)) + .addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE) + .addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE) + .addComponent(cb_EmbedRaster, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE) + .addComponent(cb_ConversionToRem, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE) + .addComponent(cb_IgnoreHardLineBreaks, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE) + .addComponent(cb_IgnoreEmptyParagraphs, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)) + .addContainerGap(332, Short.MAX_VALUE)) + ); + gl_panel_configHTML.setVerticalGroup( + gl_panel_configHTML.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addGap(38) + .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addGap(2) + .addComponent(lb_MaxWidth_1)) + .addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(31) + .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addGap(2) + .addComponent(lb_FilterLetterSpacing)) + .addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(2) + .addComponent(cb_InlineStyles) + .addGap(7) + .addComponent(cb_EmbedVectorImages) + .addGap(7) + .addComponent(cb_EmbedRaster) + .addGap(7) + .addComponent(cb_ConversionToRem) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(cb_IgnoreHardLineBreaks) + .addGap(7) + .addComponent(cb_IgnoreEmptyParagraphs) + .addGap(83) + .addComponent(cb_UseMathJax) + .addContainerGap(310, Short.MAX_VALUE)) + ); + panel_configHTML.setLayout(gl_panel_configHTML); + return panel_configHTML; + } + + private JPanel createConfigHTMLPanel() { + JPanel panel_configHTML = new JPanel(); + + JCheckBox cb_UseMathJax = new JCheckBox("Use MathJax"); + + JCheckBox cb_IgnoreEmptyParagraphs_2 = new JCheckBox("Split on whole pages only"); + + JLabel lb_SplitByLevel = new JLabel("Split into multiple files by heading level"); + + JTextField tf_SplitByLevel = new JTextField(); + tf_SplitByLevel.setColumns(10); + + JCheckBox cb_Greenstone = new JCheckBox("Split document into subsections for Greenstone digital library"); + + JCheckBox cb_IgnoreEmptyParagraphs = new JCheckBox("Filter empty paragraphs"); + + JCheckBox cb_IgnoreHardLineBreaks = new JCheckBox("Filter hard line breaks"); + + JLabel lb_FilterLetterSpacing = new JLabel("Filter letter spacing less than"); + + JTextField tf_FilterLetterSpacing = new JTextField(); + tf_FilterLetterSpacing.setColumns(10); + + JCheckBox cb_InlineStyles = new JCheckBox("Inline styles"); + + JCheckBox cb_EmbedVectorImages = new JCheckBox("Embed vector images"); + + JCheckBox cb_EmbedRaster = new JCheckBox("Embed raster images"); + + JLabel lb_Scale = new JLabel("Scale"); + + JTextField tf_Scale = new JTextField(); + tf_Scale.setColumns(10); JLabel lb_MaxWidth = new JLabel("Max body width"); - tf_MaxWidth = new JTextField(); + JTextField tf_MaxWidth = new JTextField(); tf_MaxWidth.setColumns(10); JCheckBox cb_ConversionToRem = new JCheckBox("Convert dimensions to REM"); GroupLayout gl_panel_configHTML = new GroupLayout(panel_configHTML); - gl_panel_configHTML.setHorizontalGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING) - .addGroup(gl_panel_configHTML.createSequentialGroup().addGap(40) - .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING).addComponent(cb_IgnoreEmptyParagraphs_2_1_1, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE) - .addGroup(gl_panel_configHTML.createSequentialGroup().addComponent(lb_MaxWidth_1, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE).addGap(18).addComponent(textField_1, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panel_configHTML.createSequentialGroup().addComponent(lb_MaxWidth).addGap(18).addComponent(tf_MaxWidth, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panel_configHTML.createSequentialGroup().addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 253, GroupLayout.PREFERRED_SIZE).addGap(18).addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)) - .addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE).addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE).addComponent(cb_EmbedRaster, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE) - .addComponent(cb_ConversionToRem, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE).addComponent(cb_IgnoreHardLineBreaks, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE) - .addComponent(cb_IgnoreEmptyParagraphs, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE).addComponent(cb_IgnoreEmptyParagraphs_1, GroupLayout.PREFERRED_SIZE, 482, GroupLayout.PREFERRED_SIZE) - .addGroup(gl_panel_configHTML.createSequentialGroup().addComponent(lb_FilterLetterSpacing_1, GroupLayout.PREFERRED_SIZE, 325, GroupLayout.PREFERRED_SIZE).addGap(12).addComponent(textField, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)) - .addComponent(cb_IgnoreEmptyParagraphs_2, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)) - .addContainerGap(332, Short.MAX_VALUE))); - gl_panel_configHTML.setVerticalGroup(gl_panel_configHTML.createParallelGroup(Alignment.TRAILING).addGroup(Alignment.LEADING, - gl_panel_configHTML.createSequentialGroup().addGap(38) - .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_configHTML.createSequentialGroup().addGap(2).addComponent(lb_MaxWidth_1)).addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)).addGap(6) - .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_configHTML.createSequentialGroup().addGap(2).addComponent(lb_MaxWidth)).addComponent(tf_MaxWidth, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)).addGap(6) - .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_configHTML.createSequentialGroup().addGap(2).addComponent(lb_FilterLetterSpacing)).addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)).addGap(2) - .addComponent(cb_InlineStyles).addGap(7).addComponent(cb_EmbedVectorImages).addGap(7).addComponent(cb_EmbedRaster).addGap(7).addComponent(cb_ConversionToRem).addPreferredGap(ComponentPlacement.RELATED).addComponent(cb_IgnoreHardLineBreaks).addGap(7).addComponent(cb_IgnoreEmptyParagraphs) - .addGap(4).addComponent(cb_IgnoreEmptyParagraphs_1).addGap(8) - .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_configHTML.createSequentialGroup().addGap(2).addComponent(lb_FilterLetterSpacing_1)).addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(ComponentPlacement.RELATED).addComponent(cb_IgnoreEmptyParagraphs_2).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(cb_IgnoreEmptyParagraphs_2_1_1).addContainerGap(310, Short.MAX_VALUE))); + gl_panel_configHTML.setHorizontalGroup( + gl_panel_configHTML.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addGap(40) + .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING) + .addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE) + .addGap(18) + .addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addComponent(lb_MaxWidth) + .addGap(18) + .addComponent(tf_MaxWidth, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 253, GroupLayout.PREFERRED_SIZE) + .addGap(18) + .addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)) + .addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE) + .addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE) + .addComponent(cb_EmbedRaster, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE) + .addComponent(cb_ConversionToRem, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE) + .addComponent(cb_IgnoreHardLineBreaks, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE) + .addComponent(cb_IgnoreEmptyParagraphs, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE) + .addComponent(cb_Greenstone, GroupLayout.PREFERRED_SIZE, 482, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addComponent(lb_SplitByLevel, GroupLayout.PREFERRED_SIZE, 295, GroupLayout.PREFERRED_SIZE) + .addGap(42) + .addComponent(tf_SplitByLevel, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)) + .addComponent(cb_IgnoreEmptyParagraphs_2, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)) + .addContainerGap(332, Short.MAX_VALUE)) + ); + gl_panel_configHTML.setVerticalGroup( + gl_panel_configHTML.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addGap(38) + .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addGap(2) + .addComponent(lb_Scale)) + .addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(6) + .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addGap(2) + .addComponent(lb_MaxWidth)) + .addComponent(tf_MaxWidth, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(6) + .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addGap(2) + .addComponent(lb_FilterLetterSpacing)) + .addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(2) + .addComponent(cb_InlineStyles) + .addGap(7) + .addComponent(cb_EmbedVectorImages) + .addGap(7) + .addComponent(cb_EmbedRaster) + .addGap(7) + .addComponent(cb_ConversionToRem) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(cb_IgnoreHardLineBreaks) + .addGap(7) + .addComponent(cb_IgnoreEmptyParagraphs) + .addGap(4) + .addComponent(cb_Greenstone) + .addGap(8) + .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING) + .addComponent(tf_SplitByLevel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_panel_configHTML.createSequentialGroup() + .addGap(2) + .addComponent(lb_SplitByLevel))) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(cb_IgnoreEmptyParagraphs_2) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addComponent(cb_UseMathJax) + .addContainerGap(310, Short.MAX_VALUE)) + ); panel_configHTML.setLayout(gl_panel_configHTML); return panel_configHTML; } - private JPanel createControlPanel() { - JPanel panel_control = new JPanel(); + private JPanel createControlPanel(JPanel configurationPanel) { + JPanel controlPanel = new JPanel(); - GroupLayout gl_panel_control = new GroupLayout(panel_control); - JButton btn_Exit = new JButton("Close converter"); + JButton btn_Exit = new JButton("Exit"); btn_Exit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { singleFrame.setVisible(false); singleFrame.dispose(); } }); - JButton btn_SaveConfig = new JButton("Save configuration"); + + JButton btn_SaveAs = new JButton("Save As"); + + JButton btn_Save = new JButton("Save"); + JButton btn_Convert = new JButton("Convert"); - gl_panel_control.setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, gl_panel_control.createSequentialGroup().addContainerGap(200, Short.MAX_VALUE).addComponent(btn_Exit, GroupLayout.PREFERRED_SIZE, 165, GroupLayout.PREFERRED_SIZE).addGap(5) - .addComponent(btn_SaveConfig).addGap(5).addComponent(btn_Convert, GroupLayout.PREFERRED_SIZE, 136, GroupLayout.PREFERRED_SIZE).addGap(286))); - gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) - .addGroup(gl_panel_control.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addGroup(gl_panel_control.createParallelGroup(Alignment.LEADING).addComponent(btn_Convert).addComponent(btn_Exit).addComponent(btn_SaveConfig)).addContainerGap())); - panel_control.setLayout(gl_panel_control); - return panel_control; + GroupLayout gl_panel_control = new GroupLayout(controlPanel); + gl_panel_control.setHorizontalGroup( + gl_panel_control.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_control.createSequentialGroup() + .addGap(83) + .addComponent(btn_Exit, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE) + .addGap(18) + .addComponent(btn_SaveAs, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE) + .addGap(18) + .addComponent(btn_Save, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE) + .addGap(18) + .addComponent(btn_Convert, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE) + .addContainerGap(427, Short.MAX_VALUE)) + ); + gl_panel_control.setVerticalGroup( + gl_panel_control.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_control.createSequentialGroup() + .addContainerGap() + .addGroup(gl_panel_control.createParallelGroup(Alignment.BASELINE) + .addComponent(btn_SaveAs) + .addComponent(btn_Save) + .addComponent(btn_Exit) + .addComponent(btn_Convert)) + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + controlPanel.setLayout(gl_panel_control); + return controlPanel; } public static void runGUI(XComponentContext context) {