From 920842c02756780f4bd5020ba22174dc670664bf Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Mon, 21 Jan 2019 22:56:41 +0000 Subject: [PATCH] JAL-3141 Rejigged the Preferences tab and changed some text --- resources/lang/Messages.properties | 24 ++++++------ src/jalview/jbgui/GPreferences.java | 72 ++++++++++++++++++----------------- 2 files changed, 50 insertions(+), 46 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 4e4e95d..b44c0bb 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -1366,19 +1366,19 @@ label.backupfiles_confirm_save_file = Confirm save file label.backupfiles_confirm_save_file_backupfiles_roll_wrong = Something possibly went wrong with the backups of this file, write the new file anyway? label.backups = Backups label.backup_files = Backup Files -label.enable_backupfiles = Enable backup files -label.suffix_format = Suffix format -label.suffix_template = Suffix template (use %n to represent the backup/version index) -label.suffix_template_tooltip = %n in the template will be replaced by the index number. The suffix will appear before the filename extension. -label.index_digits = Number of digits to use for the index -label.example_filenames = Example filenames -label.increment_index = Increment suffix indexes (like version files) - newest file has largest index. -label.reverse_roll = Reverse and "roll" suffix indexes (like log files) - newest file is always index 1. -label.keep_files = Keep Files -label.keep_all_backup_files = Keep all backup files +label.enable_backupfiles = Enable/disable backup files +label.suffix_format = Append to backup filenames +label.suffix_template = Append text (use %n to represent the backup number) +label.suffix_template_tooltip = %n in the text will be replaced by the backup number. The text will appear after the filename. +label.index_digits = Number of digits to use for the number (%n) +label.example_filenames = Summary of backup scheme +label.increment_index = Increase appended text numbers - newest file has largest index. +label.reverse_roll = "Roll" appended text numbers - newest backup file is always number 1. +label.keep_files = Deleting old backup files +label.keep_all_backup_files = Do not delete any old backup files label.keep_only_this_number_of_backup_files = Keep only this number of most recent backup files -label.old_backup_files = Old backup files: -label.confirm_delete = Confirm deletions +label.old_backup_files = Autodelete old backup files: +label.confirm_delete = Always ask label.auto_delete = Automatically delete label.filename = filename label.braced_oldest = (oldest) diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 5628f43..4aabd1c 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -35,6 +35,7 @@ import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; +import java.awt.FontMetrics; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; @@ -91,6 +92,9 @@ public class GPreferences extends JPanel private static final Font LABEL_FONT_ITALIC = JvSwingUtils .getLabelFont(false, true); + private static final Font LABEL_FONT_BOLD = JvSwingUtils + .getLabelFont(true, false); + /* * Visual tab components */ @@ -1688,11 +1692,22 @@ public class GPreferences extends JPanel private JPanel initBackupsTab() { JPanel backupsTab = new JPanel(); - // backupsTab.setBorder(new TitledBorder(MessageManager - // .getString("label.backup_files"))); + backupsTab.setBorder(new TitledBorder(MessageManager + .getString("label.backup_files"))); backupsTab.setLayout(new GridBagLayout()); - enableBackupFiles.setFont(LABEL_FONT); + GridBagConstraints gbc = new GridBagConstraints(); + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.anchor = GridBagConstraints.NORTHWEST; + gbc.fill = GridBagConstraints.NONE; + + initBackupsTabSuffixPanel(); + initBackupsTabKeepFilesPanel(); + initBackupsTabFilenameExamplesPanel(); + + gbc.weightx = 0.5; + enableBackupFiles.setFont(LABEL_FONT_BOLD); enableBackupFiles.setText( MessageManager.getString("label.enable_backupfiles")); enableBackupFiles.addActionListener(new ActionListener() @@ -1706,38 +1721,21 @@ public class GPreferences extends JPanel } }); - GridBagConstraints gbc = new GridBagConstraints(); - gbc.weightx = 1.0; - gbc.weighty = 0.0; - gbc.anchor = GridBagConstraints.NORTHWEST; - gbc.fill = GridBagConstraints.NONE; - // enable checkbox 1 row gbc.gridwidth = 1; gbc.gridy = 0; backupsTab.add(enableBackupFiles, gbc); + gbc.gridx = 1; + gbc.weightx = 1.0; + //gbc.anchor = GridBagConstraints.NORTHEAST; + //gbc.fill = GridBagConstraints.HORIZONTAL; + backupsTab.add(exampleFilesPanel, gbc); - initBackupsTabSuffixPanel(); - initBackupsTabKeepFilesPanel(); - initBackupsTabFilenameExamplesPanel(); - - /* - // set widths of the panels to the max one - int maxw = suffixPanel.getWidth(); - if (maxw < keepfilesPanel.getWidth()) - { - maxw = keepfilesPanel.getWidth(); - } - if (maxw < exampleFilesPanel.getWidth()) - { - maxw = exampleFilesPanel.getWidth(); - } - suffixPanel.setSize(suffixPanel.getHeight(), maxw); - keepfilesPanel.setSize(keepfilesPanel.getHeight(), maxw); - exampleFilesPanel.setSize(exampleFilesPanel.getHeight(), maxw); - */ - + gbc.anchor = GridBagConstraints.NORTHWEST; + gbc.fill = GridBagConstraints.NONE; + gbc.gridwidth = 2; // whole suffix panel next row + gbc.gridx = 0; gbc.gridy = 1; backupsTab.add(suffixPanel, gbc); @@ -1745,6 +1743,7 @@ public class GPreferences extends JPanel gbc.gridy = 2; backupsTab.add(keepfilesPanel, gbc); + /* // whole examples panel next row gbc.gridy = 3; backupsTab.add(exampleFilesPanel, gbc); @@ -1753,6 +1752,7 @@ public class GPreferences extends JPanel gbc.gridy = 4; gbc.weighty = 1.0; backupsTab.add(new JPanel(), gbc); + */ backupsOptionsSetEnabled(enableBackupFiles.isSelected()); return backupsTab; @@ -1983,12 +1983,16 @@ public class GPreferences extends JPanel private JPanel initBackupsTabFilenameExamplesPanel() { - exampleFilesPanel.setBorder(new TitledBorder( - MessageManager.getString("label.example_filenames"))); + String title = MessageManager.getString("label.example_filenames"); + TitledBorder tb = new TitledBorder(title); + //tb.setTitleFont(LABEL_FONT); + exampleFilesPanel.setBorder(tb); exampleFilesPanel.setLayout(new GridBagLayout()); + //inordinately difficult to get this titledborder the right size for the title + backupfilesExampleLabel.setEditable(false); - backupfilesExampleLabel.setPreferredSize(new Dimension(400, 85)); + backupfilesExampleLabel.setPreferredSize(new Dimension(280, 85)); backupfilesExampleLabel.setAlignmentX(LEFT_ALIGNMENT); backupfilesExampleLabel.setAlignmentY(TOP_ALIGNMENT); @@ -1997,10 +2001,10 @@ public class GPreferences extends JPanel .setBackground(exampleFilesPanel.getBackground()); updateBackupFilesExampleLabel(); + exampleFilesPanel.setMinimumSize(new Dimension(280, 85)); GridBagConstraints gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.fill = GridBagConstraints.NONE; + gbc.anchor = GridBagConstraints.EAST; gbc.gridy = 0; exampleFilesPanel.add(backupfilesExampleLabel, gbc); -- 1.7.10.2