REpainting after graph panel setVisible fixed
authoramwaterhouse <Andrew Waterhouse>
Wed, 15 Dec 2004 17:15:25 +0000 (17:15 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 15 Dec 2004 17:15:25 +0000 (17:15 +0000)
src/jalview/gui/AlignmentPanel.java

index fcb5a57..bc6ea86 100755 (executable)
@@ -75,8 +75,11 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
 \r
   public void setGraphPanelVisible(boolean b)\r
   {\r
-    scorePanelHolder.setVisible(b);\r
     idSpaceFillerPanel.setVisible(b);\r
+    scorePanelHolder.setVisible(b);\r
+\r
+    RefreshPanels();\r
+    // bit annoying to call this twice, can you do better?\r
     RefreshPanels();\r
   }\r
 \r
@@ -113,168 +116,21 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     seqPanel.seqCanvas.paintFlag = true;\r
     repaint();\r
   }\r
-  /*\r
-    seqCanvas.paintFlag = true;\r
-    if (av.getSelection().size() == 0)\r
-    {\r
-      seqCanvas.globalColorScheme = cs;\r
-      for (int i = 0; i < av.alignment.getGroups().size();i++)\r
-      {\r
-        SequenceGroup sg = (SequenceGroup)av.alignment.getGroups().elementAt(i);\r
-        sg.cs = cs;\r
-        if(!showConservation\r
-            && !(sg.cs instanceof Blosum62ColourScheme)\r
-            && sg.cs instanceof ConservationColourScheme)\r
-         {\r
-           // remove ConservationColouring from existing Conservation group\r
-           ConservationColourScheme ccs = (ConservationColourScheme)sg.cs;\r
-           sg.cs = ccs.cs;\r
-         }\r
-         else if(showConservation && !(sg.cs instanceof ConservationColourScheme))\r
-         {\r
-           // add ConservationColouring to new group\r
-           Conservation c = sg.getConservation();\r
-           Alignment al = (Alignment) av.getAlignment();\r
-           c = new Conservation("All", al.cons,\r
-                                ResidueProperties.propHash, 3, sg.sequences, 0,\r
-                                al.getWidth() );\r
-           c.calculate();\r
-           c.verdict(false, 100);\r
-           sg.setConservation(c);\r
-           sg.cs = new ConservationColourScheme(sg);\r
-         }\r
-      }\r
-    }\r
-    else\r
-    {\r
-      SequenceGroup sg = av.alignment.findGroup((Sequence)av.sel.sequenceAt(0));\r
-\r
-      if( isNewSelection(sg) )\r
-      {\r
-        sg = av.getAlignment().addGroup();\r
-        for (int i=0; i < av.getSelection().size(); i++)\r
-        {\r
-          av.alignment.removeFromGroup(av.alignment.findGroup( (Sequence) av.\r
-              sel.sequenceAt(i)),\r
-                                       (Sequence) av.sel.sequenceAt(i));\r
-          av.alignment.addToGroup(sg, (Sequence) av.sel.sequenceAt(i));\r
-        }\r
-      }\r
-\r
-\r
-      sg.cs = cs;\r
-\r
-      // Selection is made, we only want to change the conservationColour for selected group\r
-      if(  showConservation\r
-           && !(sg.cs instanceof ConservationColourScheme)\r
-           && !(sg.cs instanceof Blosum62ColourScheme))\r
-      {\r
-        Conservation c = sg.getConservation();\r
-        Alignment al = (Alignment) av.getAlignment();\r
-\r
-        c = new Conservation("All", al.cons,\r
-                             ResidueProperties.propHash, 3, sg.sequences, 0,\r
-                             al.getWidth() );\r
-        c.calculate();\r
-        c.verdict(false, 100);\r
-        sg.setConservation(c);\r
-        sg.cs = new ConservationColourScheme(sg);\r
-    }\r
-    else  if( !showConservation && sg.cs instanceof ConservationColourScheme)\r
-    {\r
-      ConservationColourScheme ccs = (ConservationColourScheme)sg.cs;\r
-      sg.cs = ccs.cs;\r
-    }\r
-   }\r
-   repaint();\r
-  }\r
-\r
-  boolean isNewSelection(SequenceGroup sg)\r
-  {\r
-    if(sg==null)\r
-      return true;\r
-\r
-    if(sg.getSize()!=av.getSelection().size())\r
-      return true;\r
-\r
-    for(int i=0; i<sg.getSize(); i++)\r
-     if( !av.getSelection().contains( sg.getSequenceAt(i) ))\r
-       return true;\r
-\r
-    return false;\r
-  }\r
-\r
-\r
-  public ColourSchemeI getColourScheme()\r
-  {\r
-    if(av.getSelection().size()>0)\r
-       return av.alignment.findGroup((Sequence)av.sel.sequenceAt(0)).cs;\r
-    else\r
-      return seqCanvas.globalColorScheme;\r
-  }\r
-*/\r
-\r
-/*  public void setColourScheme(jalview.schemes.ColourSchemeI cs, boolean conservation)\r
-  {\r
-    seqPanel.setColourScheme(cs, conservation);\r
-\r
-    av.setGlobalColourScheme(cs);\r
-\r
-    if(overviewPanel!=null)\r
-      overviewPanel.updateOverviewImage();\r
-  }\r
-\r
-   void updateResidueView()\r
-   {\r
-     if (viewport.getSelection().size() == 0)\r
-      {\r
-        for (int i = 0; i < viewport.alignment.getGroups().size(); i++)\r
-        {\r
-          SequenceGroup sg = (SequenceGroup) viewport.alignment.getGroups().elementAt(i);\r
-          sg.setDisplayBoxes( viewBoxesMenuItem.isSelected() );\r
-          sg.setDisplayText( viewTextMenuItem.isSelected() );\r
-          sg.setColourText( colourTextMenuItem.isSelected() );\r
-        }\r
-      }\r
-      else\r
-      {\r
-        SequenceGroup sg = viewport.alignment.findGroup( (Sequence) viewport.sel.sequenceAt(0));\r
-        if (alignPanel.seqPanel.isNewSelection(sg))\r
-        {\r
-          sg = viewport.getAlignment().addGroup();\r
-          for (int i = 0; i < viewport.getSelection().size(); i++)\r
-          {\r
-            viewport.alignment.removeFromGroup(viewport.alignment.findGroup( (\r
-                Sequence) viewport.sel.sequenceAt(i)),\r
-                                               (Sequence) viewport.sel.sequenceAt(\r
-                i));\r
-            viewport.alignment.addToGroup(sg,\r
-                                          (Sequence) viewport.sel.sequenceAt(i));\r
-          }\r
-        }\r
-\r
-        sg.setDisplayBoxes(viewBoxesMenuItem.isSelected());\r
-        sg.setDisplayText(viewTextMenuItem.isSelected());\r
-        sg.setColourText(colourTextMenuItem.isSelected());\r
-      }\r
-     alignPanel.RefreshPanels();\r
-   }*/\r
-\r
-\r
 \r
   public void RefreshPanels()\r
   {\r
+\r
     invalidate();\r
     seqPanel.seqCanvas.paintFlag = true;\r
     idPanel.idCanvas.paintFlag = true;\r
     idPanelHolder.setPreferredSize( idPanel.idCanvas.getPreferredSize() );\r
     setScrollValues(av.getStartRes(), av.getStartSeq());\r
     av.getConsensus(true);\r
-    validate();\r
-    repaint();\r
     if(overviewPanel!=null)\r
       overviewPanel.updateOverviewImage();\r
 \r
+    validate();\r
+    repaint();\r
   }\r
 \r
   int hextent = 0;\r
@@ -299,6 +155,8 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
 \r
     hscroll.setValues(x,hextent,0,av.getAlignment().getWidth());\r
     vscroll.setValues(y,vextent,0,av.getAlignment().getHeight() );\r
+\r
+\r
     repaint();\r
 \r
   }\r