thresholdPanel.setFont(JvSwingUtils.getLabelFont());
thresholdPanel.setLayout(new MigLayout("", "[left][right]", "[][]"));
+ percentThreshold.setBackground(Color.white);
+ percentThreshold.setFont(JvSwingUtils.getLabelFont());
+
JPanel actionPanel = new JPanel();
actionPanel.setBackground(Color.white);
actionPanel.setFont(JvSwingUtils.getLabelFont());
ngStructureFilterPanel = new StructureFilterPanel(this);
thresholdPanel.add(getThreshold());
- thresholdPanel.add(thresholdValue, "wrap");
- thresholdPanel.add(slider, "grow, span, wrap");
+ thresholdPanel.add(percentThreshold, "wrap");
+ thresholdPanel.add(slider, "grow");
+ thresholdPanel.add(thresholdValue, "span, wrap");
actionPanel.add(ok);
actionPanel.add(cancel);
slider.setEnabled(true);
thresholdValue.setEnabled(true);
+ percentThreshold.setEnabled(true);
if (selectedThresholdItem == AnnotationColourGradient.NO_THRESHOLD)
{
slider.setEnabled(false);
thresholdValue.setEnabled(false);
thresholdValue.setText("");
+ percentThreshold.setEnabled(false);
// build filter params
}
else if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD)
slider.setMinimum((int) (getCurrentAnnotation().graphMin * 1000));
slider.setMaximum((int) (getCurrentAnnotation().graphMax * 1000));
slider.setValue((int) (getCurrentAnnotation().threshold.value * 1000));
- thresholdValue.setText(getCurrentAnnotation().threshold.value + "");
+
+ if (percentThreshold.isSelected())
+ {
+ thresholdValue
+ .setText(""
+ + ((getCurrentAnnotation().threshold.value - getCurrentAnnotation().graphMin) * 100f / (getCurrentAnnotation().graphMax - getCurrentAnnotation().graphMin)));
+ }
+ else
+ {
+ thresholdValue.setText(getCurrentAnnotation().threshold.value + "");
+ }
+
slider.setMajorTickSpacing((int) (range / 10f));
slider.setEnabled(true);
thresholdValue.setEnabled(true);
ap.paintAlignment(true);
}
+
public ColumnSelection getOldColumnSelection()
{
return oldColumnSelection;
protected JCheckBox seqAssociated = new JCheckBox();
+ protected JCheckBox percentThreshold = new JCheckBox();
+
protected JSlider slider = new JSlider();
protected JTextField thresholdValue = new JTextField(20);
{
if (!adjusting)
{
- thresholdValue.setText((slider.getValue() / 1000f) + "");
+ setThresholdValueText();
valueChanged(!sliderDragging);
}
}
});
}
+ protected void setThresholdValueText()
+ {
+ adjusting = true;
+ if (percentThreshold.isSelected())
+ {
+ thresholdValue.setText("" + (slider.getValue() - slider.getMinimum())
+ * 100f / (slider.getMaximum() - slider.getMinimum()));
+ }
+ else
+ {
+ thresholdValue.setText((slider.getValue() / 1000f) + "");
+ }
+ adjusting = false;
+ }
protected void addSliderMouseListeners()
{
try
{
float f = Float.parseFloat(thresholdValue.getText());
- slider.setValue((int) (f * 1000));
+ if (percentThreshold.isEnabled())
+ {
+ slider.setValue(slider.getMinimum()
+ + ((int) ((f / 100f) * (slider.getMaximum() - slider
+ .getMinimum()))));
+ }
+ else
+ {
+ slider.setValue((int) (f * 1000));
+ }
updateView();
} catch (NumberFormatException ex)
{
}
}
+ protected void percentageValue_actionPerformed()
+ {
+ setThresholdValueText();
+ }
+
protected void thresholdIsMin_actionPerformed()
{
updateView();
}
});
+ percentThreshold.setText(MessageManager.getString("label.as_percentage"));
+ percentThreshold.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ if (!adjusting)
+ {
+ percentageValue_actionPerformed();
+ }
+ }
+ });
slider.setPaintLabels(false);
slider.setPaintTicks(true);
slider.setBackground(Color.white);