search function added
authoramwaterhouse <Andrew Waterhouse>
Wed, 1 Dec 2004 17:12:38 +0000 (17:12 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 1 Dec 2004 17:12:38 +0000 (17:12 +0000)
src/jalview/gui/AlignmentPanel.java

index 2266462..4f56474 100755 (executable)
@@ -18,8 +18,6 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
   ScalePanel scalePanel;\r
   ScorePanel scorePanel;\r
 \r
-  public boolean    groupEdit = false;\r
-\r
   public AlignmentPanel(AlignFrame af, AlignViewport av)\r
   {\r
     alignFrame = af;\r
@@ -38,7 +36,6 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
 \r
     hscroll.addAdjustmentListener(this);\r
     vscroll.addAdjustmentListener(this);\r
-    selectAll(false);\r
 \r
     addComponentListener(new ComponentAdapter()\r
    {\r
@@ -47,27 +44,19 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
           RefreshPanels();\r
      }\r
    });\r
-\r
   }\r
 \r
-  public int countSelected()\r
-  {\r
-    return av.getSelection().size();\r
-  }\r
+ public void highlightSearchResults(int [] results)\r
+ {\r
+   seqPanel.seqCanvas.highlightSearchResults( results );\r
+\r
+   // do we need to scroll the panel?\r
+   if(av.getStartSeq()>results[0] || av.getEndSeq()<results[0]  || av.getStartRes()>results[1] || av.getEndRes()<results[2])\r
+       setScrollValues(results[1], results[0]);\r
+\r
+\r
+ }\r
 \r
-  public void selectAll(boolean flag) {\r
-    int i = 0;\r
-    if (flag) {\r
-      while (i < av.getAlignment().getHeight()) {\r
-        if (! av.getSelection().contains(av.getAlignment().getSequenceAt(i))) {\r
-          av.getSelection().addElement(av.getAlignment().getSequenceAt(i));\r
-        }\r
-        i++;\r
-      }\r
-    } else {\r
-      av.getSelection().clear();\r
-    }\r
-  }\r
 \r
  public OverviewPanel getOverviewPanel()\r
  {\r
@@ -89,14 +78,12 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
 \r
   public void setWrapAlignment(boolean wrap)\r
   {\r
-\r
       scalePanelHolder.setVisible(!wrap);\r
       scorePanelHolder.setVisible(!wrap);\r
 \r
       hscroll.setVisible(!wrap);\r
       idSpaceFillerPanel.setVisible(!wrap);\r
       idSpaceFillerPanel1.setVisible(!wrap);\r
-\r
   }\r
 \r
 \r
@@ -112,9 +99,9 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
   {\r
     invalidate();\r
     validate();\r
+    seqPanel.seqCanvas.paintFlag = true;\r
     idPanel.idCanvas.paintFlag = true;\r
     idPanelHolder.setPreferredSize( idPanel.idCanvas.getPreferredSize() );\r
-    seqPanel.seqCanvas.paintFlag = true;\r
     setScrollValues(av.getStartRes(), av.getStartSeq());\r
     av.getConsensus(true);\r
     repaint();\r
@@ -146,7 +133,6 @@ 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
-    seqPanel.seqCanvas.paintFlag = true;\r
     repaint();\r
 \r
   }\r
@@ -173,7 +159,7 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     if(overviewPanel!=null)\r
       overviewPanel.setBoxPosition();\r
 \r
-\r
+    seqPanel.seqCanvas.paintFlag=true;\r
     repaint();\r
   }\r
 \r