From: amwaterhouse Date: Fri, 15 Apr 2005 15:02:02 +0000 (+0000) Subject: takes on methods previously in desktop X-Git-Tag: Release_2_0~406 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=360043ea132ce2182da64826940aaa98c40f8910;p=jalview.git takes on methods previously in desktop --- diff --git a/src/jalview/gui/SliderPanel.java b/src/jalview/gui/SliderPanel.java index 253246b..2fbe0cc 100755 --- a/src/jalview/gui/SliderPanel.java +++ b/src/jalview/gui/SliderPanel.java @@ -5,6 +5,7 @@ import jalview.schemes.*; import jalview.datamodel.*; import java.awt.event.*; import javax.swing.event.*; +import javax.swing.*; import java.util.*; public class SliderPanel extends GSliderPanel @@ -13,6 +14,112 @@ public class SliderPanel extends GSliderPanel boolean forConservation = true; ColourSchemeI cs; + static JInternalFrame conservationSlider; + static JInternalFrame PIDSlider; + + public static int setConservationSlider(AlignmentPanel ap, ColourSchemeI cs, String source) + { + SliderPanel sp = null; + ConservationColourScheme ccs = (ConservationColourScheme)cs; + int value = ccs.inc; + + if(conservationSlider == null) + { + sp = new SliderPanel(ap, value, true, cs); + conservationSlider = new JInternalFrame(); + conservationSlider.setContentPane(sp); + } + else + { + sp = (SliderPanel)conservationSlider.getContentPane(); + sp.cs = cs; + sp.setValue(value); + } + + conservationSlider.setTitle("Conservation Colour Increment ("+source+")"); + if(ap.av.alignment.getGroups()!=null) + sp.setAllGroupsCheckEnabled( true ); + else + sp.setAllGroupsCheckEnabled( false); + + return sp.getValue(); + } + + public static void showConservationSlider() + { + try{ + PIDSlider.setClosed(true); + PIDSlider = null; + }catch(Exception ex){} + + + if(!conservationSlider.isVisible()) + { + Desktop.addInternalFrame(conservationSlider, conservationSlider.getTitle(), 420, 90, false); + conservationSlider.addInternalFrameListener(new javax.swing.event. + InternalFrameAdapter() + { + public void internalFrameClosed(javax.swing.event.InternalFrameEvent e) + { + conservationSlider = null; + } + }); + conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER); + } + + } + + public static int setPIDSliderSource(AlignmentPanel ap, ColourSchemeI cs, String source) + { + SliderPanel pid = null; + if(PIDSlider == null) + { + pid = new SliderPanel(ap, 50, false, cs); + PIDSlider = new JInternalFrame(); + PIDSlider.setContentPane(pid); + PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER); + } + else + { + pid = (SliderPanel)PIDSlider.getContentPane(); + pid.cs = cs; + } + PIDSlider.setTitle("Percentage Identity Threshold ("+source+")"); + + if (ap.av.alignment.getGroups() != null) + pid.setAllGroupsCheckEnabled(true); + else + pid.setAllGroupsCheckEnabled(false); + + return pid.getValue(); + + } + + public static void showPIDSlider() + { + try{ + conservationSlider.setClosed(true); + conservationSlider = null; + }catch(Exception ex){} + + if(!PIDSlider.isVisible()) + { + Desktop.addInternalFrame(PIDSlider, PIDSlider.getTitle(), 420, 90, false); + PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER); + PIDSlider.addInternalFrameListener(new javax.swing.event. + InternalFrameAdapter() + { + public void internalFrameClosed(javax.swing.event.InternalFrameEvent e) + { + PIDSlider = null; + } + }); + PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER); + } + + } + + public SliderPanel(AlignmentPanel ap, int value, boolean forConserve, ColourSchemeI cs) { this.ap = ap;