JAL-1517 update copyright to version 2.8.2
[jalview.git] / src / jalview / gui / OptsAndParamsPage.java
index eab240f..d072378 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.2)
+ * 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 jalview.util.MessageManager;
 import jalview.ws.params.ArgumentI;
 import jalview.ws.params.OptionI;
 import jalview.ws.params.ParameterI;
@@ -109,7 +111,7 @@ public class OptsAndParamsPage
 
         enabled.setToolTipText("<html>"
                 + JvSwingUtils
-                        .wrapTooltip(((desc == null) ? "see further details by right-clicking"
+                        .wrapTooltip(((desc == null || desc.trim().length()==0) ? "see further details by right-clicking"
                                 : desc)
                                 + "<br><img src=\"" + linkImageURL + "\"/>")
                 + "</html>");
@@ -117,7 +119,7 @@ public class OptsAndParamsPage
       }
       else
       {
-        if (desc != null)
+        if (desc != null && desc.trim().length()>0)
         {
           enabled.setToolTipText("<html>"
                   + JvSwingUtils.wrapTooltip(opt.getDescription())
@@ -235,10 +237,11 @@ public class OptsAndParamsPage
 
     }
 
-    public void resetToDefault()
+
+    public void resetToDefault(boolean setDefaultParams)
     {
       enabled.setSelected(false);
-      if (option.isRequired())
+      if (option.isRequired() || (setDefaultParams && option.getValue()!=null))
       {
         // Apply default value
         selectOption(option, option.getValue());
@@ -258,7 +261,7 @@ public class OptsAndParamsPage
         initVal = (initEnabled) ? (String) val.getSelectedItem() : null;
       }
     }
-
+    
   }
 
   public class ParamBox extends JPanel implements ChangeListener,
@@ -591,9 +594,12 @@ public class OptsAndParamsPage
             @Override
             public void keyReleased(KeyEvent e)
             {
-              if (valueField.getText().trim().length() > 0)
+              if (e.isActionKey())
               {
-                actionPerformed(null);
+                if (valueField.getText().trim().length() > 0)
+                {
+                  actionPerformed(null);
+                }
               }
             }
 
@@ -673,7 +679,7 @@ public class OptsAndParamsPage
           {
             slider.getModel().setRangeProperties(iVal, 1,
                     validator.getMin().intValue(),
-                    validator.getMax().intValue(), true);
+                    validator.getMax().intValue()+1, true);
           }
           else
           {
@@ -713,9 +719,9 @@ public class OptsAndParamsPage
           ;
           if (validator.getMin() != null && validator.getMax() != null)
           {
-            slider.getModel().setRangeProperties((int) fVal * 1000, 1,
-                    (int) validator.getMin().floatValue() * 1000,
-                    (int) validator.getMax().floatValue() * 1000, true);
+            slider.getModel().setRangeProperties((int) (fVal * 1000f), 1,
+                    (int) (validator.getMin().floatValue() * 1000f),
+                    1+(int) (validator.getMax().floatValue() * 1000f), true);
           }
           else
           {
@@ -766,7 +772,7 @@ public class OptsAndParamsPage
   {
 
     JPopupMenu mnu = new JPopupMenu();
-    JMenuItem mitem = new JMenuItem("View " + finfo);
+    JMenuItem mitem = new JMenuItem(MessageManager.formatMessage("label.view_params", new String[]{finfo}));
     mitem.addActionListener(new ActionListener()
     {
 
@@ -783,9 +789,9 @@ public class OptsAndParamsPage
 
   URL linkImageURL = getClass().getResource("/images/link.gif");
 
-  Map<String, OptionBox> optSet = new Hashtable<String, OptionBox>();
+  Map<String, OptionBox> optSet = new java.util.LinkedHashMap<String, OptionBox>();
 
-  Map<String, ParamBox> paramSet = new Hashtable<String, ParamBox>();
+  Map<String, ParamBox> paramSet = new java.util.LinkedHashMap<String, ParamBox>();
 
   public Map<String, OptionBox> getOptSet()
   {