import jalview.io.JalviewFileChooser;
import jalview.schemes.AnnotationColourGradient;
import jalview.schemes.GraduatedColor;
+import jalview.util.Format;
import jalview.util.MessageManager;
+import jalview.util.QuickSort;
import jalview.viewmodel.AlignmentViewport;
import jalview.ws.dbsources.das.api.jalviewSourceI;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.Vector;
public void mousePressed(MouseEvent evt)
{
selectedRow = table.rowAtPoint(evt.getPoint());
- if (SwingUtilities.isRightMouseButton(evt))
+ if (evt.isPopupTrigger())
{
popupSort(selectedRow, (String) table.getValueAt(selectedRow, 0),
table.getValueAt(selectedRow, 1), fr.getMinMax(),
}
protected void popupSort(final int selectedRow, final String type,
- final Object typeCol, final Hashtable minmax, int x, int y)
+ final Object typeCol, final Map<String, float[][]> minmax, int x,
+ int y)
{
JPopupMenu men = new JPopupMenu(MessageManager.formatMessage(
"label.settings_for_param", new String[] { type }));
men.add(dens);
if (minmax != null)
{
- final Object typeMinMax = minmax.get(type);
+ final float[][] typeMinMax = minmax.get(type);
/*
* final JCheckBoxMenuItem chb = new JCheckBoxMenuItem("Vary Height"); //
* this is broken at the moment and isn't that useful anyway!
*
* men.add(chb);
*/
- if (typeMinMax != null && ((float[][]) typeMinMax)[0] != null)
+ if (typeMinMax != null && typeMinMax[0] != null)
{
// if (table.getValueAt(row, column));
// graduated colourschemes for those where minmax exists for the
MessageManager.getString("label.select_columns_containing"));
selCols.addActionListener(new ActionListener()
{
-
@Override
public void actionPerformed(ActionEvent arg0)
{
MessageManager.getString("label.select_columns_not_containing"));
clearCols.addActionListener(new ActionListener()
{
-
@Override
public void actionPerformed(ActionEvent arg0)
{
false, type);
}
});
+ JMenuItem hideCols = new JMenuItem(
+ MessageManager.getString("label.hide_columns_containing"));
+ hideCols.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ fr.ap.alignFrame.hideFeatureColumns(type, true);
+ }
+ });
+ JMenuItem hideOtherCols = new JMenuItem(
+ MessageManager.getString("label.hide_columns_not_containing"));
+ hideOtherCols.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ fr.ap.alignFrame.hideFeatureColumns(type, false);
+ }
+ });
men.add(selCols);
men.add(clearCols);
+ men.add(hideCols);
+ men.add(hideOtherCols);
men.show(table, x, y);
}
void save()
{
JalviewFileChooser chooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
+ Cache.getProperty("LAST_DIRECTORY"),
new String[] { "fc" },
new String[] { "Sequence Feature Colours" },
"Sequence Feature Colours");
PrintWriter out = new PrintWriter(new OutputStreamWriter(
new FileOutputStream(choice), "UTF-8"));
- Set fr_colours = fr.getAllFeatureColours();
- Iterator e = fr_colours.iterator();
+ Set<String> fr_colours = fr.getAllFeatureColours();
+ Iterator<String> e = fr_colours.iterator();
float[] sortOrder = new float[fr_colours.size()];
String[] sortTypes = new String[fr_colours.size()];
int i = 0;
while (e.hasNext())
{
- sortTypes[i] = e.next().toString();
+ sortTypes[i] = e.next();
sortOrder[i] = fr.getOrder(sortTypes[i]);
i++;
}
- jalview.util.QuickSort.sort(sortOrder, sortTypes);
+ QuickSort.sort(sortOrder, sortTypes);
sortOrder = null;
Object fcol;
GraduatedColor gcol;
- for (i = 0; i < sortTypes.length; i++)
+ for (String featureType : sortTypes)
{
jalview.schemabinding.version2.Colour col = new jalview.schemabinding.version2.Colour();
- col.setName(sortTypes[i]);
- col.setRGB(jalview.util.Format.getHexString(fr.getColour(col
- .getName())));
- fcol = fr.getFeatureStyle(sortTypes[i]);
+ col.setName(featureType);
+ fcol = fr.getFeatureStyle(featureType);
+ Color colour = fcol instanceof Color ? (Color) fcol
+ : ((GraduatedColor) fcol).getMaxColor();
+ col.setRGB(Format.getHexString(colour));
if (fcol instanceof GraduatedColor)
{
gcol = (GraduatedColor) fcol;
col.setMin(gcol.getMin());
col.setMax(gcol.getMax());
- col.setMinRGB(jalview.util.Format.getHexString(gcol
+ col.setMinRGB(Format.getHexString(gcol
.getMinColor()));
col.setAutoScale(gcol.isAutoScale());
col.setThreshold(gcol.getThresh());