package jalview.appletgui;
import jalview.datamodel.SequenceGroup;
-import jalview.schemes.ColourSchemeI;
+import jalview.renderer.ResidueShaderI;
import jalview.util.MessageManager;
import java.awt.BorderLayout;
public class SliderPanel extends Panel implements ActionListener,
AdjustmentListener, MouseListener
{
+ private static final String BACKGROUND = "Background";
+
AlignmentPanel ap;
boolean forConservation = true;
- ColourSchemeI cs;
+ ResidueShaderI cs;
static Frame conservationSlider;
static Frame PIDSlider;
public static int setConservationSlider(AlignmentPanel ap,
- ColourSchemeI cs, String source)
+ ResidueShaderI ccs, String source)
{
SliderPanel sp = null;
if (conservationSlider == null)
{
- sp = new SliderPanel(ap, cs.getConservationInc(), true, cs);
+ sp = new SliderPanel(ap, ccs.getConservationInc(), true, ccs);
conservationSlider = new Frame();
conservationSlider.add(sp);
}
else
{
sp = (SliderPanel) conservationSlider.getComponent(0);
- sp.cs = cs;
+ sp.cs = ccs;
+ sp.valueField.setText(String.valueOf(ccs.getConservationInc()));
}
- conservationSlider
- .setTitle(MessageManager.formatMessage(
- "label.conservation_colour_increment",
- new String[] { source }));
+ conservationSlider.setTitle(MessageManager.formatMessage(
+ "label.conservation_colour_increment",
+ new String[] { source == null ? BACKGROUND : source }));
if (ap.av.getAlignment().getGroups() != null)
{
sp.setAllGroupsCheckEnabled(true);
}
- public static int setPIDSliderSource(AlignmentPanel ap, ColourSchemeI cs,
- String source)
+ public static int setPIDSliderSource(AlignmentPanel ap,
+ ResidueShaderI ccs, String source)
{
SliderPanel pid = null;
if (PIDSlider == null)
{
- pid = new SliderPanel(ap, cs.getThreshold(), false, cs);
+ pid = new SliderPanel(ap, ccs.getThreshold(), false, ccs);
PIDSlider = new Frame();
PIDSlider.add(pid);
}
else
{
pid = (SliderPanel) PIDSlider.getComponent(0);
- pid.cs = cs;
+ pid.cs = ccs;
+ pid.valueField.setText(String.valueOf(ccs.getThreshold()));
}
- PIDSlider
- .setTitle(MessageManager.formatMessage(
- "label.percentage_identity_threshold",
- new String[] { source }));
+ PIDSlider.setTitle(MessageManager.formatMessage(
+ "label.percentage_identity_threshold",
+ new String[] { source == null ? BACKGROUND : source }));
if (ap.av.getAlignment().getGroups() != null)
{
}
/**
- * Hides the conservation slider panel if it is shown
+ * Hides the Conservation slider panel if it is shown
*/
public static void hideConservationSlider()
{
}
}
public SliderPanel(AlignmentPanel ap, int value, boolean forConserve,
- ColourSchemeI cs)
+ ResidueShaderI shader)
{
try
{
e.printStackTrace();
}
this.ap = ap;
- this.cs = cs;
+ this.cs = shader;
forConservation = forConserve;
undoButton.setVisible(false);
applyButton.setVisible(false);
return;
}
- ColourSchemeI toChange = cs;
+ ResidueShaderI toChange = cs;
Iterator<SequenceGroup> allGroups = null;
if (allGroupsCheck.getState())