JAL-2383 check for null, spelling
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 20 Jan 2017 10:55:50 +0000 (10:55 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 20 Jan 2017 10:55:50 +0000 (10:55 +0000)
resources/lang/Messages.properties
src/jalview/appletgui/SliderPanel.java
src/jalview/gui/SliderPanel.java
src/jalview/util/ParseHtmlBodyAndLinks.java

index a86154c..1352f0b 100644 (file)
@@ -323,7 +323,7 @@ label.size = Size:
 label.style = Style:
 label.calculating = Calculating....
 label.modify_conservation_visibility = Modify conservation visibility
-label.colour_residues_above_occurence = Colour residues above % occurrence
+label.colour_residues_above_occurrence = Colour residues above % occurrence
 label.set_this_label_text = set this label text
 label.sequences_from = Sequences from {0}
 label.successfully_loaded_file  = Successfully loaded file {0}
index 5ee665a..ec64b3b 100644 (file)
@@ -125,7 +125,7 @@ public class SliderPanel extends Panel implements ActionListener,
     SliderPanel pid = null;
     if (PIDSlider == null)
     {
-      pid = new SliderPanel(ap, 50, false, cs);
+      pid = new SliderPanel(ap, cs.getThreshold(), false, cs);
       PIDSlider = new Frame();
       PIDSlider.add(pid);
     }
@@ -178,16 +178,28 @@ public class SliderPanel extends Panel implements ActionListener,
 
   }
 
+  /**
+   * Hides the PID slider panel if it is shown
+   */
   public static void hidePIDSlider()
   {
-    PIDSlider.setVisible(false);
-    PIDSlider = null;
+    if (PIDSlider != null)
+    {
+      PIDSlider.setVisible(false);
+      PIDSlider = null;
+    }
   }
 
+  /**
+   * Hides the conservation slider panel if it is shown
+   */
   public static void hideConservationSlider()
   {
-    conservationSlider.setVisible(false);
-    conservationSlider = null;
+    if (conservationSlider != null)
+    {
+      conservationSlider.setVisible(false);
+      conservationSlider = null;
+    }
   }
   public SliderPanel(AlignmentPanel ap, int value, boolean forConserve,
           ColourSchemeI cs)
index af77c48..7d733c9 100755 (executable)
@@ -34,6 +34,8 @@ import javax.swing.JInternalFrame;
 import javax.swing.JLayeredPane;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
+import javax.swing.event.InternalFrameAdapter;
+import javax.swing.event.InternalFrameEvent;
 
 /**
  * DOCUMENT ME!
@@ -139,6 +141,7 @@ public class SliderPanel extends GSliderPanel
     else
     {
       sp = (SliderPanel) conservationSlider.getContentPane();
+      sp.slider.setValue(cs.getConservationInc());
       sp.cs = cs;
     }
 
@@ -159,25 +162,37 @@ public class SliderPanel extends GSliderPanel
     return sp.getValue();
   }
 
+  /**
+   * Hides the PID slider panel if it is shown
+   */
   public static void hidePIDSlider()
   {
-    try
-    {
-      PIDSlider.setClosed(true);
-      PIDSlider = null;
-    } catch (PropertyVetoException ex)
+    if (PIDSlider != null)
     {
+      try
+      {
+        PIDSlider.setClosed(true);
+        PIDSlider = null;
+      } catch (PropertyVetoException ex)
+      {
+      }
     }
   }
 
+  /**
+   * Hides the conservation slider panel if it is shown
+   */
   public static void hideConservationSlider()
   {
-    try
-    {
-      conservationSlider.setClosed(true);
-      conservationSlider = null;
-    } catch (PropertyVetoException ex)
+    if (conservationSlider != null)
     {
+      try
+      {
+        conservationSlider.setClosed(true);
+        conservationSlider = null;
+      } catch (PropertyVetoException ex)
+      {
+      }
     }
   }
 
@@ -186,24 +201,17 @@ public class SliderPanel extends GSliderPanel
    */
   public static void showConservationSlider()
   {
-    try
-    {
-      PIDSlider.setClosed(true);
-      PIDSlider = null;
-    } catch (Exception ex)
-    {
-    }
+    hidePIDSlider();
 
     if (!conservationSlider.isVisible())
     {
       Desktop.addInternalFrame(conservationSlider,
               conservationSlider.getTitle(), 420, 90, false);
       conservationSlider
-              .addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
+              .addInternalFrameListener(new InternalFrameAdapter()
               {
                 @Override
-                public void internalFrameClosed(
-                        javax.swing.event.InternalFrameEvent e)
+                public void internalFrameClosed(InternalFrameEvent e)
                 {
                   conservationSlider = null;
                 }
@@ -241,6 +249,7 @@ public class SliderPanel extends GSliderPanel
     else
     {
       pid = (SliderPanel) PIDSlider.getContentPane();
+      pid.slider.setValue(cs.getThreshold());
       pid.cs = cs;
     }
 
@@ -266,29 +275,21 @@ public class SliderPanel extends GSliderPanel
    */
   public static void showPIDSlider()
   {
-    try
-    {
-      conservationSlider.setClosed(true);
-      conservationSlider = null;
-    } catch (Exception ex)
-    {
-    }
+    hideConservationSlider();
 
     if (!PIDSlider.isVisible())
     {
       Desktop.addInternalFrame(PIDSlider, PIDSlider.getTitle(), 420, 90,
               false);
       PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);
-      PIDSlider
-              .addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
-              {
-                @Override
-                public void internalFrameClosed(
-                        javax.swing.event.InternalFrameEvent e)
-                {
-                  PIDSlider = null;
-                }
-              });
+      PIDSlider.addInternalFrameListener(new InternalFrameAdapter()
+      {
+        @Override
+        public void internalFrameClosed(InternalFrameEvent e)
+        {
+          PIDSlider = null;
+        }
+      });
       PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);
     }
   }
index f1b83b8..139ee19 100644 (file)
@@ -97,12 +97,12 @@ public class ParseHtmlBodyAndLinks
   public ParseHtmlBodyAndLinks(String description, boolean removeHTML,
           String newline)
   {
-    StringBuilder sb = new StringBuilder(description.length());
     if (description == null || description.length() == 0)
     {
       htmlContent = false;
       return;
     }
+    StringBuilder sb = new StringBuilder(description.length());
     if (description.toUpperCase().indexOf("<HTML>") == -1)
     {
       htmlContent = false;