*/
package jalview.appletgui;
-import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.HiddenColumns;
-import jalview.schemes.AnnotationColourGradient;
-import jalview.util.MessageManager;
-import jalview.viewmodel.annotationfilter.AnnotationFilterParameter;
-
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Checkbox;
import java.awt.event.MouseListener;
import java.awt.event.TextEvent;
import java.awt.event.TextListener;
-import java.util.Iterator;
import java.util.Vector;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.HiddenColumns;
+import jalview.schemes.AnnotationColourGradient;
+import jalview.util.MessageManager;
+import jalview.viewmodel.annotationfilter.AnnotationFilterParameter;
+
//import javax.swing.JPanel;
//import net.miginfocom.swing.MigLayout;
// restore Object state from the previous session if one exists
if (lastChooser != null)
{
- currentSearchPanel = lastChooser
- .getCurrentSearchPanel();
+ currentSearchPanel = lastChooser.getCurrentSearchPanel();
currentStructureFilterPanel = lastChooser
.getCurrentStructureFilterPanel();
- annotations.select(lastChooser
- .getAnnotations().getSelectedIndex());
- threshold.select(lastChooser
- .getThreshold().getSelectedIndex());
- actionOption = lastChooser
- .getActionOption();
+ annotations.select(lastChooser.getAnnotations().getSelectedIndex());
+ threshold.select(lastChooser.getThreshold().getSelectedIndex());
+ actionOption = lastChooser.getActionOption();
percentThreshold.setState(lastChooser.percentThreshold.getState());
}
if (av.getAnnotationColumnSelectionState() != null)
{
- HiddenColumns oldHidden = av
- .getAnnotationColumnSelectionState()
+ HiddenColumns oldHidden = av.getAnnotationColumnSelectionState()
.getOldHiddenColumns();
- if (oldHidden != null
- && !oldHidden.getHiddenRegions().isEmpty())
- {
- for (Iterator<int[]> itr = oldHidden.getHiddenRegions()
- .iterator(); itr.hasNext();)
- {
- int positions[] = itr.next();
- av.hideColumns(positions[0], positions[1]);
- }
- }
av.getAlignment().setHiddenColumns(oldHidden);
}
- ap.paintAlignment(true);
+ av.sendSelection();
+ ap.paintAlignment(true, true);
}
}
sliderDragging = false;
valueChanged(true);
}
- ap.paintAlignment(true);
+ ap.paintAlignment(true, true);
}
});
}
if (slider.isEnabled())
{
getCurrentAnnotation().threshold.value = slider.getValue() / 1000f;
- updateView();
- ap.paintAlignment(false);
+ updateView(); // this also calls paintAlignment(true,true)
}
}
}
AnnotationFilterParameter filterParams = new AnnotationFilterParameter();
- setCurrentAnnotation(av.getAlignment().getAlignmentAnnotation()[getAnnotations()
- .getSelectedIndex()]);
+ setCurrentAnnotation(av.getAlignment()
+ .getAlignmentAnnotation()[getAnnotations().getSelectedIndex()]);
- int selectedThresholdItem = getSelectedThresholdItem(getThreshold()
- .getSelectedIndex());
+ int selectedThresholdItem = getSelectedThresholdItem(
+ getThreshold().getSelectedIndex());
slider.setEnabled(true);
thresholdValue.setEnabled(true);
{
if (getCurrentAnnotation().threshold == null)
{
- getCurrentAnnotation()
- .setThreshold(
- new jalview.datamodel.GraphLine(
- (getCurrentAnnotation().graphMax - getCurrentAnnotation().graphMin) / 2f,
- "Threshold", Color.black));
+ getCurrentAnnotation().setThreshold(new jalview.datamodel.GraphLine(
+ (getCurrentAnnotation().graphMax
+ - getCurrentAnnotation().graphMin) / 2f,
+ "Threshold", Color.black));
}
adjusting = true;
- float range = getCurrentAnnotation().graphMax * 1000
- - getCurrentAnnotation().graphMin * 1000;
+ // float range = getCurrentAnnotation().graphMax * 1000
+ // - getCurrentAnnotation().graphMin * 1000;
slider.setMinimum((int) (getCurrentAnnotation().graphMin * 1000));
slider.setMaximum((int) (getCurrentAnnotation().graphMax * 1000));
- slider.setValue((int) (getCurrentAnnotation().threshold.value * 1000));
+ slider.setValue(
+ (int) (getCurrentAnnotation().threshold.value * 1000));
setThresholdValueText();
// slider.setMajorTickSpacing((int) (range / 10f));
slider.setEnabled(true);
adjusting = false;
// build filter params
- filterParams
- .setThresholdType(AnnotationFilterParameter.ThresholdType.NO_THRESHOLD);
+ filterParams.setThresholdType(
+ AnnotationFilterParameter.ThresholdType.NO_THRESHOLD);
if (getCurrentAnnotation().isQuantitative())
{
filterParams
if (selectedThresholdItem == AnnotationColourGradient.ABOVE_THRESHOLD)
{
- filterParams
- .setThresholdType(AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD);
+ filterParams.setThresholdType(
+ AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD);
}
else if (selectedThresholdItem == AnnotationColourGradient.BELOW_THRESHOLD)
{
- filterParams
- .setThresholdType(AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD);
+ filterParams.setThresholdType(
+ AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD);
}
}
}
filterParams.setRegexString(currentSearchPanel.searchBox.getText());
if (currentSearchPanel.displayName.getState())
{
- filterParams
- .addRegexSearchField(AnnotationFilterParameter.SearchableAnnotationField.DISPLAY_STRING);
+ filterParams.addRegexSearchField(
+ AnnotationFilterParameter.SearchableAnnotationField.DISPLAY_STRING);
}
if (currentSearchPanel.description.getState())
{
- filterParams
- .addRegexSearchField(AnnotationFilterParameter.SearchableAnnotationField.DESCRIPTION);
+ filterParams.addRegexSearchField(
+ AnnotationFilterParameter.SearchableAnnotationField.DESCRIPTION);
}
}
else
}
}
- av.getColumnSelection().filterAnnotations(
- getCurrentAnnotation().annotations, filterParams);
-
+ // show hidden columns here, before changing the column selection in
+ // filterAnnotations, because showing hidden columns has the side effect of
+ // adding them to the selection
av.showAllHiddenColumns();
+ av.getColumnSelection().filterAnnotations(getCurrentAnnotation(),
+ filterParams);
+
if (getActionOption() == ACTION_OPTION_HIDE)
{
av.hideSelectedColumns();
filterParams = null;
av.setAnnotationColumnSelectionState(this);
- ap.paintAlignment(true);
+ av.sendSelection();
+ ap.paintAlignment(true, true);
}
public HiddenColumns getOldHiddenColumns()
public void syncState()
{
- if (aColChooser.getActionOption() == AnnotationColumnChooser.ACTION_OPTION_HIDE)
+ if (aColChooser
+ .getActionOption() == AnnotationColumnChooser.ACTION_OPTION_HIDE)
{
furtherAction.select("Hide");
}
}
}
- public class StructureFilterPanel extends TitledPanel implements
- ItemListener
+ public class StructureFilterPanel extends TitledPanel
+ implements ItemListener
{
private AnnotationColumnChooser aColChooser;