import jalview.datamodel.*;\r
import java.awt.event.*;\r
import javax.swing.event.*;\r
+import javax.swing.*;\r
import java.util.*;\r
\r
public class SliderPanel extends GSliderPanel\r
boolean forConservation = true;\r
ColourSchemeI cs;\r
\r
+ static JInternalFrame conservationSlider;\r
+ static JInternalFrame PIDSlider;\r
+\r
+ public static int setConservationSlider(AlignmentPanel ap, ColourSchemeI cs, String source)\r
+ {\r
+ SliderPanel sp = null;\r
+ ConservationColourScheme ccs = (ConservationColourScheme)cs;\r
+ int value = ccs.inc;\r
+\r
+ if(conservationSlider == null)\r
+ {\r
+ sp = new SliderPanel(ap, value, true, cs);\r
+ conservationSlider = new JInternalFrame();\r
+ conservationSlider.setContentPane(sp);\r
+ }\r
+ else\r
+ {\r
+ sp = (SliderPanel)conservationSlider.getContentPane();\r
+ sp.cs = cs;\r
+ sp.setValue(value);\r
+ }\r
+\r
+ conservationSlider.setTitle("Conservation Colour Increment ("+source+")");\r
+ if(ap.av.alignment.getGroups()!=null)\r
+ sp.setAllGroupsCheckEnabled( true );\r
+ else\r
+ sp.setAllGroupsCheckEnabled( false);\r
+\r
+ return sp.getValue();\r
+ }\r
+\r
+ public static void showConservationSlider()\r
+ {\r
+ try{\r
+ PIDSlider.setClosed(true);\r
+ PIDSlider = null;\r
+ }catch(Exception ex){}\r
+\r
+\r
+ if(!conservationSlider.isVisible())\r
+ {\r
+ Desktop.addInternalFrame(conservationSlider, conservationSlider.getTitle(), 420, 90, false);\r
+ conservationSlider.addInternalFrameListener(new javax.swing.event.\r
+ InternalFrameAdapter()\r
+ {\r
+ public void internalFrameClosed(javax.swing.event.InternalFrameEvent e)\r
+ {\r
+ conservationSlider = null;\r
+ }\r
+ });\r
+ conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
+ }\r
+\r
+ }\r
+\r
+ public static int setPIDSliderSource(AlignmentPanel ap, ColourSchemeI cs, String source)\r
+ {\r
+ SliderPanel pid = null;\r
+ if(PIDSlider == null)\r
+ {\r
+ pid = new SliderPanel(ap, 50, false, cs);\r
+ PIDSlider = new JInternalFrame();\r
+ PIDSlider.setContentPane(pid);\r
+ PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
+ }\r
+ else\r
+ {\r
+ pid = (SliderPanel)PIDSlider.getContentPane();\r
+ pid.cs = cs;\r
+ }\r
+ PIDSlider.setTitle("Percentage Identity Threshold ("+source+")");\r
+\r
+ if (ap.av.alignment.getGroups() != null)\r
+ pid.setAllGroupsCheckEnabled(true);\r
+ else\r
+ pid.setAllGroupsCheckEnabled(false);\r
+\r
+ return pid.getValue();\r
+\r
+ }\r
+\r
+ public static void showPIDSlider()\r
+ {\r
+ try{\r
+ conservationSlider.setClosed(true);\r
+ conservationSlider = null;\r
+ }catch(Exception ex){}\r
+\r
+ if(!PIDSlider.isVisible())\r
+ {\r
+ Desktop.addInternalFrame(PIDSlider, PIDSlider.getTitle(), 420, 90, false);\r
+ PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
+ PIDSlider.addInternalFrameListener(new javax.swing.event.\r
+ InternalFrameAdapter()\r
+ {\r
+ public void internalFrameClosed(javax.swing.event.InternalFrameEvent e)\r
+ {\r
+ PIDSlider = null;\r
+ }\r
+ });\r
+ PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
+ }\r
+\r
+ }\r
+\r
+\r
public SliderPanel(AlignmentPanel ap, int value, boolean forConserve, ColourSchemeI cs)\r
{\r
this.ap = ap;\r