JAL-1445 (shift+) double click on feature type in desktop feature settings to select...
[jalview.git] / src / jalview / gui / FeatureSettings.java
index 04a70ef..d7f05dc 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
+ * Copyright (C) 2014 The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
  * 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 <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 package jalview.gui;
 
 import java.io.*;
 import java.util.*;
 import java.util.List;
-
 import java.awt.*;
 import java.awt.event.*;
 import java.beans.PropertyChangeEvent;
@@ -99,12 +99,18 @@ public class FeatureSettings extends JPanel
       public void mousePressed(MouseEvent evt)
       {
         selectedRow = table.rowAtPoint(evt.getPoint());
-        if (javax.swing.SwingUtilities.isRightMouseButton(evt))
+        if (evt.isPopupTrigger())
         {
           popupSort(selectedRow, (String) table.getValueAt(selectedRow, 0),
                   table.getValueAt(selectedRow, 1), fr.minmax, evt.getX(),
                   evt.getY());
         }
+        else if (evt.getClickCount() == 2)
+        {
+          fr.ap.alignFrame.avc.markColumnsContainingFeatures(
+                  evt.isShiftDown(),
+                  (String) table.getValueAt(selectedRow, 0));
+        }
       }
     });
 
@@ -166,11 +172,11 @@ public class FeatureSettings extends JPanel
     frame.setContentPane(this);
     if (new jalview.util.Platform().isAMac())
     {
-      Desktop.addInternalFrame(frame, "Sequence Feature Settings", 475, 480);
+      Desktop.addInternalFrame(frame, MessageManager.getString("label.sequence_feature_settings"), 475, 480);
     }
     else
     {
-      Desktop.addInternalFrame(frame, "Sequence Feature Settings", 400, 450);
+      Desktop.addInternalFrame(frame, MessageManager.getString("label.sequence_feature_settings"), 400, 450);
     }
 
     frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
@@ -188,8 +194,8 @@ public class FeatureSettings extends JPanel
   protected void popupSort(final int selectedRow, final String type,
           final Object typeCol, final Hashtable minmax, int x, int y)
   {
-    JPopupMenu men = new JPopupMenu("Settings for " + type);
-    JMenuItem scr = new JMenuItem("Sort by Score");
+    JPopupMenu men = new JPopupMenu(MessageManager.formatMessage("label.settings_for_param", new String[]{type}));
+    JMenuItem scr = new JMenuItem(MessageManager.getString("label.sort_by_score"));
     men.add(scr);
     final FeatureSettings me = this;
     scr.addActionListener(new ActionListener()
@@ -202,7 +208,7 @@ public class FeatureSettings extends JPanel
       }
 
     });
-    JMenuItem dens = new JMenuItem("Sort by Density");
+    JMenuItem dens = new JMenuItem(MessageManager.getString("label.sort_by_density"));
     dens.addActionListener(new ActionListener()
     {
 
@@ -291,6 +297,28 @@ public class FeatureSettings extends JPanel
         });
       }
     }
+    JMenuItem selCols = new JMenuItem(MessageManager.getString("label.select_columns_containing"));
+    selCols.addActionListener(new ActionListener()
+    {
+      
+      @Override
+      public void actionPerformed(ActionEvent arg0)
+      {
+        fr.ap.alignFrame.avc.markColumnsContainingFeatures(false, type);
+      }
+    });
+    JMenuItem clearCols = new JMenuItem(MessageManager.getString("label.select_columns_not_containing"));
+    clearCols.addActionListener(new ActionListener()
+    {
+      
+      @Override
+      public void actionPerformed(ActionEvent arg0)
+      {
+        fr.ap.alignFrame.avc.markColumnsContainingFeatures(true, type);
+      }
+    });
+    men.add(selCols);
+    men.add(clearCols);
     men.show(table, x, y);
   }
 
@@ -603,7 +631,7 @@ public class FeatureSettings extends JPanel
             { "Sequence Feature Colours" }, "Sequence Feature Colours");
     chooser.setFileView(new jalview.io.JalviewFileView());
     chooser.setDialogTitle("Load Feature Colours");
-    chooser.setToolTipText("Load");
+    chooser.setToolTipText(MessageManager.getString("action.load"));
 
     int value = chooser.showOpenDialog(this);
 
@@ -701,7 +729,7 @@ public class FeatureSettings extends JPanel
             { "Sequence Feature Colours" }, "Sequence Feature Colours");
     chooser.setFileView(new jalview.io.JalviewFileView());
     chooser.setDialogTitle("Save Feature Colour Scheme");
-    chooser.setToolTipText("Save");
+    chooser.setToolTipText(MessageManager.getString("action.save"));
 
     int value = chooser.showSaveDialog(this);
 
@@ -933,7 +961,7 @@ public class FeatureSettings extends JPanel
       }
     });
     sortByDens.setFont(JvSwingUtils.getLabelFont());
-    sortByDens.setText("Seq Sort by density");
+    sortByDens.setText(MessageManager.getString("label.sequence_sort_by_density"));
     sortByDens.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -1312,9 +1340,8 @@ public class FeatureSettings extends JPanel
   {
     complete();
     JOptionPane.showInternalConfirmDialog(Desktop.desktop,
-            "No das sources were selected.\n"
-                    + "Please select some sources and\n" + " try again.",
-            "No Sources Selected", JOptionPane.DEFAULT_OPTION,
+            MessageManager.getString("label.no_das_sources_selected_warn"),
+            MessageManager.getString("label.no_das_sources_selected_title"), JOptionPane.DEFAULT_OPTION,
             JOptionPane.INFORMATION_MESSAGE);
   }
 
@@ -1594,7 +1621,7 @@ class FeatureIcon implements Icon
       // width/g.getFontMetrics().stringWidth("Label"),
       // height/g.getFontMetrics().getHeight())));
 
-      g.drawString("Label", 0, 0);
+      g.drawString(MessageManager.getString("label.label"), 0, 0);
 
     }
     else