From: amwaterhouse Date: Mon, 30 Jan 2006 14:58:09 +0000 (+0000) Subject: Can be used for annotation colouring X-Git-Tag: Root_VamJalview_2_07b+~196 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7e137e5223c11e93e8fbcac9831156a6eacf5f5e;p=jalview.git Can be used for annotation colouring --- diff --git a/src/jalview/gui/SliderPanel.java b/src/jalview/gui/SliderPanel.java index 5b177d4..6f8a0b2 100755 --- a/src/jalview/gui/SliderPanel.java +++ b/src/jalview/gui/SliderPanel.java @@ -44,6 +44,7 @@ public class SliderPanel extends GSliderPanel static JInternalFrame PIDSlider; AlignmentPanel ap; boolean forConservation = true; + boolean forAnnotation = false; ColourSchemeI cs; /** @@ -89,6 +90,44 @@ public class SliderPanel extends GSliderPanel valueField.setText(value + ""); } + public SliderPanel(final AlignmentAnnotation annotation, final AlignmentPanel ap) + { + forAnnotation = true; + undoButton.setVisible(false); + applyButton.setVisible(false); + allGroupsCheck.setVisible(false); + label.setText("Adjust value - "+annotation.getGraphLine(0).label); + + float range = annotation.graphMax * 1000 - annotation.graphMin * 1000; + + slider.setMinimum( (int) (annotation.graphMin * 1000)); + slider.setMaximum( (int) (annotation.graphMax * 1000)); + slider.setValue( (int) (annotation.getGraphLine(0).value * 1000)); + valueField.setText( annotation.getGraphLine(0).value + ""); + slider.setMajorTickSpacing( (int) (range / 10f)); + slider.setMinorTickSpacing( (int) (range / 100f)); + slider.setPaintTicks(true); + + JInternalFrame slideFrame = new JInternalFrame(); + slideFrame.setLayer(JLayeredPane.PALETTE_LAYER); + Desktop.addInternalFrame(slideFrame, + "Adjust " + annotation.label +" value", + 250, 90); + + slideFrame.setContentPane(this); + slider.addChangeListener(new ChangeListener() + { + public void stateChanged(ChangeEvent evt) + { + valueField.setText( ((float)slider.getValue()/1000f) + ""); + annotation.getGraphLine(0).value = (float)slider.getValue()/1000f; + ap.repaint(); + } + }); + + } + + /** * DOCUMENT ME! * @@ -315,8 +354,16 @@ public class SliderPanel extends GSliderPanel { try { + if (forAnnotation) + { + float f = Float.parseFloat(valueField.getText()); + slider.setValue( (int)( f * 1000 )); + } + else + { int i = Integer.parseInt(valueField.getText()); slider.setValue(i); + } } catch (Exception ex) {