From 76caf07872d92bdc21faaa9278d9cccd7609d9b8 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 20 Jan 2017 10:55:50 +0000 Subject: [PATCH] JAL-2383 check for null, spelling --- resources/lang/Messages.properties | 2 +- src/jalview/appletgui/SliderPanel.java | 22 ++++++-- src/jalview/gui/SliderPanel.java | 75 ++++++++++++++------------- src/jalview/util/ParseHtmlBodyAndLinks.java | 2 +- 4 files changed, 57 insertions(+), 44 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index a86154c..1352f0b 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -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} diff --git a/src/jalview/appletgui/SliderPanel.java b/src/jalview/appletgui/SliderPanel.java index 5ee665a..ec64b3b 100644 --- a/src/jalview/appletgui/SliderPanel.java +++ b/src/jalview/appletgui/SliderPanel.java @@ -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) diff --git a/src/jalview/gui/SliderPanel.java b/src/jalview/gui/SliderPanel.java index af77c48..7d733c9 100755 --- a/src/jalview/gui/SliderPanel.java +++ b/src/jalview/gui/SliderPanel.java @@ -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); } } diff --git a/src/jalview/util/ParseHtmlBodyAndLinks.java b/src/jalview/util/ParseHtmlBodyAndLinks.java index f1b83b8..139ee19 100644 --- a/src/jalview/util/ParseHtmlBodyAndLinks.java +++ b/src/jalview/util/ParseHtmlBodyAndLinks.java @@ -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("") == -1) { htmlContent = false; -- 1.7.10.2