From: Jim Procter Date: Mon, 4 Sep 2017 13:37:56 +0000 (+0100) Subject: JAL-2527 move default colours for applet / application out of gui.Preferences so... X-Git-Tag: Release_2_10_2b1~11^2~4^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d476574d0dc6e4d98824f430e41c8965b8e93499;p=jalview.git JAL-2527 move default colours for applet / application out of gui.Preferences so applet build completes --- diff --git a/src/jalview/gui/OverviewCanvas.java b/src/jalview/gui/OverviewCanvas.java index 04e34cd..64bf15c 100644 --- a/src/jalview/gui/OverviewCanvas.java +++ b/src/jalview/gui/OverviewCanvas.java @@ -96,9 +96,9 @@ public class OverviewCanvas extends JComponent boolean useLegacy = Cache.getDefault(Preferences.USE_LEGACY_GAP, false); Color gapCol = Cache.getDefaultColour(Preferences.GAP_COLOUR, - Preferences.OVERVIEW_DEFAULT_GAP); + jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_GAP); Color hiddenCol = Cache.getDefaultColour(Preferences.HIDDEN_COLOUR, - Preferences.OVERVIEW_DEFAULT_HIDDEN); + jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_HIDDEN); cf = new OverviewResColourFinder(useLegacy, gapCol, hiddenCol); setSize(od.getWidth(), od.getHeight()); diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 7ceb04e..6635dbe 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -121,13 +121,6 @@ public class Preferences extends GPreferences private static final int MAX_FONT_SIZE = 30; - public static final Color OVERVIEW_DEFAULT_GAP = Color.lightGray; - - public static final Color OVERVIEW_DEFAULT_LEGACY_GAP = Color.white; - - public static final Color OVERVIEW_DEFAULT_HIDDEN = Color.darkGray - .darker(); - /** * Holds name and link separated with | character. Sequence ID must be * $SEQUENCE_ID$ or $SEQUENCE_ID=/.possible | chars ./=$ @@ -327,10 +320,11 @@ 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)); + jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_HIDDEN)); useLegacyGap.setSelected(Cache.getDefault(USE_LEGACY_GAP, false)); gapLabel.setEnabled(!useLegacyGap.isSelected()); gapColour.setEnabled(!useLegacyGap.isSelected()); @@ -1108,11 +1102,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); @@ -1124,7 +1120,8 @@ public class Preferences extends GPreferences useLegacyGap.setSelected(false); useLegacyGaps_actionPerformed(null); showHiddenAtStart.setSelected(true); - hiddenColour.setBackground(OVERVIEW_DEFAULT_HIDDEN); + hiddenColour.setBackground( + jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_HIDDEN); } @Override diff --git a/src/jalview/renderer/OverviewResColourFinder.java b/src/jalview/renderer/OverviewResColourFinder.java index b606ba3..a497d92 100644 --- a/src/jalview/renderer/OverviewResColourFinder.java +++ b/src/jalview/renderer/OverviewResColourFinder.java @@ -22,7 +22,6 @@ package jalview.renderer; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; -import jalview.gui.Preferences; import jalview.util.Comparison; import java.awt.Color; @@ -37,13 +36,19 @@ public class OverviewResColourFinder extends ResidueColourFinder boolean useLegacy = false; + public static final Color OVERVIEW_DEFAULT_GAP = Color.lightGray; + + public static final Color OVERVIEW_DEFAULT_LEGACY_GAP = Color.white; + + public static final Color OVERVIEW_DEFAULT_HIDDEN = Color.darkGray + .darker(); + /** * Constructor without colour settings (used by applet) */ public OverviewResColourFinder() { - this(false, Preferences.OVERVIEW_DEFAULT_GAP, - Preferences.OVERVIEW_DEFAULT_HIDDEN); + this(false, OVERVIEW_DEFAULT_GAP, OVERVIEW_DEFAULT_HIDDEN); } /** diff --git a/test/jalview/renderer/OverviewResColourFinderTest.java b/test/jalview/renderer/OverviewResColourFinderTest.java index 2016087..1687516 100644 --- a/test/jalview/renderer/OverviewResColourFinderTest.java +++ b/test/jalview/renderer/OverviewResColourFinderTest.java @@ -30,7 +30,6 @@ import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.gui.AlignViewport; import jalview.gui.JvOptionPane; -import jalview.gui.Preferences; import jalview.schemes.ColourSchemeI; import jalview.schemes.UserColourScheme; import jalview.schemes.ZappoColourScheme; @@ -244,7 +243,9 @@ public class OverviewResColourFinderTest // gaps gap colour c = rcf.getBoxColour(shader, seq, 3); - assertEquals(Preferences.OVERVIEW_DEFAULT_GAP, c); + assertEquals( + jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_GAP, + c); // legacy colouring set explicitly via constructor rcf = new OverviewResColourFinder(true, Color.blue, Color.red); @@ -268,7 +269,9 @@ public class OverviewResColourFinderTest // gaps gap colour c = rcf.getBoxColour(shader, seq, 3); - assertEquals(Preferences.OVERVIEW_DEFAULT_GAP, c); + assertEquals( + jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_GAP, + c); // non legacy colouring with colour scheme rcf = new OverviewResColourFinder(false, Color.blue, Color.red);