package jalview.appletgui;
import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.HiddenColumns;
import jalview.schemes.AnnotationColourGradient;
import jalview.util.MessageManager;
import jalview.viewmodel.annotationfilter.AnnotationFilterParameter;
private int actionOption = ACTION_OPTION_SELECT;
- private ColumnSelection oldColumnSelection;
+ private HiddenColumns oldHiddenColumns;
public AnnotationColumnChooser()
{
{
return;
}
- setOldColumnSelection(av.getColumnSelection());
+ setOldHiddenColumns(av.getAlignment().getHiddenColumns());
adjusting = true;
Vector<String> list = new Vector<String>();
int index = 1;
}
populateThresholdComboBox(threshold);
-
+ AnnotationColumnChooser lastChooser = av
+ .getAnnotationColumnSelectionState();
// restore Object state from the previous session if one exists
- if (av.getAnnotationColumnSelectionState() != null)
+ if (lastChooser != null)
{
- currentSearchPanel = av.getAnnotationColumnSelectionState()
+ currentSearchPanel = lastChooser
.getCurrentSearchPanel();
- currentStructureFilterPanel = av.getAnnotationColumnSelectionState()
+ currentStructureFilterPanel = lastChooser
.getCurrentStructureFilterPanel();
- annotations.select(av.getAnnotationColumnSelectionState()
+ annotations.select(lastChooser
.getAnnotations().getSelectedIndex());
- threshold.select(av.getAnnotationColumnSelectionState()
+ threshold.select(lastChooser
.getThreshold().getSelectedIndex());
- actionOption = av.getAnnotationColumnSelectionState()
+ actionOption = lastChooser
.getActionOption();
+ percentThreshold.setState(lastChooser.percentThreshold.getState());
}
try
thresholdValue.setEnabled(false);
thresholdValue.setColumns(7);
+ thresholdValue.setCaretPosition(0);
ok.addActionListener(this);
cancel.addActionListener(this);
// thresholdPanel.setFont(JvSwingUtils.getLabelFont());
// thresholdPanel.setLayout(new MigLayout("", "[left][right]", "[][]"));
+ percentThreshold.setLabel("As percentage");
+ percentThreshold.addItemListener(this);
+
actionPanel.setBackground(Color.white);
// actionPanel.setFont(JvSwingUtils.getLabelFont());
thresholdPanel.add(getThreshold());
thresholdPanel.add(slider);
thresholdPanel.add(thresholdValue);
+ thresholdPanel.add(percentThreshold);
actionPanel.add(ok);
actionPanel.add(cancel);
@SuppressWarnings("unchecked")
public void reset()
{
- if (this.getOldColumnSelection() != null)
+ if (this.getOldHiddenColumns() != null)
{
av.getColumnSelection().clear();
if (av.getAnnotationColumnSelectionState() != null)
{
- ColumnSelection oldSelection = av
+ HiddenColumns oldHidden = av
.getAnnotationColumnSelectionState()
- .getOldColumnSelection();
- if (oldSelection != null && oldSelection.getHiddenColumns() != null
- && !oldSelection.getHiddenColumns().isEmpty())
+ .getOldHiddenColumns();
+ if (oldHidden != null && oldHidden.getHiddenRegions() != null
+ && !oldHidden.getHiddenRegions().isEmpty())
{
- for (Iterator<int[]> itr = oldSelection.getHiddenColumns()
+ for (Iterator<int[]> itr = oldHidden.getHiddenRegions()
.iterator(); itr.hasNext();)
{
int positions[] = itr.next();
av.hideColumns(positions[0], positions[1]);
}
}
- av.setColumnSelection(oldSelection);
+ av.getAlignment().setHiddenColumns(oldHidden);
}
ap.paintAlignment(true);
}
{
if (!adjusting)
{
- thresholdValue.setText((slider.getValue() / 1000f) + "");
+ setThresholdValueText();
valueChanged(!sliderDragging);
}
}
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 + "");
+ setThresholdValueText();
// slider.setMajorTickSpacing((int) (range / 10f));
slider.setEnabled(true);
thresholdValue.setEnabled(true);
+ percentThreshold.setEnabled(true);
adjusting = false;
// build filter params
filterParams
.setThresholdType(AnnotationFilterParameter.ThresholdType.NO_THRESHOLD);
- if (getCurrentAnnotation().graph != AlignmentAnnotation.NO_GRAPH)
+ if (getCurrentAnnotation().isQuantitative())
{
filterParams
.setThresholdValue(getCurrentAnnotation().threshold.value);
ap.paintAlignment(true);
}
- public ColumnSelection getOldColumnSelection()
+ public HiddenColumns getOldHiddenColumns()
{
- return oldColumnSelection;
+ return oldHiddenColumns;
}
- public void setOldColumnSelection(ColumnSelection currentColumnSelection)
+ public void setOldHiddenColumns(HiddenColumns currentHiddenColumns)
{
- if (currentColumnSelection != null)
+ if (currentHiddenColumns != null)
{
- this.oldColumnSelection = new ColumnSelection(currentColumnSelection);
+ this.oldHiddenColumns = new HiddenColumns(currentHiddenColumns);
}
}
{
threshold_actionPerformed(null);
}
+ else if (e.getSource() == percentThreshold)
+ {
+ if (!adjusting)
+ {
+ percentageValue_actionPerformed();
+ }
+
+ }
}
public void selectedAnnotationChanged()
{
String currentView = AnnotationColumnChooser.NO_GRAPH_VIEW;
if (av.getAlignment().getAlignmentAnnotation()[getAnnotations()
- .getSelectedIndex()].graph != AlignmentAnnotation.NO_GRAPH)
+ .getSelectedIndex()].isQuantitative())
{
currentView = AnnotationColumnChooser.GRAPH_VIEW;
}
@Override
public void actionPerformed(ActionEvent evt)
{
- if (evt.getSource() == thresholdValue)
- {
- try
- {
- float f = new Float(thresholdValue.getText()).floatValue();
- slider.setValue((int) (f * 1000));
- adjustmentValueChanged(null);
- } catch (NumberFormatException ex)
- {
- }
- }
- else if (evt.getSource() == ok)
+ if (evt.getSource() == ok)
{
ok_actionPerformed(null);
}