package jalview.appletgui; import jalview.jbappletgui.GFinder; import jalview.datamodel.*; import java.awt.event.*; import java.util.*; import java.awt.*; public class Finder extends GFinder { AlignViewport av; AlignmentPanel ap; Frame frame; SuperGroup searchGroup; int seqIndex = 0; int resIndex = 0; public Finder(final AlignmentPanel ap) { this.av = ap.av; this.ap = ap; frame = new Frame(); frame.add(this); jalview.bin.JalviewLite.addFrame(frame, "Find", 340,120); frame.repaint(); frame.addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent evt) { ap.highlightSearchResults( null ); } }); } public void textfield_actionPerformed(ActionEvent e) { doSearch(false); } public void findNext_actionPerformed(ActionEvent e) { doSearch(false); } public void findAll_actionPerformed(ActionEvent e) { resIndex=0; seqIndex=0; doSearch(true); } public void cancel_actionPerformed(ActionEvent e) { try{ // if allResults is null, this effectively switches displaySearch flag in seqCanvas ap.highlightSearchResults( null ); ap.idPanel.highlightSearchResults( null ); // frame.setClosed(true); }catch(Exception ex){ } } public void createNewGroup_actionPerformed(ActionEvent e) { for(int i=0; i0) seq = (Sequence)(av.getSelectionGroup().getSequenceAt(0)); else seq = (Sequence)av.getAlignment().getSequenceAt(0); searchResults.addElement( Integer.toString( av.getAlignment().findIndex(seq) ) ); searchResults.addElement( Integer.toString( seq.findIndex(res)-1 ) ); searchResults.addElement( Integer.toString( seq.findIndex(res)-1 ) ); }catch(NumberFormatException ex){} /////////////////////////////////////////////// jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(); Color [] newColors = new Color[24]; for(int i=0; i<24; i++) newColors[i] = new Color(60,160,115); ucs.setColourScheme(newColors); searchGroup = new SuperGroup(searchString, ucs , true, true, false); int end = av.alignment.getHeight(); SequenceGroup selection = av.getSelectionGroup(); if(selection!=null) if(selection.getSize()<1 || (selection.getEndRes()-selection.getStartRes()<2)) selection = null; while( !found && seqIndex0) ap.idPanel.highlightSearchResults( idMatch ); if(searchResults.size()>0) { allResults = new int[searchResults.size()]; for(int i=0; i