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;
* @author $author$
* @version $Revision$
*/
-@SuppressWarnings("serial")
public class Preferences extends GPreferences
{
public static final String ENABLE_SPLIT_FRAME = "ENABLE_SPLIT_FRAME";
* Holds name and link separated with | character. Sequence ID must be
* $SEQUENCE_ID$ or $SEQUENCE_ID=/.possible | chars ./=$
*/
- public static UrlProviderI sequenceUrlLinks; // must be nonfinal for test
+ public static UrlProviderI sequenceUrlLinks;
- public final static UrlLinkTableModel dataModel;
+ public static UrlLinkTableModel dataModel;
/**
* Holds name and link separated with | character. Sequence IDS and Sequences
* (TODO: proper escape for using | to separate ids or sequences
*/
- public static final List<String> groupURLLinks;
+ public static List<String> groupURLLinks;
static
{
// get links selected to be in the menu (SEQUENCE_LINKS)
/*
* Set Backups tab defaults
*/
- loadLastSavedBackupsOptions();
+ if (!Platform.isJS())
+ {
+ loadLastSavedBackupsOptions();
+ }
}
/**
/*
* Save Visual settings
*/
- Cache.setPropertyNoSave("SHOW_JVSUFFIX",
+ Cache.applicationProperties.setProperty("SHOW_JVSUFFIX",
Boolean.toString(seqLimit.isSelected()));
- Cache.setPropertyNoSave("RIGHT_ALIGN_IDS",
+ Cache.applicationProperties.setProperty("RIGHT_ALIGN_IDS",
Boolean.toString(rightAlign.isSelected()));
- Cache.setPropertyNoSave("SHOW_FULLSCREEN",
+ Cache.applicationProperties.setProperty("SHOW_FULLSCREEN",
Boolean.toString(fullScreen.isSelected()));
- Cache.setPropertyNoSave("SHOW_OVERVIEW",
+ Cache.applicationProperties.setProperty("SHOW_OVERVIEW",
Boolean.toString(openoverv.isSelected()));
- Cache.setPropertyNoSave("SHOW_ANNOTATIONS",
+ Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS",
Boolean.toString(annotations.isSelected()));
- Cache.setPropertyNoSave("SHOW_CONSERVATION",
+ Cache.applicationProperties.setProperty("SHOW_CONSERVATION",
Boolean.toString(conservation.isSelected()));
- Cache.setPropertyNoSave("SHOW_QUALITY",
+ Cache.applicationProperties.setProperty("SHOW_QUALITY",
Boolean.toString(quality.isSelected()));
- Cache.setPropertyNoSave("SHOW_IDENTITY",
+ Cache.applicationProperties.setProperty("SHOW_IDENTITY",
Boolean.toString(identity.isSelected()));
- Cache.setPropertyNoSave("GAP_SYMBOL",
+ Cache.applicationProperties.setProperty("GAP_SYMBOL",
gapSymbolCB.getSelectedItem().toString());
- Cache.setPropertyNoSave("FONT_NAME",
+ Cache.applicationProperties.setProperty("FONT_NAME",
fontNameCB.getSelectedItem().toString());
- Cache.setPropertyNoSave("FONT_STYLE",
+ Cache.applicationProperties.setProperty("FONT_STYLE",
fontStyleCB.getSelectedItem().toString());
- Cache.setPropertyNoSave("FONT_SIZE",
+ Cache.applicationProperties.setProperty("FONT_SIZE",
fontSizeCB.getSelectedItem().toString());
- Cache.setPropertyNoSave("ID_ITALICS",
+ Cache.applicationProperties.setProperty("ID_ITALICS",
Boolean.toString(idItalics.isSelected()));
- Cache.setPropertyNoSave("SHOW_UNCONSERVED",
+ Cache.applicationProperties.setProperty("SHOW_UNCONSERVED",
Boolean.toString(showUnconserved.isSelected()));
- Cache.setPropertyNoSave(SHOW_OCCUPANCY,
+ Cache.applicationProperties.setProperty(SHOW_OCCUPANCY,
Boolean.toString(showOccupancy.isSelected()));
- Cache.setPropertyNoSave("SHOW_GROUP_CONSENSUS",
+ Cache.applicationProperties.setProperty("SHOW_GROUP_CONSENSUS",
Boolean.toString(showGroupConsensus.isSelected()));
- Cache.setPropertyNoSave("SHOW_GROUP_CONSERVATION",
+ Cache.applicationProperties.setProperty("SHOW_GROUP_CONSERVATION",
Boolean.toString(showGroupConservation.isSelected()));
- Cache.setPropertyNoSave("SHOW_CONSENSUS_HISTOGRAM",
+ Cache.applicationProperties.setProperty("SHOW_CONSENSUS_HISTOGRAM",
Boolean.toString(showConsensHistogram.isSelected()));
- Cache.setPropertyNoSave("SHOW_CONSENSUS_LOGO",
+ Cache.applicationProperties.setProperty("SHOW_CONSENSUS_LOGO",
Boolean.toString(showConsensLogo.isSelected()));
- Cache.setPropertyNoSave("ANTI_ALIAS",
+ Cache.applicationProperties.setProperty("ANTI_ALIAS",
Boolean.toString(smoothFont.isSelected()));
- Cache.setPropertyNoSave(SCALE_PROTEIN_TO_CDNA,
+ Cache.applicationProperties.setProperty(SCALE_PROTEIN_TO_CDNA,
Boolean.toString(scaleProteinToCdna.isSelected()));
- Cache.setPropertyNoSave("SHOW_NPFEATS_TOOLTIP",
+ Cache.applicationProperties.setProperty("SHOW_NPFEATS_TOOLTIP",
Boolean.toString(showNpTooltip.isSelected()));
- Cache.setPropertyNoSave("SHOW_DBREFS_TOOLTIP",
+ Cache.applicationProperties.setProperty("SHOW_DBREFS_TOOLTIP",
Boolean.toString(showDbRefTooltip.isSelected()));
- Cache.setPropertyNoSave("WRAP_ALIGNMENT",
+ Cache.applicationProperties.setProperty("WRAP_ALIGNMENT",
Boolean.toString(wrap.isSelected()));
- Cache.setPropertyNoSave("STARTUP_FILE",
+ Cache.applicationProperties.setProperty("STARTUP_FILE",
startupFileTextfield.getText());
- Cache.setPropertyNoSave("SHOW_STARTUP_FILE",
+ Cache.applicationProperties.setProperty("SHOW_STARTUP_FILE",
Boolean.toString(startupCheckbox.isSelected()));
- Cache.setPropertyNoSave("SORT_ALIGNMENT",
+ Cache.applicationProperties.setProperty("SORT_ALIGNMENT",
sortby.getSelectedItem().toString());
// convert description of sort order to enum name for save
.forDescription(sortAnnBy.getSelectedItem().toString());
if (annSortOrder != null)
{
- Cache.setPropertyNoSave(SORT_ANNOTATIONS,
+ Cache.applicationProperties.setProperty(SORT_ANNOTATIONS,
annSortOrder.name());
}
final boolean showAutocalcFirst = sortAutocalc.getSelectedIndex() == 0;
- Cache.setPropertyNoSave(SHOW_AUTOCALC_ABOVE,
+ Cache.applicationProperties.setProperty(SHOW_AUTOCALC_ABOVE,
Boolean.valueOf(showAutocalcFirst).toString());
/*
* Save Colours settings
*/
- Cache.setPropertyNoSave(DEFAULT_COLOUR_PROT,
+ Cache.applicationProperties.setProperty(DEFAULT_COLOUR_PROT,
protColour.getSelectedItem().toString());
- Cache.setPropertyNoSave(DEFAULT_COLOUR_NUC,
+ Cache.applicationProperties.setProperty(DEFAULT_COLOUR_NUC,
nucColour.getSelectedItem().toString());
Cache.setColourProperty("ANNOTATIONCOLOUR_MIN",
minColour.getBackground());
*/
Cache.setColourProperty(GAP_COLOUR, gapColour.getBackground());
Cache.setColourProperty(HIDDEN_COLOUR, hiddenColour.getBackground());
- Cache.setPropertyNoSave(USE_LEGACY_GAP,
+ Cache.applicationProperties.setProperty(USE_LEGACY_GAP,
Boolean.toString(useLegacyGap.isSelected()));
- Cache.setPropertyNoSave(SHOW_OV_HIDDEN_AT_START,
+ Cache.applicationProperties.setProperty(SHOW_OV_HIDDEN_AT_START,
Boolean.toString(showHiddenAtStart.isSelected()));
/*
* Save Structure settings
*/
- Cache.setPropertyNoSave(ADD_TEMPFACT_ANN,
+ Cache.applicationProperties.setProperty(ADD_TEMPFACT_ANN,
Boolean.toString(addTempFactor.isSelected()));
- Cache.setPropertyNoSave(ADD_SS_ANN,
+ Cache.applicationProperties.setProperty(ADD_SS_ANN,
Boolean.toString(addSecondaryStructure.isSelected()));
- Cache.setPropertyNoSave(USE_RNAVIEW,
+ Cache.applicationProperties.setProperty(USE_RNAVIEW,
Boolean.toString(useRnaView.isSelected()));
- Cache.setPropertyNoSave(STRUCT_FROM_PDB,
+ Cache.applicationProperties.setProperty(STRUCT_FROM_PDB,
Boolean.toString(structFromPdb.isSelected()));
- Cache.setPropertyNoSave(STRUCTURE_DISPLAY,
+ Cache.applicationProperties.setProperty(STRUCTURE_DISPLAY,
structViewer.getSelectedItem().toString());
Cache.setOrRemove(CHIMERA_PATH, chimeraPath.getText());
- Cache.setPropertyNoSave("MAP_WITH_SIFTS",
+ Cache.applicationProperties.setProperty("MAP_WITH_SIFTS",
Boolean.toString(siftsMapping.isSelected()));
SiftsSettings.setMapWithSifts(siftsMapping.isSelected());
/*
* Save Output settings
*/
- Cache.setPropertyNoSave("EPS_RENDERING",
+ Cache.applicationProperties.setProperty("EPS_RENDERING",
((OptionsParam) epsRendering.getSelectedItem()).getCode());
- Cache.setPropertyNoSave("HTML_RENDERING",
+ Cache.applicationProperties.setProperty("HTML_RENDERING",
((OptionsParam) htmlRendering.getSelectedItem()).getCode());
- Cache.setPropertyNoSave("SVG_RENDERING",
+ Cache.applicationProperties.setProperty("SVG_RENDERING",
((OptionsParam) svgRendering.getSelectedItem()).getCode());
/*
String menuLinks = sequenceUrlLinks.writeUrlsAsString(true);
if (menuLinks.isEmpty())
{
- Cache.removePropertyNoSave("SEQUENCE_LINKS");
+ Cache.applicationProperties.remove("SEQUENCE_LINKS");
}
else
{
- Cache.setPropertyNoSave("SEQUENCE_LINKS",
+ Cache.applicationProperties.setProperty("SEQUENCE_LINKS",
menuLinks.toString());
}
String nonMenuLinks = sequenceUrlLinks.writeUrlsAsString(false);
if (nonMenuLinks.isEmpty())
{
- Cache.removePropertyNoSave("STORED_LINKS");
+ Cache.applicationProperties.remove("STORED_LINKS");
}
else
{
- Cache.setPropertyNoSave("STORED_LINKS",
+ Cache.applicationProperties.setProperty("STORED_LINKS",
nonMenuLinks.toString());
}
- Cache.setPropertyNoSave("DEFAULT_URL",
+ Cache.applicationProperties.setProperty("DEFAULT_URL",
sequenceUrlLinks.getPrimaryUrlId());
- Cache.setPropertyNoSave("USE_PROXY",
+ Cache.applicationProperties.setProperty("USE_PROXY",
Boolean.toString(useProxy.isSelected()));
Cache.setOrRemove("PROXY_SERVER", proxyServerTB.getText());
/*
* Save Output settings
*/
- Cache.setPropertyNoSave("BLC_JVSUFFIX",
+ Cache.applicationProperties.setProperty("BLC_JVSUFFIX",
Boolean.toString(blcjv.isSelected()));
- Cache.setPropertyNoSave("CLUSTAL_JVSUFFIX",
+ Cache.applicationProperties.setProperty("CLUSTAL_JVSUFFIX",
Boolean.toString(clustaljv.isSelected()));
- Cache.setPropertyNoSave("FASTA_JVSUFFIX",
+ Cache.applicationProperties.setProperty("FASTA_JVSUFFIX",
Boolean.toString(fastajv.isSelected()));
- Cache.setPropertyNoSave("MSF_JVSUFFIX",
+ Cache.applicationProperties.setProperty("MSF_JVSUFFIX",
Boolean.toString(msfjv.isSelected()));
- Cache.setPropertyNoSave("PFAM_JVSUFFIX",
+ Cache.applicationProperties.setProperty("PFAM_JVSUFFIX",
Boolean.toString(pfamjv.isSelected()));
- Cache.setPropertyNoSave("PILEUP_JVSUFFIX",
+ Cache.applicationProperties.setProperty("PILEUP_JVSUFFIX",
Boolean.toString(pileupjv.isSelected()));
- Cache.setPropertyNoSave("PIR_JVSUFFIX",
+ Cache.applicationProperties.setProperty("PIR_JVSUFFIX",
Boolean.toString(pirjv.isSelected()));
- Cache.setPropertyNoSave("PIR_MODELLER",
+ Cache.applicationProperties.setProperty("PIR_MODELLER",
Boolean.toString(modellerOutput.isSelected()));
- Cache.setPropertyNoSave("EXPORT_EMBBED_BIOJSON",
+ Cache.applicationProperties.setProperty("EXPORT_EMBBED_BIOJSON",
Boolean.toString(embbedBioJSON.isSelected()));
jalview.io.PIRFile.useModellerOutput = modellerOutput.isSelected();
- Cache.setPropertyNoSave("FIGURE_AUTOIDWIDTH",
+ Cache.applicationProperties.setProperty("FIGURE_AUTOIDWIDTH",
Boolean.toString(autoIdWidth.isSelected()));
userIdWidth_actionPerformed();
- Cache.setPropertyNoSave("FIGURE_FIXEDIDWIDTH",
+ Cache.applicationProperties.setProperty("FIGURE_FIXEDIDWIDTH",
userIdWidth.getText());
/*
* Save Editing settings
*/
- Cache.setPropertyNoSave("AUTO_CALC_CONSENSUS",
+ Cache.applicationProperties.setProperty("AUTO_CALC_CONSENSUS",
Boolean.toString(autoCalculateConsCheck.isSelected()));
- Cache.setPropertyNoSave("SORT_BY_TREE",
+ Cache.applicationProperties.setProperty("SORT_BY_TREE",
Boolean.toString(sortByTree.isSelected()));
- Cache.setPropertyNoSave("PAD_GAPS",
+ Cache.applicationProperties.setProperty("PAD_GAPS",
Boolean.toString(padGaps.isSelected()));
if (!Platform.isJS())
/*
* Save Backups settings
*/
- Cache.setPropertyNoSave(BackupFiles.CONFIRM_DELETE_OLD,
- Boolean.toString(backupfilesConfirmDelete.isSelected()));
- Cache.setPropertyNoSave(BackupFiles.ENABLED,
- Boolean.toString(enableBackupFiles.isSelected()));
- Cache.setPropertyNoSave(BackupFiles.NO_MAX,
- Boolean.toString(backupfilesKeepAll.isSelected()));
- Cache.setPropertyNoSave(BackupFiles.REVERSE_ORDER,
- Boolean.toString(suffixReverse.isSelected()));
- Cache.setPropertyNoSave(BackupFiles.SUFFIX,
- suffixTemplate.getText());
- Cache.setPropertyNoSave(BackupFiles.ROLL_MAX,
- Integer.toString(getSpinnerInt(backupfilesRollMaxSpinner, 4)));
- Cache.setPropertyNoSave(BackupFiles.SUFFIX_DIGITS,
- Integer.toString(getSpinnerInt(suffixDigitsSpinner, 3)));
- Cache.setPropertyNoSave(BackupFiles.NS + "_PRESET",
- Integer.toString(getComboIntStringKey(backupfilesPresetsCombo)));
+ Cache.applicationProperties.setProperty(BackupFiles.ENABLED,
+ Platform.isJS() ? Boolean.FALSE.toString()
+ : Boolean.toString(enableBackupFiles.isSelected()));
+ if (!Platform.isJS())
+ {
+ 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.getInstance().doConfigureStructurePrefs();
+ Desktop.instance.doConfigureStructurePrefs();
try
{
frame.setClosed(true);
FileFormatI format = chooser.getSelectedFormat();
if (format != null)
{
- Cache.setPropertyNoSave("DEFAULT_FILE_FORMAT",
+ Cache.applicationProperties.setProperty("DEFAULT_FILE_FORMAT",
format.getName());
}
startupFileTextfield
boolean valid = false;
while (!valid)
{
- if (JvOptionPane.showInternalConfirmDialog(Desktop.getDesktopPane(), link,
+ if (JvOptionPane.showInternalConfirmDialog(Desktop.desktop, link,
MessageManager.getString("label.new_sequence_url_link"),
JvOptionPane.OK_CANCEL_OPTION, -1,
null) == JvOptionPane.OK_OPTION)
boolean valid = false;
while (!valid)
{
- if (JvOptionPane.showInternalConfirmDialog(Desktop.getDesktopPane(), link,
+ if (JvOptionPane.showInternalConfirmDialog(Desktop.desktop, link,
MessageManager.getString("label.edit_sequence_url_link"),
JvOptionPane.OK_CANCEL_OPTION, -1,
null) == JvOptionPane.OK_OPTION)
} catch (NumberFormatException x)
{
userIdWidth.setText("");
- JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
+ JvOptionPane.showInternalMessageDialog(Desktop.desktop,
MessageManager
.getString("warn.user_defined_width_requirements"),
MessageManager.getString("label.invalid_id_column_width"),
* Returns true if chimera path is to a valid executable, else show an error
* dialog.
*/
- protected boolean validateChimeraPath()
+ private boolean validateChimeraPath()
{
if (chimeraPath.getText().trim().length() > 0)
{
File f = new File(chimeraPath.getText());
if (!f.canExecute())
{
- JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
+ JvOptionPane.showInternalMessageDialog(Desktop.desktop,
MessageManager.getString("label.invalid_chimera_path"),
MessageManager.getString("label.invalid_name"),
JvOptionPane.ERROR_MESSAGE);
if (!found)
{
String[] options = { "OK", "Help" };
- int showHelp = JvOptionPane.showInternalOptionDialog(Desktop.getDesktopPane(),
+ int showHelp = JvOptionPane.showInternalOptionDialog(Desktop.desktop,
JvSwingUtils.wrapTooltip(true,
MessageManager.getString("label.chimera_missing")),
"", JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE,
}
}
- protected class UrlListSelectionHandler implements ListSelectionListener
+ private class UrlListSelectionHandler implements ListSelectionListener
{
@Override