fix: multiple fixes in GUI. Panel classes were populated with component creation method to fix window builder interface. Fixed selection of output folder. Improved some translations.
This commit is contained in:
parent
027106e1b7
commit
86bbdab7c5
8 changed files with 1223 additions and 795 deletions
|
@ -1,253 +0,0 @@
|
|||
package pro.litvinovg.w2phtml.gui;
|
||||
|
||||
import static pro.litvinovg.w2phtml.gui.Contstants.*;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
public class BasePanel extends JPanel {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private UIPreferences preferences = null;
|
||||
private HashMap<String, Component> configuration = null;
|
||||
|
||||
public BasePanel(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
this.configuration = configuration;
|
||||
this.preferences = preferences;
|
||||
}
|
||||
|
||||
|
||||
public BasePanel() {
|
||||
}
|
||||
|
||||
|
||||
protected JCheckBox addMathJaxCB(UIPreferences preferences) {
|
||||
JCheckBox cb_UseMathJax = new JCheckBox(Localizer.get(LABEL_USE_MATHJAX));
|
||||
cb_UseMathJax.setSelected(Boolean.parseBoolean(preferences.get(PREF_USE_MATHJAX)));
|
||||
return cb_UseMathJax;
|
||||
}
|
||||
|
||||
protected void setOutputFilePath(String newFilePath, JTextField tf_OutputFile, String extension) {
|
||||
|
||||
File inputFile = new File(newFilePath);
|
||||
if (!inputFile.exists()) {
|
||||
return;
|
||||
}
|
||||
if (!inputFile.isDirectory()) {
|
||||
File parent = inputFile.getParentFile();
|
||||
if (parent == null) {
|
||||
return;
|
||||
}
|
||||
if (!parent.canWrite()) {
|
||||
JOptionPane.showMessageDialog(ConfigurationWindow.getSingleFrame(), Localizer.get(CANT_WRITE_MESSAGE));
|
||||
}
|
||||
}
|
||||
if (newFilePath.length() < 3) {
|
||||
return;
|
||||
}
|
||||
String exportPath;
|
||||
if (inputFile.isDirectory()) {
|
||||
exportPath = newFilePath;
|
||||
tf_OutputFile.setText(exportPath);
|
||||
} else {
|
||||
String importExt = newFilePath.substring(newFilePath.length() - 3, newFilePath.length()).toLowerCase();
|
||||
if (importExt.equals(ODT_FILE_EXTENSION)) {
|
||||
exportPath = newFilePath.substring(0, newFilePath.length() - 3) + extension;
|
||||
tf_OutputFile.setText(exportPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected JCheckBox addIgnoreEmptyParsCB() {
|
||||
JCheckBox cb_IgnoreEmptyParagraphs = new JCheckBox(Localizer.get(LABEL_INGNORE_EMPTY_PARS));
|
||||
cb_IgnoreEmptyParagraphs.setSelected(Boolean.parseBoolean(preferences.get(PREF_IGNORE_EMPTY_PARS)));
|
||||
configuration.put(ARG_IGNORE_EMPTY_PARAGRAPHS, cb_IgnoreEmptyParagraphs);
|
||||
return cb_IgnoreEmptyParagraphs;
|
||||
}
|
||||
|
||||
protected JCheckBox addSplitWholePagesOnly() {
|
||||
JCheckBox cb_SplitWholePagesOnly = new JCheckBox(Localizer.get(LABEL_SPLIT_WHOLE_PAGES_ONLY));
|
||||
cb_SplitWholePagesOnly.setSelected(Boolean.parseBoolean(preferences.get(PREF_SPLIT_WHOLE_PAGES)));
|
||||
configuration.put(ARG_ALIGN_SPLITS_TO_PAGES, cb_SplitWholePagesOnly);
|
||||
return cb_SplitWholePagesOnly;
|
||||
}
|
||||
|
||||
protected JCheckBox addMathJaxCB() {
|
||||
JCheckBox cb_UseMathJax = new JCheckBox(Localizer.get(LABEL_USE_MATHJAX));
|
||||
cb_UseMathJax.setSelected(Boolean.parseBoolean(preferences.get(PREF_USE_MATHJAX)));
|
||||
configuration.put(ARG_USE_MATHJAX, cb_UseMathJax);
|
||||
return cb_UseMathJax;
|
||||
}
|
||||
protected JCheckBox addIgnoreHardLineBreaks() {
|
||||
JCheckBox cb_IgnoreHardLineBreaks = new JCheckBox(Localizer.get(LABEL_FILETER_HARD_LINE_BREAKS));
|
||||
cb_IgnoreHardLineBreaks.setSelected(Boolean.parseBoolean(preferences.get(PREF_IGNORE_HARD_BREAKS)));
|
||||
configuration.put(ARG_IGNORE_HARD_LINE_BREAKS, cb_IgnoreHardLineBreaks);
|
||||
return cb_IgnoreHardLineBreaks;
|
||||
}
|
||||
|
||||
protected JTextField addLetterSpacingFilter() {
|
||||
JTextField tf_FilterLetterSpacing = new JTextField();
|
||||
tf_FilterLetterSpacing.setText(preferences.get(PREF_LETTER_SPACING));
|
||||
configuration.put(ARG_MIN_LETTER_SPACING, tf_FilterLetterSpacing);
|
||||
tf_FilterLetterSpacing.setColumns(10);
|
||||
return tf_FilterLetterSpacing;
|
||||
}
|
||||
|
||||
|
||||
protected JCheckBox addInlineStyles() {
|
||||
JCheckBox cb_InlineStyles = new JCheckBox(Localizer.get(LABEL_INLINE_STYLES));
|
||||
cb_InlineStyles.setSelected(Boolean.parseBoolean(preferences.get(PREF_INLINE_STYLES)));
|
||||
configuration.put(ARG_CSS_INLINE, cb_InlineStyles);
|
||||
return cb_InlineStyles;
|
||||
}
|
||||
|
||||
protected JCheckBox addGreenstoneTags() {
|
||||
JCheckBox cb_Greenstone = new JCheckBox(Localizer.get(LABEL_GREENSTONE_SPLIT));
|
||||
configuration.put(ARG_GREENSTONE, cb_Greenstone);
|
||||
cb_Greenstone.setSelected(Boolean.parseBoolean(preferences.get(PREF_GREENSTONE_TAGS)));
|
||||
return cb_Greenstone;
|
||||
}
|
||||
|
||||
protected JTextField addOutputFileTextField() {
|
||||
JTextField tf_OutputFile = new JTextField("");
|
||||
configuration.put(ARG_OUTPUT_FILE, tf_OutputFile);
|
||||
tf_OutputFile.setColumns(10);
|
||||
return tf_OutputFile;
|
||||
}
|
||||
|
||||
protected JCheckBox addPagination() {
|
||||
JCheckBox cb_Pagination = new JCheckBox(Localizer.get(LABEL_PAGINATION));
|
||||
cb_Pagination.setSelected(Boolean.getBoolean(preferences.get(PREF_PAGINATION)));
|
||||
configuration.put(ARG_PAGINATION, cb_Pagination);
|
||||
return cb_Pagination;
|
||||
}
|
||||
|
||||
protected JCheckBox addConvertToPX() {
|
||||
JCheckBox cb_convertToPx = new JCheckBox(Localizer.get(LABEL_CONVERT_TO_PX));
|
||||
cb_convertToPx.setSelected(Boolean.getBoolean(preferences.get(PREF_CONVERT_TO_PX)));
|
||||
configuration.put(ARG_CONVERT_TO_PX, cb_convertToPx);
|
||||
return cb_convertToPx;
|
||||
}
|
||||
|
||||
protected JTextField addPageBreakStyle() {
|
||||
JTextField tf_pageBreakInlineStyle = new JTextField(preferences.get(PREF_PAGEBREAK_STYLES));
|
||||
tf_pageBreakInlineStyle.setColumns(10);
|
||||
configuration.put(ARG_PAGE_BREAK_STYLE, tf_pageBreakInlineStyle);
|
||||
return tf_pageBreakInlineStyle;
|
||||
}
|
||||
|
||||
protected JLabel addTargetFormat(String format) {
|
||||
JLabel lb_TargetFormat = new JLabel(format);
|
||||
configuration.put(ARG_TARGET_FORMAT, lb_TargetFormat);
|
||||
return lb_TargetFormat;
|
||||
}
|
||||
|
||||
protected JTextField addScaling() {
|
||||
JTextField tf_Scale = new JTextField();
|
||||
tf_Scale.setText(preferences.get(PREF_SCALING));
|
||||
tf_Scale.setColumns(10);
|
||||
configuration.put(ARG_SCALING, tf_Scale);
|
||||
return tf_Scale;
|
||||
}
|
||||
|
||||
protected JTextField addInputFile() {
|
||||
JTextField tf_inputFile = new JTextField(preferences.getSourceFileName());
|
||||
tf_inputFile.setColumns(10);
|
||||
configuration.put(ARG_INPUT_FILE, tf_inputFile);
|
||||
return tf_inputFile;
|
||||
}
|
||||
|
||||
protected JComboBox addImageResolution() {
|
||||
JComboBox cbox_image_resolution = new JComboBox(preferences.getAll(PREF_RESOLUTIONS));
|
||||
cbox_image_resolution.setSelectedIndex(Integer.parseInt(preferences.get(PREF_DEFAULT_IMAGE_RESOLUTION)));
|
||||
configuration.put(ARG_IMAGE_RESOLUTION, cbox_image_resolution);
|
||||
return cbox_image_resolution;
|
||||
}
|
||||
|
||||
protected JComboBox addSplitByLevel() {
|
||||
JComboBox cbox_SplitByLevel = new JComboBox(preferences.getAll(PREF_SPLIT_LEVELS));
|
||||
configuration.put(ARG_SPLIT_LEVEL, cbox_SplitByLevel);
|
||||
cbox_SplitByLevel.setSelectedIndex(Integer.parseInt(preferences.get(PREF_SPLIT_BY_LEVEL)));
|
||||
return cbox_SplitByLevel;
|
||||
}
|
||||
|
||||
protected JTextField addMaxWidth() {
|
||||
JTextField tf_MaxWidth = new JTextField(preferences.get(PREF_MAX_WIDTH));
|
||||
tf_MaxWidth.setColumns(10);
|
||||
configuration.put(ARG_MAX_WIDTH, tf_MaxWidth);
|
||||
return tf_MaxWidth;
|
||||
}
|
||||
|
||||
protected JCheckBox addEmbedRasterImages() {
|
||||
JCheckBox cb_EmbedRaster = new JCheckBox(Localizer.get(LABEL_EMBED_RASTER));
|
||||
cb_EmbedRaster.setSelected(Boolean.parseBoolean(preferences.get(PREF_EMBED_RASTER)));
|
||||
configuration.put(ARG_EMBED_IMG, cb_EmbedRaster);
|
||||
return cb_EmbedRaster;
|
||||
}
|
||||
|
||||
protected JCheckBox addEmbedVectorImages() {
|
||||
JCheckBox cb_EmbedVectorImages = new JCheckBox(Localizer.get(LABEL_EMBED_VECTOR));
|
||||
cb_EmbedVectorImages.setSelected(Boolean.parseBoolean(preferences.get(PREF_EMBED_VECTOR)));
|
||||
configuration.put(ARG_EMBED_SVG, cb_EmbedVectorImages);
|
||||
return cb_EmbedVectorImages;
|
||||
}
|
||||
|
||||
protected JButton addChooseOutputButton(JTextField tf_OutputFile, String fileExtension) {
|
||||
JButton btn_ChooseOutputFile = new JButton(Localizer.get(LABEL_BUTTON_CHOOSE));
|
||||
btn_ChooseOutputFile.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
FileDialog fileDialog = new FileDialog();
|
||||
String newFilePath = fileDialog.chooseFile(tf_OutputFile.getText(),fileExtension);
|
||||
if (newFilePath != null && !newFilePath.isEmpty()) {
|
||||
tf_OutputFile.setText(newFilePath);
|
||||
}
|
||||
}
|
||||
});
|
||||
return btn_ChooseOutputFile;
|
||||
}
|
||||
|
||||
protected void setMetadataFilePath(String newFilePath, JTextField tf_MetadataFile, String extension) {
|
||||
|
||||
File inputFile = new File(newFilePath);
|
||||
if (!inputFile.exists()) {
|
||||
return;
|
||||
}
|
||||
if (inputFile.isDirectory()) {
|
||||
tf_MetadataFile.setText(newFilePath);
|
||||
} else {
|
||||
File parent = inputFile.getParentFile();
|
||||
if (parent == null) {
|
||||
return;
|
||||
}
|
||||
if (newFilePath.length() < 3) {
|
||||
return;
|
||||
}
|
||||
String importExt = newFilePath.substring(newFilePath.length()-3, newFilePath.length()).toLowerCase();
|
||||
if (importExt.equals(ODT_FILE_EXTENSION)) {
|
||||
String metadataPath = newFilePath.substring(0, newFilePath.length()-3) + extension;
|
||||
File metaFile = new File(metadataPath);
|
||||
if (metaFile.exists() && metaFile.canRead()){
|
||||
tf_MetadataFile.setText(metadataPath);
|
||||
} else {
|
||||
tf_MetadataFile.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@ import javax.swing.GroupLayout;
|
|||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -19,7 +20,7 @@ import org.slf4j.LoggerFactory;
|
|||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||
|
||||
public class ControlPanel extends BasePanel {
|
||||
public class ControlPanel extends JPanel {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ControlPanel.class);
|
||||
private PreferencesStorage storage;
|
||||
private String configName;
|
||||
|
@ -29,7 +30,6 @@ public class ControlPanel extends BasePanel {
|
|||
this.factory = factory;
|
||||
}
|
||||
public ControlPanel(HashMap<String,Component> configuration, PreferencesStorage storage, String configName, String configType) {
|
||||
super();
|
||||
this.storage = storage;
|
||||
this.configName = configName;
|
||||
this.configType = configType;
|
||||
|
|
|
@ -3,198 +3,418 @@ package pro.litvinovg.w2phtml.gui;
|
|||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.swing.GroupLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||
import static pro.litvinovg.w2phtml.gui.Contstants.*;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
public class EpubPanel extends JPanel {
|
||||
|
||||
public class EpubPanel extends BasePanel {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private UIPreferences preferences;
|
||||
private HashMap<String, Component> configuration;
|
||||
private JTextField tf_pageBreakInlineStyle_1;
|
||||
private JComboBox cbox_image_resolution_1;
|
||||
private JCheckBox cb_Pagination_1;
|
||||
private JTextField tf_Scale_1;
|
||||
private JTextField tf_FilterLetterSpacing_1;
|
||||
private JCheckBox cb_convertToPx_1;
|
||||
private JCheckBox cb_IgnoreHardLineBreaks_1;
|
||||
private JCheckBox cb_IgnoreEmptyParagraphs_1;
|
||||
private JCheckBox cb_UseMathJax_1;
|
||||
private JCheckBox cb_EmbedVectorImages_1;
|
||||
private JCheckBox cb_InlineStyles_1;
|
||||
private JCheckBox cb_EmbedRaster_1;
|
||||
private JTextField tf_OutputFile_1;
|
||||
private JButton btn_ChooseOutputFile_1;
|
||||
private JLabel lb_TargetFormat_1;
|
||||
private JTextField tf_inputFile_1;
|
||||
private JButton btn_chooseFile_1;
|
||||
|
||||
public EpubPanel() {
|
||||
this.preferences = PreferencesStorage.getDefaultEpub(null);
|
||||
this.configuration = new HashMap<String, Component>();
|
||||
initComponents();
|
||||
}
|
||||
|
||||
public EpubPanel(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
super(configuration, preferences);
|
||||
this.configuration = configuration;
|
||||
this.preferences = preferences;
|
||||
initComponents();
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
JLabel lb_FilterLetterSpacing = new JLabel(Localizer.get(LABEL_MIN_LETTER_SPACING));
|
||||
JLabel lb_TargetFormat_description = new JLabel(Localizer.get(LABEL_TARGET_FORMAT));
|
||||
JLabel lb_Scale = new JLabel(Localizer.get(LABEL_SCALE));
|
||||
JLabel lb_FilePath = new JLabel(Localizer.get(LABEL_INPUT_FILE_PATH));
|
||||
JLabel lb_TargetFormat = addTargetFormat(EPUB3_TARGET_FORMAT);
|
||||
JLabel lb_TargetFormat = addTargetFormat(EPUB3_TARGET_FORMAT, configuration);
|
||||
JLabel lb_ImageResolution = new JLabel(Localizer.get(LABEL_IMAGE_RESOLUTION));
|
||||
JLabel lb_OutFilePath = new JLabel(Localizer.get(OUTPUT_FILE_PATH));
|
||||
JLabel lb_pageBreakInlineStyle = new JLabel(Localizer.get(LABEL_BREAK_STYLE));
|
||||
|
||||
JTextField tf_FilterLetterSpacing = addLetterSpacingFilter();
|
||||
JTextField tf_OutputFile = addOutputFileTextField();
|
||||
JTextField tf_inputFile = addInputFile();
|
||||
JTextField tf_Scale = addScaling();
|
||||
JTextField tf_pageBreakInlineStyle = addPageBreakStyle();
|
||||
JTextField tf_FilterLetterSpacing = addLetterSpacingFilter(configuration,preferences);
|
||||
JTextField tf_OutputFile = addOutputFileTextField(configuration,preferences);
|
||||
JTextField tf_inputFile = addInputFile(configuration,preferences);
|
||||
JTextField tf_Scale = addScaling(configuration,preferences);
|
||||
JTextField tf_pageBreakInlineStyle = addPageBreakStyle(configuration,preferences);
|
||||
|
||||
JCheckBox cb_UseMathJax = addMathJaxCB();
|
||||
JCheckBox cb_IgnoreEmptyParagraphs = addIgnoreEmptyParsCB();
|
||||
JCheckBox cb_IgnoreHardLineBreaks = addIgnoreHardLineBreaks();
|
||||
JCheckBox cb_InlineStyles = addInlineStyles();
|
||||
JCheckBox cb_EmbedVectorImages = addEmbedVectorImages();
|
||||
JCheckBox cb_EmbedRaster = addEmbedRasterImages();
|
||||
JCheckBox cb_convertToPx = addConvertToPX();
|
||||
JCheckBox cb_Pagination = addPagination();
|
||||
JCheckBox cb_UseMathJax = addMathJaxCB(configuration,preferences);
|
||||
JCheckBox cb_IgnoreEmptyParagraphs = addIgnoreEmptyParsCB(configuration,preferences);
|
||||
JCheckBox cb_IgnoreHardLineBreaks = addIgnoreHardLineBreaks(configuration,preferences);
|
||||
JCheckBox cb_InlineStyles = addInlineStyles(configuration,preferences);
|
||||
JCheckBox cb_EmbedVectorImages = addEmbedVectorImages(configuration,preferences);
|
||||
JCheckBox cb_EmbedRaster = addEmbedRasterImages(configuration,preferences);
|
||||
JCheckBox cb_convertToPx = addConvertToPX(configuration,preferences);
|
||||
JCheckBox cb_Pagination = addPagination(configuration,preferences);
|
||||
|
||||
JComboBox cbox_image_resolution = addImageResolution();
|
||||
JComboBox cbox_image_resolution = addImageResolution(configuration,preferences);
|
||||
|
||||
JButton btn_ChooseOutputFile = addChooseOutputButton(tf_OutputFile, EPUB_FILE_EXTENSION);
|
||||
JButton btn_chooseFile = addButtonChooseFile(tf_OutputFile, tf_inputFile);
|
||||
|
||||
GroupLayout gl_panel_configHTML = new GroupLayout(this);
|
||||
gl_panel_configHTML.setHorizontalGroup(
|
||||
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(34)
|
||||
.addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 184, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(7)
|
||||
.addComponent(tf_pageBreakInlineStyle, GroupLayout.DEFAULT_SIZE, 802, Short.MAX_VALUE)
|
||||
.addGap(60))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(32)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(lb_ImageResolution, GroupLayout.PREFERRED_SIZE, 336, GroupLayout.PREFERRED_SIZE)
|
||||
GroupLayout groupLayout = new GroupLayout(this);
|
||||
groupLayout.setHorizontalGroup(
|
||||
groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_TargetFormat_description)
|
||||
.addGap(30)
|
||||
.addComponent(lb_TargetFormat_1))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(tf_inputFile_1, GroupLayout.DEFAULT_SIZE, 413, Short.MAX_VALUE)
|
||||
.addGap(12)
|
||||
.addComponent(btn_chooseFile_1, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(19)
|
||||
.addComponent(tf_OutputFile_1, GroupLayout.DEFAULT_SIZE, 413, Short.MAX_VALUE)
|
||||
.addGap(12)
|
||||
.addComponent(btn_ChooseOutputFile_1, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(19)
|
||||
.addComponent(tf_pageBreakInlineStyle_1, GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE))
|
||||
.addComponent(cb_InlineStyles_1, GroupLayout.PREFERRED_SIZE, 492, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_EmbedVectorImages_1, GroupLayout.PREFERRED_SIZE, 362, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_EmbedRaster_1, GroupLayout.PREFERRED_SIZE, 492, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_convertToPx_1)
|
||||
.addComponent(cb_IgnoreHardLineBreaks_1, GroupLayout.PREFERRED_SIZE, 492, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_IgnoreEmptyParagraphs_1, GroupLayout.PREFERRED_SIZE, 492, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_UseMathJax_1, GroupLayout.PREFERRED_SIZE, 492, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_Pagination_1, GroupLayout.PREFERRED_SIZE, 362, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_ImageResolution, GroupLayout.PREFERRED_SIZE, 249, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(cbox_image_resolution, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(cb_Pagination, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(lb_FilterLetterSpacing, GroupLayout.DEFAULT_SIZE, 307, Short.MAX_VALUE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(215))
|
||||
.addComponent(cb_convertToPx, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_IgnoreHardLineBreaks, GroupLayout.PREFERRED_SIZE, 389, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_IgnoreEmptyParagraphs, GroupLayout.PREFERRED_SIZE, 405, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 409, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 313, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 349, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_EmbedRaster, GroupLayout.PREFERRED_SIZE, 416, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(463))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 184, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(10)
|
||||
.addComponent(tf_OutputFile, GroupLayout.DEFAULT_SIZE, 668, Short.MAX_VALUE)
|
||||
.addGap(21)
|
||||
.addComponent(btn_ChooseOutputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(10))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(lb_TargetFormat_description)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(lb_TargetFormat, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(3)
|
||||
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 178, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(14)
|
||||
.addComponent(tf_inputFile, GroupLayout.DEFAULT_SIZE, 667, Short.MAX_VALUE)
|
||||
.addGap(22)
|
||||
.addComponent(btn_chooseFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(10)))
|
||||
.addGap(48))))))
|
||||
.addComponent(cbox_image_resolution_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 91, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(tf_Scale_1, GroupLayout.PREFERRED_SIZE, 61, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 218, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(tf_FilterLetterSpacing_1, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(6))
|
||||
);
|
||||
gl_panel_configHTML.setVerticalGroup(
|
||||
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.TRAILING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_TargetFormat_description)
|
||||
.addComponent(lb_TargetFormat))
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(16)
|
||||
.addComponent(tf_inputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(12)
|
||||
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(2))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(btn_chooseFile)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)))
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(7)
|
||||
.addComponent(btn_ChooseOutputFile))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(8)
|
||||
.addComponent(tf_OutputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(10)
|
||||
.addComponent(lb_OutFilePath)))
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(8)
|
||||
.addComponent(tf_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(7)
|
||||
.addComponent(lb_pageBreakInlineStyle)))
|
||||
.addGap(22)
|
||||
.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))
|
||||
groupLayout.setVerticalGroup(
|
||||
groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(lb_TargetFormat_description)
|
||||
.addComponent(lb_TargetFormat_1))
|
||||
.addGap(6)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(5)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(tf_inputFile_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lb_FilePath)))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(3)
|
||||
.addComponent(btn_chooseFile_1)))
|
||||
.addGap(6)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(5)
|
||||
.addComponent(lb_OutFilePath))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(3)
|
||||
.addComponent(tf_OutputFile_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(btn_ChooseOutputFile_1))
|
||||
.addGap(6)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(lb_pageBreakInlineStyle)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(tf_pageBreakInlineStyle_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(8)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(cb_InlineStyles)
|
||||
.addGap(7)
|
||||
.addComponent(cb_EmbedVectorImages)
|
||||
.addGap(7)
|
||||
.addComponent(cb_EmbedRaster)
|
||||
.addGap(7)
|
||||
.addComponent(cb_convertToPx)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(cb_IgnoreHardLineBreaks)
|
||||
.addGap(7)
|
||||
.addComponent(cb_IgnoreEmptyParagraphs)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cb_UseMathJax)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(cb_Pagination)
|
||||
.addGap(7)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_Scale)
|
||||
.addComponent(tf_Scale_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(8)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(tf_FilterLetterSpacing_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(6)
|
||||
.addComponent(cb_InlineStyles_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_EmbedVectorImages_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_EmbedRaster_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_convertToPx_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_IgnoreHardLineBreaks_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_IgnoreEmptyParagraphs_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_UseMathJax_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_Pagination_1)
|
||||
.addGap(11)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_ImageResolution)
|
||||
.addComponent(cbox_image_resolution, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(118, Short.MAX_VALUE))
|
||||
.addComponent(cbox_image_resolution_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(4))
|
||||
);
|
||||
this.setLayout(gl_panel_configHTML);
|
||||
setLayout(groupLayout);
|
||||
}
|
||||
|
||||
private JButton addButtonChooseFile(JTextField tf_OutputFile, JTextField tf_inputFile) {
|
||||
JButton btn_chooseFile = new JButton(Localizer.get(LABEL_BUTTON_CHOOSE));
|
||||
btn_chooseFile.addActionListener(new ActionListener() {
|
||||
|
||||
//Shared methods added here to make WindowBuilder work
|
||||
|
||||
JCheckBox addMathJaxCB(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_UseMathJax_1 = new JCheckBox(Localizer.get(LABEL_USE_MATHJAX));
|
||||
cb_UseMathJax_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_USE_MATHJAX)));
|
||||
configuration.put(ARG_USE_MATHJAX, cb_UseMathJax_1);
|
||||
return cb_UseMathJax_1;
|
||||
}
|
||||
|
||||
JCheckBox addIgnoreEmptyParsCB(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_IgnoreEmptyParagraphs_1 = new JCheckBox(Localizer.get(LABEL_INGNORE_EMPTY_PARS));
|
||||
cb_IgnoreEmptyParagraphs_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_IGNORE_EMPTY_PARS)));
|
||||
configuration.put(ARG_IGNORE_EMPTY_PARAGRAPHS, cb_IgnoreEmptyParagraphs_1);
|
||||
return cb_IgnoreEmptyParagraphs_1;
|
||||
}
|
||||
|
||||
JCheckBox addSplitWholePagesOnly(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
JCheckBox cb_SplitWholePagesOnly = new JCheckBox(Localizer.get(LABEL_SPLIT_WHOLE_PAGES_ONLY));
|
||||
cb_SplitWholePagesOnly.setSelected(Boolean.parseBoolean(preferences.get(PREF_SPLIT_WHOLE_PAGES)));
|
||||
configuration.put(ARG_ALIGN_SPLITS_TO_PAGES, cb_SplitWholePagesOnly);
|
||||
return cb_SplitWholePagesOnly;
|
||||
}
|
||||
|
||||
JCheckBox addIgnoreHardLineBreaks(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_IgnoreHardLineBreaks_1 = new JCheckBox(Localizer.get(LABEL_FILETER_HARD_LINE_BREAKS));
|
||||
cb_IgnoreHardLineBreaks_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_IGNORE_HARD_BREAKS)));
|
||||
configuration.put(ARG_IGNORE_HARD_LINE_BREAKS, cb_IgnoreHardLineBreaks_1);
|
||||
return cb_IgnoreHardLineBreaks_1;
|
||||
}
|
||||
|
||||
JTextField addLetterSpacingFilter(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
tf_FilterLetterSpacing_1 = new JTextField();
|
||||
tf_FilterLetterSpacing_1.setText(preferences.get(PREF_LETTER_SPACING));
|
||||
configuration.put(ARG_MIN_LETTER_SPACING, tf_FilterLetterSpacing_1);
|
||||
tf_FilterLetterSpacing_1.setColumns(10);
|
||||
return tf_FilterLetterSpacing_1;
|
||||
}
|
||||
|
||||
|
||||
JCheckBox addInlineStyles(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_InlineStyles_1 = new JCheckBox(Localizer.get(LABEL_INLINE_STYLES));
|
||||
cb_InlineStyles_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_INLINE_STYLES)));
|
||||
configuration.put(ARG_CSS_INLINE, cb_InlineStyles_1);
|
||||
return cb_InlineStyles_1;
|
||||
}
|
||||
|
||||
JCheckBox addGreenstoneTags(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
JCheckBox cb_Greenstone = new JCheckBox(Localizer.get(LABEL_GREENSTONE_SPLIT));
|
||||
configuration.put(ARG_GREENSTONE, cb_Greenstone);
|
||||
cb_Greenstone.setSelected(Boolean.parseBoolean(preferences.get(PREF_GREENSTONE_TAGS)));
|
||||
return cb_Greenstone;
|
||||
}
|
||||
|
||||
JTextField addOutputFileTextField(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
tf_OutputFile_1 = new JTextField("");
|
||||
configuration.put(ARG_OUTPUT_FILE, tf_OutputFile_1);
|
||||
tf_OutputFile_1.setColumns(10);
|
||||
return tf_OutputFile_1;
|
||||
}
|
||||
|
||||
JCheckBox addPagination(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_Pagination_1 = new JCheckBox(Localizer.get(LABEL_PAGINATION));
|
||||
cb_Pagination_1.setSelected(Boolean.getBoolean(preferences.get(PREF_PAGINATION)));
|
||||
configuration.put(ARG_PAGINATION, cb_Pagination_1);
|
||||
return cb_Pagination_1;
|
||||
}
|
||||
|
||||
JCheckBox addConvertToPX(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_convertToPx_1 = new JCheckBox(Localizer.get(LABEL_CONVERT_TO_PX));
|
||||
cb_convertToPx_1.setSelected(Boolean.getBoolean(preferences.get(PREF_CONVERT_TO_PX)));
|
||||
configuration.put(ARG_CONVERT_TO_PX, cb_convertToPx_1);
|
||||
return cb_convertToPx_1;
|
||||
}
|
||||
|
||||
JTextField addPageBreakStyle(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
tf_pageBreakInlineStyle_1 = new JTextField(preferences.get(PREF_PAGEBREAK_STYLES));
|
||||
tf_pageBreakInlineStyle_1.setColumns(10);
|
||||
configuration.put(ARG_PAGE_BREAK_STYLE, tf_pageBreakInlineStyle_1);
|
||||
return tf_pageBreakInlineStyle_1;
|
||||
}
|
||||
|
||||
JLabel addTargetFormat(String format, HashMap<String, Component> configuration) {
|
||||
lb_TargetFormat_1 = new JLabel(format);
|
||||
configuration.put(ARG_TARGET_FORMAT, lb_TargetFormat_1);
|
||||
return lb_TargetFormat_1;
|
||||
}
|
||||
|
||||
JTextField addScaling(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
tf_Scale_1 = new JTextField();
|
||||
tf_Scale_1.setText(preferences.get(PREF_SCALING));
|
||||
tf_Scale_1.setColumns(10);
|
||||
configuration.put(ARG_SCALING, tf_Scale_1);
|
||||
return tf_Scale_1;
|
||||
}
|
||||
|
||||
JTextField addInputFile(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
tf_inputFile_1 = new JTextField(preferences.getSourceFileName());
|
||||
tf_inputFile_1.setColumns(10);
|
||||
configuration.put(ARG_INPUT_FILE, tf_inputFile_1);
|
||||
return tf_inputFile_1;
|
||||
}
|
||||
|
||||
JComboBox addImageResolution(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cbox_image_resolution_1 = new JComboBox(preferences.getAll(PREF_RESOLUTIONS));
|
||||
cbox_image_resolution_1.setSelectedIndex(Integer.parseInt(preferences.get(PREF_DEFAULT_IMAGE_RESOLUTION)));
|
||||
configuration.put(ARG_IMAGE_RESOLUTION, cbox_image_resolution_1);
|
||||
return cbox_image_resolution_1;
|
||||
}
|
||||
|
||||
JComboBox addSplitByLevel(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
JComboBox cbox_SplitByLevel = new JComboBox(preferences.getAll(PREF_SPLIT_LEVELS));
|
||||
configuration.put(ARG_SPLIT_LEVEL, cbox_SplitByLevel);
|
||||
cbox_SplitByLevel.setSelectedIndex(Integer.parseInt(preferences.get(PREF_SPLIT_BY_LEVEL)));
|
||||
return cbox_SplitByLevel;
|
||||
}
|
||||
|
||||
JTextField addMaxWidth(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
JTextField tf_MaxWidth = new JTextField(preferences.get(PREF_MAX_WIDTH));
|
||||
tf_MaxWidth.setColumns(10);
|
||||
configuration.put(ARG_MAX_WIDTH, tf_MaxWidth);
|
||||
return tf_MaxWidth;
|
||||
}
|
||||
|
||||
JCheckBox addEmbedRasterImages(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_EmbedRaster_1 = new JCheckBox(Localizer.get(LABEL_EMBED_RASTER));
|
||||
cb_EmbedRaster_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_EMBED_RASTER)));
|
||||
configuration.put(ARG_EMBED_IMG, cb_EmbedRaster_1);
|
||||
return cb_EmbedRaster_1;
|
||||
}
|
||||
|
||||
JCheckBox addEmbedVectorImages(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_EmbedVectorImages_1 = new JCheckBox(Localizer.get(LABEL_EMBED_VECTOR));
|
||||
cb_EmbedVectorImages_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_EMBED_VECTOR)));
|
||||
configuration.put(ARG_EMBED_SVG, cb_EmbedVectorImages_1);
|
||||
return cb_EmbedVectorImages_1;
|
||||
}
|
||||
|
||||
void setOutputFilePath(String newFilePath, JTextField tf_OutputFile, String extension) {
|
||||
|
||||
File inputFile = new File(newFilePath);
|
||||
if (!inputFile.exists()) {
|
||||
return;
|
||||
}
|
||||
if (!inputFile.isDirectory()) {
|
||||
File parent = inputFile.getParentFile();
|
||||
if (parent == null) {
|
||||
return;
|
||||
}
|
||||
if (!parent.canWrite()) {
|
||||
JOptionPane.showMessageDialog(ConfigurationWindow.getSingleFrame(), Localizer.get(CANT_WRITE_MESSAGE));
|
||||
}
|
||||
}
|
||||
if (newFilePath.length() < 3) {
|
||||
return;
|
||||
}
|
||||
String exportPath;
|
||||
if (inputFile.isDirectory()) {
|
||||
exportPath = newFilePath;
|
||||
tf_OutputFile.setText(exportPath);
|
||||
} else {
|
||||
String importExt = newFilePath.substring(newFilePath.length() - 3, newFilePath.length()).toLowerCase();
|
||||
if (importExt.equals(ODT_FILE_EXTENSION)) {
|
||||
exportPath = newFilePath.substring(0, newFilePath.length() - 3) + extension;
|
||||
tf_OutputFile.setText(exportPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JButton addChooseOutputButton(JTextField tf_OutputFile, String fileExtension) {
|
||||
btn_ChooseOutputFile_1 = new JButton(Localizer.get(LABEL_BUTTON_CHOOSE));
|
||||
btn_ChooseOutputFile_1.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
FileDialog fileDialog = new FileDialog();
|
||||
String newFilePath = fileDialog.chooseFile(tf_OutputFile.getText(),fileExtension);
|
||||
if (newFilePath != null && !newFilePath.isEmpty()) {
|
||||
tf_OutputFile.setText(newFilePath);
|
||||
}
|
||||
}
|
||||
});
|
||||
return btn_ChooseOutputFile_1;
|
||||
}
|
||||
|
||||
public void setMetadataFilePath(String newFilePath, JTextField tf_MetadataFile, String extension) {
|
||||
|
||||
File inputFile = new File(newFilePath);
|
||||
if (!inputFile.exists()) {
|
||||
return;
|
||||
}
|
||||
if (inputFile.isDirectory()) {
|
||||
tf_MetadataFile.setText(newFilePath);
|
||||
} else {
|
||||
File parent = inputFile.getParentFile();
|
||||
if (parent == null) {
|
||||
return;
|
||||
}
|
||||
if (newFilePath.length() < 3) {
|
||||
return;
|
||||
}
|
||||
String importExt = newFilePath.substring(newFilePath.length()-3, newFilePath.length()).toLowerCase();
|
||||
if (importExt.equals(ODT_FILE_EXTENSION)) {
|
||||
String metadataPath = newFilePath.substring(0, newFilePath.length()-3) + extension;
|
||||
File metaFile = new File(metadataPath);
|
||||
if (metaFile.exists() && metaFile.canRead()){
|
||||
tf_MetadataFile.setText(metadataPath);
|
||||
} else {
|
||||
tf_MetadataFile.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
JButton addButtonChooseFile(JTextField tf_OutputFile, JTextField tf_inputFile) {
|
||||
btn_chooseFile_1 = new JButton(Localizer.get(LABEL_BUTTON_CHOOSE));
|
||||
btn_chooseFile_1.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
FileDialog fileDialog = new FileDialog();
|
||||
String newFilePath = fileDialog.chooseFile(tf_inputFile.getText(),ODT_FILE_EXTENSION);
|
||||
|
@ -204,6 +424,6 @@ public class EpubPanel extends BasePanel {
|
|||
}
|
||||
}
|
||||
});
|
||||
return btn_chooseFile;
|
||||
return btn_chooseFile_1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,11 @@ public class FileDialog extends JFrame {
|
|||
int result = fileChooser.showOpenDialog(null);
|
||||
if (result == fileChooser.APPROVE_OPTION){
|
||||
selected = fileChooser.getSelectedFile();
|
||||
return selected.getAbsolutePath();
|
||||
if (selected.isDirectory()) {
|
||||
return selected.getAbsolutePath() + File.separator;
|
||||
} else {
|
||||
return selected.getAbsolutePath();
|
||||
}
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package pro.litvinovg.w2phtml.gui;
|
|||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.swing.GroupLayout;
|
||||
|
@ -10,26 +11,58 @@ import javax.swing.JButton;
|
|||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||
import static pro.litvinovg.w2phtml.gui.Contstants.*;
|
||||
import javax.swing.SpringLayout;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
public class HTMLPanel extends BasePanel{
|
||||
public class HTMLPanel extends JPanel{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static void main(String[] args) {
|
||||
HashMap<String, Component> configStub = new HashMap<String,Component>();
|
||||
UIPreferences prefStub = PreferencesStorage.getDefaultHTML(null);
|
||||
Object htmlPanel = new HTMLPanel(configStub,prefStub);
|
||||
private HashMap<String, Component> configuration = null;
|
||||
private UIPreferences preferences = null;
|
||||
private JComboBox cbox_SplitByLevel_1;
|
||||
private JCheckBox cb_Greenstone_1;
|
||||
private JCheckBox cb_IgnoreEmptyParagraphs_1;
|
||||
private JCheckBox cb_IgnoreHardLineBreaks_1;
|
||||
private JCheckBox cb_convertToPx_1;
|
||||
private JCheckBox cb_EmbedRaster_1;
|
||||
private JCheckBox cb_EmbedVectorImages_1;
|
||||
private JCheckBox cb_InlineStyles_1;
|
||||
private JTextField tf_FilterLetterSpacing_1;
|
||||
private JLabel lb_TargetFormat_1;
|
||||
private JTextField tf_OutputFile_1;
|
||||
private JTextField tf_inputFile_1;
|
||||
private JButton btn_ChooseOutputFile_1;
|
||||
private JButton btn_chooseFile_1;
|
||||
private JCheckBox cb_UseMathJax_1;
|
||||
private JCheckBox cb_SplitWholePagesOnly_1;
|
||||
private JTextField tf_Scale_1;
|
||||
private JTextField tf_pageBreakInlineStyle_1;
|
||||
private JTextField tf_MaxWidth_1;
|
||||
private JCheckBox cb_Pagination_1;
|
||||
private JComboBox cbox_image_resolution_1;
|
||||
|
||||
|
||||
public HTMLPanel() {
|
||||
this.preferences = PreferencesStorage.getDefaultHTML(null);
|
||||
this.configuration = new HashMap<String, Component>();
|
||||
initComponents();
|
||||
}
|
||||
|
||||
public HTMLPanel(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
super( configuration, preferences);
|
||||
|
||||
this.configuration = configuration;
|
||||
this.preferences = preferences;
|
||||
initComponents();
|
||||
}
|
||||
private void initComponents() {
|
||||
JLabel lb_SplitByLevel = new JLabel(Localizer.get(LABEL_SPLIT_BY_HEADING));
|
||||
JLabel lb_FilterLetterSpacing = new JLabel(Localizer.get(LABEL_MIN_LETTER_SPACING));
|
||||
JLabel lb_TargetFormat = addTargetFormat(HTML5_TARGET_FORMAT);
|
||||
JLabel lb_TargetFormat = addTargetFormat(HTML5_TARGET_FORMAT, configuration);
|
||||
JLabel lb_Scale = new JLabel(Localizer.get(LABEL_SCALE));
|
||||
JLabel lb_MaxWidth = new JLabel(Localizer.get(LABEL_MAX_BODY_WIDTH));
|
||||
JLabel lb_FilePath = new JLabel(Localizer.get(LABEL_INPUT_FILE_PATH));
|
||||
|
@ -38,191 +71,396 @@ public class HTMLPanel extends BasePanel{
|
|||
JLabel lb_ImageResolution = new JLabel(Localizer.get(LABEL_IMAGE_RESOLUTION));
|
||||
JLabel lb_pageBreakInlineStyle = new JLabel(Localizer.get(LABEL_BREAK_STYLE));
|
||||
|
||||
JTextField tf_FilterLetterSpacing = addLetterSpacingFilter();
|
||||
JTextField tf_Scale = addScaling();
|
||||
JTextField tf_MaxWidth = addMaxWidth();
|
||||
JTextField tf_inputFile = addInputFile();
|
||||
JTextField tf_OutputFile = addOutputFileTextField();
|
||||
JTextField tf_pageBreakInlineStyle = addPageBreakStyle();
|
||||
JTextField tf_FilterLetterSpacing = addLetterSpacingFilter(configuration,preferences);
|
||||
JTextField tf_Scale = addScaling(configuration,preferences);
|
||||
JTextField tf_MaxWidth = addMaxWidth(configuration,preferences);
|
||||
JTextField tf_inputFile = addInputFile(configuration,preferences);
|
||||
JTextField tf_OutputFile = addOutputFileTextField(configuration,preferences);
|
||||
JTextField tf_pageBreakInlineStyle = addPageBreakStyle(configuration,preferences);
|
||||
|
||||
JCheckBox cb_UseMathJax = addMathJaxCB();
|
||||
JCheckBox cb_IgnoreEmptyParagraphs = addIgnoreEmptyParsCB();
|
||||
JCheckBox cb_IgnoreHardLineBreaks = addIgnoreHardLineBreaks();
|
||||
JCheckBox cb_SplitWholePagesOnly = addSplitWholePagesOnly();
|
||||
JCheckBox cb_Greenstone = addGreenstoneTags();
|
||||
JCheckBox cb_InlineStyles = addInlineStyles();
|
||||
JCheckBox cb_EmbedRaster = addEmbedRasterImages();
|
||||
JCheckBox cb_EmbedVectorImages = addEmbedVectorImages();
|
||||
JCheckBox cb_convertToPx = addConvertToPX();
|
||||
JCheckBox cb_Pagination = addPagination();
|
||||
JCheckBox cb_UseMathJax = addMathJaxCB(configuration,preferences);
|
||||
JCheckBox cb_IgnoreEmptyParagraphs = addIgnoreEmptyParsCB(configuration,preferences);
|
||||
JCheckBox cb_IgnoreHardLineBreaks = addIgnoreHardLineBreaks(configuration,preferences);
|
||||
JCheckBox cb_SplitWholePagesOnly = addSplitWholePagesOnly(configuration,preferences);
|
||||
JCheckBox cb_Greenstone = addGreenstoneTags(configuration,preferences);
|
||||
JCheckBox cb_InlineStyles = addInlineStyles(configuration,preferences);
|
||||
JCheckBox cb_EmbedRaster = addEmbedRasterImages(configuration,preferences);
|
||||
JCheckBox cb_EmbedVectorImages = addEmbedVectorImages(configuration,preferences);
|
||||
JCheckBox cb_convertToPx = addConvertToPX(configuration,preferences);
|
||||
JCheckBox cb_Pagination = addPagination(configuration,preferences);
|
||||
|
||||
JComboBox cbox_image_resolution = addImageResolution();
|
||||
JComboBox cbox_SplitByLevel = addSplitByLevel();
|
||||
JComboBox cbox_image_resolution = addImageResolution(configuration,preferences);
|
||||
JComboBox cbox_SplitByLevel = addSplitByLevel(configuration,preferences);
|
||||
|
||||
JButton btn_chooseFile = addButtonChooseFile( tf_inputFile, tf_OutputFile);
|
||||
JButton btn_ChooseOutputFile = addChooseOutputButton(tf_OutputFile, HTML_FILE_EXTENSION);
|
||||
|
||||
GroupLayout gl_panel_configHTML = new GroupLayout(this);
|
||||
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.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(lb_SplitByLevel, GroupLayout.PREFERRED_SIZE, 454, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(cbox_SplitByLevel, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(541))
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(cb_Greenstone, GroupLayout.PREFERRED_SIZE, 482, GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(cb_IgnoreEmptyParagraphs, GroupLayout.PREFERRED_SIZE, 441, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(cb_IgnoreHardLineBreaks, GroupLayout.PREFERRED_SIZE, 341, GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(cb_convertToPx, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(cb_EmbedRaster)
|
||||
.addContainerGap())
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 276, GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 322, GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 350, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(635))
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(lb_MaxWidth, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 168, GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(lb_TargetFormat_description, GroupLayout.PREFERRED_SIZE, 178, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(lb_TargetFormat, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 193, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 191, GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(tf_OutputFile, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 558, Short.MAX_VALUE)
|
||||
.addComponent(tf_inputFile, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 558, Short.MAX_VALUE))
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(btn_ChooseOutputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(btn_chooseFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)))
|
||||
.addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 352, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_SplitWholePagesOnly, GroupLayout.PREFERRED_SIZE, 323, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 191, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(tf_pageBreakInlineStyle, GroupLayout.DEFAULT_SIZE, 707, Short.MAX_VALUE)
|
||||
.addComponent(tf_MaxWidth, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE))))
|
||||
.addGap(145)))))))))))))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(cb_Pagination, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(lb_ImageResolution, GroupLayout.PREFERRED_SIZE, 366, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(4)
|
||||
.addComponent(cbox_image_resolution, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(615))))
|
||||
GroupLayout groupLayout = new GroupLayout(this);
|
||||
groupLayout.setHorizontalGroup(
|
||||
groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(21)
|
||||
.addComponent(tf_OutputFile_1, GroupLayout.DEFAULT_SIZE, 463, Short.MAX_VALUE)
|
||||
.addGap(17)
|
||||
.addComponent(btn_ChooseOutputFile_1, GroupLayout.PREFERRED_SIZE, 112, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(21)
|
||||
.addComponent(tf_pageBreakInlineStyle_1, GroupLayout.DEFAULT_SIZE, 592, Short.MAX_VALUE))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 177, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(45)
|
||||
.addComponent(tf_Scale_1, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(cb_InlineStyles_1, GroupLayout.PREFERRED_SIZE, 370, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_EmbedVectorImages_1, GroupLayout.PREFERRED_SIZE, 370, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_EmbedRaster_1)
|
||||
.addComponent(cb_convertToPx_1, GroupLayout.PREFERRED_SIZE, 685, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_IgnoreHardLineBreaks_1, GroupLayout.PREFERRED_SIZE, 370, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_IgnoreEmptyParagraphs_1, GroupLayout.PREFERRED_SIZE, 501, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_Greenstone_1)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_SplitByLevel, GroupLayout.PREFERRED_SIZE, 199, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(3)
|
||||
.addComponent(cbox_SplitByLevel_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(cb_SplitWholePagesOnly_1, GroupLayout.PREFERRED_SIZE, 370, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_UseMathJax_1, GroupLayout.PREFERRED_SIZE, 370, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_Pagination_1, GroupLayout.PREFERRED_SIZE, 370, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_ImageResolution, GroupLayout.PREFERRED_SIZE, 244, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(cbox_image_resolution_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(lb_MaxWidth, GroupLayout.PREFERRED_SIZE, 177, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 220, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(tf_MaxWidth_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(26)
|
||||
.addComponent(tf_FilterLetterSpacing_1, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE))))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
|
||||
.addComponent(lb_TargetFormat_description, GroupLayout.PREFERRED_SIZE, 177, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 177, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(17)
|
||||
.addComponent(lb_TargetFormat_1, GroupLayout.PREFERRED_SIZE, 145, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(45)
|
||||
.addComponent(tf_inputFile_1, GroupLayout.DEFAULT_SIZE, 463, Short.MAX_VALUE)
|
||||
.addGap(17)
|
||||
.addComponent(btn_chooseFile_1, GroupLayout.PREFERRED_SIZE, 112, GroupLayout.PREFERRED_SIZE)))))
|
||||
.addGap(6))
|
||||
);
|
||||
gl_panel_configHTML.setVerticalGroup(
|
||||
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(12)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
|
||||
groupLayout.setVerticalGroup(
|
||||
groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(lb_TargetFormat_description)
|
||||
.addComponent(lb_TargetFormat))
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(tf_inputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(btn_chooseFile))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(lb_TargetFormat_1))
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(3)
|
||||
.addComponent(tf_inputFile_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(btn_chooseFile_1)))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(lb_FilePath)))
|
||||
.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(12)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_pageBreakInlineStyle)
|
||||
.addComponent(tf_pageBreakInlineStyle, 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))
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_MaxWidth)
|
||||
.addComponent(tf_MaxWidth, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(6)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(5)
|
||||
.addComponent(lb_OutFilePath))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(3)
|
||||
.addComponent(tf_OutputFile_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(btn_ChooseOutputFile_1))
|
||||
.addGap(6)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(lb_pageBreakInlineStyle))
|
||||
.addComponent(tf_pageBreakInlineStyle_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(8)
|
||||
.addComponent(lb_Scale))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addComponent(tf_Scale_1, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)))
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_FilterLetterSpacing)
|
||||
.addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cb_InlineStyles)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cb_EmbedVectorImages)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cb_EmbedRaster)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cb_convertToPx)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cb_IgnoreHardLineBreaks)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cb_IgnoreEmptyParagraphs)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cb_Greenstone)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_SplitByLevel, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbox_SplitByLevel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(cb_SplitWholePagesOnly)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cb_UseMathJax)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cb_Pagination)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(lb_MaxWidth))
|
||||
.addComponent(tf_MaxWidth_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(8)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(tf_FilterLetterSpacing_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(10)
|
||||
.addComponent(cb_InlineStyles_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_EmbedVectorImages_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_EmbedRaster_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_convertToPx_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_IgnoreHardLineBreaks_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_IgnoreEmptyParagraphs_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_Greenstone_1)
|
||||
.addGap(11)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_SplitByLevel)
|
||||
.addComponent(cbox_SplitByLevel_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(10)
|
||||
.addComponent(cb_SplitWholePagesOnly_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_UseMathJax_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_Pagination_1)
|
||||
.addGap(11)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_ImageResolution)
|
||||
.addComponent(cbox_image_resolution, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(101))
|
||||
.addComponent(cbox_image_resolution_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(4))
|
||||
);
|
||||
this.setLayout(gl_panel_configHTML);
|
||||
setLayout(groupLayout);
|
||||
}
|
||||
|
||||
private JButton addButtonChooseFile(JTextField tf_inputFile, JTextField tf_OutputFile) {
|
||||
JButton btn_chooseFile = new JButton(Localizer.get(LABEL_BUTTON_CHOOSE));
|
||||
btn_chooseFile.addActionListener(new ActionListener() {
|
||||
|
||||
|
||||
//Shared methods added here to make WindowBuilder work
|
||||
|
||||
JCheckBox addMathJaxCB(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_UseMathJax_1 = new JCheckBox(Localizer.get(LABEL_USE_MATHJAX));
|
||||
cb_UseMathJax_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_USE_MATHJAX)));
|
||||
configuration.put(ARG_USE_MATHJAX, cb_UseMathJax_1);
|
||||
return cb_UseMathJax_1;
|
||||
}
|
||||
|
||||
JCheckBox addIgnoreEmptyParsCB(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_IgnoreEmptyParagraphs_1 = new JCheckBox(Localizer.get(LABEL_INGNORE_EMPTY_PARS));
|
||||
cb_IgnoreEmptyParagraphs_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_IGNORE_EMPTY_PARS)));
|
||||
configuration.put(ARG_IGNORE_EMPTY_PARAGRAPHS, cb_IgnoreEmptyParagraphs_1);
|
||||
return cb_IgnoreEmptyParagraphs_1;
|
||||
}
|
||||
|
||||
JCheckBox addSplitWholePagesOnly(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_SplitWholePagesOnly_1 = new JCheckBox(Localizer.get(LABEL_SPLIT_WHOLE_PAGES_ONLY));
|
||||
cb_SplitWholePagesOnly_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_SPLIT_WHOLE_PAGES)));
|
||||
configuration.put(ARG_ALIGN_SPLITS_TO_PAGES, cb_SplitWholePagesOnly_1);
|
||||
return cb_SplitWholePagesOnly_1;
|
||||
}
|
||||
|
||||
JCheckBox addIgnoreHardLineBreaks(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_IgnoreHardLineBreaks_1 = new JCheckBox(Localizer.get(LABEL_FILETER_HARD_LINE_BREAKS));
|
||||
cb_IgnoreHardLineBreaks_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_IGNORE_HARD_BREAKS)));
|
||||
configuration.put(ARG_IGNORE_HARD_LINE_BREAKS, cb_IgnoreHardLineBreaks_1);
|
||||
return cb_IgnoreHardLineBreaks_1;
|
||||
}
|
||||
|
||||
JTextField addLetterSpacingFilter(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
tf_FilterLetterSpacing_1 = new JTextField();
|
||||
tf_FilterLetterSpacing_1.setText(preferences.get(PREF_LETTER_SPACING));
|
||||
configuration.put(ARG_MIN_LETTER_SPACING, tf_FilterLetterSpacing_1);
|
||||
tf_FilterLetterSpacing_1.setColumns(10);
|
||||
return tf_FilterLetterSpacing_1;
|
||||
}
|
||||
|
||||
|
||||
JCheckBox addInlineStyles(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_InlineStyles_1 = new JCheckBox(Localizer.get(LABEL_INLINE_STYLES));
|
||||
cb_InlineStyles_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_INLINE_STYLES)));
|
||||
configuration.put(ARG_CSS_INLINE, cb_InlineStyles_1);
|
||||
return cb_InlineStyles_1;
|
||||
}
|
||||
|
||||
JCheckBox addGreenstoneTags(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_Greenstone_1 = new JCheckBox(Localizer.get(LABEL_GREENSTONE_SPLIT));
|
||||
configuration.put(ARG_GREENSTONE, cb_Greenstone_1);
|
||||
cb_Greenstone_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_GREENSTONE_TAGS)));
|
||||
return cb_Greenstone_1;
|
||||
}
|
||||
|
||||
JTextField addOutputFileTextField(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
tf_OutputFile_1 = new JTextField("");
|
||||
configuration.put(ARG_OUTPUT_FILE, tf_OutputFile_1);
|
||||
tf_OutputFile_1.setColumns(10);
|
||||
return tf_OutputFile_1;
|
||||
}
|
||||
|
||||
JCheckBox addPagination(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_Pagination_1 = new JCheckBox(Localizer.get(LABEL_PAGINATION));
|
||||
cb_Pagination_1.setSelected(Boolean.getBoolean(preferences.get(PREF_PAGINATION)));
|
||||
configuration.put(ARG_PAGINATION, cb_Pagination_1);
|
||||
return cb_Pagination_1;
|
||||
}
|
||||
|
||||
JCheckBox addConvertToPX(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_convertToPx_1 = new JCheckBox(Localizer.get(LABEL_CONVERT_TO_PX));
|
||||
cb_convertToPx_1.setSelected(Boolean.getBoolean(preferences.get(PREF_CONVERT_TO_PX)));
|
||||
configuration.put(ARG_CONVERT_TO_PX, cb_convertToPx_1);
|
||||
return cb_convertToPx_1;
|
||||
}
|
||||
|
||||
JTextField addPageBreakStyle(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
tf_pageBreakInlineStyle_1 = new JTextField(preferences.get(PREF_PAGEBREAK_STYLES));
|
||||
tf_pageBreakInlineStyle_1.setColumns(10);
|
||||
configuration.put(ARG_PAGE_BREAK_STYLE, tf_pageBreakInlineStyle_1);
|
||||
return tf_pageBreakInlineStyle_1;
|
||||
}
|
||||
|
||||
JLabel addTargetFormat(String format, HashMap<String, Component> configuration) {
|
||||
lb_TargetFormat_1 = new JLabel(format);
|
||||
configuration.put(ARG_TARGET_FORMAT, lb_TargetFormat_1);
|
||||
return lb_TargetFormat_1;
|
||||
}
|
||||
|
||||
JTextField addScaling(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
tf_Scale_1 = new JTextField();
|
||||
tf_Scale_1.setText(preferences.get(PREF_SCALING));
|
||||
tf_Scale_1.setColumns(10);
|
||||
configuration.put(ARG_SCALING, tf_Scale_1);
|
||||
return tf_Scale_1;
|
||||
}
|
||||
|
||||
JTextField addInputFile(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
tf_inputFile_1 = new JTextField(preferences.getSourceFileName());
|
||||
tf_inputFile_1.setColumns(10);
|
||||
configuration.put(ARG_INPUT_FILE, tf_inputFile_1);
|
||||
return tf_inputFile_1;
|
||||
}
|
||||
|
||||
JComboBox addImageResolution(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cbox_image_resolution_1 = new JComboBox(preferences.getAll(PREF_RESOLUTIONS));
|
||||
cbox_image_resolution_1.setSelectedIndex(Integer.parseInt(preferences.get(PREF_DEFAULT_IMAGE_RESOLUTION)));
|
||||
configuration.put(ARG_IMAGE_RESOLUTION, cbox_image_resolution_1);
|
||||
return cbox_image_resolution_1;
|
||||
}
|
||||
|
||||
JComboBox addSplitByLevel(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cbox_SplitByLevel_1 = new JComboBox(preferences.getAll(PREF_SPLIT_LEVELS));
|
||||
configuration.put(ARG_SPLIT_LEVEL, cbox_SplitByLevel_1);
|
||||
cbox_SplitByLevel_1.setSelectedIndex(Integer.parseInt(preferences.get(PREF_SPLIT_BY_LEVEL)));
|
||||
return cbox_SplitByLevel_1;
|
||||
}
|
||||
|
||||
JTextField addMaxWidth(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
tf_MaxWidth_1 = new JTextField(preferences.get(PREF_MAX_WIDTH));
|
||||
tf_MaxWidth_1.setColumns(10);
|
||||
configuration.put(ARG_MAX_WIDTH, tf_MaxWidth_1);
|
||||
return tf_MaxWidth_1;
|
||||
}
|
||||
|
||||
JCheckBox addEmbedRasterImages(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_EmbedRaster_1 = new JCheckBox(Localizer.get(LABEL_EMBED_RASTER));
|
||||
cb_EmbedRaster_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_EMBED_RASTER)));
|
||||
configuration.put(ARG_EMBED_IMG, cb_EmbedRaster_1);
|
||||
return cb_EmbedRaster_1;
|
||||
}
|
||||
|
||||
JCheckBox addEmbedVectorImages(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_EmbedVectorImages_1 = new JCheckBox(Localizer.get(LABEL_EMBED_VECTOR));
|
||||
cb_EmbedVectorImages_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_EMBED_VECTOR)));
|
||||
configuration.put(ARG_EMBED_SVG, cb_EmbedVectorImages_1);
|
||||
return cb_EmbedVectorImages_1;
|
||||
}
|
||||
|
||||
void setOutputFilePath(String newFilePath, JTextField tf_OutputFile, String extension) {
|
||||
|
||||
File inputFile = new File(newFilePath);
|
||||
if (!inputFile.exists()) {
|
||||
return;
|
||||
}
|
||||
if (!inputFile.isDirectory()) {
|
||||
File parent = inputFile.getParentFile();
|
||||
if (parent == null) {
|
||||
return;
|
||||
}
|
||||
if (!parent.canWrite()) {
|
||||
JOptionPane.showMessageDialog(ConfigurationWindow.getSingleFrame(), Localizer.get(CANT_WRITE_MESSAGE));
|
||||
}
|
||||
}
|
||||
if (newFilePath.length() < 3) {
|
||||
return;
|
||||
}
|
||||
String exportPath;
|
||||
if (inputFile.isDirectory()) {
|
||||
exportPath = newFilePath;
|
||||
tf_OutputFile.setText(exportPath);
|
||||
} else {
|
||||
String importExt = newFilePath.substring(newFilePath.length() - 3, newFilePath.length()).toLowerCase();
|
||||
if (importExt.equals(ODT_FILE_EXTENSION)) {
|
||||
exportPath = newFilePath.substring(0, newFilePath.length() - 3) + extension;
|
||||
tf_OutputFile.setText(exportPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JButton addChooseOutputButton(JTextField tf_OutputFile, String fileExtension) {
|
||||
btn_ChooseOutputFile_1 = new JButton(Localizer.get(LABEL_BUTTON_CHOOSE));
|
||||
btn_ChooseOutputFile_1.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
FileDialog fileDialog = new FileDialog();
|
||||
String newFilePath = fileDialog.chooseFile(tf_OutputFile.getText(),fileExtension);
|
||||
if (newFilePath != null && !newFilePath.isEmpty()) {
|
||||
tf_OutputFile.setText(newFilePath);
|
||||
}
|
||||
}
|
||||
});
|
||||
return btn_ChooseOutputFile_1;
|
||||
}
|
||||
|
||||
public void setMetadataFilePath(String newFilePath, JTextField tf_MetadataFile, String extension) {
|
||||
|
||||
File inputFile = new File(newFilePath);
|
||||
if (!inputFile.exists()) {
|
||||
return;
|
||||
}
|
||||
if (inputFile.isDirectory()) {
|
||||
tf_MetadataFile.setText(newFilePath);
|
||||
} else {
|
||||
File parent = inputFile.getParentFile();
|
||||
if (parent == null) {
|
||||
return;
|
||||
}
|
||||
if (newFilePath.length() < 3) {
|
||||
return;
|
||||
}
|
||||
String importExt = newFilePath.substring(newFilePath.length()-3, newFilePath.length()).toLowerCase();
|
||||
if (importExt.equals(ODT_FILE_EXTENSION)) {
|
||||
String metadataPath = newFilePath.substring(0, newFilePath.length()-3) + extension;
|
||||
File metaFile = new File(metadataPath);
|
||||
if (metaFile.exists() && metaFile.canRead()){
|
||||
tf_MetadataFile.setText(metadataPath);
|
||||
} else {
|
||||
tf_MetadataFile.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
JButton addButtonChooseFile(JTextField tf_inputFile, JTextField tf_OutputFile) {
|
||||
btn_chooseFile_1 = new JButton(Localizer.get(LABEL_BUTTON_CHOOSE));
|
||||
btn_chooseFile_1.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String newFilePath = FileDialog.chooseFile(tf_inputFile.getText(),ODT_FILE_EXTENSION);
|
||||
if (newFilePath != null && !newFilePath.isEmpty()) {
|
||||
|
@ -231,7 +469,6 @@ public class HTMLPanel extends BasePanel{
|
|||
}
|
||||
}
|
||||
});
|
||||
return btn_chooseFile;
|
||||
return btn_chooseFile_1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,31 +3,65 @@ package pro.litvinovg.w2phtml.gui;
|
|||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.swing.GroupLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||
import static pro.litvinovg.w2phtml.gui.Contstants.*;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
|
||||
public class RDFPanel extends BasePanel {
|
||||
public class RDFPanel extends JPanel {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private UIPreferences preferences;
|
||||
private HashMap<String, Component> configuration;
|
||||
private JComboBox cbox_image_resolution_1;
|
||||
private JCheckBox cb_Pagination_1;
|
||||
private JCheckBox cb_convertToPx_1;
|
||||
private JCheckBox cb_EmbedRaster_1;
|
||||
private JCheckBox cb_EmbedVectorImages_1;
|
||||
private JTextField tf_FilterLetterSpacing_1;
|
||||
private JCheckBox cb_InlineStyles_1;
|
||||
private JLabel lb_TargetFormat_1;
|
||||
private JTextField tf_OutputFile_1;
|
||||
private JTextField tf_metadataPath_1;
|
||||
private JTextField tf_inputFile_1;
|
||||
private JButton btnChooseFile;
|
||||
private JButton btn_metadataChoose_1;
|
||||
private JButton btn_ChooseOutputFile_1;
|
||||
private JTextField tf_pageBreakInlineStyle_1;
|
||||
private JTextField tf_Scale_1;
|
||||
private JComboBox cbox_type_1;
|
||||
private JCheckBox cb_IgnoreEmptyParagraphs_1;
|
||||
private JCheckBox cb_UseMathJax_1;
|
||||
private JCheckBox cb_IgnoreHardLineBreaks_1;
|
||||
|
||||
public RDFPanel() {
|
||||
this.preferences = PreferencesStorage.getDefaultRDF(null);
|
||||
this.configuration = new HashMap<String, Component>();
|
||||
initComponents();
|
||||
}
|
||||
|
||||
public RDFPanel(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
super(configuration, preferences);
|
||||
this.configuration = configuration;
|
||||
this.preferences = preferences;
|
||||
initComponents();
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
JLabel lb_FilterLetterSpacing = new JLabel(Localizer.get(LABEL_MIN_LETTER_SPACING));
|
||||
JLabel lb_TargetFormat = addTargetFormat(RDF_TARGET_FORMAT);
|
||||
JLabel lb_TargetFormat = addTargetFormat(RDF_TARGET_FORMAT,configuration);
|
||||
JLabel lb_Scale = new JLabel(Localizer.get(LABEL_SCALE));
|
||||
JLabel lb_FilePath = new JLabel(Localizer.get(LABEL_INPUT_FILE_PATH));
|
||||
JLabel lb_TargetFormat_description = new JLabel(Localizer.get(LABEL_TARGET_FORMAT));
|
||||
|
@ -37,198 +71,173 @@ public class RDFPanel extends BasePanel {
|
|||
JLabel lb_metadataFilePath = new JLabel(Localizer.get(LABEL_METADATA_PATH));
|
||||
JLabel lb_pageBreakInlineStyle = new JLabel(Localizer.get(LABEL_BREAK_STYLE));
|
||||
|
||||
JTextField tf_OutputFile = addOutputFileTextField();
|
||||
JTextField tf_FilterLetterSpacing = addLetterSpacingFilter();
|
||||
JTextField tf_Scale = addScaling();
|
||||
JTextField tf_inputFile = addInputFile();
|
||||
JTextField tf_OutputFile = addOutputFileTextField(configuration,preferences);
|
||||
JTextField tf_FilterLetterSpacing = addLetterSpacingFilter(configuration,preferences);
|
||||
JTextField tf_Scale = addScaling(configuration,preferences);
|
||||
JTextField tf_inputFile = addInputFile(configuration,preferences);
|
||||
JTextField tf_metadataPath = addMetadataPath(configuration);
|
||||
JTextField tf_pageBreakInlineStyle = addPageBreakStyle();
|
||||
JTextField tf_pageBreakInlineStyle = addPageBreakStyle(configuration,preferences);
|
||||
|
||||
JCheckBox cb_UseMathJax = addMathJaxCB();
|
||||
JCheckBox cb_IgnoreEmptyParagraphs = addIgnoreEmptyParsCB();
|
||||
JCheckBox cb_IgnoreHardLineBreaks = addIgnoreHardLineBreaks();
|
||||
JCheckBox cb_InlineStyles = addInlineStyles();
|
||||
JCheckBox cb_UseMathJax = addMathJaxCB(configuration,preferences);
|
||||
JCheckBox cb_IgnoreEmptyParagraphs = addIgnoreEmptyParsCB(configuration,preferences);
|
||||
JCheckBox cb_IgnoreHardLineBreaks = addIgnoreHardLineBreaks(configuration,preferences);
|
||||
JCheckBox cb_InlineStyles = addInlineStyles(configuration,preferences);
|
||||
cb_InlineStyles.setEnabled(false);
|
||||
JCheckBox cb_EmbedVectorImages = addEmbedVectorImages();
|
||||
JCheckBox cb_EmbedVectorImages = addEmbedVectorImages(configuration,preferences);
|
||||
cb_EmbedVectorImages.setEnabled(false);
|
||||
JCheckBox cb_EmbedRaster = addEmbedRasterImages();
|
||||
JCheckBox cb_EmbedRaster = addEmbedRasterImages(configuration,preferences);
|
||||
cb_EmbedRaster.setEnabled(false);
|
||||
JCheckBox cb_convertToPx = addConvertToPX();
|
||||
JCheckBox cb_Pagination = addPagination();
|
||||
JCheckBox cb_convertToPx = addConvertToPX(configuration,preferences);
|
||||
JCheckBox cb_Pagination = addPagination(configuration,preferences);
|
||||
|
||||
JComboBox cbox_image_resolution = addImageResolution();
|
||||
JComboBox cbox_image_resolution = addImageResolution(configuration,preferences);
|
||||
JComboBox cbox_type = addPubTypes(configuration, preferences);
|
||||
|
||||
JButton btn_ChooseOutputFile = addChooseOutputButton(tf_OutputFile, RDF_FILE_EXTENSION);
|
||||
JButton btn_ChooseFile = addChooseFile(tf_OutputFile, tf_inputFile, tf_metadataPath);
|
||||
JButton btn_metadataChoose = addMetadataButton(tf_metadataPath);
|
||||
|
||||
GroupLayout gl_panel_configHTML = new GroupLayout(this);
|
||||
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_ImageResolution, GroupLayout.PREFERRED_SIZE, 369, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(4)
|
||||
.addComponent(cbox_image_resolution, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(cb_Pagination, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(cb_convertToPx, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(cb_EmbedRaster)
|
||||
.addContainerGap())
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(cb_EmbedVectorImages)
|
||||
.addContainerGap())
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(lb_FilterLetterSpacing)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(599))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(cb_InlineStyles)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(lb_TargetFormat_description, GroupLayout.PREFERRED_SIZE, 311, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 176, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lb_metadataFilePath, GroupLayout.PREFERRED_SIZE, 177, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 187, GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(lb_TargetFormat, GroupLayout.PREFERRED_SIZE, 68, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(tf_OutputFile, GroupLayout.DEFAULT_SIZE, 561, Short.MAX_VALUE)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(tf_metadataPath, GroupLayout.DEFAULT_SIZE, 560, Short.MAX_VALUE)
|
||||
.addGap(1))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(tf_inputFile, GroupLayout.DEFAULT_SIZE, 558, Short.MAX_VALUE)
|
||||
.addGap(3)))))
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(11)
|
||||
.addComponent(btn_ChooseFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(12)
|
||||
.addComponent(btn_metadataChoose, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(11)
|
||||
.addComponent(btn_ChooseOutputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(149))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 196, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(tf_pageBreakInlineStyle, GroupLayout.DEFAULT_SIZE, 681, Short.MAX_VALUE)
|
||||
.addGap(145))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(lb_type, GroupLayout.PREFERRED_SIZE, 148, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, 98, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbox_type, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))
|
||||
.addGap(21))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 137, GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())))))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(cb_IgnoreEmptyParagraphs, GroupLayout.PREFERRED_SIZE, 339, GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 345, GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(cb_IgnoreHardLineBreaks, GroupLayout.PREFERRED_SIZE, 344, GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap()))))
|
||||
);
|
||||
gl_panel_configHTML.setVerticalGroup(
|
||||
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_TargetFormat_description)
|
||||
.addComponent(lb_TargetFormat))
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(22)
|
||||
.addComponent(tf_inputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(24)
|
||||
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)))
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(tf_metadataPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lb_metadataFilePath, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(tf_OutputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(46)
|
||||
.addComponent(btn_ChooseFile)
|
||||
GroupLayout groupLayout = new GroupLayout(this);
|
||||
groupLayout.setHorizontalGroup(
|
||||
groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(210)
|
||||
.addComponent(lb_TargetFormat_1))
|
||||
.addComponent(lb_TargetFormat_description, GroupLayout.PREFERRED_SIZE, 382, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 198, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(12)
|
||||
.addComponent(tf_inputFile_1, GroupLayout.DEFAULT_SIZE, 448, Short.MAX_VALUE)
|
||||
.addGap(19)
|
||||
.addComponent(btnChooseFile, GroupLayout.PREFERRED_SIZE, 115, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_metadataFilePath, GroupLayout.PREFERRED_SIZE, 198, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(12)
|
||||
.addComponent(tf_metadataPath_1, GroupLayout.DEFAULT_SIZE, 448, Short.MAX_VALUE)
|
||||
.addGap(19)
|
||||
.addComponent(btn_metadataChoose_1, GroupLayout.PREFERRED_SIZE, 115, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 198, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(12)
|
||||
.addComponent(tf_OutputFile_1, GroupLayout.DEFAULT_SIZE, 448, Short.MAX_VALUE)
|
||||
.addGap(19)
|
||||
.addComponent(btn_ChooseOutputFile_1, GroupLayout.PREFERRED_SIZE, 115, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 198, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(12)
|
||||
.addComponent(tf_pageBreakInlineStyle_1, GroupLayout.DEFAULT_SIZE, 582, Short.MAX_VALUE))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_type, GroupLayout.PREFERRED_SIZE, 71, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(27)
|
||||
.addComponent(cbox_type_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(cb_InlineStyles_1)
|
||||
.addComponent(cb_EmbedVectorImages_1)
|
||||
.addComponent(cb_EmbedRaster_1)
|
||||
.addComponent(cb_convertToPx_1, GroupLayout.PREFERRED_SIZE, 658, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_IgnoreHardLineBreaks_1, GroupLayout.PREFERRED_SIZE, 382, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_IgnoreEmptyParagraphs_1, GroupLayout.PREFERRED_SIZE, 382, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_UseMathJax_1, GroupLayout.PREFERRED_SIZE, 382, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cb_Pagination_1, GroupLayout.PREFERRED_SIZE, 382, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(btn_metadataChoose)
|
||||
.addGap(7)
|
||||
.addComponent(btn_ChooseOutputFile)))
|
||||
.addGap(20)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(tf_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(18)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_type)
|
||||
.addComponent(cbox_type, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_Scale)
|
||||
.addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_FilterLetterSpacing)
|
||||
.addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(10)
|
||||
.addComponent(cb_InlineStyles)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cb_EmbedVectorImages)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cb_EmbedRaster)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cb_convertToPx)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cb_IgnoreHardLineBreaks)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cb_IgnoreEmptyParagraphs)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cb_UseMathJax)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(cb_Pagination)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_ImageResolution)
|
||||
.addComponent(cbox_image_resolution, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(87, Short.MAX_VALUE))
|
||||
.addComponent(lb_ImageResolution, GroupLayout.PREFERRED_SIZE, 245, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(cbox_image_resolution_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 83, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(tf_Scale_1, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(lb_FilterLetterSpacing)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(tf_FilterLetterSpacing_1, GroupLayout.PREFERRED_SIZE, 52, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(6))
|
||||
);
|
||||
this.setLayout(gl_panel_configHTML);
|
||||
groupLayout.setVerticalGroup(
|
||||
groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(lb_TargetFormat_1)
|
||||
.addComponent(lb_TargetFormat_description))
|
||||
.addGap(6)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(5)
|
||||
.addComponent(lb_FilePath))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(3)
|
||||
.addComponent(tf_inputFile_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(btnChooseFile))
|
||||
.addGap(6)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(5)
|
||||
.addComponent(lb_metadataFilePath))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addComponent(tf_metadataPath_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(btn_metadataChoose_1))
|
||||
.addGap(6)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(5)
|
||||
.addComponent(lb_OutFilePath))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(3)
|
||||
.addComponent(tf_OutputFile_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(btn_ChooseOutputFile_1))
|
||||
.addGap(6)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(tf_pageBreakInlineStyle_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addGap(11)
|
||||
.addComponent(lb_type))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cbox_type_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(8)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_Scale)
|
||||
.addComponent(tf_Scale_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(10)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_FilterLetterSpacing)
|
||||
.addComponent(tf_FilterLetterSpacing_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(8)
|
||||
.addComponent(cb_InlineStyles_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_EmbedVectorImages_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_EmbedRaster_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_convertToPx_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_IgnoreHardLineBreaks_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_IgnoreEmptyParagraphs_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_UseMathJax_1)
|
||||
.addGap(6)
|
||||
.addComponent(cb_Pagination_1)
|
||||
.addGap(11)
|
||||
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lb_ImageResolution, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(cbox_image_resolution_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap())
|
||||
);
|
||||
setLayout(groupLayout);
|
||||
}
|
||||
|
||||
private JButton addMetadataButton( JTextField tf_metadataPath) {
|
||||
JButton btn_metadataChoose = new JButton(Localizer.get(LABEL_BUTTON_CHOOSE));
|
||||
btn_metadataChoose.addActionListener(new ActionListener() {
|
||||
btn_metadataChoose_1 = new JButton(Localizer.get(LABEL_BUTTON_CHOOSE));
|
||||
btn_metadataChoose_1.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String newFilePath = FileDialog.chooseFile(tf_metadataPath.getText(),CSV_FILE_EXTENSION);
|
||||
if (newFilePath != null && !newFilePath.isEmpty()) {
|
||||
|
@ -236,19 +245,19 @@ public class RDFPanel extends BasePanel {
|
|||
}
|
||||
}
|
||||
});
|
||||
return btn_metadataChoose;
|
||||
return btn_metadataChoose_1;
|
||||
}
|
||||
|
||||
private JTextField addMetadataPath(HashMap<String, Component> configuration) {
|
||||
JTextField tf_metadataPath = new JTextField("");
|
||||
tf_metadataPath.setColumns(10);
|
||||
configuration.put(ARG_CSV_METADATA, tf_metadataPath);
|
||||
return tf_metadataPath;
|
||||
tf_metadataPath_1 = new JTextField("");
|
||||
tf_metadataPath_1.setColumns(10);
|
||||
configuration.put(ARG_CSV_METADATA, tf_metadataPath_1);
|
||||
return tf_metadataPath_1;
|
||||
}
|
||||
|
||||
private JButton addChooseFile( JTextField tf_OutputFile, JTextField tf_inputFile,
|
||||
JTextField tf_metadataPath) {
|
||||
JButton btnChooseFile = new JButton(Localizer.get(LABEL_BUTTON_CHOOSE));
|
||||
btnChooseFile = new JButton(Localizer.get(LABEL_BUTTON_CHOOSE));
|
||||
btnChooseFile.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String newFilePath = FileDialog.chooseFile(tf_inputFile.getText(),ODT_FILE_EXTENSION);
|
||||
|
@ -263,11 +272,222 @@ public class RDFPanel extends BasePanel {
|
|||
}
|
||||
|
||||
private JComboBox addPubTypes(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
JComboBox cbox_type = new JComboBox(preferences.getAll(PREF_PUBLICATION_TYPES));
|
||||
cbox_type.setSelectedIndex(Integer.parseInt(preferences.get(PREF_DEFAULT_PUBLICATION_TYPE)));
|
||||
configuration.put(ARG_RDF_TYPE, cbox_type);
|
||||
return cbox_type;
|
||||
cbox_type_1 = new JComboBox(preferences.getAll(PREF_PUBLICATION_TYPES));
|
||||
cbox_type_1.setSelectedIndex(Integer.parseInt(preferences.get(PREF_DEFAULT_PUBLICATION_TYPE)));
|
||||
configuration.put(ARG_RDF_TYPE, cbox_type_1);
|
||||
return cbox_type_1;
|
||||
}
|
||||
//Shared methods added here to make WindowBuilder work
|
||||
|
||||
JCheckBox addMathJaxCB(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_UseMathJax_1 = new JCheckBox(Localizer.get(LABEL_USE_MATHJAX));
|
||||
cb_UseMathJax_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_USE_MATHJAX)));
|
||||
configuration.put(ARG_USE_MATHJAX, cb_UseMathJax_1);
|
||||
return cb_UseMathJax_1;
|
||||
}
|
||||
|
||||
JCheckBox addIgnoreEmptyParsCB(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_IgnoreEmptyParagraphs_1 = new JCheckBox(Localizer.get(LABEL_INGNORE_EMPTY_PARS));
|
||||
cb_IgnoreEmptyParagraphs_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_IGNORE_EMPTY_PARS)));
|
||||
configuration.put(ARG_IGNORE_EMPTY_PARAGRAPHS, cb_IgnoreEmptyParagraphs_1);
|
||||
return cb_IgnoreEmptyParagraphs_1;
|
||||
}
|
||||
|
||||
JCheckBox addSplitWholePagesOnly(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
JCheckBox cb_SplitWholePagesOnly = new JCheckBox(Localizer.get(LABEL_SPLIT_WHOLE_PAGES_ONLY));
|
||||
cb_SplitWholePagesOnly.setSelected(Boolean.parseBoolean(preferences.get(PREF_SPLIT_WHOLE_PAGES)));
|
||||
configuration.put(ARG_ALIGN_SPLITS_TO_PAGES, cb_SplitWholePagesOnly);
|
||||
return cb_SplitWholePagesOnly;
|
||||
}
|
||||
|
||||
JCheckBox addIgnoreHardLineBreaks(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_IgnoreHardLineBreaks_1 = new JCheckBox(Localizer.get(LABEL_FILETER_HARD_LINE_BREAKS));
|
||||
cb_IgnoreHardLineBreaks_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_IGNORE_HARD_BREAKS)));
|
||||
configuration.put(ARG_IGNORE_HARD_LINE_BREAKS, cb_IgnoreHardLineBreaks_1);
|
||||
return cb_IgnoreHardLineBreaks_1;
|
||||
}
|
||||
|
||||
JTextField addLetterSpacingFilter(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
tf_FilterLetterSpacing_1 = new JTextField();
|
||||
tf_FilterLetterSpacing_1.setText(preferences.get(PREF_LETTER_SPACING));
|
||||
configuration.put(ARG_MIN_LETTER_SPACING, tf_FilterLetterSpacing_1);
|
||||
tf_FilterLetterSpacing_1.setColumns(10);
|
||||
return tf_FilterLetterSpacing_1;
|
||||
}
|
||||
|
||||
|
||||
JCheckBox addInlineStyles(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_InlineStyles_1 = new JCheckBox(Localizer.get(LABEL_INLINE_STYLES));
|
||||
cb_InlineStyles_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_INLINE_STYLES)));
|
||||
configuration.put(ARG_CSS_INLINE, cb_InlineStyles_1);
|
||||
return cb_InlineStyles_1;
|
||||
}
|
||||
|
||||
JCheckBox addGreenstoneTags(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
JCheckBox cb_Greenstone = new JCheckBox(Localizer.get(LABEL_GREENSTONE_SPLIT));
|
||||
configuration.put(ARG_GREENSTONE, cb_Greenstone);
|
||||
cb_Greenstone.setSelected(Boolean.parseBoolean(preferences.get(PREF_GREENSTONE_TAGS)));
|
||||
return cb_Greenstone;
|
||||
}
|
||||
|
||||
JTextField addOutputFileTextField(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
tf_OutputFile_1 = new JTextField("");
|
||||
configuration.put(ARG_OUTPUT_FILE, tf_OutputFile_1);
|
||||
tf_OutputFile_1.setColumns(10);
|
||||
return tf_OutputFile_1;
|
||||
}
|
||||
|
||||
JCheckBox addPagination(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_Pagination_1 = new JCheckBox(Localizer.get(LABEL_PAGINATION));
|
||||
cb_Pagination_1.setSelected(Boolean.getBoolean(preferences.get(PREF_PAGINATION)));
|
||||
configuration.put(ARG_PAGINATION, cb_Pagination_1);
|
||||
return cb_Pagination_1;
|
||||
}
|
||||
|
||||
JCheckBox addConvertToPX(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_convertToPx_1 = new JCheckBox(Localizer.get(LABEL_CONVERT_TO_PX));
|
||||
cb_convertToPx_1.setSelected(Boolean.getBoolean(preferences.get(PREF_CONVERT_TO_PX)));
|
||||
configuration.put(ARG_CONVERT_TO_PX, cb_convertToPx_1);
|
||||
return cb_convertToPx_1;
|
||||
}
|
||||
|
||||
JTextField addPageBreakStyle(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
tf_pageBreakInlineStyle_1 = new JTextField(preferences.get(PREF_PAGEBREAK_STYLES));
|
||||
tf_pageBreakInlineStyle_1.setColumns(10);
|
||||
configuration.put(ARG_PAGE_BREAK_STYLE, tf_pageBreakInlineStyle_1);
|
||||
return tf_pageBreakInlineStyle_1;
|
||||
}
|
||||
|
||||
JLabel addTargetFormat(String format, HashMap<String, Component> configuration) {
|
||||
lb_TargetFormat_1 = new JLabel(format);
|
||||
configuration.put(ARG_TARGET_FORMAT, lb_TargetFormat_1);
|
||||
return lb_TargetFormat_1;
|
||||
}
|
||||
|
||||
JTextField addScaling(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
tf_Scale_1 = new JTextField();
|
||||
tf_Scale_1.setText(preferences.get(PREF_SCALING));
|
||||
tf_Scale_1.setColumns(10);
|
||||
configuration.put(ARG_SCALING, tf_Scale_1);
|
||||
return tf_Scale_1;
|
||||
}
|
||||
|
||||
JTextField addInputFile(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
tf_inputFile_1 = new JTextField(preferences.getSourceFileName());
|
||||
tf_inputFile_1.setColumns(10);
|
||||
configuration.put(ARG_INPUT_FILE, tf_inputFile_1);
|
||||
return tf_inputFile_1;
|
||||
}
|
||||
|
||||
JComboBox addImageResolution(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cbox_image_resolution_1 = new JComboBox(preferences.getAll(PREF_RESOLUTIONS));
|
||||
cbox_image_resolution_1.setSelectedIndex(Integer.parseInt(preferences.get(PREF_DEFAULT_IMAGE_RESOLUTION)));
|
||||
configuration.put(ARG_IMAGE_RESOLUTION, cbox_image_resolution_1);
|
||||
return cbox_image_resolution_1;
|
||||
}
|
||||
|
||||
JComboBox addSplitByLevel(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
JComboBox cbox_SplitByLevel = new JComboBox(preferences.getAll(PREF_SPLIT_LEVELS));
|
||||
configuration.put(ARG_SPLIT_LEVEL, cbox_SplitByLevel);
|
||||
cbox_SplitByLevel.setSelectedIndex(Integer.parseInt(preferences.get(PREF_SPLIT_BY_LEVEL)));
|
||||
return cbox_SplitByLevel;
|
||||
}
|
||||
|
||||
JTextField addMaxWidth(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
JTextField tf_MaxWidth = new JTextField(preferences.get(PREF_MAX_WIDTH));
|
||||
tf_MaxWidth.setColumns(10);
|
||||
configuration.put(ARG_MAX_WIDTH, tf_MaxWidth);
|
||||
return tf_MaxWidth;
|
||||
}
|
||||
|
||||
JCheckBox addEmbedRasterImages(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_EmbedRaster_1 = new JCheckBox(Localizer.get(LABEL_EMBED_RASTER));
|
||||
cb_EmbedRaster_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_EMBED_RASTER)));
|
||||
configuration.put(ARG_EMBED_IMG, cb_EmbedRaster_1);
|
||||
return cb_EmbedRaster_1;
|
||||
}
|
||||
|
||||
JCheckBox addEmbedVectorImages(HashMap<String, Component> configuration, UIPreferences preferences) {
|
||||
cb_EmbedVectorImages_1 = new JCheckBox(Localizer.get(LABEL_EMBED_VECTOR));
|
||||
cb_EmbedVectorImages_1.setSelected(Boolean.parseBoolean(preferences.get(PREF_EMBED_VECTOR)));
|
||||
configuration.put(ARG_EMBED_SVG, cb_EmbedVectorImages_1);
|
||||
return cb_EmbedVectorImages_1;
|
||||
}
|
||||
|
||||
void setOutputFilePath(String newFilePath, JTextField tf_OutputFile, String extension) {
|
||||
|
||||
File inputFile = new File(newFilePath);
|
||||
if (!inputFile.exists()) {
|
||||
return;
|
||||
}
|
||||
if (!inputFile.isDirectory()) {
|
||||
File parent = inputFile.getParentFile();
|
||||
if (parent == null) {
|
||||
return;
|
||||
}
|
||||
if (!parent.canWrite()) {
|
||||
JOptionPane.showMessageDialog(ConfigurationWindow.getSingleFrame(), Localizer.get(CANT_WRITE_MESSAGE));
|
||||
}
|
||||
}
|
||||
if (newFilePath.length() < 3) {
|
||||
return;
|
||||
}
|
||||
String exportPath;
|
||||
if (inputFile.isDirectory()) {
|
||||
exportPath = newFilePath;
|
||||
tf_OutputFile.setText(exportPath);
|
||||
} else {
|
||||
String importExt = newFilePath.substring(newFilePath.length() - 3, newFilePath.length()).toLowerCase();
|
||||
if (importExt.equals(ODT_FILE_EXTENSION)) {
|
||||
exportPath = newFilePath.substring(0, newFilePath.length() - 3) + extension;
|
||||
tf_OutputFile.setText(exportPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JButton addChooseOutputButton(JTextField tf_OutputFile, String fileExtension) {
|
||||
btn_ChooseOutputFile_1 = new JButton(Localizer.get(LABEL_BUTTON_CHOOSE));
|
||||
btn_ChooseOutputFile_1.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
FileDialog fileDialog = new FileDialog();
|
||||
String newFilePath = fileDialog.chooseFile(tf_OutputFile.getText(),fileExtension);
|
||||
if (newFilePath != null && !newFilePath.isEmpty()) {
|
||||
tf_OutputFile.setText(newFilePath);
|
||||
}
|
||||
}
|
||||
});
|
||||
return btn_ChooseOutputFile_1;
|
||||
}
|
||||
|
||||
public void setMetadataFilePath(String newFilePath, JTextField tf_MetadataFile, String extension) {
|
||||
|
||||
File inputFile = new File(newFilePath);
|
||||
if (!inputFile.exists()) {
|
||||
return;
|
||||
}
|
||||
if (inputFile.isDirectory()) {
|
||||
tf_MetadataFile.setText(newFilePath);
|
||||
} else {
|
||||
File parent = inputFile.getParentFile();
|
||||
if (parent == null) {
|
||||
return;
|
||||
}
|
||||
if (newFilePath.length() < 3) {
|
||||
return;
|
||||
}
|
||||
String importExt = newFilePath.substring(newFilePath.length()-3, newFilePath.length()).toLowerCase();
|
||||
if (importExt.equals(ODT_FILE_EXTENSION)) {
|
||||
String metadataPath = newFilePath.substring(0, newFilePath.length()-3) + extension;
|
||||
File metaFile = new File(metadataPath);
|
||||
if (metaFile.exists() && metaFile.canRead()){
|
||||
tf_MetadataFile.setText(metadataPath);
|
||||
} else {
|
||||
tf_MetadataFile.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ label_use_mathjax=Use MathJax
|
|||
label_fileter_hard_line_breaks=Filter hard line breaks
|
||||
label_metadata_path=Metadata path
|
||||
label_type=Type
|
||||
label_split_by_heading=Split into multiple files by heading level
|
||||
label_split_by_heading=Split by heading level
|
||||
label_html5=html5
|
||||
error_cant_write=Attention. Can't save file in output directory.
|
||||
message_not_implemented=Not implemented
|
||||
|
|
|
@ -7,13 +7,13 @@ label_target_format=Целевой формат файла
|
|||
label_input_file_path=Путь к входному файлу
|
||||
label_output_file_path=Путь к выходному файлу
|
||||
label_convert_to_px=Конвертировать в пиксели (вместо rem)
|
||||
label_scale=Масштабирование
|
||||
label_scale=Масштаб
|
||||
label_embed_raster=Встроить растровые изображения
|
||||
label_embed_vector=Встроить векторные изображения
|
||||
label_inline_styles=Применить стили внутри html элементов
|
||||
label_button_choose=Выбрать
|
||||
label_max_body_width=Максимальная ширина
|
||||
label_min_letter_spacing=Отбросить межсимвольные расстояния меньше
|
||||
label_min_letter_spacing=Фильтр утяжки символов
|
||||
label_ingnore_empty_pars=Не конвертировать пустые параграфы
|
||||
label_greenstone_split=Встроить комментарии для содержаний в Greenstone
|
||||
label_break_style=Стиль разрывов страниц
|
||||
|
@ -22,12 +22,12 @@ label_split_whole_pages_only=Разрывы только по границам
|
|||
label_use_mathjax=Встроить библиотеку MathJax для формул
|
||||
label_fileter_hard_line_breaks=Не конвертировать жесткие разрывы строк
|
||||
label_metadata_path=Путь к метаданным
|
||||
label_type=Тип документа
|
||||
label_split_by_heading=Разделить на файлы по заголовкам до уровня (включительно)
|
||||
label_type=Вид
|
||||
label_split_by_heading=Разделять по заголовкам
|
||||
label_html5=html5
|
||||
error_cant_write=Ошибка. Не удалось сохранить файл в целевую директорию
|
||||
message_not_implemented=Данная функциональность еще не реализована
|
||||
label_image_resolution=Уменьшить разрешение изображений до (PPI)
|
||||
label_image_resolution=Разрешение изображений (PPI)
|
||||
enter_new_config_name=Введите имя новой вкладки
|
||||
config_name_is_already_in_use=Такое имя вкладки уже используется
|
||||
default_config_cant_be_saved=Настройки вкладок по умолчанию нельзя сохранять
|
||||
|
|
Loading…
Add table
Reference in a new issue