*/
package jalview.appletgui;
-import jalview.api.AlignViewportI;
-import jalview.api.FinderI;
-import jalview.datamodel.SearchResultMatchI;
-import jalview.datamodel.SearchResultsI;
-import jalview.datamodel.SequenceFeature;
-import jalview.datamodel.SequenceI;
-import jalview.util.MessageManager;
-
import java.awt.Button;
import java.awt.Checkbox;
import java.awt.Font;
import java.util.List;
import java.util.Map;
+import jalview.api.AlignViewportI;
+import jalview.api.FinderI;
+import jalview.datamodel.SearchResultMatchI;
+import jalview.datamodel.SearchResultsI;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.util.MessageManager;
+
public class Finder extends Panel implements ActionListener
{
private AlignViewportI av;
*/
package jalview.gui;
-import java.util.Locale;
-
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.FocusAdapter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
new FeatureEditor(ap, seqs, features, true).showDialog();
}
+ @Override
+ protected void copyToClipboard_actionPerformed()
+ {
+ if (searchResults.isEmpty())
+ {
+ return; // shouldn't happen
+ }
+ List<SequenceI> seqs = new ArrayList<>();
+
+ String searchString = searchBox.getUserInput();
+ String desc = "Search Results";
+
+ /*
+ * assemble dataset sequences, and template new sequence features,
+ * for the amend features dialog
+ */
+ for (SearchResultMatchI match : searchResults.getResults())
+ {
+ SequenceI seq = match.getSequence();
+ while (seq.getDatasetSequence() != null)
+ {
+ seq = seq.getDatasetSequence();
+ }
+ seqs.add(seq.getSubSequence(seq.findIndex(match.getStart()),
+ seq.findIndex(match.getEnd()) + 1));
+ }
+ Desktop.jalviewClipboard = new Object[] {
+ seqs.toArray(new SequenceI[0]), ap.av.getAlignment().getDataset(),
+ ap.av.getAlignment().getHiddenColumns() };
+ }
+
/**
* Search the alignment for the next or all matches. If 'all matches', a
* dialog is shown with the number of sequence ids and subsequences matched.
void doSearch(boolean doFindAll)
{
createFeatures.setEnabled(false);
+ copyToClipboard.setEnabled(false);
String searchString = searchBox.getUserInput();
else
{
createFeatures.setEnabled(true);
+ copyToClipboard.setEnabled(true);
}
searchBox.updateCache();
*/
package jalview.jbgui;
-import jalview.datamodel.AlignmentI;
-import jalview.io.DataSourceType;
-import jalview.io.FileFormat;
-import jalview.io.FormatAdapter;
-import jalview.io.cache.JvCacheableInputBox;
-import jalview.util.MessageManager;
-
import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.GridLayout;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
+import jalview.datamodel.AlignmentI;
+import jalview.io.DataSourceType;
+import jalview.io.FileFormat;
+import jalview.io.FormatAdapter;
+import jalview.io.cache.JvCacheableInputBox;
+import jalview.util.MessageManager;
+
public class GFinder extends JPanel
{
private static final java.awt.Font VERDANA_12 = new Font("Verdana",
protected JButton createFeatures;
+ protected JButton copyToClipboard;
+
protected JvCacheableInputBox<String> searchBox;
protected JCheckBox caseSensitive;
createFeatures_actionPerformed();
}
});
+ copyToClipboard = new JButton();
+ copyToClipboard.setEnabled(false);
+ copyToClipboard.setFont(VERDANA_12);
+ copyToClipboard.setText(MessageManager.getString("label.copy"));
+ copyToClipboard.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ copyToClipboard_actionPerformed();
+ }
+ });
eastPanel.add(findNext);
eastPanel.add(findAll);
eastPanel.add(createFeatures);
+ eastPanel.add(copyToClipboard);
+ }
+
+ protected void copyToClipboard_actionPerformed()
+ {
}
protected void textfield_keyPressed(KeyEvent e)