From 07e0b582a6cd570e7bbfa74cb12dc11905d701b3 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 1 Feb 2005 19:04:14 +0000 Subject: [PATCH] Apply to all groups method added --- src/jalview/gui/SliderPanel.java | 55 ++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/src/jalview/gui/SliderPanel.java b/src/jalview/gui/SliderPanel.java index dee77d5..79a05de 100755 --- a/src/jalview/gui/SliderPanel.java +++ b/src/jalview/gui/SliderPanel.java @@ -1,10 +1,11 @@ package jalview.gui; import jalview.jbgui.*; -import jalview.datamodel.*; import jalview.schemes.*; +import jalview.datamodel.*; import java.awt.event.*; import javax.swing.event.*; +import java.util.*; public class SliderPanel extends GSliderPanel { @@ -49,32 +50,50 @@ public class SliderPanel extends GSliderPanel public void valueChanged(int i) { + ColourSchemeI toChange = null; + Vector allGroups = null; + int groupIndex = 0; - if(forConservation) + if(allGroupsCheck.isSelected()) { - if (cs instanceof ConservationColourScheme) - ( (ConservationColourScheme) cs).inc = i; + allGroups = ap.av.alignment.getGroups(); + groupIndex = allGroups.size()-1; } else - { - if( cs instanceof ResidueColourScheme) - { - ResidueColourScheme rcs = (ResidueColourScheme) cs; - rcs.setThreshold(i); - } - else if( cs instanceof ScoreColourScheme) - { - ScoreColourScheme scs = (ScoreColourScheme) cs; - scs.setThreshold(i); - } - - } + toChange = cs; + + + while( groupIndex > -1 ) + { + if(allGroups!=null) + toChange = ((SequenceGroup)allGroups.get(groupIndex)).cs; + + if (forConservation) + { + if (toChange instanceof ConservationColourScheme) + ( (ConservationColourScheme) toChange).inc = i; + } + else + { + if (toChange.canThreshold()) + ( (ResidueColourScheme) toChange).setThreshold(i); + } + + groupIndex--; + } + ap.seqPanel.seqCanvas.paintFlag=true; ap.seqPanel.repaint(); } + public void setAllGroupsCheckEnabled(boolean b) + { + allGroupsCheck.setEnabled(b); + } + + public void valueField_actionPerformed(ActionEvent e) { try{ @@ -91,4 +110,6 @@ public class SliderPanel extends GSliderPanel { return Integer.parseInt(valueField.getText()); } + + } -- 1.7.10.2