chore: refactoring. Made localizer singleton and request localizations in a static way.

This commit is contained in:
Georgy Litvinov 2021-08-11 00:35:47 +02:00
parent c5631e06b1
commit 027106e1b7
8 changed files with 93 additions and 82 deletions

View file

@ -23,22 +23,21 @@ public class BasePanel extends JPanel {
*
*/
private static final long serialVersionUID = 1L;
private Localizer localizer = null;
private UIPreferences preferences = null;
private HashMap<String, Component> configuration = null;
public BasePanel(Localizer localizer, HashMap<String, Component> configuration, UIPreferences preferences) {
this.localizer = localizer;
public BasePanel(HashMap<String, Component> configuration, UIPreferences preferences) {
this.configuration = configuration;
this.preferences = preferences;
}
public BasePanel(Localizer localizer) {
this.localizer = localizer;
}
protected JCheckBox addMathJaxCB(Localizer localizer, UIPreferences preferences) {
JCheckBox cb_UseMathJax = new JCheckBox(localizer.getTranslation(LABEL_USE_MATHJAX));
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;
}
@ -55,7 +54,7 @@ public class BasePanel extends JPanel {
return;
}
if (!parent.canWrite()) {
JOptionPane.showMessageDialog(ConfigurationWindow.getSingleFrame(), localizer.getTranslation(CANT_WRITE_MESSAGE));
JOptionPane.showMessageDialog(ConfigurationWindow.getSingleFrame(), Localizer.get(CANT_WRITE_MESSAGE));
}
}
if (newFilePath.length() < 3) {
@ -75,27 +74,27 @@ public class BasePanel extends JPanel {
}
protected JCheckBox addIgnoreEmptyParsCB() {
JCheckBox cb_IgnoreEmptyParagraphs = new JCheckBox(localizer.getTranslation(LABEL_INGNORE_EMPTY_PARS));
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.getTranslation(LABEL_SPLIT_WHOLE_PAGES_ONLY));
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.getTranslation(LABEL_USE_MATHJAX));
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.getTranslation(LABEL_FILETER_HARD_LINE_BREAKS));
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;
@ -111,14 +110,14 @@ public class BasePanel extends JPanel {
protected JCheckBox addInlineStyles() {
JCheckBox cb_InlineStyles = new JCheckBox(localizer.getTranslation(LABEL_INLINE_STYLES));
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.getTranslation(LABEL_GREENSTONE_SPLIT));
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;
@ -132,14 +131,14 @@ public class BasePanel extends JPanel {
}
protected JCheckBox addPagination() {
JCheckBox cb_Pagination = new JCheckBox(localizer.getTranslation(LABEL_PAGINATION));
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.getTranslation(LABEL_CONVERT_TO_PX));
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;
@ -195,21 +194,21 @@ public class BasePanel extends JPanel {
}
protected JCheckBox addEmbedRasterImages() {
JCheckBox cb_EmbedRaster = new JCheckBox(localizer.getTranslation(LABEL_EMBED_RASTER));
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.getTranslation(LABEL_EMBED_VECTOR));
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.getTranslation(LABEL_BUTTON_CHOOSE));
JButton btn_ChooseOutputFile = new JButton(Localizer.get(LABEL_BUTTON_CHOOSE));
btn_ChooseOutputFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileDialog fileDialog = new FileDialog();

View file

@ -53,7 +53,7 @@ public class ConfigurationWindow extends JFrame {
* Create the application.
*/
public ConfigurationWindow() {
this.localizer = new Localizer();
this.localizer = Localizer.getInstance();
initializePreferences();
setTitle(localizer.getTranslation(CONVERTER_TITLE_LABEL));
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
@ -64,7 +64,7 @@ public class ConfigurationWindow extends JFrame {
public ConfigurationWindow(XComponentContext context, ODTDocument doc) {
this.context = context;
this.localizer = new Localizer();
this.localizer = Localizer.getInstance();
initializePreferences();
storage.setSourceFileName(doc.getFileName());
setTitle(localizer.getTranslation(CONVERTER_TITLE_LABEL));

View file

@ -28,13 +28,13 @@ public class ControlPanel extends BasePanel {
public void setFactory(PanelFactory factory) {
this.factory = factory;
}
public ControlPanel(HashMap<String,Component> configuration,Localizer localizer, PreferencesStorage storage, String configName, String configType) {
super(localizer);
public ControlPanel(HashMap<String,Component> configuration, PreferencesStorage storage, String configName, String configType) {
super();
this.storage = storage;
this.configName = configName;
this.configType = configType;
JButton btn_Exit = new JButton(localizer.getTranslation(BUTTON_EXIT_LABEL));
JButton btn_Exit = new JButton(Localizer.get(BUTTON_EXIT_LABEL));
btn_Exit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ConfigurationWindow.getSingleFrame().setVisible(false);
@ -42,15 +42,15 @@ public class ControlPanel extends BasePanel {
}
});
JButton btn_SaveAs = new JButton(localizer.getTranslation(BUTTON_SAVEAS_LABEL));
JButton btn_SaveAs = new JButton(Localizer.get(BUTTON_SAVEAS_LABEL));
btn_SaveAs.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
String newConfigName = JOptionPane.showInputDialog(localizer.getTranslation(ENTER_NEW_CONFIG_NAME));
String newConfigName = JOptionPane.showInputDialog(Localizer.get(ENTER_NEW_CONFIG_NAME));
if (newConfigName == null || newConfigName.isEmpty()) {
return;
}
if (storage.has(newConfigName)) {
JOptionPane.showMessageDialog(ConfigurationWindow.getSingleFrame(), localizer.getTranslation(CONFIG_NAME_IS_ALREADY_IN_USE));
JOptionPane.showMessageDialog(ConfigurationWindow.getSingleFrame(), Localizer.get(CONFIG_NAME_IS_ALREADY_IN_USE));
return;
}
UIPreferences newPrefs = storage.get(configName).clone();
@ -63,16 +63,16 @@ public class ControlPanel extends BasePanel {
}
});
JButton btn_Save = new JButton(localizer.getTranslation(BUTTON_SAVE_LABEL));
JButton btn_Save = new JButton(Localizer.get(BUTTON_SAVE_LABEL));
btn_Save.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
storage.get(configName).updateFrom(configuration);
storage.save();
JOptionPane.showMessageDialog(ConfigurationWindow.getSingleFrame(), localizer.getTranslation(SUCCESSFULLY_SAVED));
JOptionPane.showMessageDialog(ConfigurationWindow.getSingleFrame(), Localizer.get(SUCCESSFULLY_SAVED));
}
});
JButton btn_delete = new JButton(localizer.getTranslation(BUTTON_DELETE_LABEL));
JButton btn_delete = new JButton(Localizer.get(BUTTON_DELETE_LABEL));
btn_delete.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
storage.remove(configName);
@ -86,7 +86,7 @@ public class ControlPanel extends BasePanel {
btn_delete.setVisible(false);
}
JButton btn_startConversion = new JButton(localizer.getTranslation(BUTTON_CONVERT_LABEL));
JButton btn_startConversion = new JButton(Localizer.get(BUTTON_CONVERT_LABEL));
btn_startConversion.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
try {

View file

@ -25,17 +25,17 @@ public class EpubPanel extends BasePanel {
*/
private static final long serialVersionUID = 1L;
public EpubPanel(HashMap<String, Component> configuration, Localizer localizer, UIPreferences preferences) {
super(localizer, configuration, preferences);
public EpubPanel(HashMap<String, Component> configuration, UIPreferences preferences) {
super(configuration, preferences);
JLabel lb_FilterLetterSpacing = new JLabel(localizer.getTranslation(LABEL_MIN_LETTER_SPACING));
JLabel lb_TargetFormat_description = new JLabel(localizer.getTranslation(LABEL_TARGET_FORMAT));
JLabel lb_Scale = new JLabel(localizer.getTranslation(LABEL_SCALE));
JLabel lb_FilePath = new JLabel(localizer.getTranslation(LABEL_INPUT_FILE_PATH));
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_ImageResolution = new JLabel(localizer.getTranslation(LABEL_IMAGE_RESOLUTION));
JLabel lb_OutFilePath = new JLabel(localizer.getTranslation(OUTPUT_FILE_PATH));
JLabel lb_pageBreakInlineStyle = new JLabel(localizer.getTranslation(LABEL_BREAK_STYLE));
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();
@ -55,7 +55,7 @@ public class EpubPanel extends BasePanel {
JComboBox cbox_image_resolution = addImageResolution();
JButton btn_ChooseOutputFile = addChooseOutputButton(tf_OutputFile, EPUB_FILE_EXTENSION);
JButton btn_chooseFile = addButtonChooseFile(localizer, tf_OutputFile, tf_inputFile);
JButton btn_chooseFile = addButtonChooseFile(tf_OutputFile, tf_inputFile);
GroupLayout gl_panel_configHTML = new GroupLayout(this);
gl_panel_configHTML.setHorizontalGroup(
@ -192,8 +192,8 @@ public class EpubPanel extends BasePanel {
this.setLayout(gl_panel_configHTML);
}
private JButton addButtonChooseFile(Localizer localizer, JTextField tf_OutputFile, JTextField tf_inputFile) {
JButton btn_chooseFile = new JButton(localizer.getTranslation(LABEL_BUTTON_CHOOSE));
private JButton addButtonChooseFile(JTextField tf_OutputFile, JTextField tf_inputFile) {
JButton btn_chooseFile = new JButton(Localizer.get(LABEL_BUTTON_CHOOSE));
btn_chooseFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileDialog fileDialog = new FileDialog();

View file

@ -19,25 +19,24 @@ public class HTMLPanel extends BasePanel{
private static final long serialVersionUID = 1L;
public static void main(String[] args) {
Localizer localizerStub = new Localizer();
HashMap<String, Component> configStub = new HashMap<String,Component>();
UIPreferences prefStub = PreferencesStorage.getDefaultHTML(null);
Object htmlPanel = new HTMLPanel(configStub,localizerStub,prefStub);
Object htmlPanel = new HTMLPanel(configStub,prefStub);
}
public HTMLPanel(HashMap<String, Component> configuration, Localizer localizer, UIPreferences preferences) {
super(localizer, configuration, preferences);
public HTMLPanel(HashMap<String, Component> configuration, UIPreferences preferences) {
super( configuration, preferences);
JLabel lb_SplitByLevel = new JLabel(localizer.getTranslation(LABEL_SPLIT_BY_HEADING));
JLabel lb_FilterLetterSpacing = new JLabel(localizer.getTranslation(LABEL_MIN_LETTER_SPACING));
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_Scale = new JLabel(localizer.getTranslation(LABEL_SCALE));
JLabel lb_MaxWidth = new JLabel(localizer.getTranslation(LABEL_MAX_BODY_WIDTH));
JLabel lb_FilePath = new JLabel(localizer.getTranslation(LABEL_INPUT_FILE_PATH));
JLabel lb_TargetFormat_description = new JLabel(localizer.getTranslation(LABEL_TARGET_FORMAT));
JLabel lb_OutFilePath = new JLabel(localizer.getTranslation(OUTPUT_FILE_PATH));
JLabel lb_ImageResolution = new JLabel(localizer.getTranslation(LABEL_IMAGE_RESOLUTION));
JLabel lb_pageBreakInlineStyle = new JLabel(localizer.getTranslation(LABEL_BREAK_STYLE));
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));
JLabel lb_TargetFormat_description = new JLabel(Localizer.get(LABEL_TARGET_FORMAT));
JLabel lb_OutFilePath = new JLabel(Localizer.get(OUTPUT_FILE_PATH));
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();
@ -60,7 +59,7 @@ public class HTMLPanel extends BasePanel{
JComboBox cbox_image_resolution = addImageResolution();
JComboBox cbox_SplitByLevel = addSplitByLevel();
JButton btn_chooseFile = addButtonChooseFile(localizer, tf_inputFile, tf_OutputFile);
JButton btn_chooseFile = addButtonChooseFile( tf_inputFile, tf_OutputFile);
JButton btn_ChooseOutputFile = addChooseOutputButton(tf_OutputFile, HTML_FILE_EXTENSION);
GroupLayout gl_panel_configHTML = new GroupLayout(this);
@ -221,8 +220,8 @@ public class HTMLPanel extends BasePanel{
this.setLayout(gl_panel_configHTML);
}
private JButton addButtonChooseFile(Localizer localizer, JTextField tf_inputFile, JTextField tf_OutputFile) {
JButton btn_chooseFile = new JButton(localizer.getTranslation(LABEL_BUTTON_CHOOSE));
private JButton addButtonChooseFile(JTextField tf_inputFile, JTextField tf_OutputFile) {
JButton btn_chooseFile = new JButton(Localizer.get(LABEL_BUTTON_CHOOSE));
btn_chooseFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String newFilePath = FileDialog.chooseFile(tf_inputFile.getText(),ODT_FILE_EXTENSION);

View file

@ -13,11 +13,24 @@ public class Localizer {
private String resourceBundle = "pro.litvinovg.w2phtml.gui.localizations.w2phtml";
private ResourceBundle translations;
private boolean isOld = false;
public Localizer() {
private static Localizer localizer = null;
private Localizer() {
currentLocale = Locale.getDefault();
translations = ResourceBundle.getBundle(resourceBundle, currentLocale);
this.isOld = isOldJava();
}
public static Localizer getInstance() {
if (localizer != null) {
return localizer;
}
localizer = new Localizer();
return localizer;
}
public static String get(String name) {
Localizer.getInstance();
return localizer.getTranslation(name);
}
public String getTranslation(String name) {
if (translations != null && translations.containsKey(name)) {

View file

@ -35,15 +35,15 @@ public class PanelFactory {
String type = prefs.get(PREF_TYPE);
JPanel panel = new JPanel();
HashMap<String, Component> configuration = new HashMap<String, Component>();
ControlPanel panel_control = new ControlPanel(configuration, localizer, storage, name, type);
ControlPanel panel_control = new ControlPanel(configuration, storage, name, type);
panel_control.setFactory(this);
JPanel panel_configuration = null;
if (EPUB.equals(type)){
panel_configuration = new EpubPanel(configuration, localizer, storage.get(name));
panel_configuration = new EpubPanel(configuration, storage.get(name));
} else if (RDF.equals(type)) {
panel_configuration = new RDFPanel(configuration, localizer, storage.get(name));
panel_configuration = new RDFPanel(configuration, storage.get(name));
} else {
panel_configuration = new HTMLPanel(configuration, localizer, storage.get(name));
panel_configuration = new HTMLPanel(configuration, storage.get(name));
}
applyDefaultLayout(panel, panel_configuration, panel_control);
tabbedPane.addTab(name, null, panel, null);

View file

@ -23,19 +23,19 @@ public class RDFPanel extends BasePanel {
*/
private static final long serialVersionUID = 1L;
public RDFPanel(HashMap<String, Component> configuration, Localizer localizer, UIPreferences preferences) {
super(localizer, configuration, preferences);
public RDFPanel(HashMap<String, Component> configuration, UIPreferences preferences) {
super(configuration, preferences);
JLabel lb_FilterLetterSpacing = new JLabel(localizer.getTranslation(LABEL_MIN_LETTER_SPACING));
JLabel lb_FilterLetterSpacing = new JLabel(Localizer.get(LABEL_MIN_LETTER_SPACING));
JLabel lb_TargetFormat = addTargetFormat(RDF_TARGET_FORMAT);
JLabel lb_Scale = new JLabel(localizer.getTranslation(LABEL_SCALE));
JLabel lb_FilePath = new JLabel(localizer.getTranslation(LABEL_INPUT_FILE_PATH));
JLabel lb_TargetFormat_description = new JLabel(localizer.getTranslation(LABEL_TARGET_FORMAT));
JLabel lb_OutFilePath = new JLabel(localizer.getTranslation(OUTPUT_FILE_PATH));
JLabel lb_ImageResolution = new JLabel(localizer.getTranslation(LABEL_IMAGE_RESOLUTION));
JLabel lb_type = new JLabel(localizer.getTranslation(LABEL_TYPE));
JLabel lb_metadataFilePath = new JLabel(localizer.getTranslation(LABEL_METADATA_PATH));
JLabel lb_pageBreakInlineStyle = new JLabel(localizer.getTranslation(LABEL_BREAK_STYLE));
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));
JLabel lb_OutFilePath = new JLabel(Localizer.get(OUTPUT_FILE_PATH));
JLabel lb_ImageResolution = new JLabel(Localizer.get(LABEL_IMAGE_RESOLUTION));
JLabel lb_type = new JLabel(Localizer.get(LABEL_TYPE));
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();
@ -60,8 +60,8 @@ public class RDFPanel extends BasePanel {
JComboBox cbox_type = addPubTypes(configuration, preferences);
JButton btn_ChooseOutputFile = addChooseOutputButton(tf_OutputFile, RDF_FILE_EXTENSION);
JButton btn_ChooseFile = addChooseFile(localizer, tf_OutputFile, tf_inputFile, tf_metadataPath);
JButton btn_metadataChoose = addMetadataButton(localizer, tf_metadataPath);
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(
@ -226,8 +226,8 @@ public class RDFPanel extends BasePanel {
this.setLayout(gl_panel_configHTML);
}
private JButton addMetadataButton(Localizer localizer, JTextField tf_metadataPath) {
JButton btn_metadataChoose = new JButton(localizer.getTranslation(LABEL_BUTTON_CHOOSE));
private JButton addMetadataButton( JTextField tf_metadataPath) {
JButton btn_metadataChoose = new JButton(Localizer.get(LABEL_BUTTON_CHOOSE));
btn_metadataChoose.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String newFilePath = FileDialog.chooseFile(tf_metadataPath.getText(),CSV_FILE_EXTENSION);
@ -246,9 +246,9 @@ public class RDFPanel extends BasePanel {
return tf_metadataPath;
}
private JButton addChooseFile(Localizer localizer, JTextField tf_OutputFile, JTextField tf_inputFile,
private JButton addChooseFile( JTextField tf_OutputFile, JTextField tf_inputFile,
JTextField tf_metadataPath) {
JButton btnChooseFile = new JButton(localizer.getTranslation(LABEL_BUTTON_CHOOSE));
JButton 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);