X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPreferences.java;h=f51bfbf703a24b9dd1cb2d5b7bd0bc8929e1c8df;hb=e1aa3fdd1ca82abf5acc0cd3c2b86a5ca1083941;hp=3c0faab584b5d2b562ca6f90ef928ac765d1360d;hpb=547480978230204efda55a1ec533b7b25be2a06f;p=jalview.git diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 3c0faab..f51bfbf 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -24,6 +24,8 @@ import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; import jalview.bin.Cache; import jalview.gui.Help.HelpId; import jalview.gui.StructureViewer.ViewerType; +import jalview.io.BackupFiles; +import jalview.io.BackupFilesPresetEntry; import jalview.io.FileFormatI; import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; @@ -113,16 +115,13 @@ public class Preferences extends GPreferences public static final String USE_LEGACY_GAP = "USE_LEGACY_GAP"; - private static final int MIN_FONT_SIZE = 1; - - private static final int MAX_FONT_SIZE = 30; + public static final String GAP_COLOUR = "GAP_COLOUR"; - private static final Color OVERVIEW_DEFAULT_GAP = Color.lightGray; + public static final String HIDDEN_COLOUR = "HIDDEN_COLOUR"; - private static final Color OVERVIEW_DEFAULT_LEGACY_GAP = Color.white; + private static final int MIN_FONT_SIZE = 1; - private static final Color OVERVIEW_DEFAULT_HIDDEN = Color.darkGray - .darker(); + private static final int MAX_FONT_SIZE = 30; /** * Holds name and link separated with | character. Sequence ID must be @@ -171,8 +170,6 @@ public class Preferences extends GPreferences JInternalFrame frame; - DasSourceBrowser dasSource; - private WsPreferences wsPrefs; private OptionsParam promptEachTimeOpt = new OptionsParam( @@ -193,8 +190,6 @@ public class Preferences extends GPreferences super(); frame = new JInternalFrame(); frame.setContentPane(this); - dasSource = new DasSourceBrowser(); - dasTab.add(dasSource, BorderLayout.CENTER); wsPrefs = new WsPreferences(); wsTab.add(wsPrefs, BorderLayout.CENTER); int width = 500, height = 450; @@ -258,7 +253,7 @@ public class Preferences extends GPreferences fontStyleCB.setSelectedItem( Cache.getDefault("FONT_STYLE", Font.PLAIN + "")); - smoothFont.setSelected(Cache.getDefault("ANTI_ALIAS", false)); + smoothFont.setSelected(Cache.getDefault("ANTI_ALIAS", true)); scaleProteinToCdna .setSelected(Cache.getDefault(SCALE_PROTEIN_TO_CDNA, false)); @@ -294,8 +289,8 @@ public class Preferences extends GPreferences startupCheckbox .setSelected(Cache.getDefault("SHOW_STARTUP_FILE", true)); startupFileTextfield.setText(Cache.getDefault("STARTUP_FILE", - Cache.getDefault("www.jalview.org", "http://www.jalview.org") - + "/examples/exampleFile_2_3.jar")); + Cache.getDefault("www.jalview.org", "https://www.jalview.org") + + "/examples/exampleFile_2_7.jvp")); /* * Set Colours tab defaults @@ -323,15 +318,16 @@ public class Preferences extends GPreferences * Set overview panel defaults */ gapColour.setBackground( - Cache.getDefaultColour("GAP_COLOUR", OVERVIEW_DEFAULT_GAP)); + Cache.getDefaultColour(GAP_COLOUR, + jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_GAP)); hiddenColour.setBackground( - Cache.getDefaultColour("HIDDEN_COLOUR", - OVERVIEW_DEFAULT_HIDDEN)); - useLegacyGap.setSelected(Cache.getDefault("USE_LEGACY_GAP", false)); + Cache.getDefaultColour(HIDDEN_COLOUR, + jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_HIDDEN)); + useLegacyGap.setSelected(Cache.getDefault(USE_LEGACY_GAP, false)); gapLabel.setEnabled(!useLegacyGap.isSelected()); gapColour.setEnabled(!useLegacyGap.isSelected()); showHiddenAtStart - .setSelected(Cache.getDefault("SHOW_OV_HIDDEN_AT_START", true)); + .setSelected(Cache.getDefault(SHOW_OV_HIDDEN_AT_START, false)); /* * Set Structure tab defaults. @@ -527,8 +523,10 @@ public class Preferences extends GPreferences autoIdWidth.setSelected(Cache.getDefault("FIGURE_AUTOIDWIDTH", false)); userIdWidth.setEnabled(!autoIdWidth.isSelected()); userIdWidthlabel.setEnabled(!autoIdWidth.isSelected()); - Integer wi = Cache.getIntegerProperty("FIGURE_USERIDWIDTH"); + Integer wi = Cache.getIntegerProperty("FIGURE_FIXEDIDWIDTH"); userIdWidth.setText(wi == null ? "" : wi.toString()); + // TODO: refactor to use common enum via FormatAdapter and allow extension + // for new flat file formats blcjv.setSelected(Cache.getDefault("BLC_JVSUFFIX", true)); clustaljv.setSelected(Cache.getDefault("CLUSTAL_JVSUFFIX", true)); fastajv.setSelected(Cache.getDefault("FASTA_JVSUFFIX", true)); @@ -550,6 +548,12 @@ public class Preferences extends GPreferences annotations_actionPerformed(null); // update the display of the annotation // settings + + + /* + * Set Backups tab defaults + */ + loadLastSavedBackupsOptions(); } /** @@ -658,8 +662,8 @@ public class Preferences extends GPreferences /* * Save Overview settings */ - Cache.setColourProperty("GAP_COLOUR", gapColour.getBackground()); - Cache.setColourProperty("HIDDEN_COLOUR", hiddenColour.getBackground()); + Cache.setColourProperty(GAP_COLOUR, gapColour.getBackground()); + Cache.setColourProperty(HIDDEN_COLOUR, hiddenColour.getBackground()); Cache.applicationProperties.setProperty(USE_LEGACY_GAP, Boolean.toString(useLegacyGap.isSelected())); Cache.applicationProperties.setProperty(SHOW_OV_HIDDEN_AT_START, @@ -784,7 +788,7 @@ public class Preferences extends GPreferences Cache.applicationProperties.setProperty("FIGURE_AUTOIDWIDTH", Boolean.toString(autoIdWidth.isSelected())); userIdWidth_actionPerformed(); - Cache.applicationProperties.setProperty("FIGURE_USERIDWIDTH", + Cache.applicationProperties.setProperty("FIGURE_FIXEDIDWIDTH", userIdWidth.getText()); /* @@ -797,8 +801,31 @@ public class Preferences extends GPreferences Cache.applicationProperties.setProperty("PAD_GAPS", Boolean.toString(padGaps.isSelected())); - dasSource.saveProperties(Cache.applicationProperties); wsPrefs.updateAndRefreshWsMenuConfig(false); + + /* + * Save Backups settings + */ + Cache.applicationProperties.setProperty(BackupFiles.ENABLED, + Boolean.toString(enableBackupFiles.isSelected())); + int preset = getComboIntStringKey(backupfilesPresetsCombo); + Cache.applicationProperties.setProperty(BackupFiles.NS + "_PRESET", Integer.toString(preset)); + + if (preset == BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM) + { + BackupFilesPresetEntry customBFPE = getBackupfilesCurrentEntry(); + BackupFilesPresetEntry.backupfilesPresetEntriesValues.put( + BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM, customBFPE); + Cache.applicationProperties + .setProperty(BackupFilesPresetEntry.CUSTOMCONFIG, + customBFPE.toString()); + } + + BackupFilesPresetEntry savedBFPE = BackupFilesPresetEntry.backupfilesPresetEntriesValues + .get(preset); + Cache.applicationProperties.setProperty( + BackupFilesPresetEntry.SAVEDCONFIG, savedBFPE.toString()); + Cache.saveProperties(); Desktop.instance.doConfigureStructurePrefs(); try @@ -1104,11 +1131,13 @@ public class Preferences extends GPreferences boolean enabled = useLegacyGap.isSelected(); if (enabled) { - gapColour.setBackground(OVERVIEW_DEFAULT_LEGACY_GAP); + gapColour.setBackground( + jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_LEGACY_GAP); } else { - gapColour.setBackground(OVERVIEW_DEFAULT_GAP); + gapColour.setBackground( + jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_GAP); } gapColour.setEnabled(!enabled); gapLabel.setEnabled(!enabled); @@ -1119,8 +1148,9 @@ public class Preferences extends GPreferences { useLegacyGap.setSelected(false); useLegacyGaps_actionPerformed(null); - showHiddenAtStart.setSelected(true); - hiddenColour.setBackground(OVERVIEW_DEFAULT_HIDDEN); + showHiddenAtStart.setSelected(false); + hiddenColour.setBackground( + jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_HIDDEN); } @Override