From: gmungoc Date: Tue, 30 Jul 2019 13:08:01 +0000 (+0100) Subject: JAL-3364 more careful save/restore of preferences X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=51ff82459bf98489783edb76a9f2c983d8416803;p=jalview.git JAL-3364 more careful save/restore of preferences --- diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index b77f9db..cd31bed 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -1211,8 +1211,7 @@ public class AlignmentPanel extends GAlignmentPanel implements * split frame with 'protein scaled to codons' and 'auto id width' */ - final boolean autoIdWidth = Cache.getDefault("FIGURE_AUTOIDWIDTH", - false); + final String autoIdWidth = Cache.getProperty("FIGURE_AUTOIDWIDTH"); final Integer fixedIdWidth = Cache .getIntegerProperty("FIGURE_FIXEDIDWIDTH"); @@ -1234,7 +1233,7 @@ public class AlignmentPanel extends GAlignmentPanel implements complement = ((AlignViewport) av.getCodingComplement()) .getAlignPanel(); dim2 = complement.getAlignmentDimension(); - if (autoIdWidth && av.isScaleProteinAsCdna()) + if (Boolean.valueOf(autoIdWidth) && av.isScaleProteinAsCdna()) { int w1 = this.getVisibleIdWidth(false); int w2 = complement.getVisibleIdWidth(false); @@ -1306,10 +1305,23 @@ public class AlignmentPanel extends GAlignmentPanel implements /* * restore preference settings in case they were fudged */ - Cache.setProperty("FIGURE_AUTOIDWIDTH", - String.valueOf(autoIdWidth)); - Cache.setProperty("FIGURE_FIXEDIDWIDTH", - String.valueOf(fixedIdWidth)); + if (autoIdWidth == null) + { + Cache.removeProperty("FIGURE_AUTOIDWIDTH"); + } + else + { + Cache.setProperty("FIGURE_AUTOIDWIDTH", autoIdWidth); + } + if (fixedIdWidth == null) + { + Cache.removeProperty("FIGURE_FIXEDIDWIDTH"); + } + else + { + Cache.setProperty("FIGURE_FIXEDIDWIDTH", + String.valueOf(fixedIdWidth)); + } } }