public void mousePressed(MouseEvent evt)
{
selectedRow = table.rowAtPoint(evt.getPoint());
- if (SwingUtilities.isRightMouseButton(evt))
+ boolean ctrlDown = Platform.isControlDown(evt);
+ if (SwingUtilities.isRightMouseButton(evt) && !ctrlDown)
{
popupSort(selectedRow, (String) table.getValueAt(selectedRow, 0),
table.getValueAt(selectedRow, 1), fr.getMinMax(),
}
else if (evt.getClickCount() == 2)
{
+ boolean invertSelection = evt.isAltDown();
+ boolean toggleSelection = ctrlDown;
+ boolean extendSelection = evt.isShiftDown();
fr.ap.alignFrame.avc.markColumnsContainingFeatures(
- evt.isAltDown(), evt.isShiftDown() || evt.isMetaDown(),
- evt.isMetaDown(),
+ invertSelection, extendSelection, toggleSelection,
(String) table.getValueAt(selectedRow, 0));
}
}
int newRow = table.rowAtPoint(evt.getPoint());
if (newRow != selectedRow && selectedRow != -1 && newRow != -1)
{
+ /*
+ * reposition 'selectedRow' to 'newRow' (the dragged to location)
+ * this could be more than one row away for a very fast drag action
+ * so just swap it with adjacent rows until we get it there
+ */
Object[][] data = ((FeatureTableModel) table.getModel())
.getData();
- Object[] temp = data[selectedRow];
- data[selectedRow] = data[newRow];
- data[newRow] = temp;
+ int direction = newRow < selectedRow ? -1 : 1;
+ for (int i = selectedRow; i != newRow; i += direction)
+ {
+ Object[] temp = data[i];
+ data[i] = data[i + direction];
+ data[i + direction] = temp;
+ }
updateFeatureRenderer(data);
table.repaint();
selectedRow = newRow;
else
{
// probably the color chooser!
- table.setValueAt(colorChooser.getColor(), selectedRow, 1);
+ table.setValueAt(
+ new FeatureColour(colorChooser.getColor()),
+ selectedRow, 1);
table.validate();
me.updateFeatureRenderer(
((FeatureTableModel) table.getModel()).getData(),
void load()
{
JalviewFileChooser chooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
- new String[] { "fc" },
- new String[] { "Sequence Feature Colours" },
- "Sequence Feature Colours");
+ Cache.getProperty("LAST_DIRECTORY"), "fc",
+ "Sequence Feature Colours", "Sequence Feature Colours");
chooser.setFileView(new jalview.io.JalviewFileView());
chooser.setDialogTitle(MessageManager
.getString("label.load_feature_colours"));
void save()
{
JalviewFileChooser chooser = new JalviewFileChooser(
- Cache.getProperty("LAST_DIRECTORY"),
- new String[] { "fc" },
- new String[] { "Sequence Feature Colours" },
- "Sequence Feature Colours");
+ Cache.getProperty("LAST_DIRECTORY"), "fc",
+ "Sequence Feature Colours", "Sequence Feature Colours");
chooser.setFileView(new jalview.io.JalviewFileView());
chooser.setDialogTitle(MessageManager
.getString("label.save_feature_colours"));