import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
+import java.util.Arrays;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
int newRow = table.rowAtPoint(evt.getPoint());
if (newRow != selectedRow && selectedRow != -1 && newRow != -1)
{
- Object[] temp = new Object[3];
- temp[0] = table.getValueAt(selectedRow, 0);
- temp[1] = table.getValueAt(selectedRow, 1);
- temp[2] = table.getValueAt(selectedRow, 2);
-
- table.setValueAt(table.getValueAt(newRow, 0), selectedRow, 0);
- table.setValueAt(table.getValueAt(newRow, 1), selectedRow, 1);
- table.setValueAt(table.getValueAt(newRow, 2), selectedRow, 2);
-
- table.setValueAt(temp[0], newRow, 0);
- table.setValueAt(temp[1], newRow, 1);
- table.setValueAt(temp[2], newRow, 2);
-
+ Object[][] data = ((FeatureTableModel) table.getModel())
+ .getData();
+ Object[] temp = data[selectedRow];
+ data[selectedRow] = data[newRow];
+ data[newRow] = temp;
+ updateFeatureRenderer(data);
+ table.repaint();
selectedRow = newRow;
}
}
frame.setLayer(JLayeredPane.PALETTE_LAYER);
}
- protected void popupSort(final int row, final String type,
+ protected void popupSort(final int selectedRow, final String type,
final Object typeCol, final Map<String, float[][]> minmax, int x,
int y)
{
@Override
public void actionPerformed(ActionEvent e)
{
- me.af.avc.sortAlignmentByFeatureScore(new String[] { type });
+ me.af.avc.sortAlignmentByFeatureScore(Arrays
+ .asList(new String[] { type }));
}
});
@Override
public void actionPerformed(ActionEvent e)
{
- me.af.avc.sortAlignmentByFeatureDensity(new String[] { type });
+ me.af.avc.sortAlignmentByFeatureDensity(Arrays
+ .asList(new String[] { type }));
}
});
{
FeatureColourChooser fc = (FeatureColourChooser) e
.getSource();
- table.setValueAt(fc.getLastColour(), row, 1);
+ table.setValueAt(fc.getLastColour(), selectedRow, 1);
table.validate();
}
else
{
// probably the color chooser!
- table.setValueAt(colorChooser.getColor(), row, 1);
+ table.setValueAt(colorChooser.getColor(), selectedRow, 1);
table.validate();
me.updateFeatureRenderer(
((FeatureTableModel) table.getModel()).getData(),
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");
updateFeatureRenderer(data, true);
}
+ /**
+ * Update the priority order of features; only repaint if this changed the
+ * order of visible features
+ *
+ * @param data
+ * @param visibleNew
+ */
private void updateFeatureRenderer(Object[][] data, boolean visibleNew)
{
- fr.setFeaturePriority(data, visibleNew);
- af.alignPanel.paintAlignment(true);
+ if (fr.setFeaturePriority(data, visibleNew))
+ {
+ af.alignPanel.paintAlignment(true);
+ }
}
int selectedRow = -1;