merge commit
[jalview.git] / src / jalview / gui / FeatureSettings.java
index 2190858..8f841d1 100644 (file)
@@ -27,6 +27,7 @@ import jalview.datamodel.AlignmentI;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceGroup;
 import jalview.datamodel.SequenceI;
+import jalview.gui.Help.HelpId;
 import jalview.io.JalviewFileChooser;
 import jalview.schemes.AnnotationColourGradient;
 import jalview.schemes.GraduatedColor;
@@ -61,6 +62,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Vector;
 
+import javax.help.HelpSetException;
 import javax.swing.AbstractCellEditor;
 import javax.swing.BorderFactory;
 import javax.swing.Icon;
@@ -132,7 +134,19 @@ public class FeatureSettings extends JPanel
       ex.printStackTrace();
     }
 
-    table = new JTable();
+    table = new JTable() {
+      @Override
+      public String getToolTipText(MouseEvent e) {
+        if (table.columnAtPoint(e.getPoint()) == 0) {
+          /*
+           * Tooltip for feature name only
+           */
+          return JvSwingUtils.wrapTooltip(true,
+                MessageManager.getString("label.feature_settings_click_drag"));
+        }
+        return null;
+      }
+    };
     table.getTableHeader().setFont(new Font("Verdana", Font.PLAIN, 12));
     table.setFont(new Font("Verdana", Font.PLAIN, 12));
     table.setDefaultRenderer(Color.class, new ColorRenderer());
@@ -201,8 +215,8 @@ public class FeatureSettings extends JPanel
         }
       }
     });
-    table.setToolTipText(JvSwingUtils
-                    .wrapTooltip(true, MessageManager.getString("label.feature_settings_click_drag")));
+//    table.setToolTipText(JvSwingUtils.wrapTooltip(true,
+//            MessageManager.getString("label.feature_settings_click_drag")));
     scrollPane.setViewportView(table);
 
     dassourceBrowser = new DasSourceBrowser(this);
@@ -572,7 +586,9 @@ public class FeatureSettings extends JPanel
                 || ((Boolean) fr.featureGroups.get(group)).booleanValue())
         {
           if (group != null)
+          {
             checkGroupState(group);
+          }
           type = tmpfeatures[index].getType();
           if (!visibleChecks.contains(type))
           {
@@ -610,7 +626,9 @@ public class FeatureSettings extends JPanel
     if (fr.renderOrder != null)
     {
       if (!handlingUpdate)
+       {
         fr.findAllFeatures(groupChanged != null); // prod to update
+      }
       // colourschemes. but don't
       // affect display
       // First add the checks in the previous render order,
@@ -691,12 +709,18 @@ public class FeatureSettings extends JPanel
     {
       order[i] = fr.getOrder(data[i][0].toString());
       if (order[i] < 0)
+      {
         order[i] = fr.setOrder(data[i][0].toString(), i / order.length);
+      }
       if (i > 1)
+      {
         sort = sort || order[i - 1] > order[i];
+      }
     }
     if (sort)
+    {
       jalview.util.QuickSort.sort(order, data);
+    }
   }
 
   void load()
@@ -887,7 +911,9 @@ public class FeatureSettings extends JPanel
   public void orderByAvWidth()
   {
     if (table == null || table.getModel() == null)
+    {
       return;
+    }
     Object[][] data = ((FeatureTableModel) table.getModel()).getData();
     float[] width = new float[data.length];
     float[] awidth;
@@ -909,7 +935,9 @@ public class FeatureSettings extends JPanel
         width[i] = 0;
       }
       if (max < width[i])
+      {
         max = width[i];
+      }
     }
     boolean sort = false;
     for (int i = 0; i < width.length; i++)
@@ -929,11 +957,15 @@ public class FeatureSettings extends JPanel
         fr.setOrder(data[i][0].toString(), width[i]); // store for later
       }
       if (i > 0)
+      {
         sort = sort || width[i - 1] > width[i];
+      }
     }
     if (sort)
+     {
       jalview.util.QuickSort.sort(width, data);
     // update global priority order
+    }
 
     updateFeatureRenderer(data, false);
     table.repaint();
@@ -1001,7 +1033,9 @@ public class FeatureSettings extends JPanel
 
   JButton sortByDens = new JButton();
 
-  JPanel transbuttons = new JPanel(new GridLayout(4, 1));
+  JButton help = new JButton();
+
+  JPanel transbuttons = new JPanel(new GridLayout(5, 1));
 
   private void jbInit() throws Exception
   {
@@ -1047,6 +1081,21 @@ public class FeatureSettings extends JPanel
         sortByDens(null);
       }
     });
+    help.setFont(JvSwingUtils.getLabelFont());
+    help.setText(MessageManager.getString("action.help"));
+    help.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        try
+        {
+          Help.showHelpWindow(HelpId.SequenceFeatureSettings);
+        } catch (HelpSetException e1)
+        {
+          e1.printStackTrace();
+        }
+      }
+    });
     cancel.setFont(JvSwingUtils.getLabelFont());
     cancel.setText(MessageManager.getString("action.cancel"));
     cancel.addActionListener(new ActionListener()
@@ -1094,6 +1143,8 @@ public class FeatureSettings extends JPanel
     });
 
     transparency.setMaximum(70);
+    transparency.setToolTipText(MessageManager
+            .getString("label.transparency_tip"));
     fetchDAS.setText(MessageManager.getString("label.fetch_das_features"));
     fetchDAS.addActionListener(new ActionListener()
     {
@@ -1129,6 +1180,9 @@ public class FeatureSettings extends JPanel
     transbuttons.add(invert);
     transbuttons.add(sortByScore);
     transbuttons.add(sortByDens);
+    transbuttons.add(help);
+    JPanel sliderPanel = new JPanel();
+    sliderPanel.add(transparency);
     transPanel.add(transparency);
     transPanel.add(transbuttons);
     buttonPanel.add(ok);