Merge branch 'hotfix/JAL-1521' into Release_2_8_2_Branch
[jalview.git] / src / jalview / gui / FeatureSettings.java
index daae5a5..662d7c6 100644 (file)
@@ -6,14 +6,16 @@
  * 
  * 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.
+ * 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 <http://www.gnu.org/licenses/>.
+ * 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;
@@ -99,7 +101,7 @@ public class FeatureSettings extends JPanel
       public void mousePressed(MouseEvent evt)
       {
         selectedRow = table.rowAtPoint(evt.getPoint());
-        if (evt.isPopupTrigger())
+        if (SwingUtilities.isRightMouseButton(evt))
         {
           popupSort(selectedRow, (String) table.getValueAt(selectedRow, 0),
                   table.getValueAt(selectedRow, 1), fr.minmax, evt.getX(),
@@ -108,7 +110,8 @@ public class FeatureSettings extends JPanel
         else if (evt.getClickCount() == 2)
         {
           fr.ap.alignFrame.avc.markColumnsContainingFeatures(
-                  evt.isAltDown(),evt.isShiftDown() || evt.isMetaDown(), evt.isMetaDown(),
+                  evt.isAltDown(), evt.isShiftDown() || evt.isMetaDown(),
+                  evt.isMetaDown(),
                   (String) table.getValueAt(selectedRow, 0));
         }
       }
@@ -138,8 +141,8 @@ public class FeatureSettings extends JPanel
         }
       }
     });
-    table.setToolTipText("<html>"+JvSwingUtils
-            .wrapTooltip("Click/drag feature types up or down to change render order.<br/>Double click to select columns containing feature in alignment/current selection<br/>Pressing Alt will select columns outside features rather than inside<br/>Pressing Shift to modify current selection (rather than clear current selection)<br/>Press CTRL or Command/Meta to toggle columns in/outside features<br/>")+"</html>");
+    table.setToolTipText(JvSwingUtils
+                    .wrapTooltip(true, MessageManager.getString("label.feature_settings_click_drag")));
     scrollPane.setViewportView(table);
 
     dassourceBrowser = new DasSourceBrowser(this);
@@ -173,11 +176,15 @@ public class FeatureSettings extends JPanel
     frame.setContentPane(this);
     if (new jalview.util.Platform().isAMac())
     {
-      Desktop.addInternalFrame(frame, MessageManager.getString("label.sequence_feature_settings"), 475, 480);
+      Desktop.addInternalFrame(frame,
+              MessageManager.getString("label.sequence_feature_settings"),
+              475, 480);
     }
     else
     {
-      Desktop.addInternalFrame(frame, MessageManager.getString("label.sequence_feature_settings"), 400, 450);
+      Desktop.addInternalFrame(frame,
+              MessageManager.getString("label.sequence_feature_settings"),
+              400, 450);
     }
 
     frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
@@ -195,8 +202,11 @@ 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(MessageManager.formatMessage("label.settings_for_param", new String[]{type}));
-    JMenuItem scr = new JMenuItem(MessageManager.getString("label.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()
@@ -209,7 +219,8 @@ public class FeatureSettings extends JPanel
       }
 
     });
-    JMenuItem dens = new JMenuItem(MessageManager.getString("label.sort_by_density"));
+    JMenuItem dens = new JMenuItem(
+            MessageManager.getString("label.sort_by_density"));
     dens.addActionListener(new ActionListener()
     {
 
@@ -298,24 +309,28 @@ public class FeatureSettings extends JPanel
         });
       }
     }
-    JMenuItem selCols = new JMenuItem(MessageManager.getString("label.select_columns_containing"));
+    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, false, false, type);
+        fr.ap.alignFrame.avc.markColumnsContainingFeatures(false, false,
+                false, type);
       }
     });
-    JMenuItem clearCols = new JMenuItem(MessageManager.getString("label.select_columns_not_containing"));
+    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, false, false, type);
+        fr.ap.alignFrame.avc.markColumnsContainingFeatures(true, false,
+                false, type);
       }
     });
     men.add(selCols);
@@ -631,7 +646,7 @@ public class FeatureSettings extends JPanel
             { "fc" }, new String[]
             { "Sequence Feature Colours" }, "Sequence Feature Colours");
     chooser.setFileView(new jalview.io.JalviewFileView());
-    chooser.setDialogTitle("Load Feature Colours");
+    chooser.setDialogTitle(MessageManager.getString("label.load_feature_colours"));
     chooser.setToolTipText(MessageManager.getString("action.load"));
 
     int value = chooser.showOpenDialog(this);
@@ -729,7 +744,7 @@ public class FeatureSettings extends JPanel
             { "fc" }, new String[]
             { "Sequence Feature Colours" }, "Sequence Feature Colours");
     chooser.setFileView(new jalview.io.JalviewFileView());
-    chooser.setDialogTitle("Save Feature Colour Scheme");
+    chooser.setDialogTitle(MessageManager.getString("label.save_feature_colours"));
     chooser.setToolTipText(MessageManager.getString("action.save"));
 
     int value = chooser.showSaveDialog(this);
@@ -953,7 +968,8 @@ public class FeatureSettings extends JPanel
       }
     });
     sortByScore.setFont(JvSwingUtils.getLabelFont());
-    sortByScore.setText(MessageManager.getString("label.seq_sort_by_score"));
+    sortByScore
+            .setText(MessageManager.getString("label.seq_sort_by_score"));
     sortByScore.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -962,7 +978,8 @@ public class FeatureSettings extends JPanel
       }
     });
     sortByDens.setFont(JvSwingUtils.getLabelFont());
-    sortByDens.setText(MessageManager.getString("label.sequence_sort_by_density"));
+    sortByDens.setText(MessageManager
+            .getString("label.sequence_sort_by_density"));
     sortByDens.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -1045,8 +1062,8 @@ public class FeatureSettings extends JPanel
       }
     });
     this.add(tabbedPane, java.awt.BorderLayout.CENTER);
-    tabbedPane.addTab("Feature Settings", settingsPane);
-    tabbedPane.addTab("DAS Settings", dasSettingsPane);
+    tabbedPane.addTab(MessageManager.getString("label.feature_settings"), settingsPane);
+    tabbedPane.addTab(MessageManager.getString("label.das_settings"), dasSettingsPane);
     bigPanel.add(transPanel, java.awt.BorderLayout.SOUTH);
     transbuttons.add(optimizeOrder);
     transbuttons.add(invert);
@@ -1181,7 +1198,9 @@ public class FeatureSettings extends JPanel
         if (!valid)
         {
           return null;
-        } else {
+        }
+        else
+        {
           gps = new String[_gps.size()];
           _gps.toArray(gps);
         }
@@ -1339,10 +1358,15 @@ public class FeatureSettings extends JPanel
   public void noDasSourceActive()
   {
     complete();
-    JOptionPane.showInternalConfirmDialog(Desktop.desktop,
-            MessageManager.getString("label.no_das_sources_selected_warn"),
-            MessageManager.getString("label.no_das_sources_selected_title"), JOptionPane.DEFAULT_OPTION,
-            JOptionPane.INFORMATION_MESSAGE);
+    JOptionPane
+            .showInternalConfirmDialog(
+                    Desktop.desktop,
+                    MessageManager
+                            .getString("label.no_das_sources_selected_warn"),
+                    MessageManager
+                            .getString("label.no_das_sources_selected_title"),
+                    JOptionPane.DEFAULT_OPTION,
+                    JOptionPane.INFORMATION_MESSAGE);
   }
 
   // ///////////////////////////////////////////////////////////////////////
@@ -1356,7 +1380,7 @@ public class FeatureSettings extends JPanel
     }
 
     private String[] columnNames =
-    { "Feature Type", "Colour", "Display" };
+    { MessageManager.getString("label.feature_type"), MessageManager.getString("action.colour"), MessageManager.getString("label.display") };
 
     private Object[][] data;