From: amwaterhouse Date: Thu, 28 Apr 2005 15:31:09 +0000 (+0000) Subject: search ids added X-Git-Tag: Release_2_0~363 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=23444dd246b45e21346f6cc85564cf3f876320fd;p=jalview.git search ids added --- diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java index 6c50f31..d7a034c 100755 --- a/src/jalview/gui/IdCanvas.java +++ b/src/jalview/gui/IdCanvas.java @@ -19,6 +19,8 @@ public class IdCanvas extends JPanel int imgHeight=0; boolean fastPaint = false; + java.util.ArrayList searchResults; + public IdCanvas(AlignViewport av) { setLayout(new BorderLayout()); @@ -29,8 +31,13 @@ public class IdCanvas extends JPanel public void drawIdString(Graphics2D gg,SequenceI s,int i, int starty, int ypos) { int charHeight = av.getCharHeight(); - - if (av.getSelectionGroup()!=null && av.getSelectionGroup().sequences.contains(s)) { + if(searchResults!=null && searchResults.contains(s)) + { + gg.setColor(Color.black); + gg.fillRect(0,AlignmentUtil.getPixelHeight(starty,i,charHeight)+ ypos,getWidth(),charHeight); + gg.setColor(Color.white); + } + else if (av.getSelectionGroup()!=null && av.getSelectionGroup().sequences.contains(s)) { gg.setColor(Color.lightGray); gg.fillRect(0,AlignmentUtil.getPixelHeight(starty,i,charHeight)+ ypos,getWidth(),charHeight); gg.setColor(Color.white); @@ -145,10 +152,15 @@ public class IdCanvas extends JPanel { // Selected sequence colours - if (av.getSelectionGroup()!= null + if(searchResults!=null && searchResults.contains(av.alignment.getSequenceAt(i))) + { + gg.setColor(Color.black); + currentColor = Color.black; + currentTextColor = Color.white; + } + else if (av.getSelectionGroup()!= null && av.getSelectionGroup().sequences.contains(av.alignment.getSequenceAt(i))) { - // if(av.alignment.findGroup(al.getSequenceAt(i)).getEndRes()== currentColor = Color.lightGray; currentTextColor = Color.black; } @@ -180,4 +192,10 @@ public class IdCanvas extends JPanel } } + + public void setHighlighted(java.util.ArrayList found) + { + searchResults = found; + repaint(); + } } diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index 3444881..fcf8e92 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -176,6 +176,20 @@ public class IdPanel extends JPanel implements MouseListener, MouseMotionListene PaintRefresher.Refresh(this); } + public void highlightSearchResults( java.util.ArrayList found ) + { + idCanvas.setHighlighted( found ); + + if(found == null) + return; + + int index = av.alignment.findIndex( (SequenceI)found.get(0)); + + // do we need to scroll the panel? + if(av.getStartSeq()>index || av.getEndSeq()