import javax.swing.event.*;\r
import java.util.*;\r
import java.util.regex.*;\r
+import java.awt.*;\r
\r
public class Finder extends GFinder\r
{\r
AlignmentPanel ap;\r
JInternalFrame frame;\r
String searchString;\r
+ SuperGroup searchGroup;\r
\r
int seqIndex = 0;\r
int resIndex = 0;\r
SwingUtilities.invokeLater(new Runnable()\r
{\r
public void run()\r
- {\r
- textfield.requestFocus();\r
- }\r
+ { textfield.requestFocus(); }\r
});\r
- }\r
+ }\r
+\r
+ public void internalFrameClosing(InternalFrameEvent evt)\r
+ {\r
+ cancel_actionPerformed(null);\r
+ }\r
});\r
\r
}\r
try{\r
// if allResults is null, this effectively switches displaySearch flag in seqCanvas\r
ap.highlightSearchResults( null );\r
- frame.setClosed(true);\r
+ // frame.setClosed(true);\r
}catch(Exception ex){ }\r
+ }\r
+\r
\r
+ public void createNewGroup_actionPerformed(ActionEvent e)\r
+ {\r
+ for(int i=0; i<searchGroup.getSize(); i++)\r
+ av.alignment.addGroup( searchGroup.getGroupeAt(i));\r
+\r
+ ap.av.alignment.addSuperGroup(searchGroup);\r
+ ap.highlightSearchResults( null );\r
}\r
\r
+\r
void doSearch(boolean findAll)\r
{\r
+ createNewGroup.setEnabled(false);\r
searchString = textfield.getText().toUpperCase();\r
\r
ArrayList searchResults = new ArrayList();\r
//av.getAlignment().getSequenceAt(seq).findPosition(res)\r
}catch(NumberFormatException ex){}\r
\r
+ jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme();\r
+ Color [] newColors = new Color[24];\r
+ for(int i=0; i<24; i++)\r
+ newColors[i] = new Color(60,160,115);\r
+\r
+ ucs.setColourScheme(newColors);\r
+\r
+ searchGroup = new SuperGroup(searchString, ucs , true, true, false);\r
\r
while( !found && seqIndex<av.getAlignment().getHeight())\r
{\r
searchResults.add( Integer.toString( seqIndex) );\r
searchResults.add( Integer.toString( resIndex+ Integer.parseInt(spaces.get(resIndex).toString()) ) );\r
searchResults.add( Integer.toString( matcher.end()-1 + Integer.parseInt(spaces.get(matcher.end()-1).toString()) ) );\r
+\r
+ SequenceGroup sg = new SequenceGroup(searchString, ucs, true, true, false,\r
+ resIndex+ Integer.parseInt(spaces.get(resIndex).toString()) ,\r
+ matcher.end()-1 + Integer.parseInt(spaces.get(matcher.end()-1).toString())\r
+ );\r
+ sg.addSequence((Sequence)av.getAlignment().getSequenceAt(seqIndex));\r
+ searchGroup.addGroup( sg );\r
+\r
if(!findAll)\r
{\r
// thats enough, break and display the result\r
seqIndex++;\r
resIndex = 0;\r
}\r
- }\r
+ }\r
\r
if(searchResults.size()>0)\r
{\r
for(int i=0; i<searchResults.size(); i++)\r
allResults[i] = Integer.parseInt(searchResults.get(i).toString());\r
\r
+ createNewGroup.setEnabled(true);\r
}\r
else\r
{\r