X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAnnotationColumnChooser.java;h=0319b5c91ae101020c1c72688f1a7e7556fd6c29;hb=f3a08d3ae4aa500bbfc044281c16646ae11f53f0;hp=e25ff8f0509df2e3942ba7b84d76d3728ec56d4c;hpb=61d7d669232e22adc47cac9fe8dd9db291d382fe;p=jalview.git
diff --git a/src/jalview/appletgui/AnnotationColumnChooser.java b/src/jalview/appletgui/AnnotationColumnChooser.java
index e25ff8f..0319b5c 100644
--- a/src/jalview/appletgui/AnnotationColumnChooser.java
+++ b/src/jalview/appletgui/AnnotationColumnChooser.java
@@ -1,8 +1,27 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.appletgui;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.ColumnSelection;
-import jalview.gui.JvSwingUtils;
import jalview.schemes.AnnotationColourGradient;
import jalview.util.MessageManager;
import jalview.viewmodel.annotationfilter.AnnotationFilterParameter;
@@ -30,7 +49,7 @@ import java.awt.event.TextListener;
import java.util.Iterator;
import java.util.Vector;
-import javax.swing.JPanel;
+//import javax.swing.JPanel;
//import net.miginfocom.swing.MigLayout;
@@ -116,17 +135,22 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
slider.addAdjustmentListener(this);
slider.addMouseListener(this);
- if (av.getAlignment().getAlignmentAnnotation() == null)
+ AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation();
+ if (anns == null)
{
return;
}
setOldColumnSelection(av.getColumnSelection());
adjusting = true;
- Vector list = new Vector();
+ Vector list = new Vector();
int index = 1;
- for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
+ for (int i = 0; i < anns.length; i++)
{
- String label = av.getAlignment().getAlignmentAnnotation()[i].label;
+ String label = anns[i].label;
+ if (anns[i].sequenceRef != null)
+ {
+ label = label + "_" + anns[i].sequenceRef.getName();
+ }
if (!list.contains(label))
{
list.addElement(label);
@@ -143,19 +167,20 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
}
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();
}
@@ -180,6 +205,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
thresholdValue.setEnabled(false);
thresholdValue.setColumns(7);
+ thresholdValue.setCaretPosition(0);
ok.addActionListener(this);
cancel.addActionListener(this);
@@ -192,11 +218,14 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
slider.setPreferredSize(new Dimension(100, 32));
thresholdPanel.setBackground(Color.white);
- thresholdPanel.setFont(JvSwingUtils.getLabelFont());
+ // 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());
+ // actionPanel.setFont(JvSwingUtils.getLabelFont());
graphFilterView.setLayout(gBorderLayout);
graphFilterView.setBackground(Color.white);
@@ -205,7 +234,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
noGraphFilterView.setBackground(Color.white);
annotationComboBoxPanel.setBackground(Color.white);
- annotationComboBoxPanel.setFont(JvSwingUtils.getLabelFont());
+ // annotationComboBoxPanel.setFont(JvSwingUtils.getLabelFont());
gSearchPanel = new SearchPanel(this);
ngSearchPanel = new SearchPanel(this);
@@ -215,6 +244,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
ngStructureFilterPanel = new StructureFilterPanel(this);
thresholdPanel.setTitle("Threshold Filter");
+ thresholdPanel.add(percentThreshold);
thresholdPanel.add(getThreshold());
thresholdPanel.add(slider);
thresholdPanel.add(thresholdValue);
@@ -222,7 +252,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
actionPanel.add(ok);
actionPanel.add(cancel);
- JPanel staticPanel = new JPanel();
+ Panel staticPanel = new Panel();
staticPanel.setLayout(new BorderLayout());
staticPanel.setBackground(Color.white);
@@ -254,6 +284,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
this.validate();
}
+ @Override
@SuppressWarnings("unchecked")
public void reset()
{
@@ -283,6 +314,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
}
+ @Override
public void adjustmentValueChanged(AdjustmentEvent evt)
{
if (!adjusting)
@@ -324,6 +356,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
});
}
+ @Override
public void valueChanged(boolean updateAllAnnotation)
{
if (slider.isEnabled())
@@ -398,7 +431,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
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);
@@ -547,6 +580,14 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
{
threshold_actionPerformed(null);
}
+ else if (e.getSource() == percentThreshold)
+ {
+ if (!adjusting)
+ {
+ percentageValue_actionPerformed();
+ }
+
+ }
}
public void selectedAnnotationChanged()
@@ -570,8 +611,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
updateView();
}
- public class FurtherActionPanel extends Panel implements
- ItemListener
+ public class FurtherActionPanel extends Panel implements ItemListener
{
private AnnotationColumnChooser aColChooser;
@@ -657,7 +697,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
this.setBackground(Color.white);
this.setTitle("Structure Filter");
- this.setFont(JvSwingUtils.getLabelFont());
+ // this.setFont(JvSwingUtils.getLabelFont());
this.add(all);
this.add(alphaHelix);
@@ -784,7 +824,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
});
- displayName.setLabel(MessageManager.getString("label.display_name"));
+ displayName.setLabel(MessageManager.getString("label.label"));
displayName.setEnabled(false);
displayName.addItemListener(this);
@@ -792,7 +832,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
description.setEnabled(false);
description.addItemListener(this);
this.setTitle("Search Filter");
- this.setFont(JvSwingUtils.getLabelFont());
+ // this.setFont(JvSwingUtils.getLabelFont());
syncState();
this.add(searchBox);
@@ -848,6 +888,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
}
}
+ @Override
public void actionPerformed(ActionEvent evt)
{
if (evt.getSource() == thresholdValue)