From: kiramt Date: Wed, 30 Aug 2017 12:28:40 +0000 (+0100) Subject: JAL-2527 Code comments, tidy X-Git-Tag: Release_2_10_3b1~142^2~2^2~6 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=69dbb53dd5e77aed29eeea737414ebe2d74cebd4;p=jalview.git JAL-2527 Code comments, tidy --- diff --git a/src/jalview/gui/OverviewCanvas.java b/src/jalview/gui/OverviewCanvas.java index 301387b..5f6a1f6 100644 --- a/src/jalview/gui/OverviewCanvas.java +++ b/src/jalview/gui/OverviewCanvas.java @@ -59,6 +59,8 @@ public class OverviewCanvas extends JComponent private AlignViewportI av; + private OverviewResColourFinder cf; + public OverviewCanvas(OverviewDimensions overviewDims, AlignViewportI alignvp) { @@ -68,6 +70,12 @@ public class OverviewCanvas extends JComponent sr = new SequenceRenderer(av); sr.renderGaps = false; fr = new jalview.renderer.seqfeatures.FeatureRenderer(av); + + boolean useLegacy = Cache.getDefault("USE_LEGACY_GAP", false); + Color gapCol = Cache.getDefaultColour("GAP_COLOUR", Color.lightGray); + Color hiddenCol = Cache.getDefaultColour("HIDDEN_COLOUR", + Color.DARK_GRAY.darker()); + cf = new OverviewResColourFinder(useLegacy, gapCol, hiddenCol); } /** @@ -127,12 +135,6 @@ public class OverviewCanvas extends JComponent setPreferredSize(new Dimension(od.getWidth(), od.getHeight())); - boolean useLegacy = Cache.getDefault("USE_LEGACY_GAP", false); - Color gapCol = Cache.getDefaultColour("GAP_COLOUR", Color.lightGray); - Color hiddenCol = Cache.getDefaultColour("HIDDEN_COLOUR", Color.DARK_GRAY.darker()); - OverviewResColourFinder cf = new OverviewResColourFinder(useLegacy, - gapCol, hiddenCol); - or = new OverviewRenderer(fr, od, av.getAlignment(), av.getResidueShading(), cf); miniMe = or.draw(od.getRows(av.getAlignment()), diff --git a/src/jalview/renderer/OverviewResColourFinder.java b/src/jalview/renderer/OverviewResColourFinder.java index 8fa0e23..07fc6e3 100644 --- a/src/jalview/renderer/OverviewResColourFinder.java +++ b/src/jalview/renderer/OverviewResColourFinder.java @@ -28,21 +28,34 @@ import java.awt.Color; public class OverviewResColourFinder extends ResidueColourFinder { - final Color GAP_COLOUR; + final Color GAP_COLOUR; // default colour to use at gaps - final Color RESIDUE_COLOUR; + final Color RESIDUE_COLOUR; // default colour to use at residues - final Color HIDDEN_COLOUR; + final Color HIDDEN_COLOUR; // colour for hidden regions boolean useLegacy = false; + /** + * Constructor without colour settings (used by applet) + */ public OverviewResColourFinder() { - GAP_COLOUR = Color.lightGray; // new Color(240, 240, 240); + GAP_COLOUR = Color.lightGray; RESIDUE_COLOUR = Color.white; HIDDEN_COLOUR = Color.DARK_GRAY.darker(); } + /** + * Constructor with colour settings + * + * @param useLegacyColouring + * whether to use legacy gap colouring (white gaps, grey residues) + * @param gapCol + * gap colour if not legacy + * @param hiddenCol + * hidden region colour (transparency applied by rendering code) + */ public OverviewResColourFinder(boolean useLegacyColouring, Color gapCol, Color hiddenCol) { @@ -113,6 +126,11 @@ public class OverviewResColourFinder extends ResidueColourFinder return getBoxColour(currentShader, seq, i); } + /** + * Supply hidden colour + * + * @return colour of hidden regions + */ protected Color getHiddenColour() { return HIDDEN_COLOUR;