Merge branch 'develop' into trialMerge
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 28 May 2019 13:00:38 +0000 (14:00 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 28 May 2019 13:00:38 +0000 (14:00 +0100)
Conflicts:
src/jalview/gui/FeatureTypeSettings.java
src/jalview/io/BackupFiles.java
src/jalview/jbgui/GPreferences.java

1  2 
resources/lang/Messages.properties
resources/lang/Messages_es.properties
src/jalview/bin/Jalview.java
src/jalview/gui/APQHandlers.java
src/jalview/gui/Desktop.java
src/jalview/gui/FeatureTypeSettings.java
src/jalview/gui/JvSwingUtils.java
src/jalview/gui/Preferences.java
src/jalview/io/BackupFiles.java
src/jalview/jbgui/GDesktop.java
src/jalview/jbgui/GPreferences.java

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -160,15 -162,15 +161,15 @@@ public class FeatureTypeSettings extend
  
    JPanel singleColour = new JPanel();
  
 -  private JPanel minColour = new JPanel();
 +  JPanel minColour = new JPanel();
  
 -  private JPanel maxColour = new JPanel();
 +  JPanel maxColour = new JPanel();
  
-   private JComboBox<String> threshold = new JComboBox<>();
+   private JComboBox<Object> threshold = new JComboBox<>();
  
 -  private JSlider slider = new JSlider();
 +  JSlider slider = new JSlider();
  
 -  private JTextField thresholdValue = new JTextField(20);
 +  JTextField thresholdValue = new JTextField(20);
  
    private JCheckBox thresholdIsMin = new JCheckBox();
  
Simple merge
@@@ -546,40 -553,7 +547,43 @@@ public class Preferences extends GPrefe
      /*
       * Set Backups tab defaults
       */
--    loadLastSavedBackupsOptions();
++    if (!Platform.isJS())
++    {
++      loadLastSavedBackupsOptions();
++    }
 +  }
 +
 +  /**
 +   * A helper method that sets the items and initial selection in a character
 +   * rendering option list (Prompt each time/Lineart/Text)
 +   * 
 +   * @param comboBox
 +   * @param propertyKey
 +   */
 +  protected void setupOutputCombo(JComboBox<Object> comboBox,
 +          String propertyKey)
 +  {
 +    comboBox.addItem(promptEachTimeOpt);
 +    comboBox.addItem(lineArtOpt);
 +    comboBox.addItem(textOpt);
 +    
 +    /*
 +     * JalviewJS doesn't support Lineart so force it to Text
 +     */
 +    String defaultOption = Platform.isJS() ? "Text"
 +            : Cache.getDefault(propertyKey, "Prompt each time");
 +    if (defaultOption.equalsIgnoreCase("Text"))
 +    {
 +      comboBox.setSelectedItem(textOpt);
 +    }
 +    else if (defaultOption.equalsIgnoreCase("Lineart"))
 +    {
 +      comboBox.setSelectedItem(lineArtOpt);
 +    }
 +    else
 +    {
 +      comboBox.setSelectedItem(promptEachTimeOpt);
 +    }
    }
  
    /**
@@@ -145,8 -121,10 +122,10 @@@ public class BackupFile
  
    public static void classInit()
    {
 -    setEnabled(Cache.getDefault(ENABLED, true));
 +    setEnabled(Cache.getDefault(ENABLED, !Platform.isJS()));
-     setConfirmDelete(Cache.getDefault(CONFIRM_DELETE_OLD, true));
+     BackupFilesPresetEntry bfpe = BackupFilesPresetEntry
+             .getSavedBackupEntry();
+     setConfirmDelete(bfpe.confirmDelete);
    }
  
    public static void setEnabled(boolean flag)
Simple merge
@@@ -31,8 -31,9 +31,10 @@@ import jalview.gui.JvSwingUtils
  import jalview.gui.StructureViewer.ViewerType;
  import jalview.io.BackupFilenameParts;
  import jalview.io.BackupFiles;
+ import jalview.io.BackupFilesPresetEntry;
+ import jalview.io.IntKeyStringValueEntry;
  import jalview.util.MessageManager;
 +import jalview.util.Platform;
  
  import java.awt.BorderLayout;
  import java.awt.Color;
@@@ -373,11 -375,8 +380,11 @@@ public class GPreferences extends JPane
      tabbedPane.add(initConnectionsTab(),
              MessageManager.getString("label.connections"));
  
-       if (!Platform.isJS()) 
-       {
-         tabbedPane.add(initBackupsTab(), 
-                       MessageManager.getString("label.backups"));
-       }
 -    tabbedPane.add(initBackupsTab(),
 -            MessageManager.getString("label.backups"));
++    if (!Platform.isJS())
++    {
++      tabbedPane.add(initBackupsTab(),
++              MessageManager.getString("label.backups"));
++    }
  
      tabbedPane.add(initLinksTab(),
              MessageManager.getString("label.urllinks"));
  
    protected void loadLastSavedBackupsOptions()
    {
+     BackupFilesPresetEntry savedPreset = BackupFilesPresetEntry
+             .getSavedBackupEntry();
      enableBackupFiles
-             .setSelected(Cache.getDefault(BackupFiles.ENABLED, !Platform.isJS()));
 -            .setSelected(Cache.getDefault(BackupFiles.ENABLED, true));
++            .setSelected(Cache.getDefault(BackupFiles.ENABLED,
++                    !Platform.isJS()));
+     BackupFilesPresetEntry backupfilesCustomEntry = BackupFilesPresetEntry
+             .createBackupFilesPresetEntry(Cache
+                     .getDefault(BackupFilesPresetEntry.CUSTOMCONFIG, null));
+     if (backupfilesCustomEntry == null)
+     {
+       backupfilesCustomEntry = BackupFilesPresetEntry.backupfilesPresetEntriesValues
+               .get(BackupFilesPresetEntry.BACKUPFILESSCHEMEDEFAULT);
+     }
+     BackupFilesPresetEntry.backupfilesPresetEntriesValues.put(
+             BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM,
+             backupfilesCustomEntry);
      setComboIntStringKey(backupfilesPresetsCombo,
-             Cache.getDefault(BackupFiles.NS + "_PRESET", 1));
-     suffixTemplate.setText(Cache.getDefault(BackupFiles.SUFFIX,
-             ".bak" + BackupFiles.NUM_PLACEHOLDER));
-     suffixDigitsSpinner
-             .setValue(Cache.getDefault(BackupFiles.SUFFIX_DIGITS, 3));
-     suffixReverse.setSelected(
-             Cache.getDefault(BackupFiles.REVERSE_ORDER, false));
-     backupfilesKeepAll
-             .setSelected(Cache.getDefault(BackupFiles.NO_MAX, false));
-     backupfilesRollMaxSpinner
-             .setValue(Cache.getDefault(BackupFiles.ROLL_MAX, 3));
-     backupfilesConfirmDelete.setSelected(
-             Cache.getDefault(BackupFiles.CONFIRM_DELETE_OLD, true));
+             Cache.getDefault(BackupFiles.NS + "_PRESET",
+                     BackupFilesPresetEntry.BACKUPFILESSCHEMEDEFAULT));
+     backupsSetOptions(savedPreset);
  
      backupsOptionsSetEnabled();
      updateBackupFilesExampleLabel();